aboutsummaryrefslogtreecommitdiffstats
path: root/library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js')
-rw-r--r--[-rwxr-xr-x]library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js40
1 files changed, 31 insertions, 9 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
index a61887a92..a8f046b41 100755..100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
+++ b/library/tinymce/jscripts/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;