tinymce-rails 3.5.2 → 3.5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +181 -181
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +119 -119
- data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +4 -2
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +9 -7
- data/vendor/assets/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin_src.js +50 -50
- data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin_src.js +952 -951
- data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin_src.js +22 -14
- data/vendor/assets/javascripts/tinymce/plugins/media/langs/en_dlg.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/style/langs/en_dlg.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/style/props.htm +845 -845
- data/vendor/assets/javascripts/tinymce/plugins/style/readme.txt +19 -19
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +122 -122
- data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin_src.js +1449 -1446
- data/vendor/assets/javascripts/tinymce/plugins/table/js/table.js +4 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/color_picker.js +345 -345
- data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en_dlg.js +1 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/content.css +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/source_editor.htm +1 -1
- data/vendor/assets/javascripts/tinymce/tiny_mce.js +1 -1
- data/vendor/assets/javascripts/tinymce/tiny_mce_jquery.js +1 -1
- data/vendor/assets/javascripts/tinymce/tiny_mce_jquery_src.js +394 -158
- data/vendor/assets/javascripts/tinymce/tiny_mce_src.js +394 -158
- metadata +5 -4
@@ -1 +1 @@
|
|
1
|
-
(function(c){var b,e,a=[],d=window;c.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}p.css("visibility","hidden");function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);s.onInit.add(function(){var x,y=v;p.css("visibility","");if(v){if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}}})});c.each(r,function(t,s){s.render()})}if(!d.tinymce&&!e&&(g=j.script_url)){e=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}d.tinyMCEPreInit=d.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!d.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");c.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}c.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;e=2;if(j.script_loaded){j.script_loaded()}o();c.each(a,function(q,r){r()})}})}else{if(e===1){a.push(o)}else{o()}}return p};c.extend(c.expr[":"],{tinymce:function(g){return !!(g.id&&tinyMCE.get(g.id))}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==b){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(d.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(d.tinymce)&&(l.is(":tinymce")))}var j={};c.each(["text","html","val"],function(n,l){var o=j[l]=c.fn[l],m=(l==="text");c.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==b){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(c(v),q)});return r}}});c.each(["append","prepend"],function(n,m){var o=j[m]=c.fn[m],l=(m==="prepend");c.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==b){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});c.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=c.fn[l];c.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=c.fn.attr;c.fn.attr=function(
|
1
|
+
(function(c){var b,e,a=[],d=window;c.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}p.css("visibility","hidden");function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);s.onInit.add(function(){var x,y=v;p.css("visibility","");if(v){if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}}})});c.each(r,function(t,s){s.render()})}if(!d.tinymce&&!e&&(g=j.script_url)){e=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}d.tinyMCEPreInit=d.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!d.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");c.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}c.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;e=2;if(j.script_loaded){j.script_loaded()}o();c.each(a,function(q,r){r()})}})}else{if(e===1){a.push(o)}else{o()}}return p};c.extend(c.expr[":"],{tinymce:function(g){return !!(g.id&&"tinyMCE" in window&&tinyMCE.get(g.id))}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==b){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(d.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(d.tinymce)&&(l.is(":tinymce")))}var j={};c.each(["text","html","val"],function(n,l){var o=j[l]=c.fn[l],m=(l==="text");c.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==b){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent({save:true})):o.apply(c(v),q)});return r}}});c.each(["append","prepend"],function(n,m){var o=j[m]=c.fn[m],l=(m==="prepend");c.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==b){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});c.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=c.fn[l];c.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=c.fn.attr;c.fn.attr=function(o,q){var m=this,n=arguments;if((!o)||(o!=="value")||(!g(m))){if(q!==b){return j.attr.apply(m,n)}else{return j.attr.apply(m,n)}}if(q!==b){k.call(m.filter(":tinymce"),q);j.attr.apply(m.not(":tinymce"),n);return m}else{var p=m[0],l=h(p);return l?l.getContent({save:true}):j.attr.apply(c(p),n)}}}})(jQuery);
|
@@ -1,181 +1,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
|
-
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, , 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
|
+
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, , 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,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
|
+
})();
|