radiant-forum-extension 2.1.6 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -16
- data/Rakefile +0 -16
- data/app/controllers/forum_base_controller.rb +32 -10
- data/app/controllers/posts_controller.rb +37 -14
- data/app/helpers/forum_helper.rb +23 -16
- data/app/models/forum.rb +11 -7
- data/app/models/post.rb +53 -14
- data/app/models/post_attachment.rb +1 -1
- data/app/models/topic.rb +21 -8
- data/app/views/admin/dashboard/_forum_dashboard.html.haml +51 -0
- data/app/views/admin/forums/_form.html.haml +12 -0
- data/app/views/admin/forums/edit.html.haml +1 -1
- data/app/views/admin/forums/index.html.haml +16 -20
- data/app/views/admin/posts/_form.html.haml +2 -2
- data/app/views/admin/posts/edit.html.haml +1 -1
- data/app/views/admin/posts/index.html.haml +5 -5
- data/app/views/admin/reader_configuration/_edit_forum.html.haml +6 -0
- data/app/views/admin/reader_configuration/_forum.html.haml +5 -1
- data/app/views/admin/topics/_form.html.haml +3 -5
- data/app/views/admin/topics/edit.html.haml +1 -1
- data/app/views/admin/topics/index.html.haml +5 -5
- data/app/views/forums/_forum.html.haml +6 -5
- data/app/views/forums/_latest.html.haml +14 -12
- data/app/views/forums/_statistics.html.haml +4 -4
- data/app/views/forums/index.html.haml +8 -10
- data/app/views/forums/index.rss.builder +2 -2
- data/app/views/forums/show.html.haml +12 -15
- data/app/views/pages/_add_comment.html.haml +9 -8
- data/app/views/pages/_comments.html.haml +3 -3
- data/app/views/posts/_attachments.html.haml +1 -1
- data/app/views/posts/_confirm_delete.html.haml +7 -2
- data/app/views/posts/_context.html.haml +5 -5
- data/app/views/posts/_edit_links.html.haml +4 -4
- data/app/views/posts/_form.html.haml +15 -12
- data/app/views/posts/_ineditable.html.haml +7 -0
- data/app/views/posts/_latest.html.haml +3 -8
- data/app/views/posts/_minimal.html.haml +7 -0
- data/app/views/posts/_post.html.haml +20 -17
- data/app/views/posts/_post.rss.builder +2 -2
- data/app/views/posts/_search_form.html.haml +13 -13
- data/app/views/posts/_search_results.html.haml +15 -0
- data/app/views/posts/_search_summary.html.haml +13 -0
- data/app/views/posts/_uploader.html.haml +1 -1
- data/app/views/posts/edit.html.haml +22 -21
- data/app/views/posts/index.html.haml +12 -19
- data/app/views/posts/index.rss.builder +6 -6
- data/app/views/posts/new.html.haml +19 -22
- data/app/views/posts/remove.html.haml +15 -15
- data/app/views/posts/show.html.haml +16 -10
- data/app/views/readers/_forum_messages.html.haml +9 -6
- data/app/views/readers/_messages_summary.html.haml +1 -1
- data/app/views/shared/_standard_forum_parts.html.haml +41 -0
- data/app/views/topics/_busiest.html.haml +9 -8
- data/app/views/topics/_context.html.haml +11 -8
- data/app/views/topics/_latest.html.haml +2 -2
- data/app/views/topics/_locked.html.haml +1 -1
- data/app/views/topics/_minimal.html.haml +2 -2
- data/app/views/topics/_replies.html.haml +4 -3
- data/app/views/topics/_reply.html.haml +13 -8
- data/app/views/topics/_topic.html.haml +5 -9
- data/app/views/topics/_topic.rss.builder +1 -1
- data/app/views/topics/index.html.haml +14 -10
- data/app/views/topics/index.rss.builder +2 -2
- data/app/views/topics/show.html.haml +20 -19
- data/app/views/topics/show.rss.builder +3 -3
- data/config/initializers/radiant_config.rb +4 -1
- data/config/locales/en.yml +202 -178
- data/db/migrate/002_pages_commentable.rb +1 -2
- data/db/migrate/004_sample_layout.rb +38 -15
- data/db/migrate/20110111080550_detach_observer.rb +4 -4
- data/db/migrate/20110613112823_search_text.rb +9 -0
- data/db/migrate/20110613130230_tidy_up.rb +27 -0
- data/db/migrate/20110630083446_page_replied_at.rb +11 -0
- data/forum_extension.rb +13 -11
- data/lib/commentable_model.rb +13 -9
- data/lib/forum_admin_ui.rb +6 -6
- data/lib/forum_page.rb +5 -3
- data/lib/forum_reader.rb +7 -1
- data/lib/forum_reader_sessions_controller.rb +2 -3
- data/lib/forum_tags.rb +126 -11
- data/lib/radiant-forum-extension.rb +8 -0
- data/public/cleditor/images/buttons.gif +0 -0
- data/public/cleditor/images/icons/1.gif +0 -0
- data/public/cleditor/images/icons/10.gif +0 -0
- data/public/cleditor/images/icons/11.gif +0 -0
- data/public/cleditor/images/icons/12.gif +0 -0
- data/public/cleditor/images/icons/2.gif +0 -0
- data/public/cleditor/images/icons/3.gif +0 -0
- data/public/cleditor/images/icons/4.gif +0 -0
- data/public/cleditor/images/icons/5.gif +0 -0
- data/public/cleditor/images/icons/6.gif +0 -0
- data/public/cleditor/images/icons/7.gif +0 -0
- data/public/cleditor/images/icons/8.gif +0 -0
- data/public/cleditor/images/icons/9.gif +0 -0
- data/public/cleditor/images/icons/icons.gif +0 -0
- data/public/cleditor/images/toolbar.gif +0 -0
- data/public/cleditor/jquery.cleditor.css +24 -0
- data/public/cleditor/jquery.cleditor.icon.js +65 -0
- data/public/cleditor/jquery.cleditor.js +1132 -0
- data/public/cleditor/jquery.cleditor.xhtml.js +230 -0
- data/public/javascripts/forum.js +146 -107
- data/public/stylesheets/sass/forum.sass +94 -58
- data/radiant-forum-extension.gemspec +25 -276
- data/spec/controllers/forums_controller_spec.rb +0 -7
- data/spec/controllers/posts_controller_spec.rb +20 -37
- data/spec/controllers/topics_controller_spec.rb +1 -7
- data/spec/datasets/forums_dataset.rb +38 -40
- data/spec/lib/commentable_model_spec.rb +26 -38
- data/spec/lib/forum_reader_spec.rb +0 -4
- data/spec/models/forum_spec.rb +46 -16
- data/spec/models/post_spec.rb +10 -6
- data/spec/models/topic_spec.rb +26 -17
- data/spec/spec_helper.rb +1 -0
- metadata +66 -99
- data/VERSION +0 -1
- data/app/views/forums/_standard_parts.html.haml +0 -59
- data/lib/sanitize/config/forum.rb +0 -49
- data/public/javascripts/gallery.js +0 -275
- data/public/punymce/blank.htm +0 -1
- data/public/punymce/css/content.css +0 -4
- data/public/punymce/css/editor.css +0 -58
- data/public/punymce/i18n/sv.js +0 -28
- data/public/punymce/img/icons.gif +0 -0
- data/public/punymce/img/icons_uncompressed.png +0 -0
- data/public/punymce/plugins/bbcode.js +0 -1
- data/public/punymce/plugins/bbcode_src.js +0 -50
- data/public/punymce/plugins/editsource/css/editor.css +0 -3
- data/public/punymce/plugins/editsource/editsource.js +0 -1
- data/public/punymce/plugins/editsource/editsource_src.js +0 -81
- data/public/punymce/plugins/editsource/img/icons.gif +0 -0
- data/public/punymce/plugins/emoticons/css/content.css +0 -13
- data/public/punymce/plugins/emoticons/css/editor.css +0 -17
- data/public/punymce/plugins/emoticons/emoticons.js +0 -1
- data/public/punymce/plugins/emoticons/emoticons_src.js +0 -303
- data/public/punymce/plugins/emoticons/img/emoticons.gif +0 -0
- data/public/punymce/plugins/emoticons/img/emoticons.png +0 -0
- data/public/punymce/plugins/emoticons/img/trans.gif +0 -0
- data/public/punymce/plugins/entities.js +0 -1
- data/public/punymce/plugins/entities_src.js +0 -37
- data/public/punymce/plugins/forceblocks.js +0 -1
- data/public/punymce/plugins/forceblocks_src.js +0 -465
- data/public/punymce/plugins/forcenl.js +0 -1
- data/public/punymce/plugins/forcenl_src.js +0 -26
- data/public/punymce/plugins/image/css/editor.css +0 -1
- data/public/punymce/plugins/image/image.js +0 -1
- data/public/punymce/plugins/image/image_src.js +0 -30
- data/public/punymce/plugins/image/img/icons.gif +0 -0
- data/public/punymce/plugins/link/css/editor.css +0 -2
- data/public/punymce/plugins/link/img/icons.gif +0 -0
- data/public/punymce/plugins/link/link.js +0 -1
- data/public/punymce/plugins/link/link_src.js +0 -36
- data/public/punymce/plugins/paste.js +0 -1
- data/public/punymce/plugins/paste_src.js +0 -169
- data/public/punymce/plugins/protect.js +0 -1
- data/public/punymce/plugins/protect_src.js +0 -30
- data/public/punymce/plugins/safari2x.js +0 -1
- data/public/punymce/plugins/safari2x_src.js +0 -284
- data/public/punymce/plugins/tabfocus.js +0 -1
- data/public/punymce/plugins/tabfocus_src.js +0 -45
- data/public/punymce/plugins/textcolor/css/editor.css +0 -7
- data/public/punymce/plugins/textcolor/img/icons.gif +0 -0
- data/public/punymce/plugins/textcolor/textcolor.js +0 -1
- data/public/punymce/plugins/textcolor/textcolor_src.js +0 -73
- data/public/punymce/puny_mce.js +0 -1
- data/public/punymce/puny_mce_full.js +0 -1
- data/public/punymce/puny_mce_src.js +0 -1460
@@ -1 +0,0 @@
|
|
1
|
-
(function(a){a.plugins.ForceBlocks=function(d){var v=a.Event,s,g=this;var n,k,u,q;var c,r,p;n=a.isIE;k=a.isGecko;u=a.isOpera;q=a.isWebKit;c=a.each;r=a.extend;this.settings=p=r({element:"P"},d.settings.forceblocks);d.onPreInit.add(m,g);if(!n){d.onSetContent.add(function(t,w){if(w.format=="html"){w.content=w.content.replace(/<p>[\s\u00a0]+<\/p>/g,"<p><br /></p>")}})}d.onPostProcess.add(function(t,w){w.content=w.content.replace(/<p><\/p>/g,"<p>\u00a0</p>")});function m(){s=d.dom;v.add(d.getDoc(),"keyup",j);d.onSetContent.add(j);d.onBeforeGetContent.add(j);if(!n){d.onPreProcess.add(function(t,w){c(w.node.getElementsByTagName("br"),function(y){var x=y.parentNode;if(x&&x.nodeName=="p"&&(x.childNodes.length==1||x.lastChild==y)){x.replaceChild(t.getDoc().createTextNode("\u00a0"),y)}})});v.add(d.getDoc(),"keypress",function(t){if(t.keyCode==13&&!t.shiftKey){if(!o(t)){return v.cancel(t)}}});if(k){v.add(d.getDoc(),"keydown",function(t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){h(t,t.keyCode==8)}})}}}function b(x){var y,t;y=x.document;t=y.compatMode=="CSS1Compat"?y.documentElement:y.body;return{x:x.pageXOffset||t.scrollLeft,y:x.pageYOffset||t.scrollTop,w:x.innerWidth||t.clientWidth,h:x.innerHeight||t.clientHeight}}function l(B,y,z){var x=d.getDoc().createTreeWalker(B,4,null,false),B,A=-1;while(B=x.nextNode()){A++;if(y==0&&B==z){return A}if(y==1&&A==z){return B}}return -1}function j(){var C=this,O=d.getBody(),L=d.getDoc(),R=d.selection,D=R.getSel(),E=R.getRng(),P=-2,A,J,w,x,M=-16777215;var N,y,Q,I,F,z=O.childNodes,H,G,B;for(H=z.length-1;H>=0;H--){N=z[H];if(N.nodeType==3||(!f(N)&&N.nodeType!=8)){if(!y){if(N.nodeType!=3||/[^\s]/g.test(N.nodeValue)){if(P==-2&&E){if(!n){if(E.startContainer.nodeType==1&&(G=E.startContainer.childNodes[E.startOffset])&&G.nodeType==1){B=G.getAttribute("id");G.setAttribute("id","__mce")}else{if(d.dom.getParent(E.startContainer,function(t){return t===O})){J=E.startOffset;w=E.endOffset;P=l(O,0,E.startContainer);A=l(O,0,E.endContainer)}}}else{x=L.body.createTextRange();x.moveToElementText(O);x.collapse(1);Q=x.move("character",M)*-1;x=E.duplicate();x.collapse(1);I=x.move("character",M)*-1;x=E.duplicate();x.collapse(0);F=(x.move("character",M)*-1)-I;P=I-Q;A=F}}y=d.dom.create(p.element);y.appendChild(N.cloneNode(1));N.parentNode.replaceChild(y,N)}}else{if(y.hasChildNodes()){y.insertBefore(N,y.firstChild)}else{y.appendChild(N)}}}else{y=null}}if(P!=-2){if(!n){y=O.getElementsByTagName(p.element)[0];E=L.createRange();if(P!=-1){E.setStart(l(O,1,P),J)}else{E.setStart(y,0)}if(A!=-1){E.setEnd(l(O,1,A),w)}else{E.setEnd(y,0)}if(D){D.removeAllRanges();D.addRange(E)}}else{try{E=D.createRange();E.moveToElementText(O);E.collapse(1);E.moveStart("character",P);E.moveEnd("character",A);E.select()}catch(K){}}}else{if(!n&&(G=d.dom.get("__mce"))){if(B){G.setAttribute("id",B)}else{G.removeAttribute("id")}E=L.createRange();E.setStartBefore(G);E.setEndBefore(G);R.setRng(E)}}}function f(t){return t.nodeType==1&&/^(H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CODE|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(t.nodeName)}function e(t){return s.getParent(t,function(w){return f(w)})}function i(t){t=t.innerHTML;t=t.replace(/<img|hr|table/g,"d");t=t.replace(/<[^>]+>/g,"");return t.replace(/[ \t\r\n]+/g,"")==""}function o(O){var P=d.getDoc(),G=d.selection.getSel(),H=d.selection.getRng(),Q=P.body;var K,L,I,N,M,z,w,A,C,t,E,R,x,B,J,D,F;if(a.isOldWebKit){return true}K=P.createRange();K.setStart(G.anchorNode,G.anchorOffset);K.collapse(true);L=P.createRange();L.setStart(G.focusNode,G.focusOffset);L.collapse(true);I=K.compareBoundaryPoints(K.START_TO_END,L)<0;N=I?G.anchorNode:G.focusNode;M=I?G.anchorOffset:G.focusOffset;z=I?G.focusNode:G.anchorNode;w=I?G.focusOffset:G.anchorOffset;N=N.nodeName=="BODY"?N.firstChild:N;z=z.nodeName=="BODY"?z.firstChild:z;A=e(N);C=e(z);t=A?A.nodeName:p.element;if(s.getParent(A,function(y){return/OL|UL/.test(y.nodeName)})){return true}if(A&&(A.nodeName=="CAPTION"||/absolute|relative|static/gi.test(A.style.position))){t=p.element;A=null}if(C&&(C.nodeName=="CAPTION"||/absolute|relative|static/gi.test(C.style.position))){t=p.element;C=null}if(/(TD|TABLE|TH|CAPTION)/.test(t)||(A&&t=="DIV"&&/left|right/gi.test(A.style.cssFloat))){t=p.element;A=C=null}E=(A&&A.nodeName==t)?A.cloneNode(0):P.createElement(t);R=(C&&C.nodeName==t)?C.cloneNode(0):P.createElement(t);R.id="";if(/^(H[1-6])$/.test(t)&&N.nodeValue&&M==N.nodeValue.length){R=P.createElement(p.element)}J=x=N;do{if(J==Q||J.nodeType==9||f(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}x=J}while((J=J.previousSibling?J.previousSibling:J.parentNode));J=B=z;do{if(J==Q||J.nodeType==9||f(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}B=J}while((J=J.nextSibling?J.nextSibling:J.parentNode));if(x.nodeName==t){K.setStart(x,0)}else{K.setStartBefore(x)}K.setEnd(N,M);E.appendChild(K.cloneContents());L.setEndAfter(B);L.setStart(z,w);R.appendChild(L.cloneContents());H=P.createRange();if(!x.previousSibling&&x.parentNode.nodeName==t){H.setStartBefore(x.parentNode)}else{if(K.startContainer.nodeName==t&&K.startOffset==0){H.setStartBefore(K.startContainer)}else{H.setStart(K.startContainer,K.startOffset)}}if(!B.nextSibling&&B.parentNode.nodeName==t){H.setEndAfter(B.parentNode)}else{H.setEnd(L.endContainer,L.endOffset)}H.deleteContents();if(E.firstChild&&E.firstChild.nodeName==t){E.innerHTML=E.firstChild.innerHTML}if(R.firstChild&&R.firstChild.nodeName==t){R.innerHTML=R.firstChild.innerHTML}if(i(E)){E.innerHTML=u?" <br />":"<br />"}if(i(R)){R.innerHTML=u?" <br />":"<br />"}if(u){H.insertNode(E);H.insertNode(R)}else{H.insertNode(R);H.insertNode(E)}R.normalize();E.normalize();H=P.createRange();H.selectNodeContents(R);H.collapse(1);G.removeAllRanges();G.addRange(H);vp=b(d.getWin());D=d.dom.getPos(R).y;F=R.clientHeight;if(D<vp.y||D+F>vp.y+vp.h){d.getWin().scrollTo(0,D<vp.y?D:D-vp.h+25)}return false}function h(y,E){var B=d.getBody(),x,z=d.selection,t=z.getRng(),A=t.startContainer,x,C,D;if(A&&f(A)&&!/^(TD|TH)$/.test(A.nodeName)&&E){if(A.childNodes.length==0||(A.childNodes.length==1&&A.firstChild.nodeName=="BR")){x=A;while((x=x.previousSibling)&&!f(x)){}if(x){if(A!=B.firstChild){C=d.getDoc().createTreeWalker(x,NodeFilter.SHOW_TEXT,null,false);while(D=C.nextNode()){x=D}t=d.getDoc().createRange();t.setStart(x,x.nodeValue?x.nodeValue.length:0);t.setEnd(x,x.nodeValue?x.nodeValue.length:0);z.getSel().removeAllRanges();z.getSel().addRange(t);A.parentNode.removeChild(A)}return v.cancel(y)}}}function F(w){var G;w=w.target;if(w&&w.parentNode&&w.nodeName=="BR"&&(x=e(w))){G=w.previousSibling;v.remove(B,"DOMNodeInserted",F);if(G&&G.nodeType==3&&/\s+$/.test(G.nodeValue)){return}if(w.previousSibling||w.nextSibling){w.parentNode.removeChild(w)}}}v._add(B,"DOMNodeInserted",F);window.setTimeout(function(){v._remove(B,"DOMNodeInserted",F)},1)}}})(punymce);
|
@@ -1,465 +0,0 @@
|
|
1
|
-
(function(punymce) {
|
2
|
-
punymce.plugins.ForceBlocks = function(ed) {
|
3
|
-
var Event = punymce.Event, DOM, t = this;
|
4
|
-
var isIE, isGecko, isOpera, isWebKit;
|
5
|
-
var each, extend, st;
|
6
|
-
|
7
|
-
isIE = punymce.isIE;
|
8
|
-
isGecko = punymce.isGecko;
|
9
|
-
isOpera = punymce.isOpera;
|
10
|
-
isWebKit = punymce.isWebKit;
|
11
|
-
each = punymce.each;
|
12
|
-
extend = punymce.extend;
|
13
|
-
|
14
|
-
// Default settings
|
15
|
-
this.settings = st = extend({
|
16
|
-
element : 'P'
|
17
|
-
}, ed.settings.forceblocks);
|
18
|
-
|
19
|
-
ed.onPreInit.add(setup, t);
|
20
|
-
|
21
|
-
if (!isIE) {
|
22
|
-
ed.onSetContent.add(function(ed, o) {
|
23
|
-
if (o.format == 'html')
|
24
|
-
o.content = o.content.replace(/<p>[\s\u00a0]+<\/p>/g, '<p><br /></p>');
|
25
|
-
});
|
26
|
-
}
|
27
|
-
|
28
|
-
ed.onPostProcess.add(function(ed, o) {
|
29
|
-
o.content = o.content.replace(/<p><\/p>/g, '<p>\u00a0</p>');
|
30
|
-
});
|
31
|
-
|
32
|
-
function setup() {
|
33
|
-
DOM = ed.dom;
|
34
|
-
|
35
|
-
// Force root blocks when typing and when getting output
|
36
|
-
Event.add(ed.getDoc(), 'keyup', forceRoots);
|
37
|
-
ed.onSetContent.add(forceRoots);
|
38
|
-
ed.onBeforeGetContent.add(forceRoots);
|
39
|
-
|
40
|
-
if (!isIE) {
|
41
|
-
ed.onPreProcess.add(function(ed, o) {
|
42
|
-
each(o.node.getElementsByTagName('br'), function(n) {
|
43
|
-
var p = n.parentNode;
|
44
|
-
|
45
|
-
if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) {
|
46
|
-
p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
});
|
50
|
-
|
51
|
-
Event.add(ed.getDoc(), 'keypress', function(e) {
|
52
|
-
if (e.keyCode == 13 && !e.shiftKey) {
|
53
|
-
if (!insertPara(e))
|
54
|
-
return Event.cancel(e);
|
55
|
-
}
|
56
|
-
});
|
57
|
-
|
58
|
-
if (isGecko) {
|
59
|
-
Event.add(ed.getDoc(), 'keydown', function(e) {
|
60
|
-
if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
|
61
|
-
backspaceDelete(e, e.keyCode == 8);
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
function getViewPort(w) {
|
68
|
-
var d, b;
|
69
|
-
|
70
|
-
d = w.document;
|
71
|
-
b = d.compatMode == "CSS1Compat" ? d.documentElement : d.body;
|
72
|
-
|
73
|
-
// Returns viewport size excluding scrollbars
|
74
|
-
return {
|
75
|
-
x : w.pageXOffset || b.scrollLeft,
|
76
|
-
y : w.pageYOffset || b.scrollTop,
|
77
|
-
w : w.innerWidth || b.clientWidth,
|
78
|
-
h : w.innerHeight || b.clientHeight
|
79
|
-
};
|
80
|
-
};
|
81
|
-
|
82
|
-
function find(n, t, s) {
|
83
|
-
var w = ed.getDoc().createTreeWalker(n, 4, null, false), n, c = -1;
|
84
|
-
|
85
|
-
while (n = w.nextNode()) {
|
86
|
-
c++;
|
87
|
-
|
88
|
-
// Index by node
|
89
|
-
if (t == 0 && n == s)
|
90
|
-
return c;
|
91
|
-
|
92
|
-
// Node by index
|
93
|
-
if (t == 1 && c == s)
|
94
|
-
return n;
|
95
|
-
}
|
96
|
-
|
97
|
-
return -1;
|
98
|
-
};
|
99
|
-
|
100
|
-
function forceRoots() {
|
101
|
-
var t = this, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
|
102
|
-
var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid;
|
103
|
-
|
104
|
-
// Fix for bug #1863847
|
105
|
-
//if (e && e.keyCode == 13)
|
106
|
-
// return true;
|
107
|
-
|
108
|
-
// Wrap non blocks into blocks
|
109
|
-
for (i = nl.length - 1; i >= 0; i--) {
|
110
|
-
nx = nl[i];
|
111
|
-
|
112
|
-
// Is text or non block element
|
113
|
-
if (nx.nodeType == 3 || (!isBlock(nx) && nx.nodeType != 8)) {
|
114
|
-
if (!bl) {
|
115
|
-
// Create new block but ignore whitespace
|
116
|
-
if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
|
117
|
-
// Store selection
|
118
|
-
if (si == -2 && r) {
|
119
|
-
if (!isIE) {
|
120
|
-
// If selection is element then mark it
|
121
|
-
if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) {
|
122
|
-
// Save the id of the selected element
|
123
|
-
eid = n.getAttribute("id");
|
124
|
-
n.setAttribute("id", "__mce");
|
125
|
-
} else {
|
126
|
-
// If element is inside body, might not be the case in contentEdiable mode
|
127
|
-
if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {
|
128
|
-
so = r.startOffset;
|
129
|
-
eo = r.endOffset;
|
130
|
-
si = find(b, 0, r.startContainer);
|
131
|
-
ei = find(b, 0, r.endContainer);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
} else {
|
135
|
-
tr = d.body.createTextRange();
|
136
|
-
tr.moveToElementText(b);
|
137
|
-
tr.collapse(1);
|
138
|
-
bp = tr.move('character', c) * -1;
|
139
|
-
|
140
|
-
tr = r.duplicate();
|
141
|
-
tr.collapse(1);
|
142
|
-
sp = tr.move('character', c) * -1;
|
143
|
-
|
144
|
-
tr = r.duplicate();
|
145
|
-
tr.collapse(0);
|
146
|
-
le = (tr.move('character', c) * -1) - sp;
|
147
|
-
|
148
|
-
si = sp - bp;
|
149
|
-
ei = le;
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
bl = ed.dom.create(st.element);
|
154
|
-
bl.appendChild(nx.cloneNode(1));
|
155
|
-
nx.parentNode.replaceChild(bl, nx);
|
156
|
-
}
|
157
|
-
} else {
|
158
|
-
if (bl.hasChildNodes())
|
159
|
-
bl.insertBefore(nx, bl.firstChild);
|
160
|
-
else
|
161
|
-
bl.appendChild(nx);
|
162
|
-
}
|
163
|
-
} else
|
164
|
-
bl = null; // Time to create new block
|
165
|
-
}
|
166
|
-
|
167
|
-
// Restore selection
|
168
|
-
if (si != -2) {
|
169
|
-
if (!isIE) {
|
170
|
-
bl = b.getElementsByTagName(st.element)[0];
|
171
|
-
r = d.createRange();
|
172
|
-
|
173
|
-
// Select last location or generated block
|
174
|
-
if (si != -1)
|
175
|
-
r.setStart(find(b, 1, si), so);
|
176
|
-
else
|
177
|
-
r.setStart(bl, 0);
|
178
|
-
|
179
|
-
// Select last location or generated block
|
180
|
-
if (ei != -1)
|
181
|
-
r.setEnd(find(b, 1, ei), eo);
|
182
|
-
else
|
183
|
-
r.setEnd(bl, 0);
|
184
|
-
|
185
|
-
if (s) {
|
186
|
-
s.removeAllRanges();
|
187
|
-
s.addRange(r);
|
188
|
-
}
|
189
|
-
} else {
|
190
|
-
try {
|
191
|
-
r = s.createRange();
|
192
|
-
r.moveToElementText(b);
|
193
|
-
r.collapse(1);
|
194
|
-
r.moveStart('character', si);
|
195
|
-
r.moveEnd('character', ei);
|
196
|
-
r.select();
|
197
|
-
} catch (ex) {
|
198
|
-
// Ignore
|
199
|
-
}
|
200
|
-
}
|
201
|
-
} else if (!isIE && (n = ed.dom.get('__mce'))) {
|
202
|
-
// Restore the id of the selected element
|
203
|
-
if (eid)
|
204
|
-
n.setAttribute('id', eid);
|
205
|
-
else
|
206
|
-
n.removeAttribute('id');
|
207
|
-
|
208
|
-
// Move caret before selected element
|
209
|
-
r = d.createRange();
|
210
|
-
r.setStartBefore(n);
|
211
|
-
r.setEndBefore(n);
|
212
|
-
se.setRng(r);
|
213
|
-
}
|
214
|
-
};
|
215
|
-
|
216
|
-
function isBlock(n) {
|
217
|
-
return n.nodeType == 1 && /^(H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CODE|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);
|
218
|
-
};
|
219
|
-
|
220
|
-
function getParentBlock(n) {
|
221
|
-
return DOM.getParent(n, function(n) {
|
222
|
-
return isBlock(n);
|
223
|
-
});
|
224
|
-
};
|
225
|
-
|
226
|
-
function isEmpty(n) {
|
227
|
-
n = n.innerHTML;
|
228
|
-
n = n.replace(/<img|hr|table/g, 'd'); // Keep these
|
229
|
-
n = n.replace(/<[^>]+>/g, ''); // Remove all tags
|
230
|
-
|
231
|
-
return n.replace(/[ \t\r\n]+/g, '') == '';
|
232
|
-
};
|
233
|
-
|
234
|
-
function insertPara(e) {
|
235
|
-
var d = ed.getDoc(), s = ed.selection.getSel(), r = ed.selection.getRng(), b = d.body;
|
236
|
-
var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, y, ch;
|
237
|
-
|
238
|
-
// Check if Safari 2.x
|
239
|
-
if (punymce.isOldWebKit)
|
240
|
-
return true;
|
241
|
-
|
242
|
-
// Setup before range
|
243
|
-
rb = d.createRange();
|
244
|
-
rb.setStart(s.anchorNode, s.anchorOffset);
|
245
|
-
rb.collapse(true);
|
246
|
-
|
247
|
-
// Setup after range
|
248
|
-
ra = d.createRange();
|
249
|
-
ra.setStart(s.focusNode, s.focusOffset);
|
250
|
-
ra.collapse(true);
|
251
|
-
|
252
|
-
// Setup start/end points
|
253
|
-
dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
|
254
|
-
sn = dir ? s.anchorNode : s.focusNode;
|
255
|
-
so = dir ? s.anchorOffset : s.focusOffset;
|
256
|
-
en = dir ? s.focusNode : s.anchorNode;
|
257
|
-
eo = dir ? s.focusOffset : s.anchorOffset;
|
258
|
-
|
259
|
-
// Never use body as start or end node
|
260
|
-
sn = sn.nodeName == "BODY" ? sn.firstChild : sn;
|
261
|
-
en = en.nodeName == "BODY" ? en.firstChild : en;
|
262
|
-
|
263
|
-
// Get start and end blocks
|
264
|
-
sb = getParentBlock(sn);
|
265
|
-
eb = getParentBlock(en);
|
266
|
-
bn = sb ? sb.nodeName : st.element; // Get block name to create
|
267
|
-
|
268
|
-
// Return inside list use default browser behavior
|
269
|
-
if (DOM.getParent(sb, function(n) { return /OL|UL/.test(n.nodeName); }))
|
270
|
-
return true;
|
271
|
-
|
272
|
-
// If caption or absolute layers then always generate new blocks within
|
273
|
-
if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(sb.style.position))) {
|
274
|
-
bn = st.element;
|
275
|
-
sb = null;
|
276
|
-
}
|
277
|
-
|
278
|
-
// If caption or absolute layers then always generate new blocks within
|
279
|
-
if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(eb.style.position))) {
|
280
|
-
bn = st.element;
|
281
|
-
eb = null;
|
282
|
-
}
|
283
|
-
|
284
|
-
// Use P instead
|
285
|
-
if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(sb.style.cssFloat))) {
|
286
|
-
bn = st.element;
|
287
|
-
sb = eb = null;
|
288
|
-
}
|
289
|
-
|
290
|
-
// Setup new before and after blocks
|
291
|
-
bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : d.createElement(bn);
|
292
|
-
aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : d.createElement(bn);
|
293
|
-
|
294
|
-
// Remove id from after clone
|
295
|
-
aft.id = '';
|
296
|
-
|
297
|
-
// Is header and cursor is at the end, then force paragraph under
|
298
|
-
if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length)
|
299
|
-
aft = d.createElement(st.element);
|
300
|
-
|
301
|
-
// Find start chop node
|
302
|
-
n = sc = sn;
|
303
|
-
do {
|
304
|
-
if (n == b || n.nodeType == 9 || isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
|
305
|
-
break;
|
306
|
-
|
307
|
-
sc = n;
|
308
|
-
} while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
|
309
|
-
|
310
|
-
// Find end chop node
|
311
|
-
n = ec = en;
|
312
|
-
do {
|
313
|
-
if (n == b || n.nodeType == 9 || isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
|
314
|
-
break;
|
315
|
-
|
316
|
-
ec = n;
|
317
|
-
} while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
|
318
|
-
|
319
|
-
// Place first chop part into before block element
|
320
|
-
if (sc.nodeName == bn)
|
321
|
-
rb.setStart(sc, 0);
|
322
|
-
else
|
323
|
-
rb.setStartBefore(sc);
|
324
|
-
|
325
|
-
rb.setEnd(sn, so);
|
326
|
-
bef.appendChild(rb.cloneContents());
|
327
|
-
|
328
|
-
// Place secnd chop part within new block element
|
329
|
-
ra.setEndAfter(ec);
|
330
|
-
ra.setStart(en, eo);
|
331
|
-
aft.appendChild(ra.cloneContents());
|
332
|
-
|
333
|
-
// Create range around everything
|
334
|
-
r = d.createRange();
|
335
|
-
if (!sc.previousSibling && sc.parentNode.nodeName == bn) {
|
336
|
-
r.setStartBefore(sc.parentNode);
|
337
|
-
} else {
|
338
|
-
if (rb.startContainer.nodeName == bn && rb.startOffset == 0)
|
339
|
-
r.setStartBefore(rb.startContainer);
|
340
|
-
else
|
341
|
-
r.setStart(rb.startContainer, rb.startOffset);
|
342
|
-
}
|
343
|
-
|
344
|
-
if (!ec.nextSibling && ec.parentNode.nodeName == bn)
|
345
|
-
r.setEndAfter(ec.parentNode);
|
346
|
-
else
|
347
|
-
r.setEnd(ra.endContainer, ra.endOffset);
|
348
|
-
|
349
|
-
// Delete and replace it with new block elements
|
350
|
-
r.deleteContents();
|
351
|
-
|
352
|
-
// Never wrap blocks in blocks
|
353
|
-
if (bef.firstChild && bef.firstChild.nodeName == bn)
|
354
|
-
bef.innerHTML = bef.firstChild.innerHTML;
|
355
|
-
|
356
|
-
if (aft.firstChild && aft.firstChild.nodeName == bn)
|
357
|
-
aft.innerHTML = aft.firstChild.innerHTML;
|
358
|
-
|
359
|
-
// Padd empty blocks
|
360
|
-
if (isEmpty(bef))
|
361
|
-
bef.innerHTML = isOpera ? ' <br />' : '<br />'; // Extra space for Opera
|
362
|
-
|
363
|
-
if (isEmpty(aft))
|
364
|
-
aft.innerHTML = isOpera ? ' <br />' : '<br />'; // Extra space for Opera
|
365
|
-
|
366
|
-
// Opera needs this one backwards
|
367
|
-
if (isOpera) {
|
368
|
-
r.insertNode(bef);
|
369
|
-
r.insertNode(aft);
|
370
|
-
} else {
|
371
|
-
r.insertNode(aft);
|
372
|
-
r.insertNode(bef);
|
373
|
-
}
|
374
|
-
|
375
|
-
// Normalize
|
376
|
-
aft.normalize();
|
377
|
-
bef.normalize();
|
378
|
-
|
379
|
-
// Move cursor and scroll into view
|
380
|
-
r = d.createRange();
|
381
|
-
r.selectNodeContents(aft);
|
382
|
-
r.collapse(1);
|
383
|
-
s.removeAllRanges();
|
384
|
-
s.addRange(r);
|
385
|
-
//aft.scrollIntoView(0);
|
386
|
-
|
387
|
-
// scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs
|
388
|
-
vp = getViewPort(ed.getWin());
|
389
|
-
y = ed.dom.getPos(aft).y;
|
390
|
-
ch = aft.clientHeight;
|
391
|
-
|
392
|
-
// Is element within viewport
|
393
|
-
if (y < vp.y || y + ch > vp.y + vp.h)
|
394
|
-
ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks
|
395
|
-
|
396
|
-
return false;
|
397
|
-
};
|
398
|
-
|
399
|
-
function backspaceDelete(e, bs) {
|
400
|
-
var b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn;
|
401
|
-
|
402
|
-
// The caret sometimes gets stuck in Gecko if you delete empty paragraphs
|
403
|
-
// This workaround removes the element by hand and moves the caret to the previous element
|
404
|
-
if (sc && isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) {
|
405
|
-
if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) {
|
406
|
-
// Find previous block element
|
407
|
-
n = sc;
|
408
|
-
while ((n = n.previousSibling) && !isBlock(n)) ;
|
409
|
-
|
410
|
-
if (n) {
|
411
|
-
if (sc != b.firstChild) {
|
412
|
-
// Find last text node
|
413
|
-
w = ed.getDoc().createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
|
414
|
-
while (tn = w.nextNode())
|
415
|
-
n = tn;
|
416
|
-
|
417
|
-
// Place caret at the end of last text node
|
418
|
-
r = ed.getDoc().createRange();
|
419
|
-
r.setStart(n, n.nodeValue ? n.nodeValue.length : 0);
|
420
|
-
r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0);
|
421
|
-
se.getSel().removeAllRanges();
|
422
|
-
se.getSel().addRange(r);
|
423
|
-
|
424
|
-
// Remove the target container
|
425
|
-
sc.parentNode.removeChild(sc);
|
426
|
-
}
|
427
|
-
|
428
|
-
return Event.cancel(e);
|
429
|
-
}
|
430
|
-
}
|
431
|
-
}
|
432
|
-
|
433
|
-
// Gecko generates BR elements here and there, we don't like those so lets remove them
|
434
|
-
function handler(e) {
|
435
|
-
var pr;
|
436
|
-
|
437
|
-
e = e.target;
|
438
|
-
|
439
|
-
// A new BR was created in a block element, remove it
|
440
|
-
if (e && e.parentNode && e.nodeName == 'BR' && (n = getParentBlock(e))) {
|
441
|
-
pr = e.previousSibling;
|
442
|
-
|
443
|
-
Event.remove(b, 'DOMNodeInserted', handler);
|
444
|
-
|
445
|
-
// Is there whitespace at the end of the node before then we might need the pesky BR
|
446
|
-
// to place the caret at a correct location see bug: #2013943
|
447
|
-
if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue))
|
448
|
-
return;
|
449
|
-
|
450
|
-
// Only remove BR elements that got inserted in the middle of the text
|
451
|
-
if (e.previousSibling || e.nextSibling)
|
452
|
-
e.parentNode.removeChild(e);
|
453
|
-
}
|
454
|
-
};
|
455
|
-
|
456
|
-
// Listen for new nodes
|
457
|
-
Event._add(b, 'DOMNodeInserted', handler);
|
458
|
-
|
459
|
-
// Remove listener
|
460
|
-
window.setTimeout(function() {
|
461
|
-
Event._remove(b, 'DOMNodeInserted', handler);
|
462
|
-
}, 1);
|
463
|
-
};
|
464
|
-
};
|
465
|
-
})(punymce);
|
@@ -1 +0,0 @@
|
|
1
|
-
punymce.plugins.ForceNL=function(ed){ed.onGetContent.add(function(ed,o){if(o.format=='forcenl'||o.save){punymce.each([[/<(br\s*\/)>/gi,"\n"],[/<(br.*?\/)>/gi,""]],function(v){o.content=o.content.replace(v[0],v[1])})}});ed.onSetContent.add(function(ed,o){if(o.format=='forcenl'||o.load){punymce.each([[/\n/gi,"<br />"]],function(v){o.content=o.content.replace(v[0],v[1])})}})};
|
@@ -1,26 +0,0 @@
|
|
1
|
-
// ForceNL Plugin for PunyMCE
|
2
|
-
// - Converts all <br /> to \n
|
3
|
-
punymce.plugins.ForceNL = function(ed) {
|
4
|
-
// Forces <br /> to \n
|
5
|
-
ed.onGetContent.add(function(ed, o) {
|
6
|
-
if (o.format == 'forcenl' || o.save) {
|
7
|
-
punymce.each([
|
8
|
-
[/<(br\s*\/)>/gi, "\n"],
|
9
|
-
[/<(br.*?\/)>/gi, ""]
|
10
|
-
//[<br type="_moz"/>, ""]
|
11
|
-
], function (v) {
|
12
|
-
o.content = o.content.replace(v[0], v[1]);
|
13
|
-
});
|
14
|
-
}
|
15
|
-
});
|
16
|
-
|
17
|
-
ed.onSetContent.add(function(ed, o) {
|
18
|
-
if (o.format == 'forcenl' || o.load) {
|
19
|
-
punymce.each([
|
20
|
-
[/\n/gi,"<br />"]
|
21
|
-
], function (v) {
|
22
|
-
o.content = o.content.replace(v[0], v[1]);
|
23
|
-
});
|
24
|
-
}
|
25
|
-
});
|
26
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
.punymce a.image { background: url('../img/icons.gif') 0 0; }
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(a){a.plugins.Image=function(b){var c=a.I18n;if(!b.settings.image||b.settings.image.skip_css){a.DOM.loadCSS(a.baseURL+"/plugins/image/css/editor.css")}a.extend(b.commands,{mceInsertImage:function(h,g,j){var d,i=b.selection.getNode();d=prompt(c.entersrc,i.nodeName=="IMG"?b.dom.getAttr(i,"src"):"");if(d){b.selection.setNode(b.dom.create("img",{src:d}))}}});a.extend(b.tools,{image:{cmd:"mceInsertImage",title:c.insertimage}})};a.extend(a.I18n,{insertimage:"Insert image",entersrc:"Enter the URL of the image"})})(punymce);
|
@@ -1,30 +0,0 @@
|
|
1
|
-
(function(punymce) {
|
2
|
-
punymce.plugins.Image = function(ed) {
|
3
|
-
var I18n = punymce.I18n;
|
4
|
-
|
5
|
-
if (!ed.settings.image || ed.settings.image.skip_css)
|
6
|
-
punymce.DOM.loadCSS(punymce.baseURL + '/plugins/image/css/editor.css');
|
7
|
-
|
8
|
-
// Add image command
|
9
|
-
punymce.extend(ed.commands, {
|
10
|
-
mceInsertImage : function(u, v, e) {
|
11
|
-
var tx, f = ed.selection.getNode();
|
12
|
-
|
13
|
-
tx = prompt(I18n.entersrc, f.nodeName == "IMG" ? ed.dom.getAttr(f, "src") : "");
|
14
|
-
if (tx)
|
15
|
-
ed.selection.setNode(ed.dom.create('img', {src : tx}));
|
16
|
-
}
|
17
|
-
});
|
18
|
-
|
19
|
-
// Add tools
|
20
|
-
punymce.extend(ed.tools, {
|
21
|
-
image : {cmd : 'mceInsertImage', title : I18n.insertimage}
|
22
|
-
});
|
23
|
-
};
|
24
|
-
|
25
|
-
// English i18n strings
|
26
|
-
punymce.extend(punymce.I18n, {
|
27
|
-
insertimage : 'Insert image',
|
28
|
-
entersrc : 'Enter the URL of the image'
|
29
|
-
});
|
30
|
-
})(punymce);
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(a){a.plugins.Link=function(b){var c=a.I18n;if(!b.settings.link||b.settings.link.skip_css){a.DOM.loadCSS(a.baseURL+"/plugins/link/css/editor.css")}a.extend(b.commands,{mceInsertLink:function(h,g,j){var d,i=b.selection.getNode();d=prompt(c.enterhref,i.nodeName=="A"?b.dom.getAttr(i,"href"):"");if(d){if(b.selection.isCollapsed()){b.selection.setContent('<a href="'+d+'">'+d+"</a>")}else{b.execCommand("CreateLink",0,d)}}}});a.extend(b.tools,{link:{cmd:"mceInsertLink",title:c.link},unlink:{cmd:"Unlink",title:c.unlink}})};a.extend(a.I18n,{link:"Insert link",unlink:"Unlink",enterhref:"Enter the URL of the link"})})(punymce);
|
@@ -1,36 +0,0 @@
|
|
1
|
-
(function(punymce) {
|
2
|
-
punymce.plugins.Link = function(ed) {
|
3
|
-
var I18n = punymce.I18n;
|
4
|
-
|
5
|
-
if (!ed.settings.link || ed.settings.link.skip_css)
|
6
|
-
punymce.DOM.loadCSS(punymce.baseURL + '/plugins/link/css/editor.css');
|
7
|
-
|
8
|
-
// Add image command
|
9
|
-
punymce.extend(ed.commands, {
|
10
|
-
mceInsertLink : function(u, v, e) {
|
11
|
-
var tx, f = ed.selection.getNode();
|
12
|
-
|
13
|
-
tx = prompt(I18n.enterhref, f.nodeName == "A" ? ed.dom.getAttr(f, "href") : "");
|
14
|
-
if (tx) {
|
15
|
-
if (ed.selection.isCollapsed())
|
16
|
-
ed.selection.setContent('<a href="' + tx + '">' + tx + '</a>');
|
17
|
-
else
|
18
|
-
ed.execCommand('CreateLink', 0, tx);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
});
|
22
|
-
|
23
|
-
// Add tools
|
24
|
-
punymce.extend(ed.tools, {
|
25
|
-
link : {cmd : 'mceInsertLink', title : I18n.link},
|
26
|
-
unlink : {cmd : 'Unlink', title : I18n.unlink}
|
27
|
-
});
|
28
|
-
};
|
29
|
-
|
30
|
-
// English i18n strings
|
31
|
-
punymce.extend(punymce.I18n, {
|
32
|
-
link : 'Insert link',
|
33
|
-
unlink : 'Unlink',
|
34
|
-
enterhref : 'Enter the URL of the link'
|
35
|
-
});
|
36
|
-
})(punymce);
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(b){var a=b.Event;function c(h,f){var g,e;g=f.parentNode;e=f.nextSibling;if(e){g.insertBefore(h,e)}else{g.appendChild(h)}return h}function d(g,i,h){var e,f=g.getDoc().createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);if(h){return f.nextNode()}while(e=f.nextNode()){i=e}return i}b.plugins.Paste=function(f){var i=b.DOM,g;f.onPaste=new b.Dispatcher(f);function h(t){var u,s=[],m,q,l=f.selection,k,n,p,j,o;f.getWin().focus();if(g){r=f.selection.getRng();r.moveToBookmark(g);r.select()}u=t.split(/\r?\n/);if(u.length>1){t="";b.each(u,function(v){t+="<p>"+v+"</p>"});if(!b.isIE){f.execCommand("Delete");l.setContent('<span id="marker"></span>');m=f.dom.getParent(f.dom.get("marker").parentNode,function(v){s.push(v);if(/^(p|h[1-6]|div)$/i.test(v.nodeName)){return true}});if(m){f.onPaste.dispatch({text:t});k=n="";for(p=0;p<s.length;p++){k+="</"+s[p].nodeName.toLowerCase()+">"}for(p=s.length-1;p>=0;p--){n+="<"+s[p].nodeName.toLowerCase()+">"}t=k+t+n+'<span id="_caret"> </span>';f.getBody().innerHTML=f.getBody().innerHTML.replace(/<span id=\"marker\"><\/span>/gi,t);q=f.dom.get("_caret");if(!b.isGecko){q.scrollIntoView()}j=f.getDoc().createRange();j.setStartBefore(q);j.setEndAfter(q);l.setRng(j);f.execCommand("Delete");return}else{o=f.dom.get("marker");o.parentNode.removeChild(o)}}}f.selection.setContent(t);f.onPaste.dispatch({text:t})}function e(p){var q,k,m=f.selection,l=m.getSel(),o,j=f.getBody();q=f.dom.add(j,"div",{id:"_mcePaste",style:"position:absolute;left:-10000px;top:"+j.scrollTop}," ");o=m.getRng();q=q.firstChild;k=f.getDoc().createRange();k.setStart(q,0);k.setEnd(q,1);l.removeAllRanges();l.addRange(k);window.setTimeout(function(){var t=f.dom.get("_mcePaste"),s;s=t.innerHTML;t.parentNode.removeChild(t);if(o){m.setRng(o)}h(s.replace(/[\r\n]/g,"").replace(/<(\/p|br\s*\/?)>/g,"\n").replace(/<!--.*?-->/g,"").replace(/<[^>]+>/g,""))},0)}f.onInit.add(function(){if(b.isOpera){return}if(/Firefox\/2/.test(navigator.userAgent)){a.add(f.getDoc(),"keydown",function(j){if(((j.metaKey||j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){if(b.isIE){g=f.selection.getRng().getBookmark()}e(j)}},this)}else{a.add(b.isIE?f.getBody():f.getDoc(),"paste",function(j){var k;if(f.getWin().clipboardData){h(f.getWin().clipboardData.getData("Text"));return a.cancel(j)}if(j.clipboardData){h(j.clipboardData.getData("text/plain"));return a.cancel(j)}e(j)})}})}})(punymce);
|