tinymce-rails 3.5.4.1 → 3.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/lib/tinymce/rails/version.rb +2 -2
  2. data/vendor/assets/javascripts/tinymce/plugins/advimage/js/image.js +5 -3
  3. data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin.js +1 -1
  4. data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +184 -181
  5. data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +119 -119
  6. data/vendor/assets/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin_src.js +50 -50
  8. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +4 -4
  10. data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin_src.js +956 -952
  12. data/vendor/assets/javascripts/tinymce/plugins/media/js/media.js +34 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/media/langs/en_dlg.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +1 -4
  16. data/vendor/assets/javascripts/tinymce/plugins/style/langs/en_dlg.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/style/props.htm +845 -845
  18. data/vendor/assets/javascripts/tinymce/plugins/style/readme.txt +19 -19
  19. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +122 -122
  20. data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin_src.js +1449 -1449
  21. data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template_src.js +2 -1
  23. data/vendor/assets/javascripts/tinymce/themes/advanced/js/color_picker.js +345 -345
  24. data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en_dlg.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/tiny_mce.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/tiny_mce_jquery.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/tiny_mce_jquery_src.js +277 -75
  28. data/vendor/assets/javascripts/tinymce/tiny_mce_src.js +277 -75
  29. metadata +5 -7
@@ -1,6 +1,6 @@
1
1
  module TinyMCE
2
2
  module Rails
3
- VERSION = "3.5.4.1"
4
- TINYMCE_VERSION = "3.5.4.1"
3
+ VERSION = "3.5.5"
4
+ TINYMCE_VERSION = "3.5.5"
5
5
  end
6
6
  end
