spree_editor 0.50.0 → 0.50.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Versionfile +3 -0
- data/app/controllers/admin/editor_settings_controller.rb +5 -11
- data/app/views/admin/editor_settings/edit.html.erb +20 -19
- data/app/views/shared/editor_engines/_tiny_mce.html.erb +16 -33
- data/app/views/shared/editor_engines/_yui_rich_editor.html.erb +60 -7
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +45 -0
- data/config/locales/ru.yml +2 -0
- data/lib/editor_configuration.rb +2 -2
- data/public/images/html_editor.gif +0 -0
- data/public/javascripts/tinymce/langs/en.js +56 -3
- data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +2 -0
- data/public/javascripts/tinymce/plugins/advhr/rule.htm +30 -29
- data/public/javascripts/tinymce/plugins/advimage/image.htm +34 -31
- data/public/javascripts/tinymce/plugins/advimage/js/image.js +20 -5
- data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +2 -0
- data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +21 -17
- data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +4 -2
- data/public/javascripts/tinymce/plugins/advlink/link.htm +35 -30
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +10 -3
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +169 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +12 -3
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +13 -4
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +30 -16
- data/public/javascripts/tinymce/plugins/emotions/emotions.htm +15 -14
- data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +3 -42
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +309 -63
- data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +18 -330
- data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +199 -438
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +10 -2
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +76 -15
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -10
- data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +2 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +31 -28
- data/public/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/lists/editor_plugin_src.js +617 -0
- data/public/javascripts/tinymce/plugins/media/css/media.css +5 -4
- data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +652 -296
- data/public/javascripts/tinymce/plugins/media/js/media.js +327 -603
- data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +8 -2
- data/public/javascripts/tinymce/plugins/media/media.htm +283 -288
- data/public/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +2 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +1 -4
- data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +118 -137
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +4 -0
- data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +14 -10
- data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +17 -16
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +55 -37
- data/public/javascripts/tinymce/plugins/style/js/props.js +2 -8
- data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +8 -1
- data/public/javascripts/tinymce/plugins/style/props.htm +513 -398
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +30 -28
- data/public/javascripts/tinymce/plugins/table/cell.htm +12 -12
- data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +97 -34
- data/public/javascripts/tinymce/plugins/table/js/cell.js +9 -11
- data/public/javascripts/tinymce/plugins/table/js/row.js +13 -18
- data/public/javascripts/tinymce/plugins/table/js/table.js +8 -12
- data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +1 -1
- data/public/javascripts/tinymce/plugins/table/merge_cells.htm +11 -11
- data/public/javascripts/tinymce/plugins/table/row.htm +10 -8
- data/public/javascripts/tinymce/plugins/table/table.htm +54 -53
- data/public/javascripts/tinymce/plugins/template/js/template.js +1 -1
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +35 -19
- data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +5 -4
- data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +9 -8
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +6 -6
- data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +11 -10
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +1 -16
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +2 -2
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +3 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +4 -3
- data/public/javascripts/tinymce/themes/advanced/about.htm +3 -5
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +5 -5
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +39 -40
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +10 -9
- data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -1
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +172 -41
- data/public/javascripts/tinymce/themes/advanced/image.htm +51 -51
- data/public/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/trans.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/js/about.js +1 -0
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +5 -0
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +26 -6
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +108 -32
- data/public/javascripts/tinymce/themes/advanced/js/image.js +3 -1
- data/public/javascripts/tinymce/themes/advanced/js/link.js +4 -7
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +1 -1
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +8 -2
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +6 -3
- data/public/javascripts/tinymce/themes/advanced/link.htm +27 -28
- data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +11 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +4 -4
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +23 -0
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +105 -0
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +101 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +10 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +1 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +5 -4
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +1 -1
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +1 -1
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +3 -3
- data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -1
- data/public/javascripts/tinymce/themes/simple/editor_template_src.js +1 -2
- data/public/javascripts/tinymce/tiny_mce.js +1 -1
- data/public/javascripts/tinymce/tiny_mce_popup.js +1 -1
- data/public/javascripts/tinymce/tiny_mce_src.js +6488 -4070
- data/public/javascripts/tinymce/utils/form_utils.js +14 -4
- data/public/javascripts/tinymce/utils/mctabs.js +95 -10
- data/public/javascripts/tinymce/utils/validate.js +35 -3
- data/public/stylesheets/editor.css +23 -0
- data/spree_editor.gemspec +2 -2
- metadata +25 -4
@@ -35,6 +35,9 @@
|
|
35
35
|
// Setup number formats from config or default
|
36
36
|
t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
|
37
37
|
t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
|
38
|
+
|
39
|
+
if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))
|
40
|
+
t.isIE7 = true;
|
38
41
|
},
|
39
42
|
|
40
43
|
createControl: function(name, cm) {
|
@@ -72,12 +75,12 @@
|
|
72
75
|
// Append styles to new list element
|
73
76
|
if (format) {
|
74
77
|
list = dom.getParent(sel.getNode(), 'ol,ul');
|
75
|
-
|
76
78
|
if (list) {
|
77
79
|
dom.setStyles(list, format.styles);
|
78
|
-
list.removeAttribute('
|
80
|
+
list.removeAttribute('data-mce-style');
|
79
81
|
}
|
80
82
|
}
|
83
|
+
ed.focus();
|
81
84
|
};
|
82
85
|
|
83
86
|
btn = cm.createSplitButton(name, {
|
@@ -122,9 +125,13 @@
|
|
122
125
|
}
|
123
126
|
});
|
124
127
|
|
125
|
-
menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
128
|
+
menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
|
126
129
|
|
127
130
|
each(t[name], function(item) {
|
131
|
+
// IE<8 doesn't support lower-greek, skip it
|
132
|
+
if (t.isIE7 && item.styles.listStyleType == 'lower-greek')
|
133
|
+
return;
|
134
|
+
|
128
135
|
item.id = t.editor.dom.uniqueId();
|
129
136
|
|
130
137
|
menu.add({id : item.id, title : item.title, onclick : function() {
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}if(f.shiftKey&&f.keyCode==48){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("mceInsertLink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
|
@@ -0,0 +1,169 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2011, Moxiecode Systems AB
|
5
|
+
* Released under LGPL License.
|
6
|
+
*
|
7
|
+
* License: http://tinymce.moxiecode.com/license
|
8
|
+
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function() {
|
12
|
+
tinymce.create('tinymce.plugins.AutolinkPlugin', {
|
13
|
+
/**
|
14
|
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
15
|
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
16
|
+
* of the editor instance to intercept that event.
|
17
|
+
*
|
18
|
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
19
|
+
* @param {string} url Absolute URL to where the plugin is located.
|
20
|
+
*/
|
21
|
+
|
22
|
+
init : function(ed, url) {
|
23
|
+
var t = this;
|
24
|
+
|
25
|
+
// Internet Explorer has built-in automatic linking
|
26
|
+
if (tinyMCE.isIE)
|
27
|
+
return;
|
28
|
+
|
29
|
+
// Add a key down handler
|
30
|
+
ed.onKeyDown.add(function(ed, e) {
|
31
|
+
if (e.keyCode == 13)
|
32
|
+
return t.handleEnter(ed);
|
33
|
+
if (e.shiftKey && e.keyCode == 48)
|
34
|
+
return t.handleEclipse(ed);
|
35
|
+
});
|
36
|
+
|
37
|
+
// Add a key up handler
|
38
|
+
ed.onKeyUp.add(function(ed, e) {
|
39
|
+
if (e.keyCode == 32)
|
40
|
+
return t.handleSpacebar(ed);
|
41
|
+
});
|
42
|
+
},
|
43
|
+
|
44
|
+
handleEclipse : function(ed) {
|
45
|
+
this.parseCurrentLine(ed, -1, '(', true);
|
46
|
+
},
|
47
|
+
|
48
|
+
handleSpacebar : function(ed) {
|
49
|
+
this.parseCurrentLine(ed, 0, '', true);
|
50
|
+
},
|
51
|
+
|
52
|
+
handleEnter : function(ed) {
|
53
|
+
this.parseCurrentLine(ed, -1, '', false);
|
54
|
+
},
|
55
|
+
|
56
|
+
parseCurrentLine : function(ed, end_offset, delimiter, goback) {
|
57
|
+
var r, end, start, endContainer, bookmark, text, matches, prev, len;
|
58
|
+
|
59
|
+
// We need at least five characters to form a URL,
|
60
|
+
// hence, at minimum, five characters from the beginning of the line.
|
61
|
+
r = ed.selection.getRng().cloneRange();
|
62
|
+
if (r.startOffset < 5) {
|
63
|
+
// During testing, the caret is placed inbetween two text nodes.
|
64
|
+
// The previous text node contains the URL.
|
65
|
+
prev = r.endContainer.previousSibling;
|
66
|
+
if (prev == null) {
|
67
|
+
if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
|
68
|
+
return;
|
69
|
+
|
70
|
+
prev = r.endContainer.firstChild.nextSibling;
|
71
|
+
}
|
72
|
+
len = prev.length;
|
73
|
+
r.setStart(prev, len);
|
74
|
+
r.setEnd(prev, len);
|
75
|
+
|
76
|
+
if (r.endOffset < 5)
|
77
|
+
return;
|
78
|
+
|
79
|
+
end = r.endOffset;
|
80
|
+
endContainer = prev;
|
81
|
+
} else {
|
82
|
+
endContainer = r.endContainer;
|
83
|
+
|
84
|
+
// Get a text node
|
85
|
+
if (endContainer.nodeType != 3 && endContainer.firstChild) {
|
86
|
+
while (endContainer.nodeType != 3 && endContainer.firstChild)
|
87
|
+
endContainer = endContainer.firstChild;
|
88
|
+
|
89
|
+
r.setStart(endContainer, 0);
|
90
|
+
r.setEnd(endContainer, endContainer.nodeValue.length);
|
91
|
+
}
|
92
|
+
|
93
|
+
if (r.endOffset == 1)
|
94
|
+
end = 2;
|
95
|
+
else
|
96
|
+
end = r.endOffset - 1 - end_offset;
|
97
|
+
}
|
98
|
+
|
99
|
+
start = end;
|
100
|
+
|
101
|
+
do
|
102
|
+
{
|
103
|
+
// Move the selection one character backwards.
|
104
|
+
r.setStart(endContainer, end - 2);
|
105
|
+
r.setEnd(endContainer, end - 1);
|
106
|
+
end -= 1;
|
107
|
+
|
108
|
+
// Loop until one of the following is found: a blank space, , delimeter, (end-2) >= 0
|
109
|
+
} while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
|
110
|
+
|
111
|
+
if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
|
112
|
+
r.setStart(endContainer, end);
|
113
|
+
r.setEnd(endContainer, start);
|
114
|
+
end += 1;
|
115
|
+
} else if (r.startOffset == 0) {
|
116
|
+
r.setStart(endContainer, 0);
|
117
|
+
r.setEnd(endContainer, start);
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
r.setStart(endContainer, end);
|
121
|
+
r.setEnd(endContainer, start);
|
122
|
+
}
|
123
|
+
|
124
|
+
text = r.toString();
|
125
|
+
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);
|
126
|
+
|
127
|
+
if (matches) {
|
128
|
+
if (matches[1] == 'www.') {
|
129
|
+
matches[1] = 'http://www.';
|
130
|
+
}
|
131
|
+
|
132
|
+
bookmark = ed.selection.getBookmark();
|
133
|
+
|
134
|
+
ed.selection.setRng(r);
|
135
|
+
tinyMCE.execCommand('mceInsertLink',false, matches[1] + matches[2]);
|
136
|
+
ed.selection.moveToBookmark(bookmark);
|
137
|
+
|
138
|
+
// TODO: Determine if this is still needed.
|
139
|
+
if (tinyMCE.isWebKit) {
|
140
|
+
// move the caret to its original position
|
141
|
+
ed.selection.collapse(false);
|
142
|
+
var max = Math.min(endContainer.length, start + 1);
|
143
|
+
r.setStart(endContainer, max);
|
144
|
+
r.setEnd(endContainer, max);
|
145
|
+
ed.selection.setRng(r);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
},
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Returns information about the plugin as a name/value array.
|
152
|
+
* The current keys are longname, author, authorurl, infourl and version.
|
153
|
+
*
|
154
|
+
* @return {Object} Name/value array containing information about the plugin.
|
155
|
+
*/
|
156
|
+
getInfo : function() {
|
157
|
+
return {
|
158
|
+
longname : 'Autolink',
|
159
|
+
author : 'Moxiecode Systems AB',
|
160
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
161
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
|
162
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
163
|
+
};
|
164
|
+
}
|
165
|
+
});
|
166
|
+
|
167
|
+
// Register plugin
|
168
|
+
tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
|
169
|
+
})();
|
@@ -1 +1 @@
|
|
1
|
-
(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this;if(a.getParam("fullscreen_is_enabled")){return}function b(){var
|
1
|
+
(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:k.offsetHeight;g=d.bottom_margin+g;if(g>d.autoresize_min_height){j=g}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=a.getElement().offsetHeight;d.bottom_margin=parseInt(a.getParam("autoresize_bottom_margin",50));a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
|
@@ -26,7 +26,7 @@
|
|
26
26
|
* @param {string} url Absolute URL to where the plugin is located.
|
27
27
|
*/
|
28
28
|
init : function(ed, url) {
|
29
|
-
var t = this;
|
29
|
+
var t = this, oldSize = 0;
|
30
30
|
|
31
31
|
if (ed.getParam('fullscreen_is_enabled'))
|
32
32
|
return;
|
@@ -40,12 +40,18 @@
|
|
40
40
|
// Get height differently depending on the browser used
|
41
41
|
myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight;
|
42
42
|
|
43
|
+
// Bottom margin
|
44
|
+
myHeight = t.bottom_margin + myHeight;
|
45
|
+
|
43
46
|
// Don't make it smaller than the minimum height
|
44
47
|
if (myHeight > t.autoresize_min_height)
|
45
48
|
resizeHeight = myHeight;
|
46
49
|
|
47
50
|
// Resize content element
|
48
|
-
|
51
|
+
if ( resizeHeight !== oldSize ) {
|
52
|
+
DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
|
53
|
+
oldSize = resizeHeight;
|
54
|
+
}
|
49
55
|
|
50
56
|
// if we're throbbing, we'll re-throb to match the new size
|
51
57
|
if (t.throbbing) {
|
@@ -59,6 +65,9 @@
|
|
59
65
|
// Define minimum height
|
60
66
|
t.autoresize_min_height = ed.getElement().offsetHeight;
|
61
67
|
|
68
|
+
// Add margin at the bottom for better UX
|
69
|
+
t.bottom_margin = parseInt( ed.getParam('autoresize_bottom_margin', 50) );
|
70
|
+
|
62
71
|
// Add appropriate listeners for resizing content area
|
63
72
|
ed.onChange.add(resize);
|
64
73
|
ed.onSetContent.add(resize);
|
@@ -116,4 +125,4 @@
|
|
116
125
|
|
117
126
|
// Register plugin
|
118
127
|
tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
|
119
|
-
})();
|
128
|
+
})();
|
@@ -1 +1 @@
|
|
1
|
-
(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();m.save("TinyMCE")},getItem:function(l){var m=i.getElement();m.load("TinyMCE");return m.getAttribute(l)},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
|
1
|
+
(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
|
@@ -257,15 +257,24 @@
|
|
257
257
|
|
258
258
|
userDataElement.setAttribute(key, value);
|
259
259
|
userDataElement.expires = self.getExpDate();
|
260
|
-
|
260
|
+
|
261
|
+
try {
|
262
|
+
userDataElement.save("TinyMCE");
|
263
|
+
} catch (e) {
|
264
|
+
// Ignore, saving might fail if "Userdata Persistence" is disabled in IE
|
265
|
+
}
|
261
266
|
},
|
262
267
|
|
263
268
|
getItem : function(key) {
|
264
269
|
var userDataElement = ed.getElement();
|
265
270
|
|
266
|
-
|
267
|
-
|
268
|
-
|
271
|
+
try {
|
272
|
+
userDataElement.load("TinyMCE");
|
273
|
+
return userDataElement.getAttribute(key);
|
274
|
+
} catch (e) {
|
275
|
+
// Ignore, loading might fail if "Userdata Persistence" is disabled in IE
|
276
|
+
return null;
|
277
|
+
}
|
269
278
|
},
|
270
279
|
|
271
280
|
removeItem : function(key) {
|
@@ -1 +1 @@
|
|
1
|
-
(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/ 
|
1
|
+
(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/ |\u00a0/gi," ");b(/"/gi,'"');b(/</gi,"<");b(/>/gi,">");b(/&/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"<br />");b(/\[b\]/gi,"<strong>");b(/\[\/b\]/gi,"</strong>");b(/\[i\]/gi,"<em>");b(/\[\/i\]/gi,"</em>");b(/\[u\]/gi,"<u>");b(/\[\/u\]/gi,"</u>");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>');b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> ');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> ');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})();
|
@@ -1 +1 @@
|
|
1
|
-
(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(
|
1
|
+
(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(e){var h=this,f,d,i;h.editor=e;d=e.settings.contextmenu_never_use_native;h.onContextMenu=new tinymce.util.Dispatcher(this);f=e.onContextMenu.add(function(j,k){if((i!==0?i:k.ctrlKey)&&!d){return}a.cancel(k);if(k.target.nodeName=="IMG"){j.selection.select(k.target)}h._getMenu(j).showMenu(k.clientX||k.pageX,k.clientY||k.pageX);a.add(j.getDoc(),"click",function(l){g(j,l)});j.nodeChanged()});e.onRemove.add(function(){if(h._menu){h._menu.removeAll()}});function g(j,k){i=0;if(k&&k.button==2){i=k.ctrlKey;return}if(h._menu){h._menu.removeAll();h._menu.destroy();a.remove(j.getDoc(),"click",g)}}e.onMouseDown.add(g);e.onKeyDown.add(g);e.onKeyDown.add(function(j,k){if(k.shiftKey&&!k.ctrlKey&&!k.altKey&&k.keyCode===121){a.cancel(k);f(j,k)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
|
@@ -27,10 +27,12 @@
|
|
27
27
|
* @param {string} url Absolute URL to where the plugin is located.
|
28
28
|
*/
|
29
29
|
init : function(ed) {
|
30
|
-
var t = this,
|
30
|
+
var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey;
|
31
31
|
|
32
32
|
t.editor = ed;
|
33
33
|
|
34
|
+
contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;
|
35
|
+
|
34
36
|
/**
|
35
37
|
* This event gets fired when the context menu is shown.
|
36
38
|
*
|
@@ -40,18 +42,23 @@
|
|
40
42
|
*/
|
41
43
|
t.onContextMenu = new tinymce.util.Dispatcher(this);
|
42
44
|
|
43
|
-
ed.onContextMenu.add(function(ed, e) {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
ed.selection.setRng(lastRng);
|
45
|
+
showMenu = ed.onContextMenu.add(function(ed, e) {
|
46
|
+
// Block TinyMCE menu on ctrlKey and work around Safari issue
|
47
|
+
if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative)
|
48
|
+
return;
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
Event.cancel(e);
|
51
|
+
|
52
|
+
// Select the image if it's clicked. WebKit would other wise expand the selection
|
53
|
+
if (e.target.nodeName == 'IMG')
|
54
|
+
ed.selection.select(e.target);
|
55
|
+
|
56
|
+
t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageX);
|
57
|
+
Event.add(ed.getDoc(), 'click', function(e) {
|
58
|
+
hide(ed, e);
|
59
|
+
});
|
60
|
+
|
61
|
+
ed.nodeChanged();
|
55
62
|
});
|
56
63
|
|
57
64
|
ed.onRemove.add(function() {
|
@@ -60,12 +67,12 @@
|
|
60
67
|
});
|
61
68
|
|
62
69
|
function hide(ed, e) {
|
63
|
-
|
70
|
+
realCtrlKey = 0;
|
64
71
|
|
65
72
|
// Since the contextmenu event moves
|
66
73
|
// the selection we need to store it away
|
67
74
|
if (e && e.button == 2) {
|
68
|
-
|
75
|
+
realCtrlKey = e.ctrlKey;
|
69
76
|
return;
|
70
77
|
}
|
71
78
|
|
@@ -78,6 +85,12 @@
|
|
78
85
|
|
79
86
|
ed.onMouseDown.add(hide);
|
80
87
|
ed.onKeyDown.add(hide);
|
88
|
+
ed.onKeyDown.add(function(ed, e) {
|
89
|
+
if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {
|
90
|
+
Event.cancel(e);
|
91
|
+
showMenu(ed, e);
|
92
|
+
}
|
93
|
+
});
|
81
94
|
},
|
82
95
|
|
83
96
|
/**
|
@@ -111,7 +124,8 @@
|
|
111
124
|
m = ed.controlManager.createDropMenu('contextmenu', {
|
112
125
|
offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0),
|
113
126
|
offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0),
|
114
|
-
constrain : 1
|
127
|
+
constrain : 1,
|
128
|
+
keyboard_focus: true
|
115
129
|
});
|
116
130
|
|
117
131
|
t._menu = m;
|
@@ -144,4 +158,4 @@
|
|
144
158
|
|
145
159
|
// Register plugin
|
146
160
|
tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
|
147
|
-
})();
|
161
|
+
})();
|
@@ -5,36 +5,37 @@
|
|
5
5
|
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
6
6
|
<script type="text/javascript" src="js/emotions.js"></script>
|
7
7
|
</head>
|
8
|
-
<body style="display: none">
|
9
|
-
|
10
|
-
|
8
|
+
<body style="display: none" role="application" aria-labelledby="app_title">
|
9
|
+
<span style="display:none;" id="app_title">{#emotions_dlg.title}</span>
|
10
|
+
<div align="center">
|
11
|
+
<div class="title">{#emotions_dlg.title}:<br /><br /></div>
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
<table role="presentation" border="0" cellspacing="0" cellpadding="4">
|
14
|
+
<tr>
|
14
15
|
<td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}" title="{#emotions_dlg.cool}" /></a></td>
|
15
16
|
<td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}" title="{#emotions_dlg.cry}" /></a></td>
|
16
17
|
<td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}" title="{#emotions_dlg.embarassed}" /></a></td>
|
17
18
|
<td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}" title="{#emotions_dlg.foot_in_mouth}" /></a></td>
|
18
|
-
|
19
|
-
|
19
|
+
</tr>
|
20
|
+
<tr>
|
20
21
|
<td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}" title="{#emotions_dlg.frown}" /></a></td>
|
21
22
|
<td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}" title="{#emotions_dlg.innocent}" /></a></td>
|
22
23
|
<td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}" title="{#emotions_dlg.kiss}" /></a></td>
|
23
24
|
<td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}" title="{#emotions_dlg.laughing}" /></a></td>
|
24
|
-
|
25
|
-
|
25
|
+
</tr>
|
26
|
+
<tr>
|
26
27
|
<td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}" title="{#emotions_dlg.money_mouth}" /></a></td>
|
27
28
|
<td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}" title="{#emotions_dlg.sealed}" /></a></td>
|
28
29
|
<td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}" title="{#emotions_dlg.smile}" /></a></td>
|
29
30
|
<td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}" title="{#emotions_dlg.surprised}" /></a></td>
|
30
|
-
|
31
|
-
|
31
|
+
</tr>
|
32
|
+
<tr>
|
32
33
|
<td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}" title="{#emotions_dlg.tongue_out}" /></a></td>
|
33
34
|
<td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}" title="{#emotions_dlg.undecided}" /></a></td>
|
34
35
|
<td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}" title="{#emotions_dlg.wink}" /></a></td>
|
35
36
|
<td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}" title="{#emotions_dlg.yell}" /></a></td>
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
</tr>
|
38
|
+
</table>
|
39
|
+
</div>
|
39
40
|
</body>
|
40
41
|
</html>
|