tinymce-rails 3.4.6 → 3.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/assets/precompiled/tinymce/plugins/emotions/emotions.htm +18 -17
- data/assets/precompiled/tinymce/plugins/emotions/js/emotions.js +21 -0
- data/assets/precompiled/tinymce/plugins/emotions/langs/en_dlg.js +1 -1
- data/assets/precompiled/tinymce/plugins/lists/editor_plugin.js +1 -1
- data/assets/precompiled/tinymce/plugins/lists/editor_plugin_src.js +198 -54
- data/assets/precompiled/tinymce/plugins/media/js/media.js +27 -16
- data/assets/precompiled/tinymce/plugins/media/langs/en_dlg.js +1 -1
- data/assets/precompiled/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/assets/precompiled/tinymce/plugins/table/editor_plugin.js +1 -1
- data/assets/precompiled/tinymce/plugins/table/editor_plugin_src.js +90 -46
- data/assets/precompiled/tinymce/plugins/table/js/table.js +44 -10
- data/assets/precompiled/tinymce/plugins/table/table.htm +1 -1
- data/assets/precompiled/tinymce/themes/advanced/charmap.htm +5 -1
- data/assets/precompiled/tinymce/themes/advanced/editor_template.js +1 -1
- data/assets/precompiled/tinymce/themes/advanced/editor_template_src.js +6 -2
- data/assets/precompiled/tinymce/themes/advanced/js/charmap.js +11 -3
- data/assets/precompiled/tinymce/themes/advanced/js/color_picker.js +4 -4
- data/assets/precompiled/tinymce/themes/advanced/langs/en_dlg.js +1 -1
- data/assets/precompiled/tinymce/tiny_mce.js +1 -1
- data/assets/precompiled/tinymce/tiny_mce_jquery.js +1 -1
- data/assets/precompiled/tinymce/tiny_mce_jquery_src.js +544 -295
- data/assets/precompiled/tinymce/tiny_mce_src.js +544 -295
- data/assets/vendor/tinymce/tiny_mce.js +544 -295
- data/assets/vendor/tinymce/tiny_mce_jquery.js +544 -295
- data/lib/tinymce/railtie.rb +2 -2
- data/lib/tinymce/version.rb +2 -2
- metadata +5 -5
@@ -10,32 +10,33 @@
|
|
10
10
|
<div align="center">
|
11
11
|
<div class="title">{#emotions_dlg.title}:<br /><br /></div>
|
12
12
|
|
13
|
-
<table role="presentation" border="0" cellspacing="0" cellpadding="4">
|
13
|
+
<table id="emoticon_table" role="presentation" border="0" cellspacing="0" cellpadding="4">
|
14
14
|
<tr>
|
15
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}
|
16
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}
|
17
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}
|
18
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}
|
15
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.cool}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}. {#emotions_dlg.usage}" /></a></td>
|
16
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.cry}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}. {#emotions_dlg.usage}" /></a></td>
|
17
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" /></a></td>
|
18
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" /></a></td>
|
19
19
|
</tr>
|
20
20
|
<tr>
|
21
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}
|
22
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}
|
23
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}
|
24
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}
|
21
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.frown}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}. {#emotions_dlg.usage}" /></a></td>
|
22
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" /></a></td>
|
23
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" /></a></td>
|
24
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" /></a></td>
|
25
25
|
</tr>
|
26
26
|
<tr>
|
27
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}
|
28
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}
|
29
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}
|
30
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}
|
27
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}"/></a></td>
|
28
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" /></a></td>
|
29
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.smile}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}. {#emotions_dlg.usage}" /></a></td>
|
30
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" /></a></td>
|
31
31
|
</tr>
|
32
32
|
<tr>
|
33
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}
|
34
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}
|
35
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}
|
36
|
-
<td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}
|
33
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.tongue-out}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}. {#emotions_dlg.usage}" /></a></td>
|
34
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" /></a></td>
|
35
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.wink}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}. {#emotions_dlg.usage}" /></a></td>
|
36
|
+
<td><a class="emoticon_link" role="button" title="{#emotions_dlg.yell}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}. {#emotions_dlg.usage}" /></a></td>
|
37
37
|
</tr>
|
38
38
|
</table>
|
39
|
+
<div>{#emotions_dlg.usage}</div>
|
39
40
|
</div>
|
40
41
|
</body>
|
41
42
|
</html>
|
@@ -1,8 +1,29 @@
|
|
1
1
|
tinyMCEPopup.requireLangPack();
|
2
2
|
|
3
3
|
var EmotionsDialog = {
|
4
|
+
addKeyboardNavigation: function(){
|
5
|
+
var tableElm, cells, settings;
|
6
|
+
|
7
|
+
cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");
|
8
|
+
|
9
|
+
settings ={
|
10
|
+
root: "emoticon_table",
|
11
|
+
items: cells
|
12
|
+
};
|
13
|
+
cells[0].tabindex=0;
|
14
|
+
tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
|
15
|
+
if (tinymce.isGecko) {
|
16
|
+
cells[0].focus();
|
17
|
+
} else {
|
18
|
+
setTimeout(function(){
|
19
|
+
cells[0].focus();
|
20
|
+
}, 100);
|
21
|
+
}
|
22
|
+
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
|
23
|
+
},
|
4
24
|
init : function(ed) {
|
5
25
|
tinyMCEPopup.resizeToInnerSize();
|
26
|
+
this.addKeyboardNavigation();
|
6
27
|
},
|
7
28
|
|
8
29
|
insert : function(file, title) {
|
@@ -1 +1 @@
|
|
1
|
-
tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"});
|
1
|
+
tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",usage:"Use left and right arrows to navigate.",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"});
|
@@ -1 +1 @@
|
|
1
|
-
(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{if(v&&u.tagName==="P"&&t.tagName==="P"){return true}else{return false}}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(A,y){var w=0;var t=1;var H=2;var J=3;var z=J;function C(M){return M.keyCode===9&&(A.queryCommandState("InsertUnorderedList")||A.queryCommandState("InsertOrderedList"))}function x(){var M=B();var O=M.parentNode.parentNode;var N=M.parentNode.lastChild===M;return N&&!u(O)&&K(M)}function u(M){if(n(M)){return M.parentNode&&M.parentNode.tagName==="LI"}else{return M.tagName==="LI"}}function D(){return A.selection.isCollapsed()&&K(B())}function B(){var M=A.selection.getStart();return((M.tagName=="BR"||M.tagName=="")&&M.parentNode.tagName=="LI")?M.parentNode:M}function K(M){var N=M.childNodes.length;if(M.tagName==="LI"){return N==0?true:N==1&&(M.firstChild.tagName==""||F(M)||G(M))}return false}function F(M){return tinymce.isWebKit&&M.firstChild.nodeName=="BR"}function G(M){var N=tinymce.grep(M.parentNode.childNodes,function(Q){return Q.nodeName=="LI"});var O=M==N[N.length-1];var P=M.firstChild;return tinymce.isIE9&&O&&(P.nodeValue==String.fromCharCode(160)||P.nodeValue==String.fromCharCode(32))}function L(M){return M.keyCode===13}function I(M){if(C(M)){return w}else{if(L(M)&&x()){return H}else{if(L(M)&&D()){return t}else{return J}}}}function s(M,N){if(z==w||z==t){return r.cancel(N)}}function v(P,R){var U;if(!tinymce.isGecko){return}var N=P.selection.getStart();if(R.keyCode!=8||N.tagName!=="IMG"){return}function O(Y){var Z=Y.firstChild;var X=null;do{if(!Z){break}if(Z.tagName==="LI"){X=Z}}while(Z=Z.nextSibling);return X}function W(Y,X){while(Y.childNodes.length>0){X.appendChild(Y.childNodes[0])}}U=N.parentNode.previousSibling;if(!U){return}var S;if(U.tagName==="UL"||U.tagName==="OL"){S=U}else{if(U.previousSibling&&(U.previousSibling.tagName==="UL"||U.previousSibling.tagName==="OL")){S=U.previousSibling}else{return}}var V=O(S);var M=P.dom.createRng();M.setStart(V,1);M.setEnd(V,1);P.selection.setRng(M);P.selection.collapse(true);var Q=P.selection.getBookmark();var T=N.parentNode.cloneNode(true);if(T.tagName==="P"||T.tagName==="DIV"){W(T,V)}else{V.appendChild(T)}N.parentNode.parentNode.removeChild(N.parentNode);P.selection.moveToBookmark(Q)}function E(M){var N=A.dom.getParent(M,"ol,ul");if(N!=null){var O=N.lastChild;O.appendChild(A.getDoc().createElement(""));A.selection.setCursorLocation(O,0)}}this.ed=A;A.addCommand("Indent",this.indent,this);A.addCommand("Outdent",this.outdent,this);A.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);A.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);A.onInit.add(function(){A.editorCommands.addCommands({outdent:function(){var N=A.selection,O=A.dom;function M(P){P=O.getParent(P,O.isBlock);return P&&(parseInt(A.dom.getStyle(P,"margin-left")||0,10)+parseInt(A.dom.getStyle(P,"padding-left")||0,10))>0}return M(N.getStart())||M(N.getEnd())||A.queryCommandState("InsertOrderedList")||A.queryCommandState("InsertUnorderedList")}},"state")});A.onKeyUp.add(function(N,O){if(z==w){N.execCommand(O.shiftKey?"Outdent":"Indent",true,null);z=J;return r.cancel(O)}else{if(z==t){var M=B();var Q=N.settings.list_outdent_on_enter===true||O.shiftKey;N.execCommand(Q?"Outdent":"Indent",true,null);if(tinymce.isIE){E(M)}return r.cancel(O)}else{if(z==H){if(tinymce.isIE8){var P=N.getDoc().createTextNode("\uFEFF");N.selection.getNode().appendChild(P)}else{if(tinymce.isIE9){N.execCommand("Outdent");return r.cancel(O)}}}}}});A.onKeyDown.add(function(M,N){z=I(N)});A.onKeyDown.add(s);A.onKeyDown.add(v);A.onKeyPress.add(s)},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O,Q){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(M.tagName==="P"||G.length>1){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true);return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(Q,L,O){var t,P=Q,N,M;while(!I.isBlock(Q.parentNode)&&Q.parentNode!==I.getRoot()){Q=I.split(Q.parentNode,Q.previousSibling);Q=Q.nextSibling;P=Q}if(O){t=O.cloneNode(true);Q.parentNode.insertBefore(t,Q);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");Q.parentNode.insertBefore(t,Q)}while(P&&P!=L){N=P.nextSibling;t.appendChild(P);P=N}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(V){var U;if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(P(N,V)){I.addClass(V,"_mce_tagged_br");N=S(V)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D}}else{B={defaultAction:x}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true)})},outdent:function(){var v=this,u=v.ed,w=u.dom,s=[];function x(t){var z,y,A;if(!d(u,t,s)){if(w.getStyle(t,"margin-left")!==""||w.getStyle(t,"padding-left")!==""){return v.adjustPaddingFunction(false)(t)}A=w.getStyle(t,"text-align",true);if(A==="center"||A==="right"){w.setStyle(t,"text-align","left");return}t=c(t,w);z=t.parentNode;y=t.parentNode.parentNode;if(y.tagName==="P"){w.split(y,t.parentNode)}else{w.split(z,t);if(y.tagName==="LI"){w.split(y,t)}else{if(!w.is(y,"ol,ul")){w.rename(t,"p")}}}s.push(t)}}this.process({LI:x,defaultAction:this.adjustPaddingFunction(false)});e(s,m)},process:function(y){var D=this,w=D.ed.selection,z=D.ed.dom,C,u;function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){D.splitSafeEach(s.childNodes,x)}function B(s,t){return t>=0&&s.hasChildNodes()&&t<s.childNodes.length&&s.childNodes[t].tagName==="BR"}C=w.getSelectedBlocks();if(C.length===0){C=[z.getRoot()]}u=w.getRng(true);if(!u.collapsed){if(B(u.endContainer,u.endOffset-1)){u.setEnd(u.endContainer,u.endOffset-1);w.setRng(u)}if(B(u.startContainer,u.startOffset)){u.setStart(u.startContainer,u.startOffset+1);w.setRng(u)}}if(tinymce.isIE8){var E=D.ed.selection.getNode();if(E.tagName==="LI"&&!(E.parentNode.lastChild===E)){var A=D.ed.getDoc().createTextNode("\uFEFF");E.appendChild(A)}}g=w.getBookmark();y.OL=y.UL=v;D.splitSafeEach(C,x);w.moveToBookmark(g);g=null;D.ed.execCommand("mceRepaint")},splitSafeEach:function(t,s){if(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent))){this.classBasedEach(t,s)}else{e(t,s)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}());
|
1
|
+
(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{return v&&u.tagName==="P"&&t.tagName==="P"}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(y){var v="TABBING";var s="EMPTY";var I="ESCAPE";var z="PARAGRAPH";var M="UNKNOWN";var x=M;function E(T){return T.keyCode===tinymce.VK.TAB&&!(T.altKey||T.ctrlKey)&&(y.queryCommandState("InsertUnorderedList")||y.queryCommandState("InsertOrderedList"))}function D(){var T=y.selection.getRng();var U=T.startContainer;if(U.nodeType==3){return(T.endOffset==U.nodeValue.length)}else{if(U.nodeType==1){return T.endOffset==U.childNodes.length}}return false}function N(){var U=y.selection.getNode();var T=U.tagName==="P"&&U.parentNode.tagName==="LI"&&U.parentNode.lastChild===U;return y.selection.isCollapsed()&&T&&D()}function w(){var T=B();var V=T.parentNode.parentNode;var U=T.parentNode.lastChild===T;return U&&!t(V)&&O(T)}function t(T){if(n(T)){return T.parentNode&&T.parentNode.tagName==="LI"}else{return T.tagName==="LI"}}function F(){return y.selection.isCollapsed()&&O(B())}function B(){var T=y.selection.getStart();return((T.tagName=="BR"||T.tagName=="")&&T.parentNode.tagName=="LI")?T.parentNode:T}function O(T){var U=T.childNodes.length;if(T.tagName==="LI"){return U==0?true:U==1&&(T.firstChild.tagName==""||T.firstChild.tagName=="BR"||H(T))}return false}function H(T){var U=tinymce.grep(T.parentNode.childNodes,function(X){return X.tagName=="LI"});var V=T==U[U.length-1];var W=T.firstChild;return tinymce.isIE9&&V&&(W.nodeValue==String.fromCharCode(160)||W.nodeValue==String.fromCharCode(32))}function S(T){return T.keyCode===tinymce.VK.ENTER}function A(T){return S(T)&&!T.shiftKey}function L(T){if(E(T)){return v}else{if(A(T)&&w()){return I}else{if(A(T)&&F()){return s}else{if(A(T)&&N()){return z}else{return M}}}}}function C(T,U){if(x==v||x==s||tinymce.isGecko&&x==I){r.cancel(U)}}function J(V,X){if(x==z){var W=V.selection.getNode();var U=V.dom.create("li");var T=V.dom.getParent(W,"li");V.dom.insertAfter(U,T);if(tinyMCE.isIE8){U.appendChild(V.dom.create(" "));V.selection.setCursorLocation(U,1)}else{if(tinyMCE.isGecko){setTimeout(function(){var Y=V.getDoc().createTextNode("\uFEFF");U.appendChild(Y);V.selection.setCursorLocation(U,0)},0)}else{V.selection.setCursorLocation(U,0)}}r.cancel(X)}}function u(W,Y){var ab;if(!tinymce.isGecko){return}var U=W.selection.getStart();if(Y.keyCode!=tinymce.VK.BACKSPACE||U.tagName!=="IMG"){return}function V(af){var ag=af.firstChild;var ae=null;do{if(!ag){break}if(ag.tagName==="LI"){ae=ag}}while(ag=ag.nextSibling);return ae}function ad(af,ae){while(af.childNodes.length>0){ae.appendChild(af.childNodes[0])}}ab=U.parentNode.previousSibling;if(!ab){return}var Z;if(ab.tagName==="UL"||ab.tagName==="OL"){Z=ab}else{if(ab.previousSibling&&(ab.previousSibling.tagName==="UL"||ab.previousSibling.tagName==="OL")){Z=ab.previousSibling}else{return}}var ac=V(Z);var T=W.dom.createRng();T.setStart(ac,1);T.setEnd(ac,1);W.selection.setRng(T);W.selection.collapse(true);var X=W.selection.getBookmark();var aa=U.parentNode.cloneNode(true);if(aa.tagName==="P"||aa.tagName==="DIV"){ad(aa,ac)}else{ac.appendChild(aa)}U.parentNode.parentNode.removeChild(U.parentNode);W.selection.moveToBookmark(X)}function G(T){var U=y.dom.getParent(T,"ol,ul");if(U!=null){var V=U.lastChild;V.appendChild(y.getDoc().createElement(""));y.selection.setCursorLocation(V,0)}}this.ed=y;y.addCommand("Indent",this.indent,this);y.addCommand("Outdent",this.outdent,this);y.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);y.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);y.onInit.add(function(){y.editorCommands.addCommands({outdent:function(){var U=y.selection,V=y.dom;function T(W){W=V.getParent(W,V.isBlock);return W&&(parseInt(y.dom.getStyle(W,"margin-left")||0,10)+parseInt(y.dom.getStyle(W,"padding-left")||0,10))>0}return T(U.getStart())||T(U.getEnd())||y.queryCommandState("InsertOrderedList")||y.queryCommandState("InsertUnorderedList")}},"state")});y.onKeyUp.add(function(U,V){if(x==v){U.execCommand(V.shiftKey?"Outdent":"Indent",true,null);x=M;return r.cancel(V)}else{if(x==s){var T=B();var X=U.settings.list_outdent_on_enter===true||V.shiftKey;U.execCommand(X?"Outdent":"Indent",true,null);if(tinymce.isIE){G(T)}return r.cancel(V)}else{if(x==I){if(tinymce.isIE8){var W=U.getDoc().createTextNode("\uFEFF");U.selection.getNode().appendChild(W)}else{if(tinymce.isIE9||tinymce.isGecko){U.execCommand("Outdent");return r.cancel(V)}}}}}});function K(U,T){var V=y.getDoc().createTextNode("\uFEFF");U.insertBefore(V,T);y.selection.setCursorLocation(V,0);y.execCommand("mceRepaint")}function Q(U,W){if(S(W)){var T=B();if(T){var V=T.parentNode;var X=V&&V.parentNode;if(X&&X.nodeName=="LI"&&X.firstChild==V&&T==V.firstChild){K(X,V)}}}}function R(U,W){if(S(W)){var T=B();if(U.dom.select("ul li",T).length===1){var V=T.firstChild;K(T,V)}}}function P(U,Y){function V(ac,Z){var ab=[];var ad=new tinymce.dom.TreeWalker(Z,ac);for(var aa=ad.current();aa;aa=ad.next()){if(U.dom.is(aa,"ol,ul,li")){ab.push(aa)}}return ab}if(Y.keyCode==tinymce.VK.BACKSPACE){var T=B();if(T){var X=U.dom.getParent(T,"ol,ul");if(X&&X.firstChild===T){var W=V(X,T);U.execCommand("Outdent",false,W);U.undoManager.add();return r.cancel(Y)}}}}y.onKeyDown.add(function(T,U){x=L(U)});y.onKeyDown.add(C);y.onKeyDown.add(u);y.onKeyDown.add(J);if(tinymce.isGecko){y.onKeyUp.add(Q)}if(tinymce.isIE8){y.onKeyUp.add(R)}if(tinymce.isGecko||tinymce.isWebKit){y.onKeyDown.add(P)}},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(t){if(t.tagName==="LI"&&(M.tagName==="P"||G.length>1)){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true)}return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(P,L,N){var t,O=P,M;while(!I.isBlock(P.parentNode)&&P.parentNode!==I.getRoot()){P=I.split(P.parentNode,P.previousSibling);P=P.nextSibling;O=P}if(N){t=N.cloneNode(true);P.parentNode.insertBefore(t,P);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");P.parentNode.insertBefore(t,P)}while(O&&O!=L){M=O.nextSibling;t.appendChild(O);O=M}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(U){if(U.hasAttribute&&U.hasAttribute("_mce_bogus")){return true}if(P(N,U)){I.addClass(U,"_mce_tagged_br");N=S(U)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w&&!H||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D,elements:this.selectedBlocks()}}else{B={defaultAction:x,elements:this.selectedBlocks()}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true),elements:this.selectedBlocks()})},outdent:function(y,x){var w=this,u=w.ed,z=u.dom,s=[];function A(t){var C,B,D;if(!d(u,t,s)){if(z.getStyle(t,"margin-left")!==""||z.getStyle(t,"padding-left")!==""){return w.adjustPaddingFunction(false)(t)}D=z.getStyle(t,"text-align",true);if(D==="center"||D==="right"){z.setStyle(t,"text-align","left");return}t=c(t,z);C=t.parentNode;B=t.parentNode.parentNode;if(B.tagName==="P"){z.split(B,t.parentNode)}else{z.split(C,t);if(B.tagName==="LI"){z.split(B,t)}else{if(!z.is(B,"ol,ul")){z.rename(t,"p")}}}s.push(t)}}var v=x&&tinymce.is(x,"array")?x:this.selectedBlocks();this.process({LI:A,defaultAction:this.adjustPaddingFunction(false),elements:v});e(s,m)},process:function(y){var F=this,w=F.ed.selection,z=F.ed.dom,E,u;function B(t){var s=tinymce.grep(t.childNodes,function(H){return !(H.nodeName==="BR"||H.nodeName==="SPAN"&&z.getAttrib(H,"data-mce-type")=="bookmark"||H.nodeType==3&&(H.nodeValue==String.fromCharCode(160)||H.nodeValue==""))});return s.length===0}function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1||E.length>1&&B(s)){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){F.splitSafeEach(s.childNodes,x)}function C(s,t){return t>=0&&s.hasChildNodes()&&t<s.childNodes.length&&s.childNodes[t].tagName==="BR"}function D(){var t=w.getNode();var s=z.getParent(t,"td");return s!==null}E=y.elements;u=w.getRng(true);if(!u.collapsed){if(C(u.endContainer,u.endOffset-1)){u.setEnd(u.endContainer,u.endOffset-1);w.setRng(u)}if(C(u.startContainer,u.startOffset)){u.setStart(u.startContainer,u.startOffset+1);w.setRng(u)}}if(tinymce.isIE8){var G=F.ed.selection.getNode();if(G.tagName==="LI"&&!(G.parentNode.lastChild===G)){var A=F.ed.getDoc().createTextNode("\uFEFF");G.appendChild(A)}}g=w.getBookmark();y.OL=y.UL=v;F.splitSafeEach(E,x);w.moveToBookmark(g);g=null;if(!D()){F.ed.execCommand("mceRepaint")}},splitSafeEach:function(t,s){if(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent))){this.classBasedEach(t,s)}else{e(t,s)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},selectedBlocks:function(){var s=this.ed;var t=s.selection.getSelectedBlocks();return t.length==0?[s.dom.getRoot()]:t},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}());
|
@@ -99,11 +99,7 @@
|
|
99
99
|
return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
|
100
100
|
} else if (isList(e1)) {
|
101
101
|
return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
|
102
|
-
} else
|
103
|
-
return true;
|
104
|
-
} else {
|
105
|
-
return false;
|
106
|
-
}
|
102
|
+
} else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P';
|
107
103
|
}
|
108
104
|
|
109
105
|
function isListForIndent(e) {
|
@@ -144,15 +140,36 @@
|
|
144
140
|
}
|
145
141
|
|
146
142
|
tinymce.create('tinymce.plugins.Lists', {
|
147
|
-
init: function(ed
|
148
|
-
var LIST_TABBING =
|
149
|
-
var LIST_EMPTY_ITEM =
|
150
|
-
var LIST_ESCAPE =
|
151
|
-
var
|
143
|
+
init: function(ed) {
|
144
|
+
var LIST_TABBING = 'TABBING';
|
145
|
+
var LIST_EMPTY_ITEM = 'EMPTY';
|
146
|
+
var LIST_ESCAPE = 'ESCAPE';
|
147
|
+
var LIST_PARAGRAPH = 'PARAGRAPH';
|
148
|
+
var LIST_UNKNOWN = 'UNKNOWN';
|
152
149
|
var state = LIST_UNKNOWN;
|
153
150
|
|
154
151
|
function isTabInList(e) {
|
155
|
-
|
152
|
+
// Don't indent on Ctrl+Tab or Alt+Tab
|
153
|
+
return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&
|
154
|
+
(ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
|
155
|
+
}
|
156
|
+
|
157
|
+
function isCursorAtEndOfContainer() {
|
158
|
+
var range = ed.selection.getRng();
|
159
|
+
var startContainer = range.startContainer;
|
160
|
+
if (startContainer.nodeType == 3) {
|
161
|
+
return (range.endOffset == startContainer.nodeValue.length);
|
162
|
+
} else if (startContainer.nodeType == 1) {
|
163
|
+
return range.endOffset == startContainer.childNodes.length;
|
164
|
+
}
|
165
|
+
return false;
|
166
|
+
}
|
167
|
+
|
168
|
+
// If we are at the end of a paragraph in a list item, pressing enter should create a new list item instead of a new paragraph.
|
169
|
+
function isEndOfParagraph() {
|
170
|
+
var node = ed.selection.getNode();
|
171
|
+
var isLastParagraphOfLi = node.tagName === 'P' && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;
|
172
|
+
return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();
|
156
173
|
}
|
157
174
|
|
158
175
|
function isOnLastListItem() {
|
@@ -183,45 +200,73 @@
|
|
183
200
|
function isEmptyListItem(li) {
|
184
201
|
var numChildren = li.childNodes.length;
|
185
202
|
if (li.tagName === 'LI') {
|
186
|
-
return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' ||
|
203
|
+
return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li));
|
187
204
|
}
|
188
205
|
return false;
|
189
206
|
}
|
190
207
|
|
191
|
-
function isEmptyWebKitLi(li) {
|
192
|
-
// Check for empty LI or a LI with just a child that is a BR since Gecko and WebKit uses BR elements to place the caret
|
193
|
-
return tinymce.isWebKit && li.firstChild.nodeName == 'BR';
|
194
|
-
}
|
195
|
-
|
196
208
|
function isEmptyIE9Li(li) {
|
197
209
|
// only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these
|
198
|
-
var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.
|
210
|
+
var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'});
|
199
211
|
var isLastLi = li == lis[lis.length - 1];
|
200
212
|
var child = li.firstChild;
|
201
213
|
return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));
|
202
214
|
}
|
203
215
|
|
204
216
|
function isEnter(e) {
|
205
|
-
return e.keyCode ===
|
206
|
-
|
217
|
+
return e.keyCode === tinymce.VK.ENTER;
|
218
|
+
}
|
219
|
+
|
220
|
+
function isEnterWithoutShift(e) {
|
221
|
+
return isEnter(e) && !e.shiftKey;
|
222
|
+
}
|
207
223
|
|
208
224
|
function getListKeyState(e) {
|
209
225
|
if (isTabInList(e)) {
|
210
226
|
return LIST_TABBING;
|
211
|
-
} else if (
|
227
|
+
} else if (isEnterWithoutShift(e) && isOnLastListItem()) {
|
212
228
|
return LIST_ESCAPE;
|
213
|
-
} else if (
|
229
|
+
} else if (isEnterWithoutShift(e) && isInEmptyListItem()) {
|
214
230
|
return LIST_EMPTY_ITEM;
|
215
|
-
} else {
|
231
|
+
} else if (isEnterWithoutShift(e) && isEndOfParagraph()) {
|
232
|
+
return LIST_PARAGRAPH;
|
233
|
+
} else {
|
216
234
|
return LIST_UNKNOWN;
|
217
235
|
}
|
218
236
|
}
|
219
237
|
|
220
|
-
function
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
238
|
+
function cancelDefaultEvents(ed, e) {
|
239
|
+
// list escape is done manually using outdent as it does not create paragraphs correctly in td's
|
240
|
+
if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) {
|
241
|
+
Event.cancel(e);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
// Creates a new list item after the current selection's list item parent
|
246
|
+
function createNewLi(ed, e) {
|
247
|
+
if (state == LIST_PARAGRAPH) {
|
248
|
+
var node = ed.selection.getNode();
|
249
|
+
var li = ed.dom.create("li");
|
250
|
+
var parentLi = ed.dom.getParent(node, 'li');
|
251
|
+
ed.dom.insertAfter(li, parentLi);
|
252
|
+
|
253
|
+
// Move caret to new list element.
|
254
|
+
if (tinyMCE.isIE8) {
|
255
|
+
li.appendChild(ed.dom.create(" ")); // IE needs an element within the bullet point
|
256
|
+
ed.selection.setCursorLocation(li, 1);
|
257
|
+
} else if (tinyMCE.isGecko) {
|
258
|
+
// This setTimeout is a hack as FF behaves badly if there is no content after the bullet point
|
259
|
+
setTimeout(function () {
|
260
|
+
var n = ed.getDoc().createTextNode('\uFEFF');
|
261
|
+
li.appendChild(n);
|
262
|
+
ed.selection.setCursorLocation(li, 0);
|
263
|
+
}, 0);
|
264
|
+
} else {
|
265
|
+
ed.selection.setCursorLocation(li, 0);
|
266
|
+
}
|
267
|
+
Event.cancel(e);
|
268
|
+
}
|
269
|
+
}
|
225
270
|
|
226
271
|
function imageJoiningListItem(ed, e) {
|
227
272
|
var prevSibling;
|
@@ -230,7 +275,7 @@
|
|
230
275
|
return;
|
231
276
|
|
232
277
|
var n = ed.selection.getStart();
|
233
|
-
if (e.keyCode !=
|
278
|
+
if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG')
|
234
279
|
return;
|
235
280
|
|
236
281
|
function lastLI(node) {
|
@@ -329,8 +374,8 @@
|
|
329
374
|
ed.onKeyUp.add(function(ed, e) {
|
330
375
|
if (state == LIST_TABBING) {
|
331
376
|
ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
|
332
|
-
|
333
|
-
|
377
|
+
state = LIST_UNKNOWN;
|
378
|
+
return Event.cancel(e);
|
334
379
|
} else if (state == LIST_EMPTY_ITEM) {
|
335
380
|
var li = getLi();
|
336
381
|
var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey;
|
@@ -338,6 +383,7 @@
|
|
338
383
|
if (tinymce.isIE) {
|
339
384
|
setCursorPositionToOriginalLi(li);
|
340
385
|
}
|
386
|
+
|
341
387
|
return Event.cancel(e);
|
342
388
|
} else if (state == LIST_ESCAPE) {
|
343
389
|
if (tinymce.isIE8) {
|
@@ -346,17 +392,88 @@
|
|
346
392
|
// escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
|
347
393
|
var n = ed.getDoc().createTextNode('\uFEFF');
|
348
394
|
ed.selection.getNode().appendChild(n);
|
349
|
-
} else if (tinymce.isIE9) {
|
395
|
+
} else if (tinymce.isIE9 || tinymce.isGecko) {
|
350
396
|
// IE9 does not escape the list so we use outdent to do this and cancel the default behaviour
|
397
|
+
// Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves
|
351
398
|
ed.execCommand('Outdent');
|
352
399
|
return Event.cancel(e);
|
353
|
-
|
400
|
+
}
|
354
401
|
}
|
355
402
|
});
|
403
|
+
|
404
|
+
function fixListItem(parent, reference) {
|
405
|
+
// a zero-sized non-breaking space is placed in the empty list item so that the nested list is
|
406
|
+
// displayed on the below line instead of next to it
|
407
|
+
var n = ed.getDoc().createTextNode('\uFEFF');
|
408
|
+
parent.insertBefore(n, reference);
|
409
|
+
ed.selection.setCursorLocation(n, 0);
|
410
|
+
// repaint to remove rendering artifact. only visible when creating new list
|
411
|
+
ed.execCommand('mceRepaint');
|
412
|
+
}
|
413
|
+
|
414
|
+
function fixIndentedListItemForGecko(ed, e) {
|
415
|
+
if (isEnter(e)) {
|
416
|
+
var li = getLi();
|
417
|
+
if (li) {
|
418
|
+
var parent = li.parentNode;
|
419
|
+
var grandParent = parent && parent.parentNode;
|
420
|
+
if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) {
|
421
|
+
fixListItem(grandParent, parent);
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
|
427
|
+
function fixIndentedListItemForIE8(ed, e) {
|
428
|
+
if (isEnter(e)) {
|
429
|
+
var li = getLi();
|
430
|
+
if (ed.dom.select('ul li', li).length === 1) {
|
431
|
+
var list = li.firstChild;
|
432
|
+
fixListItem(li, list);
|
433
|
+
}
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
function fixDeletingFirstCharOfList(ed, e) {
|
438
|
+
function listElements(list, li) {
|
439
|
+
var elements = [];
|
440
|
+
var walker = new tinymce.dom.TreeWalker(li, list);
|
441
|
+
for (var node = walker.current(); node; node = walker.next()) {
|
442
|
+
if (ed.dom.is(node, 'ol,ul,li')) {
|
443
|
+
elements.push(node);
|
444
|
+
}
|
445
|
+
}
|
446
|
+
return elements;
|
447
|
+
}
|
448
|
+
|
449
|
+
if (e.keyCode == tinymce.VK.BACKSPACE) {
|
450
|
+
var li = getLi();
|
451
|
+
if (li) {
|
452
|
+
var list = ed.dom.getParent(li, 'ol,ul');
|
453
|
+
if (list && list.firstChild === li) {
|
454
|
+
var elements = listElements(list, li);
|
455
|
+
ed.execCommand("Outdent", false, elements);
|
456
|
+
ed.undoManager.add();
|
457
|
+
return Event.cancel(e);
|
458
|
+
}
|
459
|
+
}
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
356
463
|
ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
|
357
|
-
ed.onKeyDown.add(
|
464
|
+
ed.onKeyDown.add(cancelDefaultEvents);
|
358
465
|
ed.onKeyDown.add(imageJoiningListItem);
|
359
|
-
|
466
|
+
ed.onKeyDown.add(createNewLi);
|
467
|
+
|
468
|
+
if (tinymce.isGecko) {
|
469
|
+
ed.onKeyUp.add(fixIndentedListItemForGecko);
|
470
|
+
}
|
471
|
+
if (tinymce.isIE8) {
|
472
|
+
ed.onKeyUp.add(fixIndentedListItemForIE8);
|
473
|
+
}
|
474
|
+
if (tinymce.isGecko || tinymce.isWebKit) {
|
475
|
+
ed.onKeyDown.add(fixDeletingFirstCharOfList);
|
476
|
+
}
|
360
477
|
},
|
361
478
|
|
362
479
|
applyList: function(targetListType, oppositeListType) {
|
@@ -382,16 +499,18 @@
|
|
382
499
|
if (element.tagName === 'LI') {
|
383
500
|
// No change required.
|
384
501
|
} else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
|
385
|
-
processBrs(element, function(startSection, br
|
502
|
+
processBrs(element, function(startSection, br) {
|
386
503
|
doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
|
387
504
|
li = startSection.parentNode;
|
388
505
|
adjustIndentForNewList(li);
|
389
506
|
cleanupBr(br);
|
390
507
|
});
|
391
|
-
if (
|
392
|
-
|
508
|
+
if (li) {
|
509
|
+
if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) {
|
510
|
+
dom.split(li.parentNode.parentNode, li.parentNode);
|
511
|
+
}
|
512
|
+
attemptMergeWithAdjacent(li.parentNode, true);
|
393
513
|
}
|
394
|
-
attemptMergeWithAdjacent(li.parentNode, true);
|
395
514
|
return;
|
396
515
|
} else {
|
397
516
|
// Put the list around the element.
|
@@ -408,7 +527,7 @@
|
|
408
527
|
}
|
409
528
|
|
410
529
|
function doWrapList(start, end, template) {
|
411
|
-
var li, n = start, tmp
|
530
|
+
var li, n = start, tmp;
|
412
531
|
while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
|
413
532
|
start = dom.split(start.parentNode, start.previousSibling);
|
414
533
|
start = start.nextSibling;
|
@@ -423,7 +542,7 @@
|
|
423
542
|
li = dom.create('li');
|
424
543
|
start.parentNode.insertBefore(li, start);
|
425
544
|
}
|
426
|
-
|
545
|
+
while (n && n != end) {
|
427
546
|
tmp = n.nextSibling;
|
428
547
|
li.appendChild(n);
|
429
548
|
n = tmp;
|
@@ -464,7 +583,6 @@
|
|
464
583
|
// First mark the BRs that have any part of the previous section selected.
|
465
584
|
var trailingContentSelected = false;
|
466
585
|
each(dom.select(breakElements, element), function(br) {
|
467
|
-
var b;
|
468
586
|
if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
|
469
587
|
return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
|
470
588
|
}
|
@@ -560,7 +678,7 @@
|
|
560
678
|
}
|
561
679
|
});
|
562
680
|
|
563
|
-
if (hasNonList || hasOppositeType || selectedBlocks.length === 0) {
|
681
|
+
if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) {
|
564
682
|
actions = {
|
565
683
|
'LI': changeList,
|
566
684
|
'H1': makeList,
|
@@ -572,11 +690,13 @@
|
|
572
690
|
'P': makeList,
|
573
691
|
'BODY': makeList,
|
574
692
|
'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
|
575
|
-
defaultAction: wrapList
|
693
|
+
defaultAction: wrapList,
|
694
|
+
elements: this.selectedBlocks()
|
576
695
|
};
|
577
696
|
} else {
|
578
697
|
actions = {
|
579
|
-
defaultAction: convertListItemToParagraph
|
698
|
+
defaultAction: convertListItemToParagraph,
|
699
|
+
elements: this.selectedBlocks()
|
580
700
|
};
|
581
701
|
}
|
582
702
|
this.process(actions);
|
@@ -619,12 +739,13 @@
|
|
619
739
|
|
620
740
|
this.process({
|
621
741
|
'LI': indentLI,
|
622
|
-
defaultAction: this.adjustPaddingFunction(true)
|
742
|
+
defaultAction: this.adjustPaddingFunction(true),
|
743
|
+
elements: this.selectedBlocks()
|
623
744
|
});
|
624
745
|
|
625
746
|
},
|
626
747
|
|
627
|
-
outdent: function() {
|
748
|
+
outdent: function(ui, elements) {
|
628
749
|
var t = this, ed = t.ed, dom = ed.dom, outdented = [];
|
629
750
|
|
630
751
|
function outdentLI(element) {
|
@@ -656,9 +777,11 @@
|
|
656
777
|
}
|
657
778
|
}
|
658
779
|
|
780
|
+
var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks();
|
659
781
|
this.process({
|
660
782
|
'LI': outdentLI,
|
661
|
-
defaultAction: this.adjustPaddingFunction(false)
|
783
|
+
defaultAction: this.adjustPaddingFunction(false),
|
784
|
+
elements: listElements
|
662
785
|
});
|
663
786
|
|
664
787
|
each(outdented, attemptMergeWithAdjacent);
|
@@ -667,9 +790,17 @@
|
|
667
790
|
process: function(actions) {
|
668
791
|
var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
|
669
792
|
|
793
|
+
function isEmptyElement(element) {
|
794
|
+
var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) {
|
795
|
+
return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark'
|
796
|
+
|| n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == ''));
|
797
|
+
});
|
798
|
+
return excludeBrsAndBookmarks.length === 0;
|
799
|
+
}
|
800
|
+
|
670
801
|
function processElement(element) {
|
671
802
|
dom.removeClass(element, '_mce_act_on');
|
672
|
-
if (!element || element.nodeType !== 1) {
|
803
|
+
if (!element || element.nodeType !== 1 || selectedBlocks.length > 1 && isEmptyElement(element)) {
|
673
804
|
return;
|
674
805
|
}
|
675
806
|
element = findItemToOperateOn(element, dom);
|
@@ -689,11 +820,14 @@
|
|
689
820
|
container.childNodes[offset].tagName === 'BR';
|
690
821
|
}
|
691
822
|
|
692
|
-
|
693
|
-
|
694
|
-
|
823
|
+
function isInTable() {
|
824
|
+
var n = sel.getNode();
|
825
|
+
var p = dom.getParent(n, 'td');
|
826
|
+
return p !== null;
|
695
827
|
}
|
696
828
|
|
829
|
+
selectedBlocks = actions.elements;
|
830
|
+
|
697
831
|
r = sel.getRng(true);
|
698
832
|
if (!r.collapsed) {
|
699
833
|
if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
|
@@ -721,8 +855,12 @@
|
|
721
855
|
t.splitSafeEach(selectedBlocks, processElement);
|
722
856
|
sel.moveToBookmark(bookmark);
|
723
857
|
bookmark = null;
|
724
|
-
|
725
|
-
|
858
|
+
|
859
|
+
// we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6
|
860
|
+
if (!isInTable()) {
|
861
|
+
// Avoids table or image handles being left behind in Firefox.
|
862
|
+
t.ed.execCommand('mceRepaint');
|
863
|
+
}
|
726
864
|
},
|
727
865
|
|
728
866
|
splitSafeEach: function(elements, f) {
|
@@ -767,6 +905,12 @@
|
|
767
905
|
};
|
768
906
|
},
|
769
907
|
|
908
|
+
selectedBlocks: function() {
|
909
|
+
var ed = this.ed
|
910
|
+
var selectedBlocks = ed.selection.getSelectedBlocks();
|
911
|
+
return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks;
|
912
|
+
},
|
913
|
+
|
770
914
|
getInfo: function() {
|
771
915
|
return {
|
772
916
|
longname : 'Lists',
|