diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-05-08 11:38:39 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-05-08 11:38:39 +0200 |
commit | e6e0d410ac92818679c03fc9bf5359562df81921 (patch) | |
tree | fff5c213ce3e88b448ca1365b375137a52f6fa4c /program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js | |
parent | 5b0b034387715a18910a7e574b71afcfae293ecf (diff) |
TinyMCE 3.5
Diffstat (limited to 'program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js')
-rw-r--r-- | program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js b/program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js new file mode 100644 index 000000000..b9d2ab2e1 --- /dev/null +++ b/program/js/tiny_mce/plugins/visualblocks/editor_plugin_src.js @@ -0,0 +1,63 @@ +/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2012, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.VisualBlocks', {
+ init : function(ed, url) {
+ var cssId;
+
+ // We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects
+ if (!window.NodeList) {
+ return;
+ }
+
+ ed.addCommand('mceVisualBlocks', function() {
+ var dom = ed.dom, linkElm;
+
+ if (!cssId) {
+ cssId = dom.uniqueId();
+ linkElm = dom.create('link', {
+ id: cssId,
+ rel : 'stylesheet',
+ href : url + '/css/visualblocks.css'
+ });
+
+ ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
+ } else {
+ linkElm = dom.get(cssId);
+ linkElm.disabled = !linkElm.disabled;
+ }
+
+ ed.controlManager.setActive('visualblocks', !linkElm.disabled);
+ });
+
+ ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'});
+
+ ed.onInit.add(function() {
+ if (ed.settings.visualblocks_default_state) {
+ ed.execCommand('mceVisualBlocks', false, null, {skip_focus : true});
+ }
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Visual blocks',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks);
+})();
\ No newline at end of file |