X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fadvlist%2Feditor_plugin_src.js;h=a8f046b4188a3d1c669360d1a0ba0599466163ff;hp=a61887a9220678c7f62f630a47a16abbf2dd80a4;hb=b05f4eef4014db3885787ef15107cba93c932ac9;hpb=b347fec899815ec89b2738a0877880ee81e74b59 diff --git a/webcit/tiny_mce/plugins/advlist/editor_plugin_src.js b/webcit/tiny_mce/plugins/advlist/editor_plugin_src.js index a61887a92..a8f046b41 100644 --- a/webcit/tiny_mce/plugins/advlist/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/advlist/editor_plugin_src.js @@ -35,10 +35,13 @@ // 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; + var t = this, btn, format, editor = t.editor; if (name == 'numlist' || name == 'bullist') { // Default to first item if it's a default item @@ -50,7 +53,7 @@ each(format.styles, function(value, name) { // Format doesn't match - if (t.editor.dom.getStyle(node, name) != value) { + if (editor.dom.getStyle(node, name) != value) { state = false; return false; } @@ -60,24 +63,25 @@ }; function applyListFormat() { - var list, ed = t.editor, dom = ed.dom, sel = ed.selection; + 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)) - ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); + 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('_mce_style'); + list.removeAttribute('data-mce-style'); } } + + editor.focus(); }; btn = cm.createSplitButton(name, { @@ -89,8 +93,15 @@ }); 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 = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList; + var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList; if (list || format) { fmtList = t[name]; @@ -120,12 +131,23 @@ 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 : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); each(t[name], function(item) { - item.id = t.editor.dom.uniqueId(); + // 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;