diff options
Diffstat (limited to 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js')
-rw-r--r-- | mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js | 31 |
1 files changed, 23 insertions, 8 deletions
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 index 13ef02ddd..a8f046b41 100644 --- 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 @@ -41,7 +41,7 @@ },
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
@@ -53,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;
}
@@ -63,14 +63,14 @@ };
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) {
@@ -80,7 +80,8 @@ list.removeAttribute('data-mce-style');
}
}
- ed.focus();
+
+ editor.focus();
};
btn = cm.createSplitButton(name, {
@@ -92,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];
@@ -123,16 +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', titleItem: true}).setDisabled(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 = t.editor.dom.uniqueId();
+ item.id = editor.dom.uniqueId();
menu.add({id : item.id, title : item.title, onclick : function() {
format = item;
|