@@ -395,12 +395,14 @@ var ImageDialog = {
395
395
  if (v == '0')
396
396
  img.style.border = isIE ? '0' : '0 none none';
397
397
  else {
398
- if (b.length == 3 && b[isIE ? 2 : 1])
399
- bStyle = b[isIE ? 2 : 1];
398
+ var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);
399
+
400
+ if (b.length == 3 && b[isOldIE ? 2 : 1])
401
+ bStyle = b[isOldIE ? 2 : 1];
400
402
  else if (!bStyle || bStyle == 'none')
401
403
  bStyle = 'solid';
402
404
  if (b.length == 3 && b[isIE ? 0 : 2])
403
- bColor = b[isIE ? 0 : 2];
405
+ bColor = b[isOldIE ? 0 : 2];
404
406
  else if (!bColor || bColor == 'none')
405
407
  bColor = 'black';
406
408
  img.style.border = v + 'px ' + bStyle + ' ' + bColor;
@@ -1 +1 @@
1
- (function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){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(true).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)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();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)})();
1
+ (function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){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(true).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}if(n.nodeType==3){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)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();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)})();
@@ -1,181 +1,184 @@
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
- // Add a key down handler
26
- ed.onKeyDown.addToTop(function(ed, e) {
27
- if (e.keyCode == 13)
28
- return t.handleEnter(ed);
29
- });
30
-
31
- // Internet Explorer has built-in automatic linking for most cases
32
- if (tinyMCE.isIE)
33
- return;
34
-
35
- ed.onKeyPress.add(function(ed, e) {
36
- if (e.which == 41)
37
- return t.handleEclipse(ed);
38
- });
39
-
40
- // Add a key up handler
41
- ed.onKeyUp.add(function(ed, e) {
42
- if (e.keyCode == 32)
43
- return t.handleSpacebar(ed);
44
- });
45
- },
46
-
47
- handleEclipse : function(ed) {
48
- this.parseCurrentLine(ed, -1, '(', true);
49
- },
50
-
51
- handleSpacebar : function(ed) {
52
- this.parseCurrentLine(ed, 0, '', true);
53
- },
54
-
55
- handleEnter : function(ed) {
56
- this.parseCurrentLine(ed, -1, '', false);
57
- },
58
-
59
- parseCurrentLine : function(ed, end_offset, delimiter, goback) {
60
- var r, end, start, endContainer, bookmark, text, matches, prev, len;
61
-
62
- // We need at least five characters to form a URL,
63
- // hence, at minimum, five characters from the beginning of the line.
64
- r = ed.selection.getRng(true).cloneRange();
65
- if (r.startOffset < 5) {
66
- // During testing, the caret is placed inbetween two text nodes.
67
- // The previous text node contains the URL.
68
- prev = r.endContainer.previousSibling;
69
- if (prev == null) {
70
- if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
71
- return;
72
-
73
- prev = r.endContainer.firstChild.nextSibling;
74
- }
75
- len = prev.length;
76
- r.setStart(prev, len);
77
- r.setEnd(prev, len);
78
-
79
- if (r.endOffset < 5)
80
- return;
81
-
82
- end = r.endOffset;
83
- endContainer = prev;
84
- } else {
85
- endContainer = r.endContainer;
86
-
87
- // Get a text node
88
- if (endContainer.nodeType != 3 && endContainer.firstChild) {
89
- while (endContainer.nodeType != 3 && endContainer.firstChild)
90
- endContainer = endContainer.firstChild;
91
-
92
- r.setStart(endContainer, 0);
93
- r.setEnd(endContainer, endContainer.nodeValue.length);
94
- }
95
-
96
- if (r.endOffset == 1)
97
- end = 2;
98
- else
99
- end = r.endOffset - 1 - end_offset;
100
- }
101
-
102
- start = end;
103
-
104
- do
105
- {
106
- // Move the selection one character backwards.
107
- r.setStart(endContainer, end - 2);
108
- r.setEnd(endContainer, end - 1);
109
- end -= 1;
110
-
111
- // Loop until one of the following is found: a blank space, &nbsp;, delimeter, (end-2) >= 0
112
- } while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
113
-
114
- if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
115
- r.setStart(endContainer, end);
116
- r.setEnd(endContainer, start);
117
- end += 1;
118
- } else if (r.startOffset == 0) {
119
- r.setStart(endContainer, 0);
120
- r.setEnd(endContainer, start);
121
- }
122
- else {
123
- r.setStart(endContainer, end);
124
- r.setEnd(endContainer, start);
125
- }
126
-
127
- // Exclude last . from word like "www.site.com."
128
- var text = r.toString();
129
- if (text.charAt(text.length - 1) == '.') {
130
- r.setEnd(endContainer, start - 1);
131
- }
132
-
133
- text = r.toString();
134
- matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);
135
-
136
- if (matches) {
137
- if (matches[1] == 'www.') {
138
- matches[1] = 'http://www.';
139
- } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
140
- matches[1] = 'mailto:' + matches[1];
141
- }
142
-
143
- bookmark = ed.selection.getBookmark();
144
-
145
- ed.selection.setRng(r);
146
- tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
147
- ed.selection.moveToBookmark(bookmark);
148
- ed.nodeChanged();
149
-
150
- // TODO: Determine if this is still needed.
151
- if (tinyMCE.isWebKit) {
152
- // move the caret to its original position
153
- ed.selection.collapse(false);
154
- var max = Math.min(endContainer.length, start + 1);
155
- r.setStart(endContainer, max);
156
- r.setEnd(endContainer, max);
157
- ed.selection.setRng(r);
158
- }
159
- }
160
- },
161
-
162
- /**
163
- * Returns information about the plugin as a name/value array.
164
- * The current keys are longname, author, authorurl, infourl and version.
165
- *
166
- * @return {Object} Name/value array containing information about the plugin.
167
- */
168
- getInfo : function() {
169
- return {
170
- longname : 'Autolink',
171
- author : 'Moxiecode Systems AB',
172
- authorurl : 'http://tinymce.moxiecode.com',
173
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
174
- version : tinymce.majorVersion + "." + tinymce.minorVersion
175
- };
176
- }
177
- });
178
-
179
- // Register plugin
180
- tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
181
- })();
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
+ // Add a key down handler
26
+ ed.onKeyDown.addToTop(function(ed, e) {
27
+ if (e.keyCode == 13)
28
+ return t.handleEnter(ed);
29
+ });
30
+
31
+ // Internet Explorer has built-in automatic linking for most cases
32
+ if (tinyMCE.isIE)
33
+ return;
34
+
35
+ ed.onKeyPress.add(function(ed, e) {
36
+ if (e.which == 41)
37
+ return t.handleEclipse(ed);
38
+ });
39
+
40
+ // Add a key up handler
41
+ ed.onKeyUp.add(function(ed, e) {
42
+ if (e.keyCode == 32)
43
+ return t.handleSpacebar(ed);
44
+ });
45
+ },
46
+
47
+ handleEclipse : function(ed) {
48
+ this.parseCurrentLine(ed, -1, '(', true);
49
+ },
50
+
51
+ handleSpacebar : function(ed) {
52
+ this.parseCurrentLine(ed, 0, '', true);
53
+ },
54
+
55
+ handleEnter : function(ed) {
56
+ this.parseCurrentLine(ed, -1, '', false);
57
+ },
58
+
59
+ parseCurrentLine : function(ed, end_offset, delimiter, goback) {
60
+ var r, end, start, endContainer, bookmark, text, matches, prev, len;
61
+
62
+ // We need at least five characters to form a URL,
63
+ // hence, at minimum, five characters from the beginning of the line.
64
+ r = ed.selection.getRng(true).cloneRange();
65
+ if (r.startOffset < 5) {
66
+ // During testing, the caret is placed inbetween two text nodes.
67
+ // The previous text node contains the URL.
68
+ prev = r.endContainer.previousSibling;
69
+ if (prev == null) {
70
+ if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
71
+ return;
72
+
73
+ prev = r.endContainer.firstChild.nextSibling;
74
+ }
75
+ len = prev.length;
76
+ r.setStart(prev, len);
77
+ r.setEnd(prev, len);
78
+
79
+ if (r.endOffset < 5)
80
+ return;
81
+
82
+ end = r.endOffset;
83
+ endContainer = prev;
84
+ } else {
85
+ endContainer = r.endContainer;
86
+
87
+ // Get a text node
88
+ if (endContainer.nodeType != 3 && endContainer.firstChild) {
89
+ while (endContainer.nodeType != 3 && endContainer.firstChild)
90
+ endContainer = endContainer.firstChild;
91
+
92
+ // Move range to text node
93
+ if (endContainer.nodeType == 3) {
94
+ r.setStart(endContainer, 0);
95
+ r.setEnd(endContainer, endContainer.nodeValue.length);
96
+ }
97
+ }
98
+
99
+ if (r.endOffset == 1)
100
+ end = 2;
101
+ else
102
+ end = r.endOffset - 1 - end_offset;
103
+ }
104
+
105
+ start = end;
106
+
107
+ do
108
+ {
109
+ // Move the selection one character backwards.
110
+ r.setStart(endContainer, end - 2);
111
+ r.setEnd(endContainer, end - 1);
112
+ end -= 1;
113
+
114
+ // Loop until one of the following is found: a blank space, &nbsp;, delimeter, (end-2) >= 0
115
+ } while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
116
+
117
+ if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
118
+ r.setStart(endContainer, end);
119
+ r.setEnd(endContainer, start);
120
+ end += 1;
121
+ } else if (r.startOffset == 0) {
122
+ r.setStart(endContainer, 0);
123
+ r.setEnd(endContainer, start);
124
+ }
125
+ else {
126
+ r.setStart(endContainer, end);
127
+ r.setEnd(endContainer, start);
128
+ }
129
+
130
+ // Exclude last . from word like "www.site.com."
131
+ var text = r.toString();
132
+ if (text.charAt(text.length - 1) == '.') {
133
+ r.setEnd(endContainer, start - 1);
134
+ }
135
+
136
+ text = r.toString();
137
+ matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);
138
+
139
+ if (matches) {
140
+ if (matches[1] == 'www.') {
141
+ matches[1] = 'http://www.';
142
+ } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
143
+ matches[1] = 'mailto:' + matches[1];
144
+ }
145
+
146
+ bookmark = ed.selection.getBookmark();
147
+
148
+ ed.selection.setRng(r);
149
+ tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
150
+ ed.selection.moveToBookmark(bookmark);
151
+ ed.nodeChanged();
152
+
153
+ // TODO: Determine if this is still needed.
154
+ if (tinyMCE.isWebKit) {
155
+ // move the caret to its original position
156
+ ed.selection.collapse(false);
157
+ var max = Math.min(endContainer.length, start + 1);
158
+ r.setStart(endContainer, max);
159
+ r.setEnd(endContainer, max);
160
+ ed.selection.setRng(r);
161
+ }
162
+ }
163
+ },
164
+
165
+ /**
166
+ * Returns information about the plugin as a name/value array.
167
+ * The current keys are longname, author, authorurl, infourl and version.
168
+ *
169
+ * @return {Object} Name/value array containing information about the plugin.
170
+ */
171
+ getInfo : function() {
172
+ return {
173
+ longname : 'Autolink',
174
+ author : 'Moxiecode Systems AB',
175
+ authorurl : 'http://tinymce.moxiecode.com',
176
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
177
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
178
+ };
179
+ }
180
+ });
181
+
182
+ // Register plugin
183
+ tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
184
+ })();
@@ -1,119 +1,119 @@
1
- /**
2
- * editor_plugin_src.js
3
- *
4
- * Copyright 2009, 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
- /**
13
- * Auto Resize
14
- *
15
- * This plugin automatically resizes the content area to fit its content height.
16
- * It will retain a minimum height, which is the height of the content area when
17
- * it's initialized.
18
- */
19
- tinymce.create('tinymce.plugins.AutoResizePlugin', {
20
- /**
21
- * Initializes the plugin, this will be executed after the plugin has been created.
22
- * This call is done before the editor instance has finished it's initialization so use the onInit event
23
- * of the editor instance to intercept that event.
24
- *
25
- * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
26
- * @param {string} url Absolute URL to where the plugin is located.
27
- */
28
- init : function(ed, url) {
29
- var t = this, oldSize = 0;
30
-
31
- if (ed.getParam('fullscreen_is_enabled'))
32
- return;
33
-
34
- /**
35
- * This method gets executed each time the editor needs to resize.
36
- */
37
- function resize() {
38
- var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
39
-
40
- // Get height differently depending on the browser used
41
- myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight);
42
-
43
- // Don't make it smaller than the minimum height
44
- if (myHeight > t.autoresize_min_height)
45
- resizeHeight = myHeight;
46
-
47
- // If a maximum height has been defined don't exceed this height
48
- if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
49
- resizeHeight = t.autoresize_max_height;
50
- body.style.overflowY = "auto";
51
- de.style.overflowY = "auto"; // Old IE
52
- } else {
53
- body.style.overflowY = "hidden";
54
- de.style.overflowY = "hidden"; // Old IE
55
- body.scrollTop = 0;
56
- }
57
-
58
- // Resize content element
59
- if (resizeHeight !== oldSize) {
60
- deltaSize = resizeHeight - oldSize;
61
- DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
62
- oldSize = resizeHeight;
63
-
64
- // WebKit doesn't decrease the size of the body element until the iframe gets resized
65
- // So we need to continue to resize the iframe down until the size gets fixed
66
- if (tinymce.isWebKit && deltaSize < 0)
67
- resize();
68
- }
69
- };
70
-
71
- t.editor = ed;
72
-
73
- // Define minimum height
74
- t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight));
75
-
76
- // Define maximum height
77
- t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0));
78
-
79
- // Add padding at the bottom for better UX
80
- ed.onInit.add(function(ed){
81
- ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
82
- });
83
-
84
- // Add appropriate listeners for resizing content area
85
- ed.onChange.add(resize);
86
- ed.onSetContent.add(resize);
87
- ed.onPaste.add(resize);
88
- ed.onKeyUp.add(resize);
89
- ed.onPostRender.add(resize);
90
-
91
- if (ed.getParam('autoresize_on_init', true)) {
92
- ed.onLoad.add(resize);
93
- ed.onLoadContent.add(resize);
94
- }
95
-
96
- // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
97
- ed.addCommand('mceAutoResize', resize);
98
- },
99
-
100
- /**
101
- * Returns information about the plugin as a name/value array.
102
- * The current keys are longname, author, authorurl, infourl and version.
103
- *
104
- * @return {Object} Name/value array containing information about the plugin.
105
- */
106
- getInfo : function() {
107
- return {
108
- longname : 'Auto Resize',
109
- author : 'Moxiecode Systems AB',
110
- authorurl : 'http://tinymce.moxiecode.com',
111
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize',
112
- version : tinymce.majorVersion + "." + tinymce.minorVersion
113
- };
114
- }
115
- });
116
-
117
- // Register plugin
118
- tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
119
- })();
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2009, 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
+ /**
13
+ * Auto Resize
14
+ *
15
+ * This plugin automatically resizes the content area to fit its content height.
16
+ * It will retain a minimum height, which is the height of the content area when
17
+ * it's initialized.
18
+ */
19
+ tinymce.create('tinymce.plugins.AutoResizePlugin', {
20
+ /**
21
+ * Initializes the plugin, this will be executed after the plugin has been created.
22
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
23
+ * of the editor instance to intercept that event.
24
+ *
25
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
26
+ * @param {string} url Absolute URL to where the plugin is located.
27
+ */
28
+ init : function(ed, url) {
29
+ var t = this, oldSize = 0;
30
+
31
+ if (ed.getParam('fullscreen_is_enabled'))
32
+ return;
33
+
34
+ /**
35
+ * This method gets executed each time the editor needs to resize.
36
+ */
37
+ function resize() {
38
+ var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
39
+
40
+ // Get height differently depending on the browser used
41
+ myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight);
42
+
43
+ // Don't make it smaller than the minimum height
44
+ if (myHeight > t.autoresize_min_height)
45
+ resizeHeight = myHeight;
46
+
47
+ // If a maximum height has been defined don't exceed this height
48
+ if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
49
+ resizeHeight = t.autoresize_max_height;
50
+ body.style.overflowY = "auto";
51
+ de.style.overflowY = "auto"; // Old IE
52
+ } else {
53
+ body.style.overflowY = "hidden";
54
+ de.style.overflowY = "hidden"; // Old IE
55
+ body.scrollTop = 0;
56
+ }
57
+
58
+ // Resize content element
59
+ if (resizeHeight !== oldSize) {
60
+ deltaSize = resizeHeight - oldSize;
61
+ DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
62
+ oldSize = resizeHeight;
63
+
64
+ // WebKit doesn't decrease the size of the body element until the iframe gets resized
65
+ // So we need to continue to resize the iframe down until the size gets fixed
66
+ if (tinymce.isWebKit && deltaSize < 0)
67
+ resize();
68
+ }
69
+ };
70
+
71
+ t.editor = ed;
72
+
73
+ // Define minimum height
74
+ t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight));
75
+
76
+ // Define maximum height
77
+ t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0));
78
+
79
+ // Add padding at the bottom for better UX
80
+ ed.onInit.add(function(ed){
81
+ ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
82
+ });
83
+
84
+ // Add appropriate listeners for resizing content area
85
+ ed.onChange.add(resize);
86
+ ed.onSetContent.add(resize);
87
+ ed.onPaste.add(resize);
88
+ ed.onKeyUp.add(resize);
89
+ ed.onPostRender.add(resize);
90
+
91
+ if (ed.getParam('autoresize_on_init', true)) {
92
+ ed.onLoad.add(resize);
93
+ ed.onLoadContent.add(resize);
94
+ }
95
+
96
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
97
+ ed.addCommand('mceAutoResize', resize);
98
+ },
99
+
100
+ /**
101
+ * Returns information about the plugin as a name/value array.
102
+ * The current keys are longname, author, authorurl, infourl and version.
103
+ *
104
+ * @return {Object} Name/value array containing information about the plugin.
105
+ */
106
+ getInfo : function() {
107
+ return {
108
+ longname : 'Auto Resize',
109
+ author : 'Moxiecode Systems AB',
110
+ authorurl : 'http://tinymce.moxiecode.com',
111
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize',
112
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
113
+ };
114
+ }
115
+ });
116
+
117
+ // Register plugin
118
+ tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
119
+ })();