|
1 define("tinymce/util/Quirks",["tinymce/util/VK","tinymce/dom/RangeUtils","tinymce/dom/TreeWalker","tinymce/html/Node","tinymce/html/Entities","tinymce/Env","tinymce/util/Tools"],function(f,e,d,c,g,a,b){return function(h){var ab=b.each,O=h.$;var k=f.BACKSPACE,w=f.DELETE,j=h.dom,y=h.selection,af=h.settings,N=h.parser,D=h.serializer;var m=a.gecko,u=a.ie,Y=a.webkit;var T="data:text/mce-internal,";var l=u?"Text":"URL";function S(al,ak){try{h.getDoc().execCommand(al,false,ak)}catch(aj){}}function B(){var aj=h.getDoc().documentMode;return aj?aj:6}function R(aj){return aj.isDefaultPrevented()}function I(ak){var aj;if(ak.dataTransfer){if(h.selection.isCollapsed()&&ak.target.tagName=="IMG"){y.select(ak.target)}aj=h.selection.getContent();if(aj.length>0){ak.dataTransfer.setData(l,T+escape(aj))}}}function C(ak){var al,aj;if(ak.dataTransfer){al=ak.dataTransfer.getData(l);if(al&&al.indexOf(T)>=0){aj=unescape(al.substr(T.length))}}return aj}function J(aj){if(h.queryCommandSupported("mceInsertClipboardContent")){h.execCommand("mceInsertClipboardContent",false,{content:aj})}else{h.execCommand("mceInsertContent",false,aj)}}function ah(){var av=h.getDoc(),ao=h.dom,aw=h.selection;var ak=window.MutationObserver,ap,au;if(!ak){ap=true;ak=function(){var ax=[],aA;function az(aC){var aB=aC.relatedNode||aC.target;ax.push({target:aB,addedNodes:[aB]})}function ay(aC){var aB=aC.relatedNode||aC.target;ax.push({target:aB,attributeName:aC.attrName})}this.observe=function(aB){aA=aB;aA.addEventListener("DOMSubtreeModified",az,false);aA.addEventListener("DOMNodeInsertedIntoDocument",az,false);aA.addEventListener("DOMNodeInserted",az,false);aA.addEventListener("DOMAttrModified",ay,false)};this.disconnect=function(){aA.removeEventListener("DOMSubtreeModified",az,false);aA.removeEventListener("DOMNodeInsertedIntoDocument",az,false);aA.removeEventListener("DOMNodeInserted",az,false);aA.removeEventListener("DOMAttrModified",ay,false)};this.takeRecords=function(){return ax}}}function aj(az){var ay=ao.schema.getBlockElements(),ax=h.getBody();if(az.nodeName!="BR"){return false}for(az=az;az!=ax&&!ay[az.nodeName];az=az.parentNode){if(az.nextSibling){return false}}return true}function al(ay,ax){var az;for(az=ay.nextSibling;az&&az!=ax;az=az.nextSibling){if(az.nodeType==3&&O.trim(az.data).length===0){continue}if(az!==ax){return false}}return az===ax}function aq(aA,az,ay){var aC,aB,ax;ax=ao.schema.getNonEmptyElements();aC=new d(ay||aA,aA);while((aB=aC[az?"next":"prev"]())){if(ax[aB.nodeName]&&!aj(aB)){return aB}if(aB.nodeType==3&&aB.data.length>0){return aB}}}function at(ay){var aB,az,ax,aA,aC;if(ay.collapsed){return}aB=ao.getParent(e.getNode(ay.startContainer,ay.startOffset),ao.isBlock);az=ao.getParent(e.getNode(ay.endContainer,ay.endOffset),ao.isBlock);aC=h.schema.getTextBlockElements();if(aB==az){return}if(!aC[aB.nodeName]||!aC[az.nodeName]){return}if(ao.getContentEditable(aB)==="false"||ao.getContentEditable(az)==="false"){return}ay.deleteContents();ax=aq(aB,false);aA=aq(az,true);if(!ao.isEmpty(az)){O(aB).append(az.childNodes)}O(az).remove();if(ax){if(ax.nodeType==1){if(ax.nodeName=="BR"){ay.setStartBefore(ax);ay.setEndBefore(ax)}else{ay.setStartAfter(ax);ay.setEndAfter(ax)}}else{ay.setStart(ax,ax.data.length);ay.setEnd(ax,ax.data.length)}}else{if(aA){if(aA.nodeType==1){ay.setStartBefore(aA);ay.setEndBefore(aA)}else{ay.setStart(aA,0);ay.setEnd(aA,0)}}}aw.setRng(ay);return true}function an(ay,aD){var aA,aC,az,aB,ax,aE;if(!ay.collapsed){return ay}ax=ay.startContainer;aE=ay.startOffset;if(ax.nodeType==3){if(aD){if(aE<ax.data.length){return ay}}else{if(aE>0){return ay}}}aA=e.getNode(ay.startContainer,ay.startOffset);az=ao.getParent(aA,ao.isBlock);aC=aq(h.getBody(),aD,aA);aB=ao.getParent(aC,ao.isBlock);if(!aA||!aC){return ay}if(aB&&az!=aB){if(!aD){if(!al(aB,az)){return ay}if(aC.nodeType==1){if(aC.nodeName=="BR"){ay.setStartBefore(aC)}else{ay.setStartAfter(aC)}}else{ay.setStart(aC,aC.data.length)}if(aA.nodeType==1){ay.setEnd(aA,0)}else{ay.setEndBefore(aA)}}else{if(!al(az,aB)){return ay}if(aA.nodeType==1){if(aA.nodeName=="BR"){ay.setStartBefore(aA)}else{ay.setStartAfter(aA)}}else{ay.setStart(aA,aA.data.length)}if(aC.nodeType==1){ay.setEnd(aC,0)}else{ay.setEndBefore(aC)}}}return ay}function am(ay){var ax=aw.getRng();ax=an(ax,ay);if(at(ax)){return true}}function ar(az){var ay,ax,aA;if(am(az)){return}b.each(h.getBody().getElementsByTagName("*"),function(aB){if(aB.tagName=="SPAN"){aB.setAttribute("mce-data-marked",1)}if(!aB.hasAttribute("data-mce-style")&&aB.hasAttribute("style")){h.dom.setAttrib(aB,"style",h.dom.getAttrib(aB,"style"))}});ay=new ak(function(){});ay.observe(h.getDoc(),{childList:true,attributes:true,subtree:true,attributeFilter:["style"]});h.getDoc().execCommand(az?"ForwardDelete":"Delete",false,null);ax=h.selection.getRng();aA=ax.startContainer.parentNode;b.each(ay.takeRecords(),function(aB){if(!ao.isChildOf(aB.target,h.getBody())){return}if(aB.attributeName=="style"){var aC=aB.target.getAttribute("data-mce-style");if(aC){aB.target.setAttribute("style",aC)}else{aB.target.removeAttribute("style")}}b.each(aB.addedNodes,function(aE){if(aE.nodeName=="SPAN"&&!aE.getAttribute("mce-data-marked")){var aF,aD;if(aE==aA){aF=ax.startOffset;aD=aE.firstChild}ao.remove(aE,true);if(aD){ax.setStart(aD,aF);ax.setEnd(aD,aF);h.selection.setRng(ax)}}})});ay.disconnect();b.each(h.dom.select("span[mce-data-marked]"),function(aB){aB.removeAttribute("mce-data-marked")})}h.on("keydown",function(aB){var aA=aB.keyCode==w,ax=aB.ctrlKey||aB.metaKey;if(!R(aB)&&(aA||aB.keyCode==k)){var az=h.selection.getRng(),ay=az.startContainer,aC=az.startOffset;if(!ax&&az.collapsed&&ay.nodeType==3){if(aA?aC<ay.data.length:aC>0){return}}aB.preventDefault();if(ax){h.selection.getSel().modify("extend",aA?"forward":"backward",aB.metaKey?"lineboundary":"word")}ar(aA)}});h.on("keypress",function(aC){if(!R(aC)&&!aw.isCollapsed()&&aC.charCode&&!f.metaKeyPressed(aC)){var ax,aD,aB,ay,az,aA;ax=h.selection.getRng();aA=String.fromCharCode(aC.charCode);aC.preventDefault();aD=O(ax.startContainer).parents().filter(function(aE,aF){return !!h.schema.getTextInlineElements()[aF.nodeName]});ar(true);aD=aD.filter(function(aE,aF){return !O.contains(h.getBody(),aF)});if(aD.length){aB=ao.createFragment();aD.each(function(aE,aF){aF=aF.cloneNode(false);if(aB.hasChildNodes()){aF.appendChild(aB.firstChild);aB.appendChild(aF)}else{az=aF;aB.appendChild(aF)}aB.appendChild(aF)});az.appendChild(h.getDoc().createTextNode(aA));ay=ao.getParent(ax.startContainer,ao.isBlock);if(ao.isEmpty(ay)){O(ay).empty().append(aB)}else{ax.insertNode(aB)}ax.setStart(az.firstChild,1);ax.setEnd(az.firstChild,1);h.selection.setRng(ax)}else{h.selection.setContent(aA)}}});h.addCommand("Delete",function(){ar()});h.addCommand("ForwardDelete",function(){ar(true)});if(ap){return}h.on("dragstart",function(ax){au=aw.getRng();I(ax)});h.on("drop",function(ax){if(!R(ax)){var ay=C(ax);if(ay){ax.preventDefault();window.setTimeout(function(){var az=e.getCaretRangeFromPoint(ax.x,ax.y,av);if(au){aw.setRng(au);au=null}ar();aw.setRng(az);J(ay)},0)}}});h.on("cut",function(ax){if(!R(ax)&&ax.clipboardData){ax.preventDefault();ax.clipboardData.clearData();ax.clipboardData.setData("text/html",h.selection.getContent());ax.clipboardData.setData("text/plain",h.selection.getContent({format:"text"}));ar(true)}})}function H(){function aj(am){var al=j.create("body");var an=am.cloneContents();al.appendChild(an);return y.serializer.serialize(al,{format:"html"})}function ak(al){if(!al.setStart){if(al.item){return false}var ap=al.duplicate();ap.moveToElementText(h.getBody());return e.compareRanges(al,ap)}var an=aj(al);var ao=j.createRng();ao.selectNode(h.getBody());var am=aj(ao);return an===am}h.on("keydown",function(ao){var an=ao.keyCode,am,al;if(!R(ao)&&(an==w||an==k)){am=h.selection.isCollapsed();al=h.getBody();if(am&&!j.isEmpty(al)){return}if(!am&&!ak(h.selection.getRng())){return}ao.preventDefault();h.setContent("");if(al.firstChild&&j.isBlock(al.firstChild)){h.selection.setCursorLocation(al.firstChild,0)}else{h.selection.setCursorLocation(al,0)}h.nodeChanged()}})}function ag(){h.shortcuts.add("meta+a",null,"SelectAll")}function ai(){if(!h.settings.content_editable){j.bind(h.getDoc(),"focusin",function(){y.setRng(y.getRng())});j.bind(h.getDoc(),"mousedown mouseup",function(aj){if(aj.target==h.getDoc().documentElement){h.getBody().focus();if(aj.type=="mousedown"){y.placeCaretAt(aj.clientX,aj.clientY)}else{y.setRng(y.getRng())}}})}}function V(){h.on("keydown",function(al){if(!R(al)&&al.keyCode===k){if(!h.getBody().getElementsByTagName("hr").length){return}if(y.isCollapsed()&&y.getRng(true).startOffset===0){var ak=y.getNode();var aj=ak.previousSibling;if(ak.nodeName=="HR"){j.remove(ak);al.preventDefault();return}if(aj&&aj.nodeName&&aj.nodeName.toLowerCase()==="hr"){j.remove(aj);al.preventDefault()}}}})}function Q(){if(!window.Range.prototype.getClientRects){h.on("mousedown",function(ak){if(!R(ak)&&ak.target.nodeName==="HTML"){var aj=h.getBody();aj.blur();setTimeout(function(){aj.focus()},0)}})}}function p(){h.on("click",function(ak){var aj=ak.target;if(/^(IMG|HR)$/.test(aj.nodeName)){ak.preventDefault();y.getSel().setBaseAndExtent(aj,0,aj,1);h.nodeChanged()}if(aj.nodeName=="A"&&j.hasClass(aj,"mce-item-anchor")){ak.preventDefault();y.select(aj)}})}function ac(){function ak(){var al=j.getAttribs(y.getStart().cloneNode(false));return function(){var am=y.getStart();if(am!==h.getBody()){j.setAttrib(am,"style",null);ab(al,function(an){am.setAttributeNode(an.cloneNode(true))})}}}function aj(){return !y.isCollapsed()&&j.getParent(y.getStart(),j.isBlock)!=j.getParent(y.getEnd(),j.isBlock)}h.on("keypress",function(am){var al;if(!R(am)&&(am.keyCode==8||am.keyCode==46)&&aj()){al=ak();h.getDoc().execCommand("delete",false,null);al();am.preventDefault();return false}});j.bind(h.getDoc(),"cut",function(am){var al;if(!R(am)&&aj()){al=ak();setTimeout(function(){al()},0)}})}function P(){document.body.setAttribute("role","application")}function M(){h.on("keydown",function(ak){if(!R(ak)&&ak.keyCode===k){if(y.isCollapsed()&&y.getRng(true).startOffset===0){var aj=y.getNode().previousSibling;if(aj&&aj.nodeName&&aj.nodeName.toLowerCase()==="table"){ak.preventDefault();return false}}}})}function Z(){if(B()>7){return}S("RespectVisibilityInDesign",true);h.contentStyles.push(".mceHideBrInPre pre br {display: none}");j.addClass(h.getBody(),"mceHideBrInPre");N.addNodeFilter("pre",function(aj){var al=aj.length,an,ak,ao,am;while(al--){an=aj[al].getAll("br");ak=an.length;while(ak--){ao=an[ak];am=ao.prev;if(am&&am.type===3&&am.value.charAt(am.value-1)!="\n"){am.value+="\n"}else{ao.parent.insert(new c("#text",3),ao,true).value="\n"}}}});D.addNodeFilter("pre",function(aj){var al=aj.length,an,ak,ao,am;while(al--){an=aj[al].getAll("br");ak=an.length;while(ak--){ao=an[ak];am=ao.prev;if(am&&am.type==3){am.value=am.value.replace(/\r?\n$/,"")}}}})}function o(){j.bind(h.getBody(),"mouseup",function(){var ak,aj=y.getNode();if(aj.nodeName=="IMG"){if((ak=j.getStyle(aj,"width"))){j.setAttrib(aj,"width",ak.replace(/[^0-9%]+/g,""));j.setStyle(aj,"width","")}if((ak=j.getStyle(aj,"height"))){j.setAttrib(aj,"height",ak.replace(/[^0-9%]+/g,""));j.setStyle(aj,"height","")}}})}function ae(){h.on("keydown",function(an){var al,ak,ao,aj,am;if(R(an)||an.keyCode!=f.BACKSPACE){return}al=y.getRng();ak=al.startContainer;ao=al.startOffset;aj=j.getRoot();am=ak;if(!al.collapsed||ao!==0){return}while(am&&am.parentNode&&am.parentNode.firstChild==am&&am.parentNode!=aj){am=am.parentNode}if(am.tagName==="BLOCKQUOTE"){h.formatter.toggle("blockquote",null,am);al=j.createRng();al.setStart(ak,0);al.setEnd(ak,0);y.setRng(al)}})}function ad(){function aj(){h._refreshContentEditable();S("StyleWithCSS",false);S("enableInlineTableEditing",false);if(!af.object_resizing){S("enableObjectResizing",false)}}if(!af.readonly){h.on("BeforeExecCommand MouseDown",aj)}}function L(){function aj(){ab(j.select("a"),function(am){var ak=am.parentNode,al=j.getRoot();if(ak.lastChild===am){while(ak&&!j.isBlock(ak)){if(ak.parentNode.lastChild!==ak||ak===al){return}ak=ak.parentNode}j.add(ak,"br",{"data-mce-bogus":1})}})}h.on("SetContent ExecCommand",function(ak){if(ak.type=="setcontent"||ak.command==="mceInsertLink"){aj()}})}function z(){if(af.forced_root_block){h.on("init",function(){S("DefaultParagraphSeparator",af.forced_root_block)})}}function F(){h.on("Undo Redo SetContent",function(aj){if(!aj.initial){h.execCommand("mceRepaint")}})}function q(){h.on("keydown",function(ak){var aj;if(!R(ak)&&ak.keyCode==k){aj=h.getDoc().selection.createRange();if(aj&&aj.item){ak.preventDefault();h.undoManager.beforeChange();j.remove(aj.item(0));h.undoManager.add()}}})}function K(){var aj;if(B()>=10){aj="";ab("p div h1 h2 h3 h4 h5 h6".split(" "),function(ak,al){aj+=(al>0?",":"")+ak+":empty"});h.contentStyles.push(aj+"{padding-right: 1px !important}")}}function aa(){if(B()<9){N.addNodeFilter("noscript",function(aj){var ak=aj.length,al,am;while(ak--){al=aj[ak];am=al.firstChild;if(am){al.attr("data-mce-innertext",am.value)}}});D.addNodeFilter("noscript",function(aj){var ak=aj.length,al,an,am;while(ak--){al=aj[ak];an=aj[ak].firstChild;if(an){an.value=g.decode(an.value)}else{am=al.attributes.map["data-mce-innertext"];if(am){al.attr("data-mce-innertext",null);an=new c("#text",3);an.value=am;an.raw=true;al.append(an)}}}})}}function G(){var ap=j.doc,ak=ap.body,am,an,aq;function ao(ar,av){var at=ak.createTextRange();try{at.moveToPoint(ar,av)}catch(au){at=null}return at}function al(at){var ar;if(at.button){ar=ao(at.x,at.y);if(ar){if(ar.compareEndPoints("StartToStart",an)>0){ar.setEndPoint("StartToStart",an)}else{ar.setEndPoint("EndToEnd",an)}ar.select()}}else{aj()}}function aj(){var ar=ap.selection.createRange();if(an&&!ar.item&&ar.compareEndPoints("StartToEnd",ar)===0){an.select()}j.unbind(ap,"mouseup",aj);j.unbind(ap,"mousemove",al);an=am=0}ap.documentElement.unselectable=true;j.bind(ap,"mousedown contextmenu",function(ar){if(ar.target.nodeName==="HTML"){if(am){aj()}aq=ap.documentElement;if(aq.scrollHeight>aq.clientHeight){return}am=1;an=ao(ar.x,ar.y);if(an){j.bind(ap,"mouseup",aj);j.bind(ap,"mousemove",al);j.getRoot().focus();an.select()}}})}function X(){h.on("keyup focusin mouseup",function(aj){if(aj.keyCode!=65||!f.metaKeyPressed(aj)){y.normalize()}},true)}function s(){h.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function t(){if(!h.inline){h.on("keydown",function(){if(document.activeElement==document.body){h.getWin().focus()}})}}function x(){if(!h.inline){h.contentStyles.push("body {min-height: 150px}");h.on("click",function(ak){if(ak.target.nodeName=="HTML"){var aj;aj=h.selection.getRng();h.getBody().focus();h.selection.setRng(aj);h.selection.normalize();h.nodeChanged()}})}}function v(){if(a.mac){h.on("keydown",function(aj){if(f.metaKeyPressed(aj)&&(aj.keyCode==37||aj.keyCode==39)){aj.preventDefault();h.selection.getSel().modify("move",aj.keyCode==37?"backward":"forward","lineboundary")}})}}function U(){S("AutoUrlDetect",false)}function A(){if(!h.inline){h.on("focus blur beforegetcontent",function(){var aj=h.dom.create("br");h.getBody().appendChild(aj);aj.parentNode.removeChild(aj)},true)}}function r(){h.on("click",function(aj){var ak=aj.target;do{if(ak.tagName==="A"){aj.preventDefault();return}}while((ak=ak.parentNode))});h.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function i(){h.on("touchstart",function(am){var an,al,ak,aj;an=am.target;al=new Date().getTime();aj=am.changedTouches;if(!aj||aj.length>1){return}ak=aj[0];h.once("touchend",function(aq){var ap=aq.changedTouches[0],ao;if(new Date().getTime()-al>500){return}if(Math.abs(ak.clientX-ap.clientX)>5){return}if(Math.abs(ak.clientY-ap.clientY)>5){return}ao={target:an};ab("pageX pageY clientX clientY screenX screenY".split(" "),function(ar){ao[ar]=ap[ar]});ao=h.fire("click",ao);if(!ao.isDefaultPrevented()){h.selection.placeCaretAt(ap.clientX,ap.clientY);h.nodeChanged()}})})}function E(){h.on("init",function(){h.dom.bind(h.getBody(),"submit",function(aj){aj.preventDefault()})})}function W(){N.addNodeFilter("br",function(aj){var ak=aj.length;while(ak--){if(aj[ak].attr("class")=="Apple-interchange-newline"){aj[ak].remove()}}})}function n(){h.on("dragstart",function(aj){I(aj)});h.on("drop",function(ak){if(!R(ak)){var al=C(ak);if(al){ak.preventDefault();var aj=e.getCaretRangeFromPoint(ak.x,ak.y,h.getDoc());y.setRng(aj);J(al)}}})}ae();H();X();if(Y){ah();ai();p();z();E();M();W();i();if(a.iOS){t();x();r()}else{ag()}}if(u&&a.ie<11){V();P();Z();o();q();K();aa();G()}if(a.ie>=11){x();A();M()}if(a.ie){ag();U();n()}if(m){V();Q();ac();ad();L();F();s();v();M()}}}); |