aboutsummaryrefslogtreecommitdiff
path: root/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist
diff options
context:
space:
mode:
Diffstat (limited to 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist')
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js1
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js176
2 files changed, 177 insertions, 0 deletions
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js
new file mode 100644
index 000000000..57ecce6e0
--- /dev/null
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})(); \ No newline at end of file
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
new file mode 100644
index 000000000..a8f046b41
--- /dev/null
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
@@ -0,0 +1,176 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ var each = tinymce.each;
+
+ tinymce.create('tinymce.plugins.AdvListPlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ function buildFormats(str) {
+ var formats = [];
+
+ each(str.split(/,/), function(type) {
+ formats.push({
+ title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),
+ styles : {
+ listStyleType : type == 'default' ? '' : type
+ }
+ });
+ });
+
+ return formats;
+ };
+
+ // Setup number formats from config or default
+ t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
+ t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
+
+ if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))
+ t.isIE7 = true;
+ },
+
+ createControl: function(name, cm) {
+ var t = this, btn, format, editor = t.editor;
+
+ if (name == 'numlist' || name == 'bullist') {
+ // Default to first item if it's a default item
+ if (t[name][0].title == 'advlist.def')
+ format = t[name][0];
+
+ function hasFormat(node, format) {
+ var state = true;
+
+ each(format.styles, function(value, name) {
+ // Format doesn't match
+ if (editor.dom.getStyle(node, name) != value) {
+ state = false;
+ return false;
+ }
+ });
+
+ return state;
+ };
+
+ function applyListFormat() {
+ var list, dom = editor.dom, sel = editor.selection;
+
+ // Check for existing list element
+ list = dom.getParent(sel.getNode(), 'ol,ul');
+
+ // Switch/add list type if needed
+ if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
+ editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
+
+ // Append styles to new list element
+ if (format) {
+ list = dom.getParent(sel.getNode(), 'ol,ul');
+ if (list) {
+ dom.setStyles(list, format.styles);
+ list.removeAttribute('data-mce-style');
+ }
+ }
+
+ editor.focus();
+ };
+
+ btn = cm.createSplitButton(name, {
+ title : 'advanced.' + name + '_desc',
+ 'class' : 'mce_' + name,
+ onclick : function() {
+ applyListFormat();
+ }
+ });
+
+ btn.onRenderMenu.add(function(btn, menu) {
+ menu.onHideMenu.add(function() {
+ if (t.bookmark) {
+ editor.selection.moveToBookmark(t.bookmark);
+ t.bookmark = 0;
+ }
+ });
+
+ menu.onShowMenu.add(function() {
+ var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;
+
+ if (list || format) {
+ fmtList = t[name];
+
+ // Unselect existing items
+ each(menu.items, function(item) {
+ var state = true;
+
+ item.setSelected(0);
+
+ if (list && !item.isDisabled()) {
+ each(fmtList, function(fmt) {
+ if (fmt.id == item.id) {
+ if (!hasFormat(list, fmt)) {
+ state = false;
+ return false;
+ }
+ }
+ });
+
+ if (state)
+ item.setSelected(1);
+ }
+ });
+
+ // Select the current format
+ if (!list)
+ menu.items[format.id].setSelected(1);
+ }
+
+ editor.focus();
+
+ // IE looses it's selection so store it away and restore it later
+ if (tinymce.isIE) {
+ t.bookmark = editor.selection.getBookmark(1);
+ }
+ });
+
+ menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
+
+ each(t[name], function(item) {
+ // IE<8 doesn't support lower-greek, skip it
+ if (t.isIE7 && item.styles.listStyleType == 'lower-greek')
+ return;
+
+ item.id = editor.dom.uniqueId();
+
+ menu.add({id : item.id, title : item.title, onclick : function() {
+ format = item;
+ applyListFormat();
+ }});
+ });
+ });
+
+ return btn;
+ }
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Advanced lists',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);
+})(); \ No newline at end of file