diff --git a/src/static/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js b/src/static/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js new file mode 100644 index 00000000..14345b16 --- /dev/null +++ b/src/static/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js @@ -0,0 +1,10 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("a11yHelp",function(f){function m(a){for(var b,c,h=[],d=0;d=b&&(a-=c,h.push(e[c]));h.push(e[a]||String.fromCharCode(a));return h.join("+")}function t(a,b){var c=f.getCommandKeystroke(b,!0);return c.length?CKEDITOR.tools.array.map(c,m).join(" / "):a}var a=f.lang.a11yhelp,b=f.lang.common.keyboard,p=CKEDITOR.tools.getNextId(),q=/\$\{(.*?)\}/g,g=[CKEDITOR.ALT,CKEDITOR.SHIFT,CKEDITOR.CTRL],e={8:b[8],9:a.tab,13:b[13],16:b[16],17:b[17],18:b[18],19:a.pause, +20:a.capslock,27:a.escape,33:a.pageUp,34:a.pageDown,35:b[35],36:b[36],37:a.leftArrow,38:a.upArrow,39:a.rightArrow,40:a.downArrow,45:a.insert,46:b[46],91:a.leftWindowKey,92:a.rightWindowKey,93:a.selectKey,96:a.numpad0,97:a.numpad1,98:a.numpad2,99:a.numpad3,100:a.numpad4,101:a.numpad5,102:a.numpad6,103:a.numpad7,104:a.numpad8,105:a.numpad9,106:a.multiply,107:a.add,109:a.subtract,110:a.decimalPoint,111:a.divide,112:a.f1,113:a.f2,114:a.f3,115:a.f4,116:a.f5,117:a.f6,118:a.f7,119:a.f8,120:a.f9,121:a.f10, +122:a.f11,123:a.f12,144:a.numLock,145:a.scrollLock,186:a.semiColon,187:a.equalSign,188:a.comma,189:a.dash,190:a.period,191:a.forwardSlash,192:a.graveAccent,219:a.openBracket,220:a.backSlash,221:a.closeBracket,222:a.singleQuote};e[CKEDITOR.ALT]=b[18];e[CKEDITOR.SHIFT]=b[16];e[CKEDITOR.CTRL]=CKEDITOR.env.mac?b[224]:b[17];return{title:a.title,minWidth:600,minHeight:400,contents:[{id:"info",label:f.lang.common.generalTab,expand:!0,elements:[{type:"html",id:"legends",style:"white-space:normal;",focus:function(){this.getElement().focus()}, +html:function(){for(var b='\x3cdiv class\x3d"cke_accessibility_legend" role\x3d"document" aria-labelledby\x3d"'+p+'_arialbl" tabIndex\x3d"-1"\x3e%1\x3c/div\x3e\x3cspan id\x3d"'+p+'_arialbl" class\x3d"cke_voice_label"\x3e'+a.contents+" \x3c/span\x3e",e=[],c=a.legend,h=c.length,d=0;d]*>)([\s\S]*?)<\/style>/gi,function(a,b,d){c(f,"style",b,d);return""});b=b.replace(/]*\/>/i,function(b){c(f,"base",b);return""});b=b.replace(/([\s\S]*)<\/title>/i,function(b,a){d.$.title=a;return""});b=b.replace(/<head>([\s\S]*)<\/head>/i,function(b){var a= +new CKEDITOR.dom.element("div",d);a.setHtml(b);a.moveChildren(f);return""});b.replace(/(<body[^>]*>)([\s\S]*)(?=$|<\/body>)/i,function(b,a,c){d.getBody().setHtml(c);(b=CKEDITOR.htmlParser.fragment.fromHtml(a).children[0].attributes)&&d.getBody().setAttributes(b)})}else a.apply(this,arguments)}}),CKEDITOR.addCss("body.cke_editable { padding: 8px }"),CKEDITOR.ui.on("ready",function(a){a=a.data;if(a._.panel){var c=a._.panel._.panel,b;(function m(){c.isLoaded?(b=c._.holder,f(b)):setTimeout(m,30)})()}else a instanceof +CKEDITOR.dialog&&f(a._.element)}))},init:function(a){CKEDITOR.env.air&&(a.on("uiReady",function(){f(a.container);a.on("elementsPathUpdate",function(a){f(a.data.space)})}),a.on("contentDom",function(){a.document.on("click",function(a){a.data.preventDefault(!0)})}))}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/autocomplete/plugin.js b/src/static/ckeditor/plugins/autocomplete/plugin.js new file mode 100644 index 00000000..7ecb5c7e --- /dev/null +++ b/src/static/ckeditor/plugins/autocomplete/plugin.js @@ -0,0 +1,21 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function f(a,b){var c=a.config.autocomplete_commitKeystrokes||CKEDITOR.config.autocomplete_commitKeystrokes;this.editor=a;this.throttle=void 0!==b.throttle?b.throttle:20;this.view=this.getView();this.model=this.getModel(b.dataCallback);this.model.itemsLimit=b.itemsLimit;this.textWatcher=this.getTextWatcher(b.textTestCallback);this.commitKeystrokes=CKEDITOR.tools.array.isArray(c)?c.slice():[c];this._listeners=[];this.outputTemplate=void 0!==b.outputTemplate?new CKEDITOR.template(b.outputTemplate): +null;b.itemTemplate&&(this.view.itemTemplate=new CKEDITOR.template(b.itemTemplate));if("ready"===this.editor.status)this.attach();else this.editor.on("instanceReady",function(){this.attach()},this);a.on("destroy",function(){this.destroy()},this)}function g(a){this.itemTemplate=new CKEDITOR.template('\x3cli data-id\x3d"{id}"\x3e{name}\x3c/li\x3e');this.editor=a}function h(a){this.dataCallback=a;this.isActive=!1;this.itemsLimit=0}function l(a){return CKEDITOR.tools.array.reduce(CKEDITOR.tools.object.keys(a), +function(b,c){b[c]=CKEDITOR.tools.htmlEncode(a[c]);return b},{})}CKEDITOR.plugins.add("autocomplete",{requires:"textwatcher",onLoad:function(){CKEDITOR.document.appendStyleSheet(this.path+"skins/default.css")},isSupportedEnvironment:function(){return!CKEDITOR.env.ie||8<CKEDITOR.env.version}});f.prototype={attach:function(){function a(){this._listeners.push(d.on("keydown",function(a){this.onKeyDown(a)},this,null,5))}var b=this.editor,c=CKEDITOR.document.getWindow(),d=b.editable(),k=d.isInline()?d: +d.getDocument();CKEDITOR.env.iOS&&!d.isInline()&&(k=b.window.getFrame().getParent());this.view.append();this.view.attach();this.textWatcher.attach();this._listeners.push(this.textWatcher.on("matched",this.onTextMatched,this));this._listeners.push(this.textWatcher.on("unmatched",this.onTextUnmatched,this));this._listeners.push(this.model.on("change-data",this.modelChangeListener,this));this._listeners.push(this.model.on("change-selectedItemId",this.onSelectedItemId,this));this._listeners.push(this.view.on("change-selectedItemId", +this.onSelectedItemId,this));this._listeners.push(this.view.on("click-item",this.onItemClick,this));this._listeners.push(c.on("scroll",function(){this.viewRepositionListener()},this));this._listeners.push(k.on("scroll",function(){this.viewRepositionListener()},this));this._listeners.push(b.on("contentDom",a,this));this._listeners.push(this.view.element.on("mousedown",function(a){a.data.preventDefault()},null,null,9999));d&&a.call(this)},close:function(){this.model.setActive(!1);this.view.close()}, +commit:function(a){if(this.model.isActive){this.close();if(null==a&&(a=this.model.selectedItemId,null==a))return;a=this.model.getItemById(a);var b=this.editor;b.fire("saveSnapshot");b.getSelection().selectRanges([this.model.range]);b.insertHtml(this.getHtmlToInsert(a),"text");b.fire("saveSnapshot")}},destroy:function(){CKEDITOR.tools.array.forEach(this._listeners,function(a){a.removeListener()});this._listeners=[];this.view.element&&this.view.element.remove()},getHtmlToInsert:function(a){a=l(a);return this.outputTemplate? +this.outputTemplate.output(a):a.name},getModel:function(a){var b=this;return new h(function(c,d){return a.call(this,CKEDITOR.tools.extend({autocomplete:b},c),d)})},getTextWatcher:function(a){return new CKEDITOR.plugins.textWatcher(this.editor,a,this.throttle)},getView:function(){return new g(this.editor)},open:function(){this.model.hasData()&&(this.model.setActive(!0),this.view.open(),this.model.selectFirst(),this.view.updatePosition(this.model.range))},viewRepositionListener:function(){this.model.isActive&& +this.view.updatePosition(this.model.range)},modelChangeListener:function(a){this.model.hasData()?(this.view.updateItems(a.data),this.open()):this.close()},onItemClick:function(a){this.commit(a.data)},onKeyDown:function(a){if(this.model.isActive){var b=a.data.getKey(),c=!1;27==b?(this.close(),this.textWatcher.unmatch(),c=!0):40==b?(this.model.selectNext(),c=!0):38==b?(this.model.selectPrevious(),c=!0):-1!=CKEDITOR.tools.indexOf(this.commitKeystrokes,b)&&(this.commit(),this.textWatcher.unmatch(),c= +!0);c&&(a.cancel(),a.data.preventDefault(),this.textWatcher.consumeNext())}},onSelectedItemId:function(a){this.model.setItem(a.data);this.view.selectItem(a.data)},onTextMatched:function(a){this.model.setActive(!1);this.model.setQuery(a.data.text,a.data.range)},onTextUnmatched:function(){this.model.query=null;this.model.lastRequestId=null;this.close()}};g.prototype={append:function(){this.document=CKEDITOR.document;this.element=this.createElement();this.document.getBody().append(this.element)},appendItems:function(a){this.element.setHtml(""); +this.element.append(a)},attach:function(){this.element.on("click",function(a){(a=a.data.getTarget().getAscendant(this.isItemElement,!0))&&this.fire("click-item",a.data("id"))},this);this.element.on("mouseover",function(a){a=a.data.getTarget();this.element.contains(a)&&(a=a.getAscendant(function(a){return a.hasAttribute("data-id")},!0))&&(a=a.data("id"),this.fire("change-selectedItemId",a))},this)},close:function(){this.element.removeClass("cke_autocomplete_opened")},createElement:function(){var a= +new CKEDITOR.dom.element("ul",this.document);a.addClass("cke_autocomplete_panel");a.setStyle("z-index",this.editor.config.baseFloatZIndex-3);return a},createItem:function(a){a=l(a);return CKEDITOR.dom.element.createFromHtml(this.itemTemplate.output(a),this.document)},getViewPosition:function(a){a=a.getClientRects();a=a[a.length-1];var b;b=this.editor.editable();b=b.isInline()?CKEDITOR.document.getWindow().getScrollPosition():b.getParent().getDocumentPosition(CKEDITOR.document);var c=CKEDITOR.document.getBody(); +"static"===c.getComputedStyle("position")&&(c=c.getParent());c=c.getDocumentPosition();b.x-=c.x;b.y-=c.y;return{top:a.top+b.y,bottom:a.top+a.height+b.y,left:a.left+b.x}},getItemById:function(a){return this.element.findOne('li[data-id\x3d"'+a+'"]')},isItemElement:function(a){return a.type==CKEDITOR.NODE_ELEMENT&&Boolean(a.data("id"))},open:function(){this.element.addClass("cke_autocomplete_opened")},selectItem:function(a){null!=this.selectedItemId&&this.getItemById(this.selectedItemId).removeClass("cke_autocomplete_selected"); +var b=this.getItemById(a);b.addClass("cke_autocomplete_selected");this.selectedItemId=a;this.scrollElementTo(b)},setPosition:function(a){var b=this.editor,c=this.element.getSize("height"),d=b.editable(),b=CKEDITOR.env.iOS&&!d.isInline()?b.window.getFrame().getParent().getClientRect(!0):d.isInline()?d.getClientRect(!0):b.window.getFrame().getClientRect(!0),d=a.top-b.top,k=b.bottom-a.bottom,e;e=a.top<b.top?b.top:Math.min(b.bottom,a.bottom);c>k&&c<d&&(e=a.top-c);b.bottom<a.bottom&&(e=Math.min(a.top- +c,b.bottom-c));b.top>a.top&&(e=Math.max(a.bottom,b.top));this.element.setStyles({left:a.left+"px",top:e+"px"})},scrollElementTo:function(a){a.scrollIntoParent(this.element)},updateItems:function(a){var b,c=new CKEDITOR.dom.documentFragment(this.document);for(b=0;b<a.length;++b)c.append(this.createItem(a[b]));this.appendItems(c);this.selectedItemId=null},updatePosition:function(a){this.setPosition(this.getViewPosition(a))}};CKEDITOR.event.implementOn(g.prototype);h.prototype={getIndexById:function(a){if(!this.hasData())return-1; +for(var b=this.data,c=0,d=b.length;c<d;c++)if(b[c].id==a)return c;return-1},getItemById:function(a){a=this.getIndexById(a);return~a&&this.data[a]||null},hasData:function(){return Boolean(this.data&&this.data.length)},setItem:function(a){if(0>this.getIndexById(a))throw Error("Item with given id does not exist");this.selectedItemId=a},select:function(a){this.fire("change-selectedItemId",a)},selectFirst:function(){this.hasData()&&this.select(this.data[0].id)},selectLast:function(){this.hasData()&&this.select(this.data[this.data.length- +1].id)},selectNext:function(){if(null==this.selectedItemId)this.selectFirst();else{var a=this.getIndexById(this.selectedItemId);0>a||a+1==this.data.length?this.selectFirst():this.select(this.data[a+1].id)}},selectPrevious:function(){if(null==this.selectedItemId)this.selectLast();else{var a=this.getIndexById(this.selectedItemId);0>=a?this.selectLast():this.select(this.data[a-1].id)}},setActive:function(a){this.isActive=a;this.fire("change-isActive",a)},setQuery:function(a,b){var c=this,d=CKEDITOR.tools.getNextId(); +this.lastRequestId=d;this.query=a;this.range=b;this.selectedItemId=this.data=null;this.dataCallback({query:a,range:b},function(a){d==c.lastRequestId&&(c.data=c.itemsLimit?a.slice(0,c.itemsLimit):a,c.fire("change-data",c.data))})}};CKEDITOR.event.implementOn(h.prototype);CKEDITOR.plugins.autocomplete=f;f.view=g;f.model=h;CKEDITOR.config.autocomplete_commitKeystrokes=[9,13]})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/autocomplete/skins/default.css b/src/static/ckeditor/plugins/autocomplete/skins/default.css new file mode 100644 index 00000000..f96974cd --- /dev/null +++ b/src/static/ckeditor/plugins/autocomplete/skins/default.css @@ -0,0 +1,38 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_autocomplete_panel +{ + position: absolute; + display: none; + box-sizing: border-box; + width: 200px; + max-height: 300px; + overflow: auto; + padding: 0; + margin: 0; + list-style: none; + background: #FFF; + border: 1px solid #b6b6b6; + border-bottom-color: #999; + border-radius: 3px; + font: 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif; +} +.cke_autocomplete_opened +{ + display: block; +} +.cke_autocomplete_panel > li +{ + padding: 5px; +} +.cke_autocomplete_panel > li:hover +{ + cursor: pointer; +} +.cke_autocomplete_selected, .cke_autocomplete_panel > li:hover +{ + background-color: #EFF0EF; +} diff --git a/src/static/ckeditor/plugins/autoembed/lang/zh-cn.js b/src/static/ckeditor/plugins/autoembed/lang/zh-cn.js new file mode 100644 index 00000000..959fc45d --- /dev/null +++ b/src/static/ckeditor/plugins/autoembed/lang/zh-cn.js @@ -0,0 +1 @@ +CKEDITOR.plugins.setLang("autoembed","zh-cn",{embeddingInProgress:"正在尝试嵌入粘贴的 URL 里的媒体内容...",embeddingFailed:"此 URL 无法自动嵌入媒体内容"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/autoembed/plugin.js b/src/static/ckeditor/plugins/autoembed/plugin.js new file mode 100644 index 00000000..76d0b246 --- /dev/null +++ b/src/static/ckeditor/plugins/autoembed/plugin.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function p(a,g){var b=a.editable().findOne('a[data-cke-autoembed\x3d"'+g+'"]'),c=a.lang.autoembed,d;if(b&&b.data("cke-saved-href")){var b=b.data("cke-saved-href"),e=CKEDITOR.plugins.autoEmbed.getWidgetDefinition(a,b);if(e){var f="function"==typeof e.defaults?e.defaults():e.defaults,f=CKEDITOR.dom.element.createFromHtml(e.template.output(f)),h,m=a.widgets.wrapElement(f,e.name),n=new CKEDITOR.dom.documentFragment(m.getDocument());n.append(m);(h=a.widgets.initOn(f,e))?(d=a.showNotification(c.embeddingInProgress, +"info"),h.loadContent(b,{noNotifications:!0,callback:function(){var b=a.editable().findOne('a[data-cke-autoembed\x3d"'+g+'"]');if(b){var c=a.getSelection(),e=a.createRange(),f=a.editable();a.fire("saveSnapshot");a.fire("lockSnapshot",{dontUpdate:!0});var l=c.createBookmarks(!1)[0],k=l.startNode,h=l.endNode||k;CKEDITOR.env.ie&&9>CKEDITOR.env.version&&!l.endNode&&k.equals(b.getNext())&&b.append(k);e.setStartBefore(b);e.setEndAfter(b);f.insertElement(m,e);f.contains(k)&&f.contains(h)?c.selectBookmarks([l]): +(k.remove(),h.remove());a.fire("unlockSnapshot")}d.hide();a.widgets.finalizeCreation(n)},errorCallback:function(){d.hide();a.widgets.destroy(h,!0);a.showNotification(c.embeddingFailed,"info")}})):a.widgets.finalizeCreation(n)}else CKEDITOR.warn("autoembed-no-widget-def")}}var q=/^<a[^>]+href="([^"]+)"[^>]*>([^<]+)<\/a>$/i;CKEDITOR.plugins.add("autoembed",{requires:"autolink,undo",lang:"ar,az,bg,ca,cs,da,de,de-ch,el,en,en-au,eo,es,es-mx,et,eu,fa,fr,gl,hr,hu,it,ja,km,ko,ku,lt,lv,mk,nb,nl,oc,pl,pt,pt-br,ro,ru,sk,sq,sr,sr-latn,sv,tr,ug,uk,vi,zh,zh-cn", +init:function(a){var g=1,b;a.on("paste",function(c){if(c.data.dataTransfer.getTransferType(a)==CKEDITOR.DATA_TRANSFER_INTERNAL)b=0;else{var d=c.data.dataValue.match(q);if(b=null!=d&&decodeURI(d[1])==decodeURI(d[2]))c.data.dataValue='\x3ca data-cke-autoembed\x3d"'+ ++g+'"'+c.data.dataValue.substr(2)}},null,null,20);a.on("afterPaste",function(){b&&p(a,g)})}});CKEDITOR.plugins.autoEmbed={getWidgetDefinition:function(a,g){var b=a.config.autoEmbed_widget||"embed,embedSemantic",c,d=a.widgets.registered; +if("string"==typeof b)for(b=b.split(",");c=b.shift();){if(d[c])return d[c]}else if("function"==typeof b)return d[b(g)];return null}}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/autogrow/plugin.js b/src/static/ckeditor/plugins/autogrow/plugin.js new file mode 100644 index 00000000..e3731c1d --- /dev/null +++ b/src/static/ckeditor/plugins/autogrow/plugin.js @@ -0,0 +1,8 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function h(a){function m(){e=a.document;n=e[CKEDITOR.env.ie?"getBody":"getDocumentElement"]();c=CKEDITOR.env.quirks?e.getBody():e.getDocumentElement();var d=CKEDITOR.env.quirks?c:c.findOne("body");d&&(d.setStyle("height","auto"),d.setStyle("min-height",CKEDITOR.env.safari?"0%":"auto"));f=CKEDITOR.dom.element.createFromHtml('\x3cspan style\x3d"margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;"\x3e'+(CKEDITOR.env.webkit?"\x26nbsp;":"")+"\x3c/span\x3e",e)}function g(){k&& +c.setStyle("overflow-y","hidden");var d=a.window.getViewPaneSize().height,b;n.append(f);b=f.getDocumentPosition(e).y+f.$.offsetHeight;f.remove();b+=h;b=Math.max(b,r);b=Math.min(b,p);b!=d&&l!=b&&(b=a.fire("autoGrow",{currentHeight:d,newHeight:b}).newHeight,a.resize(a.container.getStyle("width"),b,!0),l=b);k||(b<p&&c.$.scrollHeight>c.$.clientHeight?c.setStyle("overflow-y","hidden"):c.removeStyle("overflow-y"))}var l,e,n,c,f,h=a.config.autoGrow_bottomSpace||0,r=void 0!==a.config.autoGrow_minHeight?a.config.autoGrow_minHeight: +200,p=a.config.autoGrow_maxHeight||Infinity,k=!a.config.autoGrow_maxHeight;a.addCommand("autogrow",{exec:g,modes:{wysiwyg:1},readOnly:1,canUndo:!1,editorFocus:!1});var t={contentDom:1,key:1,selectionChange:1,insertElement:1,mode:1},q;for(q in t)a.on(q,function(d){"wysiwyg"==d.editor.mode&&setTimeout(function(){var b=a.getCommand("maximize");!a.window||b&&b.state==CKEDITOR.TRISTATE_ON?l=null:(g(),k||g())},100)});a.on("afterCommandExec",function(a){"maximize"==a.data.name&&"wysiwyg"==a.editor.mode&& +(a.data.command.state==CKEDITOR.TRISTATE_ON?c.removeStyle("overflow-y"):g())});a.on("contentDom",m);m();a.config.autoGrow_onStartup&&a.editable().isVisible()&&a.execCommand("autogrow")}CKEDITOR.plugins.add("autogrow",{init:function(a){if(a.elementMode!=CKEDITOR.ELEMENT_MODE_INLINE)a.on("instanceReady",function(){a.editable().isInline()?a.ui.space("contents").setStyle("height","auto"):h(a)})}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/autolink/plugin.js b/src/static/ckeditor/plugins/autolink/plugin.js new file mode 100644 index 00000000..627d8c3f --- /dev/null +++ b/src/static/ckeditor/plugins/autolink/plugin.js @@ -0,0 +1,8 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){var f=/"/g;CKEDITOR.plugins.add("autolink",{requires:"clipboard,textmatch",init:function(c){function e(a){a={text:a,link:a.replace(f,"%22")};a=a.link.match(CKEDITOR.config.autolink_urlRegex)?g.output(a):h.output(a);if(c.plugins.link){a=CKEDITOR.dom.element.createFromHtml(a);var b=CKEDITOR.plugins.link.parseLinkAttributes(c,a),b=CKEDITOR.plugins.link.getLinkAttributes(c,b);CKEDITOR.tools.isEmpty(b.set)||a.setAttributes(b.set);b.removed.length&&a.removeAttributes(b.removed);a.removeAttribute("data-cke-saved-href"); +a=a.getOuterHtml()}return a}function k(a,b){var c=a.slice(0,b).split(/\s+/);return(c=c[c.length-1])&&d(c)?{start:a.lastIndexOf(c),end:b}:null}function d(a){return a.match(CKEDITOR.config.autolink_urlRegex)||a.match(CKEDITOR.config.autolink_emailRegex)}var g=new CKEDITOR.template('\x3ca href\x3d"{link}"\x3e{text}\x3c/a\x3e'),h=new CKEDITOR.template('\x3ca href\x3d"mailto:{link}"\x3e{text}\x3c/a\x3e');c.on("paste",function(a){if(a.data.dataTransfer.getTransferType(c)!=CKEDITOR.DATA_TRANSFER_INTERNAL){var b= +a.data.dataValue;-1<b.indexOf("\x3c")||!d(b)||(a.data.dataValue=e(b),a.data.type="html")}});if(!CKEDITOR.env.ie||CKEDITOR.env.edge){var l=c.config.autolink_commitKeystrokes||CKEDITOR.config.autolink_commitKeystrokes;c.on("key",function(a){if("wysiwyg"===c.mode&&-1!=CKEDITOR.tools.indexOf(l,a.data.keyCode)){var b=CKEDITOR.plugins.textMatch.match(c.getSelection().getRanges()[0],k);if(b&&(a=c.getSelection(),!a.getRanges()[0].startContainer.getAscendant("a",!0)&&(a.selectRanges([b.range]),c.insertHtml(e(b.text), +"text"),!CKEDITOR.env.webkit))){var b=a.getRanges()[0],d=c.createRange();d.setStartAfter(b.startContainer);a.selectRanges([d])}}})}}});CKEDITOR.config.autolink_commitKeystrokes=[13,32];CKEDITOR.config.autolink_urlRegex=/^(https?|ftp):\/\/(-\.)?([^\s\/?\.#]+\.?)+(\/[^\s]*)?[^\s\.,]$/i;CKEDITOR.config.autolink_emailRegex=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/balloonpanel/plugin.js b/src/static/ckeditor/plugins/balloonpanel/plugin.js new file mode 100644 index 00000000..779dec18 --- /dev/null +++ b/src/static/ckeditor/plugins/balloonpanel/plugin.js @@ -0,0 +1,22 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){var f=!1;CKEDITOR.plugins.add("balloonpanel",{init:function(){f||(CKEDITOR.document.appendStyleSheet(this.path+"skins/"+CKEDITOR.skin.name+"/balloonpanel.css"),f=!0)}});CKEDITOR.ui.balloonPanel=function(a,b){this.editor=a;CKEDITOR.tools.extend(this,{width:360,height:"auto",triangleWidth:20,triangleHeight:20,triangleMinDistance:40},b,!0);this.templates={};for(var c in this.templateDefinitions)this.templates[c]=new CKEDITOR.template(this.templateDefinitions[c]);this.parts={};this.focusables= +{};this.showListeners={};this.activeShowListeners={};this.rect={visible:!1};this.build();a.on("destroy",function(){this.destroy()},this)};CKEDITOR.ui.balloonPanel.prototype={templateDefinitions:{panel:'\x3cdiv class\x3d"cke {id} cke_reset_all cke_chrome cke_balloon cke_editor_{name} cke_{langDir} '+CKEDITOR.env.cssClass+'" dir\x3d"{langDir}" title\x3d"'+(CKEDITOR.env.gecko?" ":"")+'" lang\x3d"{langCode}" role\x3d"dialog" style\x3d"{style}" tabindex\x3d"-1" aria-labelledby\x3d"cke_{name}_arialbl"\x3e\x3c/div\x3e', +content:'\x3cdiv class\x3d"cke_balloon_content"\x3e{content}\x3c/div\x3e',title:'\x3cdiv class\x3d"cke_balloon_title" role\x3d"presentation"\x3e{title}\x3c/div\x3e',close:'\x3ca class\x3d"cke_balloon_close_button" href\x3d"javascript:void(0)" title\x3d"Close" role\x3d"button" tabindex\x3d"-1"\x3e\x3cspan class\x3d"cke_label"\x3eX\x3c/span\x3e\x3c/a\x3e',triangleOuter:'\x3cspan class\x3d"cke_balloon_triangle cke_balloon_triangle_outer"\x3e\x3c/span\x3e',triangleInner:'\x3cspan class\x3d"cke_balloon_triangle cke_balloon_triangle_inner"\x3e\x26#8203;\x3c/span\x3e'}, +build:function(){var a=this.editor;this.parts={title:CKEDITOR.dom.element.createFromHtml(this.templates.title.output({title:this.title})),close:CKEDITOR.dom.element.createFromHtml(this.templates.close.output()),panel:CKEDITOR.dom.element.createFromHtml(this.templates.panel.output({id:a.id,langDir:a.lang.dir,langCode:a.langCode,name:a.name,style:"display:none;",voiceLabel:a.lang.editorPanel+", "+a.name})),content:CKEDITOR.dom.element.createFromHtml(this.templates.content.output({content:this.content|| +""})),triangleOuter:CKEDITOR.dom.element.createFromHtml(this.templates.triangleOuter.output()),triangleInner:CKEDITOR.dom.element.createFromHtml(this.templates.triangleInner.output())};this.parts.panel.append(this.parts.title,1);this.parts.panel.append(this.parts.close,1);this.parts.panel.append(this.parts.triangleOuter);this.parts.panel.append(this.parts.content);this.parts.triangleOuter.append(this.parts.triangleInner);this.registerFocusable(this.parts.panel);this.registerFocusable(this.parts.close); +this.parts.title.unselectable();this.parts.close.unselectable();CKEDITOR.document.getBody().append(this.parts.panel);this.resize(this.width,this.height);this.on("show",this.activateShowListeners,this);this.on("hide",this.deactivateShowListeners,this);this.parts.close.on("click",function(a){this.hide();a.data.preventDefault()},this)},show:function(){this.rect.visible||(this.rect.visible=!0,this.parts.panel.show(),this.fire("show"))},hide:function(){this.rect.visible&&(this.rect.visible=!1,this.parts.panel.hide(), +this.blur(),this.fire("hide"))},blur:function(){this.editor.focus()},move:function(a,b){this.rect.left=b;this.rect.top=a;this.parts.panel.setStyles({left:CKEDITOR.tools.cssLength(b),top:CKEDITOR.tools.cssLength(a)})},attach:function(){function a(a,b){var d=Math.max(0,Math.min(a.right,b.right)-Math.max(a.left,b.left)),c=Math.max(0,Math.min(a.bottom,b.bottom)-Math.max(a.top,b.top));return d*c}function b(a,b,c,e){a={top:a,left:b};a.right=a.left+c;a.bottom=a.top+e;return a}function c(a,b){a.right=b.right; +a.width=a.right-a.left;b.y&&(a.y=b.y);return a}function z(a){var b=f(a,!0);a=f(a);b=c(b[0],b.pop());a=c(a[0],a.pop());b.bottom=a.bottom;b.height=b.bottom-b.top;a.y&&(b.y=a.y);a.top=b.top;a.height=b.height;return[b,a]}function f(a,b){var c=b?a[0]:a[a.length-1],e=b?"top":"bottom";return CKEDITOR.tools.array.filter(a,function(a){if(a[e]===c[e])return a})}var u,v,x,q,A={right:"left",top:"bottom",topLeft:"bottomLeft",topRight:"bottomRight",bottom:"top",bottomLeft:"topLeft",bottomRight:"topRight",left:"right"}; +return function(p,l){if(p instanceof CKEDITOR.dom.selection){var d=p.getRanges(),d=p.isFake&&p.isInTable()?CKEDITOR.tools.array.map(d,function(a){return a.getClientRects(!0)[0]}):d[d.length-1].getClientRects(!0),e=d[0],f=d[d.length-1],r;r=e===f?[e]:e.top===f.top?[c(e,f)]:z(d)}if(l instanceof CKEDITOR.dom.element||!l)l={focusElement:l};l=CKEDITOR.tools.extend(l,{show:!0});!0===l.show&&this.show();this.fire("attach");u=CKEDITOR.document.getWindow();v=this.editor.window.getFrame();x=this.editor.editable(); +q=x.isInline();!q&&CKEDITOR.env.safari&&(v=v.getParent());var d=this.getWidth(),e=this.getHeight(),f=d*e,g,k,h;g=p.getClientRect&&p.getClientRect(!0);var t=q?x.getClientRect(!0):v.getClientRect(!0),y=u.getViewPaneSize(),w=u.getScrollPosition(),m={top:Math.max(t.top,w.y),left:Math.max(t.left,w.x),right:Math.min(t.right,y.width+w.x),bottom:Math.min(t.bottom,y.height+w.y)};q&&this.editor.elementMode===CKEDITOR.ELEMENT_MODE_INLINE&&(m=this._getViewPaneRect(u),m.right+=this.triangleWidth,m.bottom+=this.triangleHeight); +r?(CKEDITOR.tools.array.forEach(r,function(a){this._adjustElementRect(a,q?m:t)},this),g=this._getAlignments(r[0],d,e),1<r.length&&(g["bottom hcenter"]=this._getAlignments(r[1],d,e)["bottom hcenter"]),h={"top hcenter":!0,"bottom hcenter":!0}):(this._adjustElementRect(g,q?m:t),g=this._getAlignments(g,d,e));for(var n in h||g){h=b(g[n].top,g[n].left,d,e);h=g[n].areaDifference=f-a(h,m);if(0===h){k=n;break}k||(k=n);h<g[k].areaDifference&&(k=n)}n=(h=this.parts.panel.getAscendant(function(a){return a instanceof +CKEDITOR.dom.document?!1:"static"!==a.getComputedStyle("position")}))?parseInt(h.getComputedStyle("margin-left"),10):0;h=h?parseInt(h.getComputedStyle("margin-top"),10):0;this.move(g[k].top-h,g[k].left-n);k=k.split(" ");this.setTriangle(A[k[0]],k[1]);!1!==l.focusElement&&(l.focusElement||this.parts.panel).focus()}}(),resize:function(a,b){this.rect.width=a;this.rect.height=b;this.parts.panel.setStyles({width:CKEDITOR.tools.cssLength(a),height:CKEDITOR.tools.cssLength(b)})},getWidth:function(){return"auto"=== +this.rect.width?this.parts.panel.getClientRect().width:this.rect.width},getHeight:function(){return"auto"===this.rect.height?this.parts.panel.getClientRect().height:this.rect.height},setTriangle:function(a,b){var c=this.parts.triangleOuter,f=this.parts.triangleInner;this.triangleSide&&(c.removeClass("cke_balloon_triangle_"+this.triangleSide),c.removeClass("cke_balloon_triangle_align_"+this.triangleAlign),f.removeClass("cke_balloon_triangle_"+this.triangleSide));this.triangleSide=a;this.triangleAlign= +b;c.addClass("cke_balloon_triangle_"+a);c.addClass("cke_balloon_triangle_align_"+b);f.addClass("cke_balloon_triangle_"+a)},registerFocusable:function(a){this.editor.focusManager.add(a);this.focusables[a.getUniqueId()]=a},deregisterFocusable:function(a){this.editor.focusManager.remove(a);delete this.focusables[a.getUniqueId()]},addShowListener:function(a){var b=CKEDITOR.tools.getNextNumber();this.showListeners[b]=a;this.rect.visible&&this.activateShowListener(b);var c=this;return{removeListener:function(){c.removeShowListener(b)}}}, +removeShowListener:function(a){this.deactivateShowListener(a);delete this.showListeners[a]},activateShowListener:function(a){this.activeShowListeners[a]=this.showListeners[a].call(this)},deactivateShowListener:function(a){this.activeShowListeners[a]&&this.activeShowListeners[a].removeListener();delete this.activeShowListeners[a]},activateShowListeners:function(){for(var a in this.showListeners)this.activateShowListener(a)},deactivateShowListeners:function(){for(var a in this.activeShowListeners)this.deactivateShowListener(a)}, +destroy:function(){this.deactivateShowListeners();this.parts.panel.remove()},setTitle:function(a){this.parts.title.setHtml(a)},_getAlignments:function(a,b,c){return{"right vcenter":{top:a.top+a.height/2-c/2,left:a.right+this.triangleWidth},"left vcenter":{top:a.top+a.height/2-c/2,left:a.left-b-this.triangleWidth},"top hcenter":{top:a.top-c-this.triangleHeight,left:a.left+a.width/2-b/2},"top left":{top:a.top-c-this.triangleHeight,left:a.left+a.width/2-this.triangleMinDistance},"top right":{top:a.top- +c-this.triangleHeight,left:a.right-a.width/2-b+this.triangleMinDistance},"bottom hcenter":{top:a.bottom+this.triangleHeight,left:a.left+a.width/2-b/2},"bottom left":{top:a.bottom+this.triangleHeight,left:a.left+a.width/2-this.triangleMinDistance},"bottom right":{top:a.bottom+this.triangleHeight,left:a.right-a.width/2-b+this.triangleMinDistance}}},_adjustElementRect:function(a,b){a.left=Math.max(b.left,Math.min(b.right-1,a.left));a.right=Math.max(b.left,Math.min(b.right,a.right));a.top=Math.max(b.top, +Math.min(b.bottom-1,a.top));a.bottom=Math.max(b.top,Math.min(b.bottom,a.bottom))},_getViewPaneRect:function(a){var b=a.getScrollPosition();a=a.getViewPaneSize();return{top:b.y,bottom:b.y+a.height,left:b.x,right:b.x+a.width}}};CKEDITOR.event.implementOn(CKEDITOR.ui.balloonPanel.prototype)})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/kama/balloonpanel.css b/src/static/ckeditor/plugins/balloonpanel/skins/kama/balloonpanel.css new file mode 100644 index 00000000..9bcc3fa0 --- /dev/null +++ b/src/static/ckeditor/plugins/balloonpanel/skins/kama/balloonpanel.css @@ -0,0 +1,220 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon +{ + position: absolute; + z-index: 10000; + + background: #fff; + border: 1px solid #b2b2b2; + border-bottom-color: #999; + + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, .15); + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .15); + box-shadow: 0 0 3px rgba(0, 0, 0, .15); + + outline: none; +} + +.cke_balloon_title +{ + font-weight: bold; + font-size: 14px; + cursor: default; + + color: #474747; + text-shadow: 0 1px 0 rgba(255,255,255,.75); + + padding: 3px 3px 8px; + border-bottom: 1px solid #eee; + + -moz-border-radius: 2px 2px 0 0; + -webkit-border-radius: 2px 2px 0 0; + border-radius: 2px 2px 0 0; + + -moz-box-shadow: 0 1px 0 #fff inset; + -webkit-box-shadow: 0 1px 0 #fff inset; + box-shadow: 0 1px 0 #fff inset; +} + +/* The close button at the top of the panel. */ +a.cke_balloon_close_button +{ + background-image: url(../../../../skins/kama/images/sprites.png); + background-repeat: no-repeat; + background-position: 0 -1022px; + position: absolute; + cursor: pointer; + text-align: center; + height: 20px; + width: 20px; + top: 5px; +} + +a.cke_balloon_close_button:hover { + background-position: 0 -1045px; +} + +.cke_balloon_content +{ + overflow: hidden; + min-height: 68px; +} + +.cke_balloon_close_button:hover +{ + opacity: 1; + filter: alpha(opacity = 100); +} + +.cke_balloon_close_button span +{ + display: none; +} + +.cke_ltr .cke_balloon_close_button +{ + right: 5px; +} + +.cke_rtl .cke_balloon_close_button +{ + left: 6px; +} + +.cke_balloon_triangle +{ + position: absolute; + border-style: solid; + display: block; + width: 0; + height: 0; +} + +.cke_balloon_triangle_inner +{ + z-index: 0; +} + +.cke_balloon_triangle_outer +{ + z-index: 0; +} + +/* side: [ bottom, top ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_bottom, + .cke_balloon_triangle_outer.cke_balloon_triangle_top + { + border-color: #6B6B6B transparent; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_bottom, + .cke_balloon_triangle_inner.cke_balloon_triangle_top + { + left: -20px; + } + +/* side: [ bottom ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_bottom + { + border-width: 20px 20px 0; + bottom: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_bottom + { + border-color: #fff transparent; + border-width: 20px 20px 0; + top: -21px; + } + +/* side: [ top ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_top + { + border-width: 0 20px 20px; + top: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_top + { + border-color: #fff transparent; + border-width: 0 20px 20px; + top: 1px; + } + +/* side: [ left, right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_left, + .cke_balloon_triangle_outer.cke_balloon_triangle_right + { + border-color: transparent #6B6B6B; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_left, + .cke_balloon_triangle_inner.cke_balloon_triangle_right + { + border-color: transparent #fff; + top: -20px; + } + +/* side: [ left ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_left + { + border-width: 20px 20px 20px 0; + left: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_left + { + border-color: transparent #fff; + border-width: 20px 20px 20px 0; + left: 1px; + } + +/* side: [ right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_right + { + border-width: 20px 0 20px 20px; + right: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_right + { + border-width: 20px 0 20px 20px; + right: 1px; + } + + +/* align: [ hcenter ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_hcenter + { + left: 50%; + margin-left: -20px; + } + +/* align: [ left ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_left + { + left: 20px; + margin-left: 0; + } + +/* align: [ right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_right + { + right: 20px; + margin-left: 0; + } + +/* align: [ vcenter ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_vcenter + { + top: 50%; + margin-top: -20px; + } diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/balloonpanel.css b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/balloonpanel.css new file mode 100644 index 00000000..2df0b710 --- /dev/null +++ b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/balloonpanel.css @@ -0,0 +1,223 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon +{ + position: absolute; + z-index: 10000; + + background: #fff; + border: 2px solid #aaa; + outline: none; +} + +.cke_balloon_title +{ + font-weight: bold; + font-size: 12px; + cursor: default; + + color: #484848; + + padding: 12px 30px 12px 12px; /* Let's the title and close don't overlap each other - padding-right. */ + background: #f8f8f8; +} + +/* The close button at the top of the panel. */ +a.cke_balloon_close_button +{ + background-image: url(images/close.png); + background-repeat: no-repeat; + background-position: 50% -1px; + position: absolute; + cursor: pointer; + text-align: center; + height: 16px; + width: 16px; + top: 8px; + z-index: 5; + opacity: 0.7; + filter: alpha(opacity = 70); + border: 2px solid transparent; + border-radius: 2px; +} + +a.cke_balloon_close_button:focus, +a.cke_balloon_close_button:active +{ + outline: none; + border: 2px solid #0079f7; +} + +.cke_balloon_content +{ + overflow: hidden; + min-height: 68px; + padding: 0 6px 6px 6px; +} + +.cke_balloon_close_button:hover +{ + opacity: 1; + filter: alpha(opacity = 100); +} + +.cke_balloon_close_button:focus:hover +{ + opacity: 1; + filter: alpha(opacity = 100); + border: 2px solid #139FF7; +} + +.cke_hidpi .cke_balloon_close_button +{ + background-image: url(images/hidpi/close.png); + background-size: 16px; +} + +.cke_balloon_close_button span +{ + display: none; +} + +.cke_ltr .cke_balloon_close_button +{ + right: 10px; +} + +.cke_rtl .cke_balloon_close_button +{ + left: 10px; +} + +.cke_balloon_triangle +{ + position: absolute; + border-style: solid; + display: block; + width: 0; + height: 0; +} + +.cke_balloon_triangle_inner +{ + z-index: 0; +} + +.cke_balloon_triangle_outer +{ + z-index: 0; +} + +/* side: [ bottom, top ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_bottom, +.cke_balloon_triangle_outer.cke_balloon_triangle_top +{ + border-color: #999 transparent; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_bottom, +.cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + left: -20px; +} + +/* side: [ bottom ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_bottom +{ + border-width: 20px 20px 0; + bottom: -20px; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_bottom +{ + border-color: #fff transparent; + border-width: 20px 20px 0; + top: -22px; +} + +/* side: [ top ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_top +{ + border-width: 0 20px 20px; + top: -20px; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + border-color: #f8f8f8 transparent; + border-width: 0 20px 20px; + top: 2px; +} + +/* side: [ left, right ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_left, +.cke_balloon_triangle_outer.cke_balloon_triangle_right +{ + border-color: transparent #999; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_left, +.cke_balloon_triangle_inner.cke_balloon_triangle_right +{ + border-color: transparent #fff; + top: -20px; +} + +/* side: [ left ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_left +{ + border-width: 20px 20px 20px 0; + left: -20px; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_left +{ + border-color: transparent #fff; + border-width: 20px 20px 20px 0; + left: 2px; +} + +/* side: [ right ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_right +{ + border-width: 20px 0 20px 20px; + right: -20px; +} + +.cke_balloon_triangle_inner.cke_balloon_triangle_right +{ + border-width: 20px 0 20px 20px; + right: 2px; +} + + +/* align: [ hcenter ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_align_hcenter +{ + left: 50%; + margin-left: -20px; +} + +/* align: [ left ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_align_left +{ + left: 20px; + margin-left: 0; +} + +/* align: [ right ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_align_right +{ + right: 20px; + margin-left: 0; +} + +/* align: [ vcenter ] */ +.cke_balloon_triangle_outer.cke_balloon_triangle_align_vcenter +{ + top: 50%; + margin-top: -20px; +} diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/close.png b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/close.png new file mode 100644 index 00000000..40caa6dd Binary files /dev/null and b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/close.png differ diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/hidpi/close.png b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/hidpi/close.png new file mode 100644 index 00000000..0e4aa2ef Binary files /dev/null and b/src/static/ckeditor/plugins/balloonpanel/skins/moono-lisa/images/hidpi/close.png differ diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono/balloonpanel.css b/src/static/ckeditor/plugins/balloonpanel/skins/moono/balloonpanel.css new file mode 100644 index 00000000..5286b4f8 --- /dev/null +++ b/src/static/ckeditor/plugins/balloonpanel/skins/moono/balloonpanel.css @@ -0,0 +1,237 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon +{ + position: absolute; + z-index: 10000; + + background: #fff; + border: 1px solid #b2b2b2; + border-bottom-color: #999; + + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, .15); + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .15); + box-shadow: 0 0 3px rgba(0, 0, 0, .15); + + outline: none; +} + +.cke_balloon_title +{ + font-weight: bold; + font-size: 13px; + cursor: default; + + color: #474747; + text-shadow: 0 1px 0 rgba(255,255,255,.75); + + border-bottom: 1px solid #999; + padding: 6px 10px; + + -moz-border-radius: 2px 2px 0 0; + -webkit-border-radius: 2px 2px 0 0; + border-radius: 2px 2px 0 0; + + -moz-box-shadow: 0 1px 0 #fff inset; + -webkit-box-shadow: 0 1px 0 #fff inset; + box-shadow: 0 1px 0 #fff inset; + + /* Let's the title and close don't overlap each other */ + padding-right: 30px; + + background: #cfd1cf; + background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#cfd1cf)); + background-image: -moz-linear-gradient(top, #f5f5f5, #cfd1cf); + background-image: -webkit-linear-gradient(top, #f5f5f5, #cfd1cf); + background-image: -o-linear-gradient(top, #f5f5f5, #cfd1cf); + background-image: -ms-linear-gradient(top, #f5f5f5, #cfd1cf); + background-image: linear-gradient(top, #f5f5f5, #cfd1cf); + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#f5f5f5', endColorstr='#cfd1cf'); +} + +/* The close button at the top of the panel. */ +a.cke_balloon_close_button +{ + background-image: url(images/close.png); + background-repeat: no-repeat; + background-position: 50%; + position: absolute; + cursor: pointer; + text-align: center; + height: 20px; + width: 20px; + top: 3px; + z-index: 5; + opacity: 0.8; + filter: alpha(opacity = 80); +} + +.cke_balloon_content +{ + overflow: hidden; + min-height: 68px; +} + +.cke_balloon_close_button:hover +{ + opacity: 1; + filter: alpha(opacity = 100); +} + +.cke_hidpi .cke_balloon_close_button +{ + background-image: url(images/hidpi/close.png); + background-size: 16px; +} + +.cke_balloon_close_button span +{ + display: none; +} + +.cke_ltr .cke_balloon_close_button +{ + right: 5px; +} + +.cke_rtl .cke_balloon_close_button +{ + left: 6px; +} + +.cke_balloon_triangle +{ + position: absolute; + border-style: solid; + display: block; + width: 0; + height: 0; +} + +.cke_balloon_triangle_inner +{ + z-index: 0; +} + +.cke_balloon_triangle_outer +{ + z-index: 0; +} + +/* side: [ bottom, top ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_bottom, + .cke_balloon_triangle_outer.cke_balloon_triangle_top + { + border-color: #6B6B6B transparent; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_bottom, + .cke_balloon_triangle_inner.cke_balloon_triangle_top + { + left: -20px; + } + +/* side: [ bottom ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_bottom + { + border-width: 20px 20px 0; + bottom: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_bottom + { + border-color: #fff transparent; + border-width: 20px 20px 0; + top: -21px; + } + +/* side: [ top ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_top + { + border-width: 0 20px 20px; + top: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_top + { + border-color: #f5f5f5 transparent; + border-width: 0 20px 20px; + top: 1px; + } + +/* side: [ left, right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_left, + .cke_balloon_triangle_outer.cke_balloon_triangle_right + { + border-color: transparent #6B6B6B; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_left, + .cke_balloon_triangle_inner.cke_balloon_triangle_right + { + border-color: transparent #fff; + top: -20px; + } + +/* side: [ left ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_left + { + border-width: 20px 20px 20px 0; + left: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_left + { + border-color: transparent #fff; + border-width: 20px 20px 20px 0; + left: 1px; + } + +/* side: [ right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_right + { + border-width: 20px 0 20px 20px; + right: -20px; + } + + .cke_balloon_triangle_inner.cke_balloon_triangle_right + { + border-width: 20px 0 20px 20px; + right: 1px; + } + + +/* align: [ hcenter ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_hcenter + { + left: 50%; + margin-left: -20px; + } + +/* align: [ left ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_left + { + left: 20px; + margin-left: 0; + } + +/* align: [ right ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_right + { + right: 20px; + margin-left: 0; + } + +/* align: [ vcenter ] */ + .cke_balloon_triangle_outer.cke_balloon_triangle_align_vcenter + { + top: 50%; + margin-top: -20px; + } diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/close.png b/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/close.png new file mode 100644 index 00000000..04b9c97d Binary files /dev/null and b/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/close.png differ diff --git a/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/hidpi/close.png b/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/hidpi/close.png new file mode 100644 index 00000000..e406c2c3 Binary files /dev/null and b/src/static/ckeditor/plugins/balloonpanel/skins/moono/images/hidpi/close.png differ diff --git a/src/static/ckeditor/plugins/balloontoolbar/plugin.js b/src/static/ckeditor/plugins/balloontoolbar/plugin.js new file mode 100644 index 00000000..11534c66 --- /dev/null +++ b/src/static/ckeditor/plugins/balloontoolbar/plugin.js @@ -0,0 +1,20 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function g(a,b){this.editor=a;this.options=b;this.toolbar=new CKEDITOR.ui.balloonToolbar(a);this.options&&"undefined"===typeof this.options.priority&&(this.options.priority=CKEDITOR.plugins.balloontoolbar.PRIORITY.MEDIUM);this._loadButtons()}function h(a){this.editor=a;this._contexts=[];this._listeners=[];this._attachListeners()}var l=function(){return CKEDITOR.tools.array.filter(["matches","msMatchesSelector","webkitMatchesSelector","mozMatchesSelector","oMatchesSelector"],function(a){return window.HTMLElement? +a in HTMLElement.prototype:!1})[0]}();CKEDITOR.ui.balloonToolbarView=function(a,b){b=CKEDITOR.tools.extend(b||{},{width:"auto",triangleWidth:7,triangleHeight:7});CKEDITOR.ui.balloonPanel.call(this,a,b);this._listeners=[]};CKEDITOR.ui.balloonToolbar=function(a,b){this._view=new CKEDITOR.ui.balloonToolbarView(a,b);this._items={}};CKEDITOR.ui.balloonToolbar.prototype.attach=function(a,b){this._view.renderItems(this._items);this._view.attach(a,{focusElement:!1,show:!b})};CKEDITOR.ui.balloonToolbar.prototype.show= +function(){this._view.show()};CKEDITOR.ui.balloonToolbar.prototype.hide=function(){this._view.hide()};CKEDITOR.ui.balloonToolbar.prototype.reposition=function(){this._view.reposition()};CKEDITOR.ui.balloonToolbar.prototype.addItem=function(a,b){this._items[a]=b};CKEDITOR.ui.balloonToolbar.prototype.addItems=function(a){for(var b in a)this.addItem(b,a[b])};CKEDITOR.ui.balloonToolbar.prototype.getItem=function(a){return this._items[a]};CKEDITOR.ui.balloonToolbar.prototype.deleteItem=function(a){this._items[a]&& +(delete this._items[a],this._view.renderItems(this._items))};CKEDITOR.ui.balloonToolbar.prototype.destroy=function(){for(var a in this._items)this._items[a].destroy&&this._items[a].destroy(),this.deleteItem(a);this._pointedElement=null;this._view.destroy()};CKEDITOR.ui.balloonToolbar.prototype.refresh=function(){for(var a in this._items){var b=this._view.editor.getCommand(this._items[a].command);b&&b.refresh(this._view.editor,this._view.editor.elementPath())}};g.prototype={destroy:function(){this.toolbar&& +this.toolbar.destroy()},show:function(a){a&&this.toolbar.attach(a);this.toolbar.show()},hide:function(){this.toolbar.hide()},refresh:function(){this.toolbar.refresh()},_matchRefresh:function(a,b){var c=null;this.options.refresh&&(c=this.options.refresh(this.editor,a,b)||null)&&!1===c instanceof CKEDITOR.dom.element&&(c=a&&a.lastElement||this.editor.editable());return c},_matchWidget:function(){var a=this.options.widgets,b=null;if(a){var c=this.editor.widgets&&this.editor.widgets.focused&&this.editor.widgets.focused.name; +"string"===typeof a&&(a=a.split(","));-1!==CKEDITOR.tools.array.indexOf(a,c)&&(b=this.editor.widgets.focused.element)}return b},_matchElement:function(a){return this.options.cssSelector&&l&&a.$[l](this.options.cssSelector)?a:null},_loadButtons:function(){var a=this.options.buttons;a&&(a=a.split(","),CKEDITOR.tools.array.forEach(a,function(a){var c=this.editor.ui.create(a);c&&this.toolbar.addItem(a,c)},this))}};h.prototype={create:function(a){a=new CKEDITOR.plugins.balloontoolbar.context(this.editor, +a);this.add(a);return a},add:function(a){this._contexts.push(a)},check:function(a){function b(a,b,c){f(a,function(a){if(!k||k.options.priority>a.options.priority){var d=b(a,c);d instanceof CKEDITOR.dom.element&&(g=d,k=a)}})}function c(a,b){return a._matchElement(b)}a||(a=this.editor.getSelection(),CKEDITOR.tools.array.forEach(a.getRanges(),function(a){a.shrink(CKEDITOR.SHRINK_ELEMENT,!0)}));if(a){var f=CKEDITOR.tools.array.forEach,d=a.getRanges()[0],e=d&&d.startPath(),g,k;b(this._contexts,function(b){return b._matchRefresh(e, +a)});b(this._contexts,function(a){return a._matchWidget()});if(e)for((d=a.getSelectedElement())&&!d.isReadOnly()&&b(this._contexts,c,d),d=0;d<e.elements.length;d++){var h=e.elements[d];h.isReadOnly()||b(this._contexts,c,h)}this.hide();k&&k.show(g)}},hide:function(){CKEDITOR.tools.array.forEach(this._contexts,function(a){a.hide()})},destroy:function(){CKEDITOR.tools.array.forEach(this._listeners,function(a){a.removeListener()});this._listeners.splice(0,this._listeners.length);this._clear()},_clear:function(){CKEDITOR.tools.array.forEach(this._contexts, +function(a){a.destroy()});this._contexts.splice(0,this._contexts.length)},_refresh:function(){CKEDITOR.tools.array.forEach(this._contexts,function(a){a.refresh()})},_attachListeners:function(){this._listeners.push(this.editor.on("destroy",function(){this.destroy()},this),this.editor.on("selectionChange",function(){this.check()},this),this.editor.on("mode",function(){this.hide()},this,null,9999),this.editor.on("blur",function(){this.hide()},this,null,9999),this.editor.on("afterInsertHtml",function(){this.check(); +this._refresh()},this,null,9999))}};var m=!1,n=!1;CKEDITOR.plugins.add("balloontoolbar",{requires:"balloonpanel",isSupportedEnvironment:function(){return!CKEDITOR.env.ie||8<CKEDITOR.env.version},beforeInit:function(a){n||(CKEDITOR.document.appendStyleSheet(this.path+"skins/default.css"),CKEDITOR.document.appendStyleSheet(this.path+"skins/"+CKEDITOR.skin.name+"/balloontoolbar.css"),n=!0);a.balloonToolbars=new CKEDITOR.plugins.balloontoolbar.contextManager(a)},init:function(a){a.balloonToolbars=new CKEDITOR.plugins.balloontoolbar.contextManager(a); +m||(m=!0,CKEDITOR.ui.balloonToolbarView.prototype=CKEDITOR.tools.extend({},CKEDITOR.ui.balloonPanel.prototype),CKEDITOR.ui.balloonToolbarView.prototype.build=function(){CKEDITOR.ui.balloonPanel.prototype.build.call(this);this.parts.panel.addClass("cke_balloontoolbar");this.parts.title.remove();this.deregisterFocusable(this.parts.close);this.parts.close.remove()},CKEDITOR.ui.balloonToolbarView.prototype.show=function(){function a(){this.reposition()}if(!this.rect.visible){var c=this.editor,f=c.editable(), +d=f.isInline()?f:f.getDocument(),e=CKEDITOR.document.getWindow();CKEDITOR.env.iOS&&!f.isInline()&&(d=c.window.getFrame().getParent());this._detachListeners();this._listeners.push(c.on("change",a,this));this._listeners.push(c.on("resize",a,this));this._listeners.push(e.on("resize",a,this));this._listeners.push(e.on("scroll",a,this));this._listeners.push(d.on("scroll",a,this));CKEDITOR.ui.balloonPanel.prototype.show.call(this)}},CKEDITOR.ui.balloonToolbarView.prototype.reposition=function(){this.rect.visible&& +this.attach(this._pointedElement,{focusElement:!1})},CKEDITOR.ui.balloonToolbarView.prototype.hide=function(){this._detachListeners();CKEDITOR.ui.balloonPanel.prototype.hide.call(this)},CKEDITOR.ui.balloonToolbarView.prototype.blur=function(a){a&&this.editor.focus()},CKEDITOR.ui.balloonToolbarView.prototype._getAlignments=function(a,c,f){a=CKEDITOR.ui.balloonPanel.prototype._getAlignments.call(this,a,c,f);return{"bottom hcenter":a["bottom hcenter"],"top hcenter":a["top hcenter"]}},CKEDITOR.ui.balloonToolbarView.prototype._detachListeners= +function(){this._listeners.length&&(CKEDITOR.tools.array.forEach(this._listeners,function(a){a.removeListener()}),this._listeners=[])},CKEDITOR.ui.balloonToolbarView.prototype.destroy=function(){this._deregisterItemFocusables();CKEDITOR.ui.balloonPanel.prototype.destroy.call(this);this._detachListeners()},CKEDITOR.ui.balloonToolbarView.prototype.renderItems=function(a){var c=[],f=CKEDITOR.tools.object.keys(a),d=!1;this._deregisterItemFocusables();CKEDITOR.tools.array.forEach(f,function(e){CKEDITOR.ui.richCombo&& +a[e]instanceof CKEDITOR.ui.richCombo&&d?(d=!1,c.push("\x3c/span\x3e")):CKEDITOR.ui.richCombo&&a[e]instanceof CKEDITOR.ui.richCombo||d||(d=!0,c.push('\x3cspan class\x3d"cke_toolgroup"\x3e'));a[e].render(this.editor,c)},this);d&&c.push("\x3c/span\x3e");this.parts.content.setHtml(c.join(""));this.parts.content.unselectable();CKEDITOR.tools.array.forEach(this.parts.content.find("a").toArray(),function(a){a.setAttribute("draggable","false");this.registerFocusable(a)},this)},CKEDITOR.ui.balloonToolbarView.prototype.attach= +function(a,c){this._pointedElement=a;CKEDITOR.ui.balloonPanel.prototype.attach.call(this,a,c)},CKEDITOR.ui.balloonToolbarView.prototype._deregisterItemFocusables=function(){var a=this.focusables,c;for(c in a)this.parts.content.contains(a[c])&&this.deregisterFocusable(a[c])})}});CKEDITOR.plugins.balloontoolbar={context:g,contextManager:h,PRIORITY:{LOW:999,MEDIUM:500,HIGH:10}}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/balloontoolbar/skins/default.css b/src/static/ckeditor/plugins/balloontoolbar/skins/default.css new file mode 100644 index 00000000..c66b5856 --- /dev/null +++ b/src/static/ckeditor/plugins/balloontoolbar/skins/default.css @@ -0,0 +1,95 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon.cke_balloontoolbar +{ + position: absolute; + z-index: 10000; + outline: none; + background: #f8f8f8; + border: 1px solid #d1d1d1; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle +{ + position: absolute; + border-style: solid; + display: block; + width: 0; + height: 0; +} + +/* The .cke_balloon_content container height will be stretched to children height, so padding is properly applied. */ +.cke_balloon.cke_balloontoolbar .cke_balloon_content +{ + float: left; + min-height: 10px; + padding: 3px; +} + +/* Removes bottom margins from buttons/combos so only '.cke_balloon_content' padding decides about balloon toolbar padding. */ +.cke_balloon.cke_balloontoolbar .cke_toolgroup, +.cke_balloon.cke_balloontoolbar .cke_combo_button +{ + margin-bottom: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_content > span:last-child > a.cke_combo_button, +.cke_balloon.cke_balloontoolbar .cke_balloon_content > span:last-child.cke_toolgroup { + margin-right: 0; + padding-right: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer +{ + z-index: 0; +} + +/* align: [ hcenter ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_align_hcenter +{ + left: 50%; + margin-left: -7px; +} + +/* side: [ bottom, top ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_bottom, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_top +{ + border-color: #d1d1d1 transparent; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_bottom, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + border-color: #f8f8f8 transparent; + left: -7px; +} + +/* side: [ bottom ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_bottom +{ + border-width: 7px 7px 0; + bottom: -7px; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_bottom +{ + border-width: 7px 7px 0; + top: -8px; +} + +/* side: [ top ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_top +{ + border-width: 0 7px 7px; + top: -7px; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + border-width: 0 7px 7px; +} diff --git a/src/static/ckeditor/plugins/balloontoolbar/skins/kama/balloontoolbar.css b/src/static/ckeditor/plugins/balloontoolbar/skins/kama/balloontoolbar.css new file mode 100644 index 00000000..b6578832 --- /dev/null +++ b/src/static/ckeditor/plugins/balloontoolbar/skins/kama/balloontoolbar.css @@ -0,0 +1,30 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon.cke_balloontoolbar +{ + border: 1px solid #D3D3D3; + background: #fff url(../../../../skins/kama/images/sprites.png) repeat-x 0 -150px; + background: linear-gradient(to bottom, #fff, #d3d3d3 20px); + padding: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_content +{ + padding: 4px; +} + +/* side: [ bottom, top ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_bottom, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_top, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_bottom +{ + border-color: #D3D3D3 transparent; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + border-color: #fff transparent; +} diff --git a/src/static/ckeditor/plugins/balloontoolbar/skins/moono-lisa/balloontoolbar.css b/src/static/ckeditor/plugins/balloontoolbar/skins/moono-lisa/balloontoolbar.css new file mode 100644 index 00000000..8c003a18 --- /dev/null +++ b/src/static/ckeditor/plugins/balloontoolbar/skins/moono-lisa/balloontoolbar.css @@ -0,0 +1,44 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon.cke_balloontoolbar span:last-child a:last-child::after, +.cke_balloon.cke_balloontoolbar span:last-child a:last-child:hover::after, +.cke_balloon.cke_balloontoolbar span:last-child::after +{ + border-right: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_combo +{ + margin-bottom: 0; + margin-right: 2px; +} + +.cke_balloon.cke_balloontoolbar .cke_combo:first-child a.cke_combo_button +{ + margin-left: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_combo:last-child +{ + margin-right: 0; +} + +/* Negative value for left margin is needed to overlap separator (#2535). */ +.cke_balloon.cke_balloontoolbar .cke_combo a.cke_combo_button +{ + margin: 0 1px 0 -2px; +} + +/* Combo states (#1682). */ +.cke_balloon.cke_balloontoolbar .cke_combo_on a.cke_combo_button, +.cke_balloon.cke_balloontoolbar .cke_combo_off a.cke_combo_button:hover, +.cke_balloon.cke_balloontoolbar .cke_combo_off a.cke_combo_button:focus, +.cke_balloon.cke_balloontoolbar .cke_combo_off a.cke_combo_button:active +{ + border: none; + padding: 1px; + outline: 1px solid #bcbcbc; +} diff --git a/src/static/ckeditor/plugins/balloontoolbar/skins/moono/balloontoolbar.css b/src/static/ckeditor/plugins/balloontoolbar/skins/moono/balloontoolbar.css new file mode 100644 index 00000000..7beed84b --- /dev/null +++ b/src/static/ckeditor/plugins/balloontoolbar/skins/moono/balloontoolbar.css @@ -0,0 +1,34 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_balloon.cke_balloontoolbar +{ + background: linear-gradient(to bottom, #f5f5f5, #cfd1cf); + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#f5f5f5', endColorstr='#cfd1cf'); + border: 1px solid #b6b6b6; + border-radius: 0; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_content +{ + padding: 4px; +} + +/* side: [ bottom, top ] */ +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_bottom, +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_outer.cke_balloon_triangle_top +{ + border-color: #b6b6b6 transparent; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_bottom +{ + border-color: #cfd1cf transparent; +} + +.cke_balloon.cke_balloontoolbar .cke_balloon_triangle_inner.cke_balloon_triangle_top +{ + border-color: #f5f5f5 transparent; +} diff --git a/src/static/ckeditor/plugins/bbcode/plugin.js b/src/static/ckeditor/plugins/bbcode/plugin.js new file mode 100644 index 00000000..ffdc9998 --- /dev/null +++ b/src/static/ckeditor/plugins/bbcode/plugin.js @@ -0,0 +1,23 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){CKEDITOR.on("dialogDefinition",function(a){var b;b=a.data.name;a=a.data.definition;"link"==b?(a.removeContents("target"),a.removeContents("upload"),a.removeContents("advanced"),b=a.getContents("info"),b.remove("emailSubject"),b.remove("emailBody")):"image"==b&&(a.removeContents("advanced"),b=a.getContents("Link"),b.remove("cmbTarget"),b=a.getContents("info"),b.remove("txtAlt"),b.remove("basic"))});var l={b:"strong",u:"u",i:"em",s:"s",color:"span",size:"span",left:"div",right:"div",center:"div", +justify:"div",quote:"blockquote",code:"code",url:"a",email:"span",img:"span","*":"li",list:"ol"},x={strong:"b",b:"b",u:"u",em:"i",i:"i",s:"s",code:"code",li:"*"},m={strong:"b",em:"i",u:"u",s:"s",li:"*",ul:"list",ol:"list",code:"code",a:"link",img:"img",blockquote:"quote"},y={color:"color",size:"font-size",left:"text-align",center:"text-align",right:"text-align",justify:"text-align"},z={url:"href",email:"mailhref",quote:"cite",list:"listType"},n=CKEDITOR.dtd,A=CKEDITOR.tools.extend({table:1},n.$block, +n.$listItem,n.$tableContent,n.$list),C=/\s*(?:;\s*|$)/,q={smiley:":)",sad:":(",wink:";)",laugh:":D",cheeky:":P",blush:":*)",surprise:":-o",indecision:":|",angry:"\x3e:(",angel:"o:)",cool:"8-)",devil:"\x3e:-)",crying:";(",kiss:":-*"},B={},r=[],t;for(t in q)B[q[t]]=t,r.push(q[t].replace(/\(|\)|\:|\/|\*|\-|\|/g,function(a){return"\\"+a}));var r=new RegExp(r.join("|"),"g"),D=function(){var a=[],b={nbsp:" ",shy:"­"},c;for(c in b)a.push(c);a=new RegExp("\x26("+a.join("|")+");","g");return function(c){return c.replace(a, +function(e,a){return b[a]})}}();CKEDITOR.BBCodeParser=function(){this._={bbcPartsRegex:/(?:\[([^\/\]=]*?)(?:=([^\]]*?))?\])|(?:\[\/([a-z]{1,16})\])/ig}};CKEDITOR.BBCodeParser.prototype={parse:function(a){for(var b,c,k=0;b=this._.bbcPartsRegex.exec(a);)if(c=b.index,c>k&&(k=a.substring(k,c),this.onText(k,1)),k=this._.bbcPartsRegex.lastIndex,(c=(b[1]||b[3]||"").toLowerCase())&&!l[c])this.onText(b[0]);else if(b[1]){var e=l[c],g={},h={};b=b[2];if("left"==c||"right"==c||"center"==c||"justify"==c)b=c;if(b)if("list"== +c&&(isNaN(b)?/^[a-z]+$/.test(b)?b="lower-alpha":/^[A-Z]+$/.test(b)&&(b="upper-alpha"):b="decimal"),y[c]){"size"==c&&(b+="%");h[y[c]]=b;b=g;var f="",d=void 0;for(d in h)var u=(d+":"+h[d]).replace(C,";"),f=f+u;b.style=f}else z[c]&&(g[z[c]]=CKEDITOR.tools.htmlDecode(b));if("email"==c||"img"==c)g.bbcode=c;this.onTagOpen(e,g,CKEDITOR.dtd.$empty[e])}else if(b[3])this.onTagClose(l[c]);if(a.length>k)this.onText(a.substring(k,a.length),1)}};CKEDITOR.htmlParser.fragment.fromBBCode=function(a){function b(e){if(0< +h.length)for(var a=0;a<h.length;a++){var b=h[a],c=b.name,g=CKEDITOR.dtd[c],f=d.name&&CKEDITOR.dtd[d.name];f&&!f[c]||e&&g&&!g[e]&&CKEDITOR.dtd[e]||(b=b.clone(),b.parent=d,d=b,h.splice(a,1),a--)}}function c(a,e){var b=d.children.length,c=0<b&&d.children[b-1],b=!c&&v.getRule(m[d.name],"breakAfterOpen"),c=c&&c.type==CKEDITOR.NODE_ELEMENT&&v.getRule(m[c.name],"breakAfterClose"),g=a&&v.getRule(m[a],e?"breakBeforeClose":"breakBeforeOpen");f&&(b||c||g)&&f--;f&&a in A&&f++;for(;f&&f--;)d.children.push(new CKEDITOR.htmlParser.element("br"))} +function k(a,e){c(a.name,1);e=e||d||g;var b=e.children.length;a.previous=0<b&&e.children[b-1]||null;a.parent=e;e.children.push(a);a.returnPoint&&(d=a.returnPoint,delete a.returnPoint)}var e=new CKEDITOR.BBCodeParser,g=new CKEDITOR.htmlParser.fragment,h=[],f=0,d=g,u;e.onTagOpen=function(a,g){var f=new CKEDITOR.htmlParser.element(a,g);if(CKEDITOR.dtd.$removeEmpty[a])h.push(f);else{var w=d.name,p=w&&(CKEDITOR.dtd[w]||(d._.isBlockLike?CKEDITOR.dtd.div:CKEDITOR.dtd.span));if(p&&!p[a]){var p=!1,l;a==w? +k(d,d.parent):(a in CKEDITOR.dtd.$listItem?(e.onTagOpen("ul",{}),l=d):(k(d,d.parent),h.unshift(d)),p=!0);d=l?l:d.returnPoint||d.parent;if(p){e.onTagOpen.apply(this,arguments);return}}b(a);c(a);f.parent=d;f.returnPoint=u;u=0;f.isEmpty?k(f):d=f}};e.onTagClose=function(a){for(var e=h.length-1;0<=e;e--)if(a==h[e].name){h.splice(e,1);return}for(var b=[],c=[],g=d;g.type&&g.name!=a;)g._.isBlockLike||c.unshift(g),b.push(g),g=g.parent;if(g.type){for(e=0;e<b.length;e++)a=b[e],k(a,a.parent);d=g;k(g,g.parent); +g==d&&(d=d.parent);h=h.concat(c)}};e.onText=function(a){var e=CKEDITOR.dtd[d.name];if(!e||e["#"])c(),b(),a.replace(/(\r\n|[\r\n])|[^\r\n]*/g,function(a,e){if(void 0!==e&&e.length)f++;else if(a.length){var b=0;a.replace(r,function(e,c){k(new CKEDITOR.htmlParser.text(a.substring(b,c)),d);k(new CKEDITOR.htmlParser.element("smiley",{desc:B[e]}),d);b=c+e.length});b!=a.length&&k(new CKEDITOR.htmlParser.text(a.substring(b,a.length)),d)}})};for(e.parse(CKEDITOR.tools.htmlEncode(a));d.type!=CKEDITOR.NODE_DOCUMENT_FRAGMENT;)a= +d.parent,k(d,a),d=a;return g};var v=new (CKEDITOR.tools.createClass({$:function(){this._={output:[],rules:[]};this.setRules("list",{breakBeforeOpen:1,breakAfterOpen:1,breakBeforeClose:1,breakAfterClose:1});this.setRules("*",{breakBeforeOpen:1,breakAfterOpen:0,breakBeforeClose:1,breakAfterClose:0});this.setRules("quote",{breakBeforeOpen:1,breakAfterOpen:0,breakBeforeClose:0,breakAfterClose:1})},proto:{setRules:function(a,b){var c=this._.rules[a];c?CKEDITOR.tools.extend(c,b,!0):this._.rules[a]=b},getRule:function(a, +b){return this._.rules[a]&&this._.rules[a][b]},openTag:function(a){a in l&&(this.getRule(a,"breakBeforeOpen")&&this.lineBreak(1),this.write("[",a))},openTagClose:function(a){"br"==a?this._.output.push("\n"):a in l&&(this.write("]"),this.getRule(a,"breakAfterOpen")&&this.lineBreak(1))},attribute:function(a,b){"option"==a&&this.write("\x3d",b)},closeTag:function(a){a in l&&(this.getRule(a,"breakBeforeClose")&&this.lineBreak(1),"*"!=a&&this.write("[/",a,"]"),this.getRule(a,"breakAfterClose")&&this.lineBreak(1))}, +text:function(a){this.write(a)},comment:function(){},lineBreak:function(){!this._.hasLineBreak&&this._.output.length&&(this.write("\n"),this._.hasLineBreak=1)},write:function(){this._.hasLineBreak=0;var a=Array.prototype.join.call(arguments,"");this._.output.push(a)},reset:function(){this._.output=[];this._.hasLineBreak=0},getHtml:function(a){var b=this._.output.join("");a&&this.reset();return D(b)}}}));CKEDITOR.plugins.add("bbcode",{requires:"entities",beforeInit:function(a){CKEDITOR.tools.extend(a.config, +{enterMode:CKEDITOR.ENTER_BR,basicEntities:!1,entities:!1,fillEmptyBlocks:!1},!0);a.filter.disable();a.activeEnterMode=a.enterMode=CKEDITOR.ENTER_BR},init:function(a){function b(a){var b=a.data;a=CKEDITOR.htmlParser.fragment.fromBBCode(a.data.dataValue);var c=new CKEDITOR.htmlParser.basicWriter;a.writeHtml(c,k);a=c.getHtml(!0);b.dataValue=a}var c=a.config,k=new CKEDITOR.htmlParser.filter;k.addRules({elements:{blockquote:function(a){var b=new CKEDITOR.htmlParser.element("div");b.children=a.children; +a.children=[b];if(b=a.attributes.cite){var c=new CKEDITOR.htmlParser.element("cite");c.add(new CKEDITOR.htmlParser.text(b.replace(/^"|"$/g,"")));delete a.attributes.cite;a.children.unshift(c)}},span:function(a){var b;if(b=a.attributes.bbcode)"img"==b?(a.name="img",a.attributes.src=a.children[0].value,a.children=[]):"email"==b&&(a.name="a",a.attributes.href="mailto:"+a.children[0].value),delete a.attributes.bbcode},ol:function(a){a.attributes.listType?"decimal"!=a.attributes.listType&&(a.attributes.style= +"list-style-type:"+a.attributes.listType):a.name="ul";delete a.attributes.listType},a:function(a){a.attributes.href||(a.attributes.href=a.children[0].value)},smiley:function(a){a.name="img";var b=a.attributes.desc,h=c.smiley_images[CKEDITOR.tools.indexOf(c.smiley_descriptions,b)],h=CKEDITOR.tools.htmlEncode(c.smiley_path+h);a.attributes={src:h,"data-cke-saved-src":h,title:b,alt:b}}}});a.dataProcessor.htmlFilter.addRules({elements:{$:function(b){var c=b.attributes,h=CKEDITOR.tools.parseCssText(c.style, +1),f,d=b.name;if(d in x)d=x[d];else if("span"==d)if(f=h.color)d="color",f=CKEDITOR.tools.convertRgbToHex(f);else{if(f=h["font-size"])if(c=f.match(/(\d+)%$/))f=c[1],d="size"}else if("ol"==d||"ul"==d){if(f=h["list-style-type"])switch(f){case "lower-alpha":f="a";break;case "upper-alpha":f="A"}else"ol"==d&&(f=1);d="list"}else if("blockquote"==d){try{var k=b.children[0],l=b.children[1],m="cite"==k.name&&k.children[0].value;m&&(f='"'+m+'"',b.children=l.children)}catch(n){}d="quote"}else if("a"==d){if(f= +c.href)-1!==f.indexOf("mailto:")?(d="email",b.children=[new CKEDITOR.htmlParser.text(f.replace("mailto:",""))],f=""):((d=1==b.children.length&&b.children[0])&&d.type==CKEDITOR.NODE_TEXT&&d.value==f&&(f=""),d="url")}else if("img"==d){b.isEmpty=0;h=c["data-cke-saved-src"]||c.src;c=c.alt;if(h&&-1!=h.indexOf(a.config.smiley_path)&&c)return new CKEDITOR.htmlParser.text(q[c]);b.children=[new CKEDITOR.htmlParser.text(h)]}b.name=d;f&&(b.attributes.option=f);return null},div:function(a){var b=CKEDITOR.tools.parseCssText(a.attributes.style, +1)["text-align"]||"";if(b)return a.name=b,null},br:function(a){if((a=a.next)&&a.name in A)return!1}}},1);a.dataProcessor.writer=v;if(a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE)a.once("contentDom",function(){a.on("setData",b)});else a.on("setData",b)},afterInit:function(a){var b;a._.elementsPath&&(b=a._.elementsPath.filters)&&b.push(function(b){var k=b.getName(),e=m[k]||!1;"link"==e&&0===b.getAttribute("href").indexOf("mailto:")?e="email":"span"==k?b.getStyle("font-size")?e="size":b.getStyle("color")&& +(e="color"):"div"==k&&b.getStyle("text-align")?e=b.getStyle("text-align"):"img"==e&&(b=b.data("cke-saved-src")||b.getAttribute("src"))&&0===b.indexOf(a.config.smiley_path)&&(e="smiley");return e})}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/cloudservices/plugin.js b/src/static/ckeditor/plugins/cloudservices/plugin.js new file mode 100644 index 00000000..99d49f35 --- /dev/null +++ b/src/static/ckeditor/plugins/cloudservices/plugin.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){CKEDITOR.plugins.add("cloudservices",{requires:"filetools,ajax",onLoad:function(){function a(a,b,f,d){c.call(this,a,b,f);this.customToken=d}var c=CKEDITOR.fileTools.fileLoader;a.prototype=CKEDITOR.tools.extend({},c.prototype);a.prototype.upload=function(a,b){(a=a||this.editor.config.cloudServices_uploadUrl)?c.prototype.upload.call(this,a,b):CKEDITOR.error("cloudservices-no-upload-url")};CKEDITOR.plugins.cloudservices.cloudServicesLoader=a},beforeInit:function(a){var c=a.config.cloudServices_tokenUrl, +e={token:null,REFRESH_INTERVAL:a.CLOUD_SERVICES_TOKEN_INTERVAL||36E5,refreshToken:function(){CKEDITOR.ajax.load(c,function(b){b&&(e.token=b)})},init:function(){this.refreshToken();var b=window.setInterval(this.refreshToken,this.REFRESH_INTERVAL);a.once("destroy",function(){window.clearInterval(b)})}};c?e.init():CKEDITOR.error("cloudservices-no-token-url");a.on("fileUploadRequest",function(b){var a=b.data.fileLoader,d=b.data.requestData,c=a.customToken||e.token;a instanceof CKEDITOR.plugins.cloudservices.cloudServicesLoader&& +(d.file=d.upload,delete d.upload,c?b.data.fileLoader.xhr.setRequestHeader("Authorization",c):(CKEDITOR.error("cloudservices-no-token"),b.cancel()))},null,null,6);a.on("fileUploadResponse",function(a){var c=a.data.fileLoader,d=c.xhr,e;if(c instanceof CKEDITOR.plugins.cloudservices.cloudServicesLoader){a.stop();try{e=JSON.parse(d.responseText),a.data.response=e}catch(g){CKEDITOR.warn("filetools-response-error",{responseText:d.responseText})}}})}});CKEDITOR.plugins.cloudservices={cloudServicesLoader:null}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/codesnippet/lang/zh-cn.js b/src/static/ckeditor/plugins/codesnippet/lang/zh-cn.js index 5f6685c3..7f77cfb5 100755 --- a/src/static/ckeditor/plugins/codesnippet/lang/zh-cn.js +++ b/src/static/ckeditor/plugins/codesnippet/lang/zh-cn.js @@ -2,4 +2,4 @@ Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -CKEDITOR.plugins.setLang("codesnippet","zh-cn",{button:"插入代码段",codeContents:"代码文档",emptySnippetError:"插入的代码不能为空。",language:"代码语言",title:"代码段",pathName:"代码段"}); \ No newline at end of file +CKEDITOR.plugins.setLang("codesnippet","zh-cn",{button:"插入代码段",codeContents:"代码内容",emptySnippetError:"插入的代码不能为空。",language:"代码语言",title:"代码段",pathName:"代码段"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/codesnippetgeshi/plugin.js b/src/static/ckeditor/plugins/codesnippetgeshi/plugin.js new file mode 100644 index 00000000..1e7aa557 --- /dev/null +++ b/src/static/ckeditor/plugins/codesnippetgeshi/plugin.js @@ -0,0 +1,10 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){CKEDITOR.plugins.add("codesnippetgeshi",{requires:"ajax,codesnippet",init:function(c){var d=new CKEDITOR.htmlParser.basicWriter,f=new CKEDITOR.plugins.codesnippet.highlighter({languages:a,highlighter:function(b,a,e){b=JSON.stringify({lang:a,html:b});CKEDITOR.ajax.post(CKEDITOR.getUrl(c.config.codeSnippetGeshi_url||""),b,"application/json",function(a){a?(CKEDITOR.htmlParser.fragment.fromHtml(a||"").children[0].writeChildrenHtml(d),e(d.getHtml(!0))):e("")})}});c.plugins.codesnippet.setHighlighter(f)}}); +var a={abap:"ABAP",actionscript:"ActionScript",ada:"Ada",apache:"Apache Configuration",applescript:"AppleScript",asm:"Assembly",asp:"Active Server Pages (ASP)",autoit:"AutoIt",bash:"Bash",basic4gl:"Basic4GL",bf:"Brainfuck",blitzbasic:"Blitz BASIC",bnf:"Backus-Naur Form",c:"C",c_mac:"C (Mac)",caddcl:"AutoCAD DCL",cadlisp:"AutoLISP",cfdg:"CFDG",cfm:"ColdFusion Markup Language",cil:"Common Intermediate Language (CIL)",cobol:"COBOL","cpp-qt":"C++ (Qt toolkit)",cpp:"C++",csharp:"C#",css:"Cascading Style Sheets (CSS)", +d:"D",delphi:"Delphi",diff:"Diff",div:"DIV",dos:"DOS batch file",dot:"DOT",eiffel:"Eiffel",fortran:"Fortran",freebasic:"FreeBASIC",gambas:"Gambas",genero:"Genero",gettext:"GNU internationalization (i18n) library",glsl:"OpenGL Shading Language (GLSL)",gml:"Game Maker Language (GML)",gnuplot:"gnuplot",groovy:"Groovy",haskell:"Haskell",hq9plus:"HQ9+",html4strict:"HTML",html5:"HTML5",idl:"Uno IDL",ini:"INI",inno:"Inno",intercal:"INTERCAL",io:"Io",java:"Java",java5:"Java(TM) 2 Platform Standard Edition 5.0", +javascript:"JavaScript",kixtart:"KiXtart",klonec:"Klone C",klonecpp:"Klone C++",latex:"LaTeX",lisp:"Lisp",lolcode:"LOLCODE",lotusscript:"LotusScript",lua:"Lua",Code:"Language",m68k:"Motorola 68000 Assembler",make:"make",matlab:"MATLAB M",mirc:"mIRC scripting language",mxml:"MXML",mpasm:"Microchip Assembler",mysql:"MySQL",nsis:"Nullsoft Scriptable Install System (NSIS)",objc:"Objective-C","ocaml-brief":"OCaml",ocaml:"OCaml",oobas:"OpenOffice.org Basic",oracle8:"Oracle 8 SQL",oracle11:"Oracle 11 SQL", +pascal:"Pascal",per:"per",perl:"Perl","php-brief":"PHP",php:"PHP",pixelbender:"Pixel Bender",plsql:"PL/SQL",povray:"Persistence of Vision Raytracer",powershell:"Windows PowerShell",progress:"OpenEdge Advanced Business Language",prolog:"Prolog",providex:"ProvideX",python:"Python",qbasic:"QBasic/QuickBASIC",rails:"Rails",reg:"Windows Registry",robots:"robots.txt",rsplus:"R",ruby:"Ruby",sas:"SAS",scala:"Scala",scheme:"Scheme",scilab:"Scilab",sdlbasic:"SdlBasic",smalltalk:"Smalltalk",smarty:"Smarty", +sql:"SQL",tcl:"Tcl",teraterm:"Tera Term",text:"Plain text",thinbasic:"thinBasic",tsql:"Transact-SQL",typoscript:"TypoScript",vala:"Vala",vb:"Visual Basic",vbnet:"Visual Basic .NET",verilog:"Verilog",vhdl:"VHDL",vim:"Vimscript",visualfoxpro:"Visual FoxPro",visualprolog:"Visual Prolog",whitespace:"Whitespace",winbatch:"Winbatch",xml:"XML",xorg_conf:"Xorg.conf",xpp:"X++",z80:"ZiLOG Z80 Assembler"}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/copyformatting/styles/copyformatting.css b/src/static/ckeditor/plugins/copyformatting/styles/copyformatting.css index 70a7a881..ad859665 100644 --- a/src/static/ckeditor/plugins/copyformatting/styles/copyformatting.css +++ b/src/static/ckeditor/plugins/copyformatting/styles/copyformatting.css @@ -39,7 +39,7 @@ html.cke_copyformatting_active { clip: rect(1px, 1px, 1px, 1px); padding: 0; border: 0; - height: auto; + height: 1px; width: 1px; overflow: hidden; } diff --git a/src/static/ckeditor/plugins/ddfilebrowser/plugin.js b/src/static/ckeditor/plugins/ddfilebrowser/plugin.js index 8e0e590e..7c12b688 100644 --- a/src/static/ckeditor/plugins/ddfilebrowser/plugin.js +++ b/src/static/ckeditor/plugins/ddfilebrowser/plugin.js @@ -15,7 +15,7 @@ CKEDITOR.plugins.add("ddfilebrowser", { var systemZoom = width / window.screen.availWidth; var posLeft = (width - w) / 2 / systemZoom + dualScreenLeft; var posTop = (height - h) / 2 / systemZoom + dualScreenTop; - window.open("./dialog/select_soft.php?f=" + a.name + "&noeditor=yes", "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + posLeft + ", top=" + posTop); + window.open("./dialog/select_soft.php?f=" + a.name, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + posLeft + ", top=" + posTop); } }); a.ui.addButton("DDFileBrowser", diff --git a/src/static/ckeditor/plugins/devtools/lang/_translationstatus.txt b/src/static/ckeditor/plugins/devtools/lang/_translationstatus.txt new file mode 100644 index 00000000..415fca75 --- /dev/null +++ b/src/static/ckeditor/plugins/devtools/lang/_translationstatus.txt @@ -0,0 +1,27 @@ +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + +bg.js Found: 5 Missing: 0 +cs.js Found: 5 Missing: 0 +cy.js Found: 5 Missing: 0 +da.js Found: 5 Missing: 0 +de.js Found: 5 Missing: 0 +el.js Found: 5 Missing: 0 +eo.js Found: 5 Missing: 0 +et.js Found: 5 Missing: 0 +fa.js Found: 5 Missing: 0 +fi.js Found: 5 Missing: 0 +fr.js Found: 5 Missing: 0 +gu.js Found: 5 Missing: 0 +he.js Found: 5 Missing: 0 +hr.js Found: 5 Missing: 0 +it.js Found: 5 Missing: 0 +nb.js Found: 5 Missing: 0 +nl.js Found: 5 Missing: 0 +no.js Found: 5 Missing: 0 +pl.js Found: 5 Missing: 0 +tr.js Found: 5 Missing: 0 +ug.js Found: 5 Missing: 0 +uk.js Found: 5 Missing: 0 +vi.js Found: 5 Missing: 0 +zh-cn.js Found: 5 Missing: 0 diff --git a/src/static/ckeditor/plugins/devtools/lang/zh-cn.js b/src/static/ckeditor/plugins/devtools/lang/zh-cn.js new file mode 100644 index 00000000..ad445a51 --- /dev/null +++ b/src/static/ckeditor/plugins/devtools/lang/zh-cn.js @@ -0,0 +1,5 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang("devtools","zh-cn",{title:"元素信息",dialogName:"对话框窗口名称",tabName:"选项卡名称",elementId:"元素 ID",elementType:"元素类型"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/devtools/plugin.js b/src/static/ckeditor/plugins/devtools/plugin.js new file mode 100644 index 00000000..25467ea2 --- /dev/null +++ b/src/static/ckeditor/plugins/devtools/plugin.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("devtools",{lang:"ar,az,bg,ca,cs,cy,da,de,de-ch,el,en,en-au,en-gb,eo,es,es-mx,et,eu,fa,fi,fr,fr-ca,gl,gu,he,hr,hu,id,it,ja,km,ko,ku,lt,lv,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,tr,tt,ug,uk,vi,zh,zh-cn",init:function(k){k._.showDialogDefinitionTooltips=1},onLoad:function(){CKEDITOR.document.appendStyleText(CKEDITOR.config.devtools_styles||"#cke_tooltip { padding: 5px; border: 2px solid #333; background: #ffffff }#cke_tooltip h2 { font-size: 1.1em; border-bottom: 1px solid; margin: 0; padding: 1px; }#cke_tooltip ul { padding: 0pt; list-style-type: none; }")}}); +(function(){function k(a,c,b,f){a=a.lang.devtools;var l='\x3ca href\x3d"https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_definition_'+(b?"text"==b.type?"textInput":b.type:"content")+'.html" target\x3d"_blank" rel\x3d"noopener noreferrer"\x3e'+(b?b.type:"content")+"\x3c/a\x3e";c="\x3ch2\x3e"+a.title+"\x3c/h2\x3e\x3cul\x3e\x3cli\x3e\x3cstrong\x3e"+a.dialogName+"\x3c/strong\x3e : "+c.getName()+"\x3c/li\x3e\x3cli\x3e\x3cstrong\x3e"+a.tabName+"\x3c/strong\x3e : "+f+"\x3c/li\x3e";b&&(c+="\x3cli\x3e\x3cstrong\x3e"+ +a.elementId+"\x3c/strong\x3e : "+b.id+"\x3c/li\x3e");c+="\x3cli\x3e\x3cstrong\x3e"+a.elementType+"\x3c/strong\x3e : "+l+"\x3c/li\x3e";return c+"\x3c/ul\x3e"}function m(d,c,b,f,l,g){var e=c.getDocumentPosition(),h={"z-index":CKEDITOR.dialog._.currentZIndex+10,top:e.y+c.getSize("height")+"px"};a.setHtml(d(b,f,l,g));a.show();"rtl"==b.lang.dir?(d=CKEDITOR.document.getWindow().getViewPaneSize(),h.right=d.width-e.x-c.getSize("width")+"px"):h.left=e.x+"px";a.setStyles(h)}var a;CKEDITOR.on("reset",function(){a&& +a.remove();a=null});CKEDITOR.on("dialogDefinition",function(d){var c=d.editor;if(c._.showDialogDefinitionTooltips){a||(a=CKEDITOR.dom.element.createFromHtml('\x3cdiv id\x3d"cke_tooltip" tabindex\x3d"-1" style\x3d"position: absolute"\x3e\x3c/div\x3e',CKEDITOR.document),a.hide(),a.on("mouseover",function(){this.show()}),a.on("mouseout",function(){this.hide()}),a.appendTo(CKEDITOR.document.getBody()));var b=d.data.definition.dialog,f=c.config.devtools_textCallback||k;b.on("load",function(){for(var d= +b.parts.tabs.getChildren(),g,e=0,h=d.count();e<h;e++)g=d.getItem(e),g.on("mouseover",function(){var a=this.$.id;m(f,this,c,b,null,a.substring(4,a.lastIndexOf("_")))}),g.on("mouseout",function(){a.hide()});b.foreach(function(d){if(!(d.type in{hbox:1,vbox:1})){var e=d.getElement();e&&(e.on("mouseover",function(){m(f,this,c,b,d,b._.currentTabId)}),e.on("mouseout",function(){a.hide()}))}})})}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/div/dialogs/div.js b/src/static/ckeditor/plugins/div/dialogs/div.js new file mode 100644 index 00000000..48233dad --- /dev/null +++ b/src/static/ckeditor/plugins/div/dialogs/div.js @@ -0,0 +1,10 @@ +(function(){function t(a,m,r){m.is&&m.getCustomData("block_processed")||(m.is&&CKEDITOR.dom.element.setMarker(r,m,"block_processed",!0),a.push(m))}function q(a,m){function r(){this.foreach(function(a){/^(?!vbox|hbox)/.test(a.type)&&(a.setup||(a.setup=function(c){a.setValue(c.getAttribute(a.id)||"",1)}),a.commit||(a.commit=function(c){var f=this.getValue();if("dir"!=a.id||c.getComputedStyle("direction")!=f)f?c.setAttribute(a.id,f):c.removeAttribute(a.id)}))})}var q=function(){var g=CKEDITOR.tools.extend({}, +CKEDITOR.dtd.$blockLimit);a.config.div_wrapTable&&(delete g.td,delete g.th);return g}(),u=CKEDITOR.dtd.div,n={},p=[];return{title:a.lang.div.title,minWidth:400,minHeight:165,contents:[{id:"info",label:a.lang.common.generalTab,title:a.lang.common.generalTab,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"elementStyle",type:"select",style:"width: 100%;",label:a.lang.div.styleSelectLabel,"default":"",items:[[a.lang.common.notSet,""]],onChange:function(){var g=["info:elementStyle","info:class", +"advanced:dir","advanced:style"],c=this.getDialog(),f=c.getModel(a),f=f&&f.clone()||new CKEDITOR.dom.element("div",a.document);this.commit(f,!0);for(var g=[].concat(g),b=g.length,k,e=0;e<b;e++)(k=c.getContentElement.apply(c,g[e].split(":")))&&k.setup&&k.setup(f,!0)},setup:function(g){for(var c in n)n[c].checkElementRemovable(g,!0,a)&&this.setValue(c,1)},commit:function(g){var c;(c=this.getValue())?n[c].applyToObject(g,a):g.removeAttribute("style")}},{id:"class",type:"text",requiredContent:"div(cke-xyz)", +label:a.lang.common.cssClass,"default":""}]}]},{id:"advanced",label:a.lang.common.advancedTab,title:a.lang.common.advancedTab,elements:[{type:"vbox",padding:1,children:[{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"id",requiredContent:"div[id]",label:a.lang.common.id,"default":""},{type:"text",id:"lang",requiredContent:"div[lang]",label:a.lang.common.langCode,"default":""}]},{type:"hbox",children:[{type:"text",id:"style",requiredContent:"div{cke-xyz}",style:"width: 100%;",label:a.lang.common.cssStyle, +"default":"",commit:function(a){a.setAttribute("style",this.getValue())}}]},{type:"hbox",children:[{type:"text",id:"title",requiredContent:"div[title]",style:"width: 100%;",label:a.lang.common.advisoryTitle,"default":""}]},{type:"select",id:"dir",requiredContent:"div[dir]",style:"width: 100%;",label:a.lang.common.langDir,"default":"",items:[[a.lang.common.notSet,""],[a.lang.common.langDirLtr,"ltr"],[a.lang.common.langDirRtl,"rtl"]]}]}]}],getModel:function(a){return"editdiv"===m?CKEDITOR.plugins.div.getSurroundDiv(a): +null},onLoad:function(){r.call(this);var g=this,c=this.getContentElement("info","elementStyle");a.getStylesSet(function(f){var b,k;if(f)for(var e=0;e<f.length;e++)k=f[e],k.element&&"div"==k.element&&(b=k.name,n[b]=k=new CKEDITOR.style(k),a.filter.check(k)&&(c.items.push([b,b]),c.add(b,b)));c[1<c.items.length?"enable":"disable"]();setTimeout(function(){var b=g.getModel(a);b&&c.setup(b)},0)})},onShow:function(){"editdiv"==m&&this.setupContent(this.getModel(a))},onOk:function(){if("editdiv"==m)p=[this.getModel(a)]; +else{var g=[],c={},f=[],b,k=a.getSelection(),e=k.getRanges(),n=k.createBookmarks(),h,l;for(h=0;h<e.length;h++)for(l=e[h].createIterator();b=l.getNextParagraph();)if(b.getName()in q&&!b.isReadOnly()){var d=b.getChildren();for(b=0;b<d.count();b++)t(f,d.getItem(b),c)}else{for(;!u[b.getName()]&&!b.equals(e[h].root);)b=b.getParent();t(f,b,c)}CKEDITOR.dom.element.clearAllMarkers(c);e=[];h=null;for(l=0;l<f.length;l++)b=f[l],d=a.elementPath(b).blockLimit,d.isReadOnly()&&(d=d.getParent()),a.config.div_wrapTable&& +d.is(["td","th"])&&(d=a.elementPath(d.getParent()).blockLimit),d.equals(h)||(h=d,e.push([])),b.getParent()&&e[e.length-1].push(b);for(h=0;h<e.length;h++)if(e[h].length){d=e[h][0];f=d.getParent();for(b=1;b<e[h].length;b++)f=f.getCommonAncestor(e[h][b]);f||(f=a.editable());l=new CKEDITOR.dom.element("div",a.document);for(b=0;b<e[h].length;b++){for(d=e[h][b];d.getParent()&&!d.getParent().equals(f);)d=d.getParent();e[h][b]=d}for(b=0;b<e[h].length;b++)d=e[h][b],d.getCustomData&&d.getCustomData("block_processed")|| +(d.is&&CKEDITOR.dom.element.setMarker(c,d,"block_processed",!0),b||l.insertBefore(d),l.append(d));CKEDITOR.dom.element.clearAllMarkers(c);g.push(l)}k.selectBookmarks(n);p=g}g=p.length;for(c=0;c<g;c++)this.commitContent(p[c]),!p[c].getAttribute("style")&&p[c].removeAttribute("style");this.hide()},onHide:function(){this.getMode(a)===CKEDITOR.dialog.EDITING_MODE&&this.getModel(a).removeCustomData("elementStyle")}}}CKEDITOR.dialog.add("creatediv",function(a){return q(a,"creatediv")});CKEDITOR.dialog.add("editdiv", +function(a){return q(a,"editdiv")})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/divarea/plugin.js b/src/static/ckeditor/plugins/divarea/plugin.js new file mode 100644 index 00000000..4f3a5f0e --- /dev/null +++ b/src/static/ckeditor/plugins/divarea/plugin.js @@ -0,0 +1,5 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("divarea",{afterInit:function(a){a.addMode("wysiwyg",function(c){var b=CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_wysiwyg_div cke_reset cke_enable_context_menu" hidefocus\x3d"true"\x3e\x3c/div\x3e');a.ui.space("contents").append(b);b=a.editable(b);b.detach=CKEDITOR.tools.override(b.detach,function(a){return function(){a.apply(this,arguments);this.remove()}});a.setData(a.getData(1),c);a.fire("contentDom")})}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/docprops/dialogs/docprops.js b/src/static/ckeditor/plugins/docprops/dialogs/docprops.js new file mode 100644 index 00000000..c507780b --- /dev/null +++ b/src/static/ckeditor/plugins/docprops/dialogs/docprops.js @@ -0,0 +1,25 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("docProps",function(g){function t(a,d){var e=function(){b(this);d(this,this._.parentDialog)},b=function(a){a.removeListener("ok",e);a.removeListener("cancel",b)},f=function(a){a.on("ok",e);a.on("cancel",b)};g.execCommand(a);if(g._.storedDialogs.colordialog)f(g._.storedDialogs.colordialog);else CKEDITOR.on("dialogDefinition",function(b){if(b.data.name==a){var d=b.data.definition;b.removeListener();d.onLoad=CKEDITOR.tools.override(d.onLoad,function(a){return function(){f(this);d.onLoad= +a;"function"==typeof a&&a.call(this)}})}})}function n(){var a=this.getDialog().getContentElement("general",this.id+"Other");a&&("other"==this.getValue()?(a.getInputElement().removeAttribute("readOnly"),a.focus(),a.getElement().removeClass("cke_disabled")):(a.getInputElement().setAttribute("readOnly",!0),a.getElement().addClass("cke_disabled")))}function k(a,d,e){return function(b,f,c){f=m;b="undefined"!=typeof e?e:this.getValue();!b&&a in f?f[a].remove():b&&a in f?f[a].setAttribute("content",b):b&& +(f=new CKEDITOR.dom.element("meta",g.document),f.setAttribute(d?"http-equiv":"name",a),f.setAttribute("content",b),c.append(f))}}function l(a,d){return function(){var e=m,e=a in e?e[a].getAttribute("content")||"":"";if(d)return e;this.setValue(e);return null}}function p(a){return function(d,e,b,f){f.removeAttribute("margin"+a);d=this.getValue();""!==d?f.setStyle("margin-"+a,CKEDITOR.tools.cssLength(d)):f.removeStyle("margin-"+a)}}function q(a,d,e){a.removeStyle(d);a.getComputedStyle(d)!=e&&a.setStyle(d, +e)}var c=g.lang.docprops,h=g.lang.common,m={},r=function(a,d,e){return{type:"hbox",padding:0,widths:["60%","40%"],children:[CKEDITOR.tools.extend({type:"text",id:a,label:c[d]},e||{},1),{type:"button",id:a+"Choose",label:c.chooseColor,className:"colorChooser",onClick:function(){var b=this;t("colordialog",function(d){var e=b.getDialog();e.getContentElement(e._.currentTabId,a).setValue(d.getContentElement("picker","selectedColor").getValue())})}}]}},u="javascript:void((function(){"+encodeURIComponent("document.open();"+ +(CKEDITOR.env.ie?"("+CKEDITOR.tools.fixDomain+")();":"")+'document.write( \'\x3chtml style\x3d"background-color: #ffffff; height: 100%"\x3e\x3chead\x3e\x3c/head\x3e\x3cbody style\x3d"width: 100%; height: 100%; margin: 0px"\x3e'+c.previewHtml+"\x3c/body\x3e\x3c/html\x3e' );document.close();")+"})())";return{title:c.title,minHeight:330,minWidth:500,getModel:function(){return g.document},onShow:function(){for(var a=g.document,d=a.getElementsByTag("html").getItem(0),e=a.getHead(),b=a.getBody(),f={},c= +a.getElementsByTag("meta"),h=c.count(),k=0;k<h;k++){var l=c.getItem(k);f[l.getAttribute(l.hasAttribute("http-equiv")?"http-equiv":"name").toLowerCase()]=l}m=f;this.setupContent(a,d,e,b)},onHide:function(){m={}},onOk:function(){var a=g.document,d=a.getElementsByTag("html").getItem(0),e=a.getHead(),b=a.getBody();this.commitContent(a,d,e,b)},contents:[{id:"general",label:h.generalTab,elements:[{type:"text",id:"title",label:c.docTitle,setup:function(a){this.setValue(a.getElementsByTag("title").getItem(0).data("cke-title"))}, +commit:function(a,d,e,b,c){c||a.getElementsByTag("title").getItem(0).data("cke-title",this.getValue())}},{type:"hbox",children:[{type:"select",id:"dir",label:h.langDir,style:"width: 100%",items:[[h.notSet,""],[h.langDirLtr,"ltr"],[h.langDirRtl,"rtl"]],setup:function(a,d,e,b){this.setValue(b.getDirection()||"")},commit:function(a,d,e,b){(a=this.getValue())?b.setAttribute("dir",a):b.removeAttribute("dir");b.removeStyle("direction")}},{type:"text",id:"langCode",label:h.langCode,setup:function(a,d){this.setValue(d.getAttribute("xml:lang")|| +d.getAttribute("lang")||"")},commit:function(a,d,e,b,c){c||((a=this.getValue())?d.setAttributes({"xml:lang":a,lang:a}):d.removeAttributes({"xml:lang":1,lang:1}))}}]},{type:"hbox",children:[{type:"select",id:"charset",label:c.charset,style:"width: 100%",items:[[h.notSet,""],[c.charsetASCII,"us-ascii"],[c.charsetCE,"iso-8859-2"],[c.charsetCT,"big5"],[c.charsetCR,"iso-8859-5"],[c.charsetGR,"iso-8859-7"],[c.charsetJP,"iso-2022-jp"],[c.charsetKR,"iso-2022-kr"],[c.charsetTR,"iso-8859-9"],[c.charsetUN,"utf-8"], +[c.charsetWE,"iso-8859-1"],[c.other,"other"]],"default":"",onChange:function(){this.getDialog().selectedCharset="other"!=this.getValue()?this.getValue():"";n.call(this)},setup:function(){this.metaCharset="charset"in m;var a=l(this.metaCharset?"charset":"content-type",1,1).call(this);!this.metaCharset&&a.match(/charset=[^=]+$/)&&(a=a.substring(a.indexOf("\x3d")+1));if(a){this.setValue(a.toLowerCase());if(!this.getValue()){this.setValue("other");var d=this.getDialog().getContentElement("general","charsetOther"); +d&&d.setValue(a)}this.getDialog().selectedCharset=a}n.call(this)},commit:function(a,d,e,b,c){c||(b=this.getValue(),c=this.getDialog().getContentElement("general","charsetOther"),"other"==b&&(b=c?c.getValue():""),b&&!this.metaCharset&&(b=(m["content-type"]?m["content-type"].getAttribute("content").split(";")[0]:"text/html")+"; charset\x3d"+b),k(this.metaCharset?"charset":"content-type",1,b).call(this,a,d,e))}},{type:"text",id:"charsetOther",label:c.charsetOther,onChange:function(){this.getDialog().selectedCharset= +this.getValue()}}]},{type:"hbox",children:[{type:"select",id:"docType",label:c.docType,style:"width: 100%",items:[[h.notSet,""],["XHTML 1.1",'\x3c!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"\x3e'],["XHTML 1.0 Transitional",'\x3c!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\x3e'],["XHTML 1.0 Strict",'\x3c!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"\x3e'], +["XHTML 1.0 Frameset",'\x3c!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"\x3e'],["HTML 5","\x3c!DOCTYPE html\x3e"],["HTML 4.01 Transitional",'\x3c!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\x3e'],["HTML 4.01 Strict",'\x3c!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"\x3e'],["HTML 4.01 Frameset",'\x3c!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"\x3e'], +["HTML 3.2",'\x3c!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"\x3e'],["HTML 2.0",'\x3c!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"\x3e'],[c.other,"other"]],onChange:n,setup:function(){if(g.docType&&(this.setValue(g.docType),!this.getValue())){this.setValue("other");var a=this.getDialog().getContentElement("general","docTypeOther");a&&a.setValue(g.docType)}n.call(this)},commit:function(a,d,c,b,f){f||(a=this.getValue(),d=this.getDialog().getContentElement("general","docTypeOther"),g.docType= +"other"==a?d?d.getValue():"":a)}},{type:"text",id:"docTypeOther",label:c.docTypeOther}]},{type:"checkbox",id:"xhtmlDec",label:c.xhtmlDec,setup:function(){this.setValue(!!g.xmlDeclaration)},commit:function(a,d,c,b,f){f||(this.getValue()?(g.xmlDeclaration='\x3c?xml version\x3d"1.0" encoding\x3d"'+(this.getDialog().selectedCharset||"utf-8")+'"?\x3e',d.setAttribute("xmlns","http://www.w3.org/1999/xhtml")):(g.xmlDeclaration="",d.removeAttribute("xmlns")))}}]},{id:"design",label:c.design,elements:[{type:"hbox", +widths:["60%","40%"],children:[{type:"vbox",children:[r("txtColor","txtColor",{setup:function(a,d,c,b){this.setValue(b.getComputedStyle("color"))},commit:function(a,d,c,b,f){if(this.isChanged()||f)b.removeAttribute("text"),(a=this.getValue())?b.setStyle("color",a):b.removeStyle("color")}}),r("bgColor","bgColor",{setup:function(a,d,c,b){a=b.getComputedStyle("background-color")||"";this.setValue("transparent"==a?"":a)},commit:function(a,d,c,b,f){if(this.isChanged()||f)b.removeAttribute("bgcolor"),(a= +this.getValue())?b.setStyle("background-color",a):q(b,"background-color","transparent")}}),{type:"hbox",widths:["60%","40%"],padding:1,children:[{type:"text",id:"bgImage",label:c.bgImage,setup:function(a,d,c,b){a=b.getComputedStyle("background-image")||"";a="none"==a?"":a.replace(/url\(\s*(["']?)\s*([^\)]*)\s*\1\s*\)/i,function(a,b,d){return d});this.setValue(a)},commit:function(a,d,c,b){b.removeAttribute("background");(a=this.getValue())?b.setStyle("background-image","url("+a+")"):q(b,"background-image", +"none")}},{type:"button",id:"bgImageChoose",label:h.browseServer,style:"display:inline-block;margin-top:10px;",hidden:!0,filebrowser:"design:bgImage"}]},{type:"checkbox",id:"bgFixed",label:c.bgFixed,setup:function(a,d,c,b){this.setValue("fixed"==b.getComputedStyle("background-attachment"))},commit:function(a,d,c,b){this.getValue()?b.setStyle("background-attachment","fixed"):q(b,"background-attachment","scroll")}}]},{type:"vbox",children:[{type:"html",id:"marginTitle",html:'\x3cdiv style\x3d"text-align: center; margin: 0px auto; font-weight: bold"\x3e'+ +c.margin+"\x3c/div\x3e"},{type:"text",id:"marginTop",label:c.marginTop,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,d,c,b){this.setValue(b.getStyle("margin-top")||b.getAttribute("margintop")||"")},commit:p("top")},{type:"hbox",children:[{type:"text",id:"marginLeft",label:c.marginLeft,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,d,c,b){this.setValue(b.getStyle("margin-left")||b.getAttribute("marginleft")|| +"")},commit:p("left")},{type:"text",id:"marginRight",label:c.marginRight,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,d,c,b){this.setValue(b.getStyle("margin-right")||b.getAttribute("marginright")||"")},commit:p("right")}]},{type:"text",id:"marginBottom",label:c.marginBottom,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,c,e,b){this.setValue(b.getStyle("margin-bottom")||b.getAttribute("marginbottom")|| +"")},commit:p("bottom")}]}]}]},{id:"meta",label:c.meta,elements:[{type:"textarea",id:"metaKeywords",label:c.metaKeywords,setup:l("keywords"),commit:k("keywords")},{type:"textarea",id:"metaDescription",label:c.metaDescription,setup:l("description"),commit:k("description")},{type:"text",id:"metaAuthor",label:c.metaAuthor,setup:l("author"),commit:k("author")},{type:"text",id:"metaCopyright",label:c.metaCopyright,setup:l("copyright"),commit:k("copyright")}]},{id:"preview",label:h.preview,elements:[{type:"html", +id:"previewHtml",html:'\x3ciframe src\x3d"'+u+'" style\x3d"width: 100%; height: 310px" hidefocus\x3d"true" frameborder\x3d"0"\x3e\x3c/iframe\x3e',onLoad:function(){var a=this.getElement();this.getDialog().on("selectPage",function(c){if("preview"==c.data.page){var e=this;setTimeout(function(){var b=a.getFrameDocument(),c=b.getElementsByTag("html").getItem(0),d=b.getHead(),g=b.getBody();e.commitContent(b,c,d,g,1)},50)}});a.getAscendant("table").setStyle("height","100%")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/docprops/icons/docprops-rtl.png b/src/static/ckeditor/plugins/docprops/icons/docprops-rtl.png new file mode 100644 index 00000000..c6c63532 Binary files /dev/null and b/src/static/ckeditor/plugins/docprops/icons/docprops-rtl.png differ diff --git a/src/static/ckeditor/plugins/docprops/icons/docprops.png b/src/static/ckeditor/plugins/docprops/icons/docprops.png new file mode 100644 index 00000000..16a50006 Binary files /dev/null and b/src/static/ckeditor/plugins/docprops/icons/docprops.png differ diff --git a/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops-rtl.png b/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops-rtl.png new file mode 100644 index 00000000..3e468bd5 Binary files /dev/null and b/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops-rtl.png differ diff --git a/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops.png b/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops.png new file mode 100644 index 00000000..ac44303e Binary files /dev/null and b/src/static/ckeditor/plugins/docprops/icons/hidpi/docprops.png differ diff --git a/src/static/ckeditor/plugins/docprops/lang/zh-cn.js b/src/static/ckeditor/plugins/docprops/lang/zh-cn.js new file mode 100644 index 00000000..88665925 --- /dev/null +++ b/src/static/ckeditor/plugins/docprops/lang/zh-cn.js @@ -0,0 +1,2 @@ +CKEDITOR.plugins.setLang("docprops","zh-cn",{bgColor:"背景颜色",bgFixed:"不滚动背景图像",bgImage:"背景图像",charset:"字符编码",charsetASCII:"ASCII",charsetCE:"中欧",charsetCR:"西里尔文",charsetCT:"繁体中文 (Big5)",charsetGR:"希腊文",charsetJP:"日文",charsetKR:"韩文",charsetOther:"其它字符编码",charsetTR:"土耳其文",charsetUN:"Unicode (UTF-8)",charsetWE:"西欧",chooseColor:"选择",design:"设计",docTitle:"页面标题",docType:"文档类型",docTypeOther:"其它文档类型",label:"页面属性",margin:"页面边距",marginBottom:"下",marginLeft:"左",marginRight:"右",marginTop:"上",meta:"Meta 数据",metaAuthor:"作者", +metaCopyright:"版权",metaDescription:"页面说明",metaKeywords:"页面索引关键字 (用半角逗号[,]分隔)",other:"\x3c其他\x3e",previewHtml:'\x3cp\x3e这是一些\x3cstrong\x3e演示用文字\x3c/strong\x3e。您当前正在使用\x3ca href\x3d"javascript:void(0)"\x3eCKEditor\x3c/a\x3e。\x3c/p\x3e',title:"页面属性",txtColor:"文本颜色",xhtmlDec:"包含 XHTML 声明"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/docprops/plugin.js b/src/static/ckeditor/plugins/docprops/plugin.js new file mode 100644 index 00000000..275b5ca3 --- /dev/null +++ b/src/static/ckeditor/plugins/docprops/plugin.js @@ -0,0 +1,6 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("docprops",{requires:"wysiwygarea,dialog,colordialog",lang:"af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",icons:"docprops,docprops-rtl",hidpi:!0,init:function(a){var b=new CKEDITOR.dialogCommand("docProps");b.modes={wysiwyg:a.config.fullPage};b.allowedContent={body:{styles:"*",attributes:"dir"}, +html:{attributes:"lang,xml:lang"}};b.requiredContent="body";a.addCommand("docProps",b);CKEDITOR.dialog.add("docProps",this.path+"dialogs/docprops.js");a.ui.addButton&&a.ui.addButton("DocProps",{label:a.lang.docprops.label,command:"docProps",toolbar:"document,30"})}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/easyimage/dialogs/easyimagealt.js b/src/static/ckeditor/plugins/easyimage/dialogs/easyimagealt.js new file mode 100644 index 00000000..1c6bf5bc --- /dev/null +++ b/src/static/ckeditor/plugins/easyimage/dialogs/easyimagealt.js @@ -0,0 +1,6 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("easyimageAlt",function(b){return{title:b.lang.easyimage.commands.altText,minWidth:200,minHeight:30,getModel:function(){var a=b.widgets.focused;return a&&"easyimage"==a.name?a:null},onOk:function(){var a=CKEDITOR.tools.trim(this.getValueOf("info","txtAlt")),c=this.getModel(b);c&&c.parts.image.setAttribute("alt",a)},onShow:function(){var a=this.getContentElement("info","txtAlt"),c=this.getModel(b);c&&a.setValue(c.parts.image.getAttribute("alt"));a.focus()},contents:[{id:"info", +label:b.lang.easyimage.commands.altText,accessKey:"I",elements:[{type:"text",id:"txtAlt",label:b.lang.easyimage.commands.altText}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimagealigncenter.png b/src/static/ckeditor/plugins/easyimage/icons/easyimagealigncenter.png new file mode 100644 index 00000000..424be405 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimagealigncenter.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimagealignleft.png b/src/static/ckeditor/plugins/easyimage/icons/easyimagealignleft.png new file mode 100644 index 00000000..7a520bec Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimagealignleft.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimagealignright.png b/src/static/ckeditor/plugins/easyimage/icons/easyimagealignright.png new file mode 100644 index 00000000..d096f339 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimagealignright.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimagealt.png b/src/static/ckeditor/plugins/easyimage/icons/easyimagealt.png new file mode 100644 index 00000000..3b997725 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimagealt.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimagefull.png b/src/static/ckeditor/plugins/easyimage/icons/easyimagefull.png new file mode 100644 index 00000000..37bc79d4 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimagefull.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimageside.png b/src/static/ckeditor/plugins/easyimage/icons/easyimageside.png new file mode 100644 index 00000000..d096f339 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimageside.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/easyimageupload.png b/src/static/ckeditor/plugins/easyimage/icons/easyimageupload.png new file mode 100644 index 00000000..8ea97259 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/easyimageupload.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealigncenter.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealigncenter.png new file mode 100644 index 00000000..633a4fe1 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealigncenter.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignleft.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignleft.png new file mode 100644 index 00000000..d60710f6 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignleft.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignright.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignright.png new file mode 100644 index 00000000..aaac75fe Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealignright.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealt.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealt.png new file mode 100644 index 00000000..a39c3dd4 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagealt.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagefull.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagefull.png new file mode 100644 index 00000000..2de074a6 Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimagefull.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageside.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageside.png new file mode 100644 index 00000000..aaac75fe Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageside.png differ diff --git a/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageupload.png b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageupload.png new file mode 100644 index 00000000..d0f21aee Binary files /dev/null and b/src/static/ckeditor/plugins/easyimage/icons/hidpi/easyimageupload.png differ diff --git a/src/static/ckeditor/plugins/easyimage/lang/en.js b/src/static/ckeditor/plugins/easyimage/lang/en.js new file mode 100644 index 00000000..bbc94bcc --- /dev/null +++ b/src/static/ckeditor/plugins/easyimage/lang/en.js @@ -0,0 +1,5 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang("easyimage","en",{commands:{fullImage:"Full Size Image",sideImage:"Side Image",altText:"Change image alternative text",upload:"Upload Image"},uploadFailed:"Your image could not be uploaded due to a network error."}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/easyimage/plugin.js b/src/static/ckeditor/plugins/easyimage/plugin.js new file mode 100644 index 00000000..56aa5e9b --- /dev/null +++ b/src/static/ckeditor/plugins/easyimage/plugin.js @@ -0,0 +1,19 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function f(a){return CKEDITOR.tools.capitalize(a,!0)}function p(a,c){function b(a){return function(b,d){var c=b.widgets.focused,e=CKEDITOR.TRISTATE_DISABLED;c&&"easyimage"===c.name&&(e=a&&a.call(this,c,b,d)?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF);this.setState(e)}}function e(a,c,d,g){d.type="widget";d.widget="easyimage";d.group=d.group||"easyimage";d.element="figure";c=new CKEDITOR.style(d);a.filter.allow(c);c=new CKEDITOR.styleCommand(c);c.contextSensitive=!0;c.refresh=b(function(a, +b,c){return this.style.checkActive(c,b)});a.addCommand(g,c);c=a.getCommand(g);c.enable=function(){};c.refresh(a,a.elementPath());return c}a.addCommand("easyimageAlt",new CKEDITOR.dialogCommand("easyimageAlt",{startDisabled:!0,contextSensitive:!0,refresh:b()}));(function(b){function c(a,b){var d=a.match(/^easyimage(.+)$/);if(d){var e=(d[1][0]||"").toLowerCase()+d[1].substr(1);if(d[1]in b)return d[1];if(e in b)return e}return null}a.on("afterCommandExec",function(d){c(d.data.name,b)&&(a.forceNextSelectionCheck(), +a.selectionChange(!0))});a.on("beforeCommandExec",function(d){c(d.data.name,b)&&d.data.command.style.checkActive(d.editor.elementPath(),a)&&(d.cancel(),a.focus())});for(var d in b)e(a,d,b[d],"easyimage"+f(d))})(c)}function q(a){var c=a.config.easyimage_toolbar;a.plugins.contextmenu&&(c.split&&(c=c.split(",")),a.addMenuGroup("easyimage"),CKEDITOR.tools.array.forEach(c,function(b){b=a.ui.items[b];a.addMenuItem(b.name,{label:b.label,command:b.command,group:"easyimage"})}))}function r(a){var c=a.sender.editor, +b=c.config.easyimage_toolbar;b.split&&(b=b.split(","));CKEDITOR.tools.array.forEach(b,function(b){b=c.ui.items[b];a.data[b.name]=c.getCommand(b.command).state})}function t(a,c){var b=a.config,e=b.easyimage_class,b={name:"easyimage",allowedContent:{figure:{classes:b.easyimage_sideClass},img:{attributes:"!src,srcset,alt,width,sizes"}},requiredContent:"figure; img[!src]",styleableElements:"figure",supportedTypes:new RegExp("image/("+l.join("|")+")","i"),loaderType:CKEDITOR.plugins.cloudservices.cloudServicesLoader, +progressReporterType:CKEDITOR.plugins.imagebase.progressBar,upcasts:{figure:function(a){if((!e||a.hasClass(e))&&1===a.find("img",!0).length)return a}},init:function(){function b(a,c){var e=a.$;if(e.complete&&e.naturalWidth)return c(e.naturalWidth);a.once("load",function(){c(e.naturalWidth)})}var c=this.parts.image;c&&!c.$.complete&&b(c,function(){a._.easyImageToolbarContext.toolbar.reposition()});c=this.element.data("cke-upload-id");"undefined"!==typeof c&&(this.setData("uploadId",c),this.element.data("cke-upload-id", +!1));this.on("contextMenu",r);a.config.easyimage_class&&this.addClass(a.config.easyimage_class);this.on("uploadStarted",function(){var a=this;b(a.parts.image,function(b){a.parts.image.hasAttribute("width")||(a.editor.fire("lockSnapshot"),a.parts.image.setAttribute("width",b),a.editor.fire("unlockSnapshot"))})});this.on("uploadDone",function(a){a=a.data.loader.responseData.response;var b=CKEDITOR.plugins.easyimage._parseSrcSet(a);this.parts.image.setAttributes({"data-cke-saved-src":a["default"],src:a["default"], +srcset:b,sizes:"100vw"})});this.on("uploadFailed",function(){alert(this.editor.lang.easyimage.uploadFailed)});this._loadDefaultStyle()},_loadDefaultStyle:function(){var b=!1,e=a.config.easyimage_defaultStyle,d;for(d in c){var g=a.getCommand("easyimage"+f(d));!b&&g&&g.style&&-1!==CKEDITOR.tools.array.indexOf(g.style.group,"easyimage")&&this.checkStyleActive(g.style)&&(b=!0)}!b&&e&&a.getCommand("easyimage"+f(e))&&this.applyStyle(a.getCommand("easyimage"+f(e)).style)}};e&&(b.requiredContent+="(!"+e+ +")",b.allowedContent.figure.classes="!"+e+","+b.allowedContent.figure.classes);a.plugins.link&&(b=CKEDITOR.plugins.imagebase.addFeature(a,"link",b));b=CKEDITOR.plugins.imagebase.addFeature(a,"upload",b);b=CKEDITOR.plugins.imagebase.addFeature(a,"caption",b);CKEDITOR.plugins.imagebase.addImageWidget(a,"easyimage",b)}function u(a){var c=new RegExp("\x3cimg[^\x3e]*\\ssrc\x3d[\\'\\\"]?data:image/("+l.join("|")+");base64,","i");a.on("paste",function(b){if(!a.isReadOnly&&c.test(b.data.dataValue)){b=b.data; +var e=document.implementation.createHTMLDocument(""),e=new CKEDITOR.dom.element(e.body),f=a.widgets.registered.easyimage,l=0,d,g,k,m;e.data("cke-editable",1);e.appendHtml(b.dataValue);g=e.find("img");for(m=0;m<g.count();m++){k=g.getItem(m);var h=(d=k.getAttribute("src"))&&"data:"==d.substring(0,5),n=null===k.data("cke-realelement");h&&n&&!k.isReadOnly(1)&&(l++,1<l&&(h=a.getSelection().getRanges(),h[0].enlarge(CKEDITOR.ENLARGE_ELEMENT),h[0].collapse(!1)),d.match(/image\/([a-z]+?);/i),h=f._spawnLoader(a, +d,f),d=f._insertWidget(a,f,d,!1,{uploadId:h.id}),d.data("cke-upload-id",h.id),d.replace(k))}b.dataValue=e.getHtml()}})}function v(a){a.ui.addButton("EasyImageUpload",{label:a.lang.easyimage.commands.upload,command:"easyimageUpload",toolbar:"insert,1"});a.addCommand("easyimageUpload",{exec:function(){var c=CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"file" accept\x3d"image/*" multiple\x3d"multiple"\x3e');c.once("change",function(b){b=b.data.getTarget();b.$.files.length&&a.fire("paste",{method:"paste", +dataValue:"",dataTransfer:new CKEDITOR.plugins.clipboard.dataTransfer({files:b.$.files})})});c.$.click()}})}var n=!1,l=["jpeg","png","gif","bmp"];CKEDITOR.plugins.easyimage={_parseSrcSet:function(a){var c=[],b;for(b in a)"default"!==b&&c.push(a[b]+" "+b+"w");return c.join(", ")}};CKEDITOR.plugins.add("easyimage",{requires:"imagebase,balloontoolbar,button,dialog,cloudservices",lang:"en",icons:"easyimagefull,easyimageside,easyimagealt,easyimagealignleft,easyimagealigncenter,easyimagealignright,easyimageupload", +hidpi:!0,onLoad:function(){CKEDITOR.dialog.add("easyimageAlt",this.path+"dialogs/easyimagealt.js")},isSupportedEnvironment:function(){return!CKEDITOR.env.ie||11<=CKEDITOR.env.version},init:function(a){this.isSupportedEnvironment()&&(n||(CKEDITOR.document.appendStyleSheet(this.path+"styles/easyimage.css"),n=!0),a.addContentsCss&&a.addContentsCss(this.path+"styles/easyimage.css"))},afterInit:function(a){if(this.isSupportedEnvironment()){var c;c=CKEDITOR.tools.object.merge({full:{attributes:{"class":"easyimage-full"}, +label:a.lang.easyimage.commands.fullImage},side:{attributes:{"class":"easyimage-side"},label:a.lang.easyimage.commands.sideImage},alignLeft:{attributes:{"class":"easyimage-align-left"},label:a.lang.common.alignLeft},alignCenter:{attributes:{"class":"easyimage-align-center"},label:a.lang.common.alignCenter},alignRight:{attributes:{"class":"easyimage-align-right"},label:a.lang.common.alignRight}},a.config.easyimage_styles);t(a,c);u(a);p(a,c);a.ui.addButton("EasyImageAlt",{label:a.lang.easyimage.commands.altText, +command:"easyimageAlt",toolbar:"easyimage,3"});for(var b in c)a.ui.addButton("EasyImage"+f(b),{label:c[b].label,command:"easyimage"+f(b),toolbar:"easyimage,99",icon:c[b].icon,iconHiDpi:c[b].iconHiDpi});q(a);c=a.config.easyimage_toolbar;a._.easyImageToolbarContext=a.balloonToolbars.create({buttons:c.join?c.join(","):c,widgets:["easyimage"]});v(a)}}});CKEDITOR.config.easyimage_class="easyimage";CKEDITOR.config.easyimage_styles={};CKEDITOR.config.easyimage_defaultStyle="full";CKEDITOR.config.easyimage_toolbar= +["EasyImageFull","EasyImageSide","EasyImageAlt"]})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/easyimage/styles/easyimage.css b/src/static/ckeditor/plugins/easyimage/styles/easyimage.css new file mode 100644 index 00000000..fb208ea0 --- /dev/null +++ b/src/static/ckeditor/plugins/easyimage/styles/easyimage.css @@ -0,0 +1,118 @@ +/* +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.easyimage, .cke_widget_wrapper_easyimage { + background: transparent; + border: none; + outline: 0px; + display: block; + padding: 0; + clear: both; +} + +/* +The outline is not a part of the element's dimensions. A border needs to be used as an outline to align the linked image with a caption. +*/ +.easyimage a > img { + outline: none; + border: 1px solid #0782C1; + box-sizing: border-box; + padding: 1px; +} + +.cke_widget_wrapper_easyimage figure { + margin: 0; +} + +.easyimage img, .cke_widget_uploadeasyimage img { + display: block; + height: auto; + margin: 0 auto; + max-width: 100%; +} + +.cke_widget_wrapper_easyimage-side, :not(.cke_widget_wrapper_easyimage):not(.cke_widget_wrapper_easyimage-side) > .easyimage-side, +.cke_widget_wrapper_easyimage-align-right, :not(.cke_widget_wrapper_easyimage):not(.cke_widget_wrapper_easyimage-align-right) > .easyimage-align-right { + /* + The :not() selector will be used for Easy Image content ouside of the editor, for example: when the editor was destroyed. + See https://github.com/ckeditor/ckeditor4/pull/1150#discussion_r150415261 for more details. + */ + float: right; + max-width: 50%; + /* + In case of placement inside the parent container like a table cell, 'min-width' is needed to prevent the widget from having + tiny sizes. The `em` unit is used so it works well and has proper proportions to the textual content around (#1553). + */ + min-width: 10em; + margin-left: 1.5em; +} + +/* +Overwrite 'max-width: 50%' with 'max-width: 50vw' to prevent the native Chrome bug: +https://bugs.chromium.org/p/chromium/issues/detail?id=803045 (#1550). +*/ +body.cke_editable > .cke_widget_wrapper_easyimage-side { + max-width: 50vw; +} + +.cke_widget_wrapper_easyimage-align-left, :not(.cke_widget_wrapper_easyimage):not(.cke_widget_wrapper_easyimage-align-left) > .easyimage-align-left { + float: left; + max-width: 50%; + min-width: 10em; + margin-right: 1.5em; +} + +.cke_widget_wrapper_easyimage-align-center, :not(.cke_widget_wrapper_easyimage):not(.cke_widget_wrapper_easyimage-align-center) > .easyimage-align-center { + margin: 0 auto; + max-width: 90%; +} + +.easyimage .cke_widget_editable { + background-color: #f7f7f7; + /* Add border so when caption is focused, blue border does not cause flickering. */ + border: 1px solid #f7f7f7; + color: #333; + padding: .8em; +} + +.cke_widget_wrapper:hover .easyimage .cke_widget_editable { + outline: 3px solid transparent; +} + +.cke_widget_wrapper .easyimage .cke_widget_editable.cke_widget_editable_focused { + background-color: #fff; + border-color: #48a3f5; + outline: none; +} + +/* Loaders */ + +.cke_widget_element.easyimage { + position: relative; +} + +.cke_loader { + position: absolute; + top: 0px; + left: 0px; + right: 0px; +} + +.cke_loader .cke_bar { + height: 10px; + background: #6a9ed1; + width: 0; +} + +/* Fancy opacity effect discussed in #1533. Transition is assigned in this awkward way so that it **does not** happen for +the initial render, otherwise it would start transitioning from opacity 1 to 0.x upon the first render. */ + +.cke_widget_wrapper_easyimage:not(.cke_widget_wrapper_uploading) figure img { + transition: opacity 0.3s ease-in-out; +} + +.cke_widget_wrapper_easyimage.cke_widget_wrapper_uploading figure img { + opacity: 0.75; +} diff --git a/src/static/ckeditor/plugins/embedbase/lang/zh-cn.js b/src/static/ckeditor/plugins/embedbase/lang/zh-cn.js index 3a2c90a0..092c1908 100755 --- a/src/static/ckeditor/plugins/embedbase/lang/zh-cn.js +++ b/src/static/ckeditor/plugins/embedbase/lang/zh-cn.js @@ -1 +1 @@ -CKEDITOR.plugins.setLang("embedbase","zh-cn",{pathName:"媒体对象",title:"嵌入媒体",button:"插入媒体",unsupportedUrlGiven:"不支持指定的 URL",unsupportedUrl:"嵌入媒体不支持此 URL {url}",fetchingFailedGiven:"无法抓取此 URL 的文档",fetchingFailed:"无法抓取 {url} 的文档",fetchingOne:"正在抓取...",fetchingMany:"正在抓取,{max} 中的 {current} ..."}); \ No newline at end of file +CKEDITOR.plugins.setLang("embedbase","zh-cn",{pathName:"媒体对象",title:"嵌入媒体",button:"插入媒体",unsupportedUrlGiven:"不支持指定的 URL",unsupportedUrl:"嵌入媒体不支持此 URL {url}",fetchingFailedGiven:"无法抓取此 URL 的内容",fetchingFailed:"无法抓取 {url} 的内容",fetchingOne:"正在抓取...",fetchingMany:"正在抓取,{max} 中的 {current} ..."}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/flash/dialogs/flash.js b/src/static/ckeditor/plugins/flash/dialogs/flash.js new file mode 100644 index 00000000..d4c24eb1 --- /dev/null +++ b/src/static/ckeditor/plugins/flash/dialogs/flash.js @@ -0,0 +1,24 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function b(a,b,c){var h=n[this.id];if(h)for(var f=this instanceof CKEDITOR.ui.dialog.checkbox,e=0;e<h.length;e++){var d=h[e];switch(d.type){case 1:if(!a)continue;if(null!==a.getAttribute(d.name)){a=a.getAttribute(d.name);f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"]);break;case 2:if(!a)continue;if(d.name in c){a=c[d.name];f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"]);break;case 4:if(!b)continue; +if(b.getAttribute(d.name)){a=b.getAttribute(d.name);f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"])}}}function c(a,b,c){var h=n[this.id];if(h)for(var f=""===this.getValue(),e=this instanceof CKEDITOR.ui.dialog.checkbox,d=0;d<h.length;d++){var g=h[d];switch(g.type){case 1:if(!a||"data"==g.name&&b&&!a.hasAttribute("data"))continue;var m=this.getValue();f||e&&m===g["default"]?a.removeAttribute(g.name):a.setAttribute(g.name,m);break;case 2:if(!a)continue; +m=this.getValue();if(f||e&&m===g["default"])g.name in c&&c[g.name].remove();else if(g.name in c)c[g.name].setAttribute("value",m);else{var p=CKEDITOR.dom.element.createFromHtml("\x3ccke:param\x3e\x3c/cke:param\x3e",a.getDocument());p.setAttributes({name:g.name,value:m});1>a.getChildCount()?p.appendTo(a):p.insertBefore(a.getFirst())}break;case 4:if(!b)continue;m=this.getValue();f||e&&m===g["default"]?b.removeAttribute(g.name):b.setAttribute(g.name,m)}}}for(var n={id:[{type:1,name:"id"}],classid:[{type:1, +name:"classid"}],codebase:[{type:1,name:"codebase"}],pluginspage:[{type:4,name:"pluginspage"}],src:[{type:2,name:"movie"},{type:4,name:"src"},{type:1,name:"data"}],name:[{type:4,name:"name"}],align:[{type:1,name:"align"}],"class":[{type:1,name:"class"},{type:4,name:"class"}],width:[{type:1,name:"width"},{type:4,name:"width"}],height:[{type:1,name:"height"},{type:4,name:"height"}],hSpace:[{type:1,name:"hSpace"},{type:4,name:"hSpace"}],vSpace:[{type:1,name:"vSpace"},{type:4,name:"vSpace"}],style:[{type:1, +name:"style"},{type:4,name:"style"}],type:[{type:4,name:"type"}]},k="play loop menu quality scale salign wmode bgcolor base flashvars allowScriptAccess allowFullScreen".split(" "),l=0;l<k.length;l++)n[k[l]]=[{type:4,name:k[l]},{type:2,name:k[l]}];k=["play","loop","menu"];for(l=0;l<k.length;l++)n[k[l]][0]["default"]=n[k[l]][1]["default"]=!0;CKEDITOR.dialog.add("flash",function(a){var l=!a.config.flashEmbedTagOnly,k=a.config.flashAddEmbedTag||a.config.flashEmbedTagOnly,h,f="\x3cdiv\x3e"+CKEDITOR.tools.htmlEncode(a.lang.common.preview)+ +'\x3cbr\x3e\x3cdiv id\x3d"cke_FlashPreviewLoader'+CKEDITOR.tools.getNextNumber()+'" style\x3d"display:none"\x3e\x3cdiv class\x3d"loading"\x3e\x26nbsp;\x3c/div\x3e\x3c/div\x3e\x3cdiv id\x3d"cke_FlashPreviewBox'+CKEDITOR.tools.getNextNumber()+'" class\x3d"FlashPreviewBox"\x3e\x3c/div\x3e\x3c/div\x3e';return{title:a.lang.flash.title,minWidth:420,minHeight:310,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"flash"===a.data("cke-real-element-type")?a:null},onShow:function(){this.fakeImage= +this.objectNode=this.embedNode=null;h=new CKEDITOR.dom.element("embed",a.document);var e=this.getModel(a);if(e){this.fakeImage=e;var d=a.restoreRealElement(e),g=null,b=null,c={};if("cke:object"==d.getName()){g=d;d=g.getElementsByTag("embed","cke");0<d.count()&&(b=d.getItem(0));for(var d=g.getElementsByTag("param","cke"),f=0,l=d.count();f<l;f++){var k=d.getItem(f),n=k.getAttribute("name"),k=k.getAttribute("value");c[n]=k}}else"cke:embed"==d.getName()&&(b=d);this.objectNode=g;this.embedNode=b;this.setupContent(g, +b,c,e)}},onOk:function(){var e=null,d=null,b=null;this.fakeImage?(e=this.objectNode,d=this.embedNode):(l&&(e=CKEDITOR.dom.element.createFromHtml("\x3ccke:object\x3e\x3c/cke:object\x3e",a.document),e.setAttributes({classid:"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",codebase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\x3d6,0,40,0"})),k&&(d=CKEDITOR.dom.element.createFromHtml("\x3ccke:embed\x3e\x3c/cke:embed\x3e",a.document),d.setAttributes({type:"application/x-shockwave-flash", +pluginspage:"http://www.macromedia.com/go/getflashplayer"}),e&&d.appendTo(e)));if(e)for(var b={},c=e.getElementsByTag("param","cke"),f=0,h=c.count();f<h;f++)b[c.getItem(f).getAttribute("name")]=c.getItem(f);c={};f={};this.commitContent(e,d,b,c,f);e=a.createFakeElement(e||d,"cke_flash","flash",!0);e.setAttributes(f);e.setStyles(c);this.fakeImage?(e.replace(this.fakeImage),a.getSelection().selectElement(e)):a.insertElement(e)},onHide:function(){this.preview&&this.preview.setHtml("")},contents:[{id:"info", +label:a.lang.common.generalTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{type:"hbox",widths:["280px","110px"],align:"right",className:"cke_dialog_flash_url",children:[{id:"src",type:"text",label:a.lang.common.url,required:!0,validate:CKEDITOR.dialog.validate.notEmpty(a.lang.flash.validateSrc),setup:b,commit:c,onLoad:function(){var a=this.getDialog(),b=function(b){h.setAttribute("src",b);a.preview.setHtml('\x3cembed height\x3d"100%" width\x3d"100%" src\x3d"'+CKEDITOR.tools.htmlEncode(h.getAttribute("src"))+ +'" type\x3d"application/x-shockwave-flash"\x3e\x3c/embed\x3e')};a.preview=a.getContentElement("info","preview").getElement().getChild(3);this.on("change",function(a){a.data&&a.data.value&&b(a.data.value)});this.getInputElement().on("change",function(){b(this.getValue())},this)}},{type:"button",id:"browse",filebrowser:"info:src",hidden:!0,style:"display:inline-block;margin-top:14px;",label:a.lang.common.browseServer}]}]},{type:"hbox",widths:["25%","25%","25%","25%","25%"],children:[{type:"text",id:"width", +requiredContent:"embed[width]",style:"width:95px",label:a.lang.common.width,validate:CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1",a.lang.common.width)),setup:b,commit:c},{type:"text",id:"height",requiredContent:"embed[height]",style:"width:95px",label:a.lang.common.height,validate:CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1",a.lang.common.height)),setup:b,commit:c},{type:"text",id:"hSpace",requiredContent:"embed[hspace]",style:"width:95px", +label:a.lang.flash.hSpace,validate:CKEDITOR.dialog.validate.integer(a.lang.flash.validateHSpace),setup:b,commit:c},{type:"text",id:"vSpace",requiredContent:"embed[vspace]",style:"width:95px",label:a.lang.flash.vSpace,validate:CKEDITOR.dialog.validate.integer(a.lang.flash.validateVSpace),setup:b,commit:c}]},{type:"vbox",children:[{type:"html",id:"preview",style:"width:95%;",html:f}]}]},{id:"Upload",hidden:!0,filebrowser:"uploadButton",label:a.lang.common.upload,elements:[{type:"file",id:"upload",label:a.lang.common.upload, +size:38},{type:"fileButton",id:"uploadButton",label:a.lang.common.uploadSubmit,filebrowser:"info:src","for":["Upload","upload"]}]},{id:"properties",label:a.lang.flash.propertiesTab,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"scale",type:"select",requiredContent:"embed[scale]",label:a.lang.flash.scale,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.scaleAll,"showall"],[a.lang.flash.scaleNoBorder,"noborder"],[a.lang.flash.scaleFit,"exactfit"]],setup:b, +commit:c},{id:"allowScriptAccess",type:"select",requiredContent:"embed[allowscriptaccess]",label:a.lang.flash.access,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.accessAlways,"always"],[a.lang.flash.accessSameDomain,"samedomain"],[a.lang.flash.accessNever,"never"]],setup:b,commit:c}]},{type:"hbox",widths:["50%","50%"],children:[{id:"wmode",type:"select",requiredContent:"embed[wmode]",label:a.lang.flash.windowMode,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet, +""],[a.lang.flash.windowModeWindow,"window"],[a.lang.flash.windowModeOpaque,"opaque"],[a.lang.flash.windowModeTransparent,"transparent"]],setup:b,commit:c},{id:"quality",type:"select",requiredContent:"embed[quality]",label:a.lang.flash.quality,"default":"high",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.qualityBest,"best"],[a.lang.flash.qualityHigh,"high"],[a.lang.flash.qualityAutoHigh,"autohigh"],[a.lang.flash.qualityMedium,"medium"],[a.lang.flash.qualityAutoLow,"autolow"], +[a.lang.flash.qualityLow,"low"]],setup:b,commit:c}]},{type:"hbox",widths:["50%","50%"],children:[{id:"align",type:"select",requiredContent:"object[align]",label:a.lang.common.align,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.common.left,"left"],[a.lang.flash.alignAbsBottom,"absBottom"],[a.lang.flash.alignAbsMiddle,"absMiddle"],[a.lang.flash.alignBaseline,"baseline"],[a.lang.common.alignBottom,"bottom"],[a.lang.common.alignMiddle,"middle"],[a.lang.common.right,"right"], +[a.lang.flash.alignTextTop,"textTop"],[a.lang.common.alignTop,"top"]],setup:b,commit:function(a,b,f,k,l){var h=this.getValue();c.apply(this,arguments);h&&(l.align=h)}},{type:"html",html:"\x3cdiv\x3e\x3c/div\x3e"}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(a.lang.flash.flashvars),children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"menu",label:a.lang.flash.chkMenu,"default":!0,setup:b,commit:c},{type:"checkbox",id:"play",label:a.lang.flash.chkPlay,"default":!0,setup:b,commit:c}, +{type:"checkbox",id:"loop",label:a.lang.flash.chkLoop,"default":!0,setup:b,commit:c},{type:"checkbox",id:"allowFullScreen",label:a.lang.flash.chkFull,"default":!0,setup:b,commit:c}]}]}]},{id:"advanced",label:a.lang.common.advancedTab,elements:[{type:"hbox",children:[{type:"text",id:"id",requiredContent:"object[id]",label:a.lang.common.id,setup:b,commit:c}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",id:"bgcolor",requiredContent:"embed[bgcolor]",label:a.lang.flash.bgcolor,setup:b,commit:c}, +{type:"text",id:"class",requiredContent:"embed(cke-xyz)",label:a.lang.common.cssClass,setup:b,commit:c}]},{type:"text",id:"style",requiredContent:"embed{cke-xyz}",validate:CKEDITOR.dialog.validate.inlineStyle(a.lang.common.invalidInlineStyle),label:a.lang.common.cssStyle,setup:b,commit:c}]}]}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/flash/images/placeholder.png b/src/static/ckeditor/plugins/flash/images/placeholder.png new file mode 100644 index 00000000..0bc6caa7 Binary files /dev/null and b/src/static/ckeditor/plugins/flash/images/placeholder.png differ diff --git a/src/static/ckeditor/plugins/forms/dialogs/button.js b/src/static/ckeditor/plugins/forms/dialogs/button.js new file mode 100644 index 00000000..a2873342 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/button.js @@ -0,0 +1,8 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("button",function(b){function d(a){var b=this.getValue();b?(a.attributes[this.id]=b,"name"==this.id&&(a.attributes["data-cke-saved-name"]=b)):(delete a.attributes[this.id],"name"==this.id&&delete a.attributes["data-cke-saved-name"])}return{title:b.lang.forms.button.title,minWidth:350,minHeight:150,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&a.is("input")&&a.getAttribute("type")in{button:1,reset:1,submit:1}?a:null},onShow:function(){var a=this.getModel(this.getParentEditor()); +a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a),d=this.getMode(a)==CKEDITOR.dialog.CREATION_MODE,c=b?CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0]:new CKEDITOR.htmlParser.element("input");this.commitContent(c);var e=new CKEDITOR.htmlParser.basicWriter;c.writeHtml(e);c=CKEDITOR.dom.element.createFromHtml(e.getHtml(),a.document);d?a.insertElement(c):(c.replace(b),a.getSelection().selectElement(c))},contents:[{id:"info",label:b.lang.forms.button.title, +title:b.lang.forms.button.title,elements:[{id:"name",type:"text",bidi:!0,label:b.lang.common.name,"default":"",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:d},{id:"value",type:"text",label:b.lang.forms.button.text,accessKey:"V","default":"",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:d},{id:"type",type:"select",label:b.lang.forms.button.type,"default":"button",accessKey:"T",items:[[b.lang.forms.button.typeBtn,"button"],[b.lang.forms.button.typeSbm, +"submit"],[b.lang.forms.button.typeRst,"reset"]],setup:function(a){this.setValue(a.getAttribute("type")||"")},commit:d}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/checkbox.js b/src/static/ckeditor/plugins/forms/dialogs/checkbox.js new file mode 100644 index 00000000..74fac12f --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/checkbox.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("checkbox",function(d){return{title:d.lang.forms.checkboxAndRadio.checkboxTitle,minWidth:350,minHeight:140,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"checkbox"==a.getAttribute("type")?a:null},onShow:function(){var a=this.getModel(this.getParentEditor());a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a);b||(b=a.document.createElement("input"),b.setAttribute("type","checkbox"),a.insertElement(b));this.commitContent({element:b})}, +contents:[{id:"info",label:d.lang.forms.checkboxAndRadio.checkboxTitle,title:d.lang.forms.checkboxAndRadio.checkboxTitle,startupFocus:"txtName",elements:[{id:"txtName",type:"text",label:d.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"txtValue",type:"text",label:d.lang.forms.checkboxAndRadio.value, +"default":"",accessKey:"V",setup:function(a){a=a.getAttribute("value");this.setValue(CKEDITOR.env.ie&&"on"==a?"":a)},commit:function(a){var b=a.element,c=this.getValue();!c||CKEDITOR.env.ie&&"on"==c?CKEDITOR.env.ie?(c=new CKEDITOR.dom.element("input",b.getDocument()),b.copyAttributes(c,{value:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c):b.removeAttribute("value"):b.setAttribute("value",c)}},{id:"cmbSelected",type:"checkbox",label:d.lang.forms.checkboxAndRadio.selected,"default":"", +accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(CKEDITOR.env.ie){var c=!!b.getAttribute("checked"),e=!!this.getValue();c!=e&&(c=CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"checkbox"'+(e?' checked\x3d"checked"':"")+"/\x3e",d.document),b.copyAttributes(c,{type:1,checked:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c)}else a=this.getValue(),CKEDITOR.env.webkit&&(b.$.checked=a),a?b.setAttribute("checked", +"checked"):b.removeAttribute("checked")}},{id:"required",type:"checkbox",label:d.lang.forms.checkboxAndRadio.required,"default":"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute,commit:function(a){a=a.element;this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/form.js b/src/static/ckeditor/plugins/forms/dialogs/form.js new file mode 100644 index 00000000..6dc8fd73 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/form.js @@ -0,0 +1,8 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("form",function(a){var d={action:1,id:1,method:1,enctype:1,target:1};return{title:a.lang.forms.form.title,minWidth:350,minHeight:200,getModel:function(b){return b.elementPath().contains("form",1)||null},onShow:function(){var b=this.getModel(this.getParentEditor());b&&this.setupContent(b)},onOk:function(){var b=this.getParentEditor(),a=this.getModel(b);a||(a=b.document.createElement("form"),a.appendBogus(),b.insertElement(a));this.commitContent(a)},onLoad:function(){function a(b){this.setValue(b.getAttribute(this.id)|| +"")}function e(a){this.getValue()?a.setAttribute(this.id,this.getValue()):a.removeAttribute(this.id)}this.foreach(function(c){d[c.id]&&(c.setup=a,c.commit=e)})},contents:[{id:"info",label:a.lang.forms.form.title,title:a.lang.forms.form.title,elements:[{id:"txtName",bidi:!0,type:"text",label:a.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()): +(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"action",type:"text",label:a.lang.forms.form.action,"default":"",accessKey:"T"},{type:"hbox",widths:["45%","55%"],children:[{id:"id",type:"text",label:a.lang.common.id,"default":"",accessKey:"I"},{id:"enctype",type:"select",label:a.lang.forms.form.encoding,style:"width:100%",accessKey:"E","default":"",items:[[""],["text/plain"],["multipart/form-data"],["application/x-www-form-urlencoded"]]}]},{type:"hbox",widths:["45%","55%"],children:[{id:"target", +type:"select",label:a.lang.common.target,style:"width:100%",accessKey:"M","default":"",items:[[a.lang.common.notSet,""],[a.lang.common.targetNew,"_blank"],[a.lang.common.targetTop,"_top"],[a.lang.common.targetSelf,"_self"],[a.lang.common.targetParent,"_parent"]]},{id:"method",type:"select",label:a.lang.forms.form.method,accessKey:"M","default":"GET",items:[["GET","get"],["POST","post"]]}]}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/hiddenfield.js b/src/static/ckeditor/plugins/forms/dialogs/hiddenfield.js new file mode 100644 index 00000000..8dbc1be0 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/hiddenfield.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("hiddenfield",function(c){return{title:c.lang.forms.hidden.title,hiddenField:null,minWidth:350,minHeight:110,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&a.data("cke-real-element-type")&&"hiddenfield"==a.data("cke-real-element-type")?a:null},onShow:function(){var a=this.getParentEditor(),b=this.getModel(a);b&&(this.setupContent(a.restoreRealElement(b)),a.getSelection().selectElement(b))},onOk:function(){var a=this.getValueOf("info","_cke_saved_name"),b= +this.getParentEditor(),a=CKEDITOR.env.ie&&8>CKEDITOR.document.$.documentMode?b.document.createElement('\x3cinput name\x3d"'+CKEDITOR.tools.htmlEncode(a)+'"\x3e'):b.document.createElement("input");a.setAttribute("type","hidden");this.commitContent(a);var a=b.createFakeElement(a,"cke_hidden","hiddenfield"),c=this.getModel(b);c?(a.replace(c),b.getSelection().selectElement(a)):b.insertElement(a);return!0},contents:[{id:"info",label:c.lang.forms.hidden.title,title:c.lang.forms.hidden.title,elements:[{id:"_cke_saved_name", +type:"text",label:c.lang.forms.hidden.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.setAttribute("name",this.getValue()):a.removeAttribute("name")}},{id:"value",type:"text",label:c.lang.forms.hidden.value,"default":"",accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){this.getValue()?a.setAttribute("value",this.getValue()):a.removeAttribute("value")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/radio.js b/src/static/ckeditor/plugins/forms/dialogs/radio.js new file mode 100644 index 00000000..a9d2543e --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/radio.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("radio",function(c){return{title:c.lang.forms.checkboxAndRadio.radioTitle,minWidth:350,minHeight:140,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"input"==a.getName()&&"radio"==a.getAttribute("type")?a:null},onShow:function(){var a=this.getModel(this.getParentEditor());a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a);b||(b=a.document.createElement("input"),b.setAttribute("type","radio"),a.insertElement(b));this.commitContent({element:b})}, +contents:[{id:"info",label:c.lang.forms.checkboxAndRadio.radioTitle,title:c.lang.forms.checkboxAndRadio.radioTitle,elements:[{id:"name",type:"text",label:c.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"value",type:"text",label:c.lang.forms.checkboxAndRadio.value,"default":"", +accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){a=a.element;this.getValue()?a.setAttribute("value",this.getValue()):a.removeAttribute("value")}},{id:"checked",type:"checkbox",label:c.lang.forms.checkboxAndRadio.selected,"default":"",accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(CKEDITOR.env.ie){var d=b.getAttribute("checked"),e=!!this.getValue();d!=e&&(d=CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"radio"'+ +(e?' checked\x3d"checked"':"")+"\x3e\x3c/input\x3e",c.document),b.copyAttributes(d,{type:1,checked:1}),d.replace(b),e&&d.setAttribute("checked","checked"),c.getSelection().selectElement(d),a.element=d)}else a=this.getValue(),CKEDITOR.env.webkit&&(b.$.checked=a),a?b.setAttribute("checked","checked"):b.removeAttribute("checked")}},{id:"required",type:"checkbox",label:c.lang.forms.checkboxAndRadio.required,"default":"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute, +commit:function(a){a=a.element;this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/select.js b/src/static/ckeditor/plugins/forms/dialogs/select.js new file mode 100644 index 00000000..d8242545 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/select.js @@ -0,0 +1,21 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("select",function(c){function h(a,b,e,d,c){a=f(a);d=d?d.createElement("OPTION"):document.createElement("OPTION");if(a&&d&&"option"==d.getName())CKEDITOR.env.ie?(isNaN(parseInt(c,10))?a.$.options.add(d.$):a.$.options.add(d.$,c),d.$.innerHTML=0<b.length?b:"",d.$.value=e):(null!==c&&c<a.getChildCount()?a.getChild(0>c?0:c).insertBeforeMe(d):a.append(d),d.setText(0<b.length?b:""),d.setValue(e));else return!1;return d}function p(a){a=f(a);for(var b=g(a),e=a.getChildren().count()-1;0<= +e;e--)a.getChild(e).$.selected&&a.getChild(e).remove();k(a,b)}function q(a,b,e,d){a=f(a);if(0>b)return!1;a=a.getChild(b);a.setText(e);a.setValue(d);return a}function m(a){for(a=f(a);a.getChild(0)&&a.getChild(0).remove(););}function l(a,b,e){a=f(a);var d=g(a);if(0>d)return!1;b=d+b;b=0>b?0:b;b=b>=a.getChildCount()?a.getChildCount()-1:b;if(d==b)return!1;var d=a.getChild(d),c=d.getText(),r=d.getValue();d.remove();d=h(a,c,r,e?e:null,b);k(a,b);return d}function g(a){return(a=f(a))?a.$.selectedIndex:-1} +function k(a,b){a=f(a);if(0>b)return null;var e=a.getChildren().count();a.$.selectedIndex=b>=e?e-1:b;return a}function n(a){return(a=f(a))?a.getChildren():!1}function f(a){return a&&a.domId&&a.getInputElement().$?a.getInputElement():a&&a.$?a:!1}return{title:c.lang.forms.select.title,minWidth:CKEDITOR.env.ie?460:395,minHeight:CKEDITOR.env.ie?320:300,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"select"==a.getName()?a:null},onShow:function(){this.setupContent("clear");var a= +this.getModel(this.getParentEditor());if(a){this.setupContent(a.getName(),a);for(var a=n(a),b=0;b<a.count();b++)this.setupContent("option",a.getItem(b))}},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a),e=this.getMode(a)==CKEDITOR.dialog.CREATION_MODE;e&&(b=a.document.createElement("select"));this.commitContent(b);if(e&&(a.insertElement(b),CKEDITOR.env.ie)){var d=a.getSelection(),c=d.createBookmarks();setTimeout(function(){d.selectBookmarks(c)},0)}},contents:[{id:"info",label:c.lang.forms.select.selectInfo, +title:c.lang.forms.select.selectInfo,accessKey:"",elements:[{id:"txtName",type:"text",widths:["25%","75%"],labelLayout:"horizontal",label:c.lang.common.name,"default":"",accessKey:"N",style:"width:350px",setup:function(a,b){"clear"==a?this.setValue(this["default"]||""):"select"==a&&this.setValue(b.data("cke-saved-name")||b.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"txtValue", +type:"text",widths:["25%","75%"],labelLayout:"horizontal",label:c.lang.forms.select.value,style:"width:350px","default":"",className:"cke_disabled",onLoad:function(){this.getInputElement().setAttribute("readOnly",!0)},setup:function(a,b){"clear"==a?this.setValue(""):"option"==a&&b.getAttribute("selected")&&this.setValue(b.$.value)}},{type:"hbox",className:"cke_dialog_forms_select_order_txtsize",widths:["175px","170px"],children:[{id:"txtSize",type:"text",labelLayout:"horizontal",label:c.lang.forms.select.size, +"default":"",accessKey:"S",style:"width:175px",validate:function(){var a=CKEDITOR.dialog.validate.integer(c.lang.common.validateNumberFailed);return""===this.getValue()||a.apply(this)},setup:function(a,b){"select"==a&&this.setValue(b.getAttribute("size")||"");CKEDITOR.env.webkit&&this.getInputElement().setStyle("width","86px")},commit:function(a){this.getValue()?a.setAttribute("size",this.getValue()):a.removeAttribute("size")}},{type:"html",html:"\x3cspan\x3e"+CKEDITOR.tools.htmlEncode(c.lang.forms.select.lines)+ +"\x3c/span\x3e"}]},{type:"html",html:"\x3cspan\x3e"+CKEDITOR.tools.htmlEncode(c.lang.forms.select.opAvail)+"\x3c/span\x3e"},{type:"hbox",widths:["115px","115px","100px"],className:"cke_dialog_forms_select_order",children:[{type:"vbox",children:[{id:"txtOptName",type:"text",label:c.lang.forms.select.opText,style:"width:115px",setup:function(a){"clear"==a&&this.setValue("")}},{type:"select",id:"cmbName",label:"",title:"",size:5,style:"width:115px;height:75px",items:[],onChange:function(){var a=this.getDialog(), +b=a.getContentElement("info","cmbValue"),e=a.getContentElement("info","txtOptName"),a=a.getContentElement("info","txtOptValue"),d=g(this);k(b,d);e.setValue(this.getValue());a.setValue(b.getValue())},setup:function(a,b){"clear"==a?m(this):"option"==a&&h(this,b.getText(),b.getText(),this.getDialog().getParentEditor().document)},commit:function(a){var b=this.getDialog(),e=n(this),d=n(b.getContentElement("info","cmbValue")),c=b.getContentElement("info","txtValue").getValue();m(a);for(var f=0;f<e.count();f++){var g= +h(a,e.getItem(f).getValue(),d.getItem(f).getValue(),b.getParentEditor().document);d.getItem(f).getValue()==c&&(g.setAttribute("selected","selected"),g.selected=!0)}}}]},{type:"vbox",children:[{id:"txtOptValue",type:"text",label:c.lang.forms.select.opValue,style:"width:115px",setup:function(a){"clear"==a&&this.setValue("")}},{type:"select",id:"cmbValue",label:"",size:5,style:"width:115px;height:75px",items:[],onChange:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),e=a.getContentElement("info", +"txtOptName"),a=a.getContentElement("info","txtOptValue"),d=g(this);k(b,d);e.setValue(b.getValue());a.setValue(this.getValue())},setup:function(a,b){if("clear"==a)m(this);else if("option"==a){var e=b.getValue();h(this,e,e,this.getDialog().getParentEditor().document);"selected"==b.getAttribute("selected")&&this.getDialog().getContentElement("info","txtValue").setValue(e)}}}]},{type:"vbox",padding:5,children:[{type:"button",id:"btnAdd",label:c.lang.forms.select.btnAdd,title:c.lang.forms.select.btnAdd, +style:"width:100%;",onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","txtOptName"),e=a.getContentElement("info","txtOptValue"),d=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue");h(d,b.getValue(),b.getValue(),a.getParentEditor().document);h(c,e.getValue(),e.getValue(),a.getParentEditor().document);b.setValue("");e.setValue("")}},{type:"button",id:"btnModify",label:c.lang.forms.select.btnModify,title:c.lang.forms.select.btnModify,style:"width:100%;", +onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","txtOptName"),e=a.getContentElement("info","txtOptValue"),d=a.getContentElement("info","cmbName"),a=a.getContentElement("info","cmbValue"),c=g(d);0<=c&&(q(d,c,b.getValue(),b.getValue()),q(a,c,e.getValue(),e.getValue()))}},{type:"button",id:"btnUp",style:"width:100%;",label:c.lang.forms.select.btnUp,title:c.lang.forms.select.btnUp,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info", +"cmbValue");l(b,-1,a.getParentEditor().document);l(c,-1,a.getParentEditor().document)}},{type:"button",id:"btnDown",style:"width:100%;",label:c.lang.forms.select.btnDown,title:c.lang.forms.select.btnDown,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue");l(b,1,a.getParentEditor().document);l(c,1,a.getParentEditor().document)}}]}]},{type:"hbox",widths:["40%","20%","40%"],children:[{type:"button",id:"btnSetValue",label:c.lang.forms.select.btnSetValue, +title:c.lang.forms.select.btnSetValue,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbValue");a.getContentElement("info","txtValue").setValue(b.getValue())}},{type:"button",id:"btnDelete",label:c.lang.forms.select.btnDelete,title:c.lang.forms.select.btnDelete,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue"),d=a.getContentElement("info","txtOptName"),a=a.getContentElement("info","txtOptValue");p(b); +p(c);d.setValue("");a.setValue("")}},{type:"vbox",children:[{id:"chkMulti",type:"checkbox",label:c.lang.forms.select.chkMulti,"default":"",accessKey:"M",value:"checked",setup:function(a,b){"select"==a&&this.setValue(b.getAttribute("multiple"))},commit:function(a){this.getValue()?a.setAttribute("multiple",this.getValue()):a.removeAttribute("multiple")}},{id:"required",type:"checkbox",label:c.lang.forms.select.required,"default":"",accessKey:"Q",value:"checked",setup:function(a,b){"select"==a&&CKEDITOR.plugins.forms._setupRequiredAttribute.call(this, +b)},commit:function(a){this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/textarea.js b/src/static/ckeditor/plugins/forms/dialogs/textarea.js new file mode 100644 index 00000000..a5408632 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/textarea.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("textarea",function(b){return{title:b.lang.forms.textarea.title,minWidth:350,minHeight:220,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"textarea"==a.getName()?a:null},onShow:function(){var a=this.getModel(this.getParentEditor());a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a),c=this.getMode(a)==CKEDITOR.dialog.CREATION_MODE;c&&(b=a.document.createElement("textarea"));this.commitContent(b);c&&a.insertElement(b)}, +contents:[{id:"info",label:b.lang.forms.textarea.title,title:b.lang.forms.textarea.title,elements:[{id:"_cke_saved_name",type:"text",label:b.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{type:"hbox",widths:["50%","50%"],children:[{id:"cols",type:"text",label:b.lang.forms.textarea.cols, +"default":"",accessKey:"C",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed),setup:function(a){a=a.hasAttribute("cols")&&a.getAttribute("cols");this.setValue(a||"")},commit:function(a){this.getValue()?a.setAttribute("cols",this.getValue()):a.removeAttribute("cols")}},{id:"rows",type:"text",label:b.lang.forms.textarea.rows,"default":"",accessKey:"R",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed),setup:function(a){a= +a.hasAttribute("rows")&&a.getAttribute("rows");this.setValue(a||"")},commit:function(a){this.getValue()?a.setAttribute("rows",this.getValue()):a.removeAttribute("rows")}}]},{id:"value",type:"textarea",label:b.lang.forms.textfield.value,"default":"",setup:function(a){this.setValue(a.$.defaultValue)},commit:function(a){a.$.value=a.$.defaultValue=this.getValue()}},{id:"required",type:"checkbox",label:b.lang.forms.textfield.required,"default":"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute, +commit:function(a){this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/dialogs/textfield.js b/src/static/ckeditor/plugins/forms/dialogs/textfield.js new file mode 100644 index 00000000..7b1d3383 --- /dev/null +++ b/src/static/ckeditor/plugins/forms/dialogs/textfield.js @@ -0,0 +1,11 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("textfield",function(b){function e(a){a=a.element;var b=this.getValue();b?a.setAttribute(this.id,b):a.removeAttribute(this.id)}function f(a){a=a.hasAttribute(this.id)&&a.getAttribute(this.id);this.setValue(a||"")}var g={email:1,password:1,search:1,tel:1,text:1,url:1};return{title:b.lang.forms.textfield.title,minWidth:350,minHeight:150,getModel:function(a){a=a.getSelection().getSelectedElement();return!a||"input"!=a.getName()||!g[a.getAttribute("type")]&&a.getAttribute("type")? +null:a},onShow:function(){var a=this.getModel(this.getParentEditor());a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a),c=this.getMode(a)==CKEDITOR.dialog.CREATION_MODE;c&&(b=a.document.createElement("input"),b.setAttribute("type","text"));b={element:b};c&&a.insertElement(b.element);this.commitContent(b);c||a.getSelection().selectElement(b.element)},onLoad:function(){this.foreach(function(a){a.getValue&&(a.setup||(a.setup=f),a.commit||(a.commit=e))})},contents:[{id:"info", +label:b.lang.forms.textfield.title,title:b.lang.forms.textfield.title,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"_cke_saved_name",type:"text",label:b.lang.forms.textfield.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"value",type:"text",label:b.lang.forms.textfield.value, +"default":"",accessKey:"V",commit:function(a){if(CKEDITOR.env.ie&&!this.getValue()){var d=a.element,c=new CKEDITOR.dom.element("input",b.document);d.copyAttributes(c,{value:1});c.replace(d);a.element=c}else e.call(this,a)}}]},{type:"hbox",widths:["50%","50%"],children:[{id:"size",type:"text",label:b.lang.forms.textfield.charWidth,"default":"",accessKey:"C",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)},{id:"maxLength",type:"text",label:b.lang.forms.textfield.maxChars, +"default":"",accessKey:"M",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)}],onLoad:function(){CKEDITOR.env.ie7Compat&&this.getElement().setStyle("zoom","100%")}},{id:"type",type:"select",label:b.lang.forms.textfield.type,"default":"text",accessKey:"M",items:[[b.lang.forms.textfield.typeEmail,"email"],[b.lang.forms.textfield.typePass,"password"],[b.lang.forms.textfield.typeSearch,"search"],[b.lang.forms.textfield.typeTel,"tel"],[b.lang.forms.textfield.typeText, +"text"],[b.lang.forms.textfield.typeUrl,"url"]],setup:function(a){this.setValue(a.getAttribute("type"))},commit:function(a){var d=a.element;if(CKEDITOR.env.ie){var c=d.getAttribute("type"),e=this.getValue();c!=e&&(c=CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"'+e+'"\x3e\x3c/input\x3e',b.document),d.copyAttributes(c,{type:1}),c.replace(d),a.element=c)}else d.setAttribute("type",this.getValue())}},{id:"required",type:"checkbox",label:b.lang.forms.textfield.required,"default":"",accessKey:"Q", +value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute,commit:function(a){a=a.element;this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/forms/images/hiddenfield.gif b/src/static/ckeditor/plugins/forms/images/hiddenfield.gif new file mode 100644 index 00000000..988d9565 Binary files /dev/null and b/src/static/ckeditor/plugins/forms/images/hiddenfield.gif differ diff --git a/src/static/ckeditor/plugins/iframe/dialogs/iframe.js b/src/static/ckeditor/plugins/iframe/dialogs/iframe.js new file mode 100644 index 00000000..f29a82e8 --- /dev/null +++ b/src/static/ckeditor/plugins/iframe/dialogs/iframe.js @@ -0,0 +1,11 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function d(c){var e=this instanceof CKEDITOR.ui.dialog.checkbox;c.hasAttribute(this.id)&&(c=c.getAttribute(this.id),e?this.setValue(g[this.id]["true"]==c.toLowerCase()):this.setValue(c))}function f(c){var e=this.getValue(),a=this.att||this.id,d=this instanceof CKEDITOR.ui.dialog.checkbox?g[this.id][e]:e;""===e||"tabindex"===a&&!1===e?c.removeAttribute(a):c.setAttribute(a,d)}var g={scrolling:{"true":"yes","false":"no"},frameborder:{"true":"1","false":"0"},tabindex:{"true":"-1","false":!1}}; +CKEDITOR.dialog.add("iframe",function(c){var e=c.lang.iframe,a=c.lang.common,g=c.plugins.dialogadvtab;return{title:e.title,minWidth:350,minHeight:260,getModel:function(b){return(b=b.getSelection().getSelectedElement())&&"iframe"===b.data("cke-real-element-type")?b:null},onShow:function(){this.fakeImage=this.iframeNode=null;var b=this.getSelectedElement();b&&b.data("cke-real-element-type")&&"iframe"==b.data("cke-real-element-type")&&(this.fakeImage=b,this.iframeNode=b=c.restoreRealElement(b),this.setupContent(b))}, +onOk:function(){var b;b=this.fakeImage?this.iframeNode:new CKEDITOR.dom.element("iframe");var a={},d={};this.commitContent(b,a,d);b=c.createFakeElement(b,"cke_iframe","iframe",!0);b.setAttributes(d);b.setStyles(a);this.fakeImage?(b.replace(this.fakeImage),c.getSelection().selectElement(b)):c.insertElement(b)},contents:[{id:"info",label:a.generalTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{id:"src",type:"text",label:a.url,required:!0,validate:CKEDITOR.dialog.validate.notEmpty(e.noUrl), +setup:d,commit:f}]},{type:"hbox",children:[{id:"width",type:"text",requiredContent:"iframe[width]",style:"width:100%",labelLayout:"vertical",label:a.width,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.width)),setup:d,commit:f},{id:"height",type:"text",requiredContent:"iframe[height]",style:"width:100%",labelLayout:"vertical",label:a.height,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.height)),setup:d,commit:f},{id:"align",type:"select", +requiredContent:"iframe[align]","default":"",items:[[a.notSet,""],[a.left,"left"],[a.right,"right"],[a.alignTop,"top"],[a.alignMiddle,"middle"],[a.alignBottom,"bottom"]],style:"width:100%",labelLayout:"vertical",label:a.align,setup:function(a,c){d.apply(this,arguments);if(c){var e=c.getAttribute("align");this.setValue(e&&e.toLowerCase()||"")}},commit:function(a,c,d){f.apply(this,arguments);this.getValue()&&(d.align=this.getValue())}}]},{type:"hbox",widths:["33%","33%","33%"],children:[{id:"scrolling", +type:"checkbox",requiredContent:"iframe[scrolling]",label:e.scrolling,setup:d,commit:f},{id:"frameborder",type:"checkbox",requiredContent:"iframe[frameborder]",label:e.border,setup:d,commit:f},{id:"tabindex",type:"checkbox",requiredContent:"iframe[tabindex]",label:e.tabindex,setup:d,commit:f}]},{type:"hbox",widths:["50%","50%"],children:[{id:"name",type:"text",requiredContent:"iframe[name]",label:a.name,setup:d,commit:f},{id:"title",type:"text",requiredContent:"iframe[title]",label:a.advisoryTitle, +setup:d,commit:f}]},{id:"longdesc",type:"text",requiredContent:"iframe[longdesc]",label:a.longDescr,setup:d,commit:f}]},g&&g.createAdvancedTab(c,{id:1,classes:1,styles:1},"iframe")]}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/iframe/images/placeholder.png b/src/static/ckeditor/plugins/iframe/images/placeholder.png new file mode 100644 index 00000000..4af09565 Binary files /dev/null and b/src/static/ckeditor/plugins/iframe/images/placeholder.png differ diff --git a/src/static/ckeditor/plugins/iframedialog/plugin.js b/src/static/ckeditor/plugins/iframedialog/plugin.js new file mode 100644 index 00000000..ae2074f5 --- /dev/null +++ b/src/static/ckeditor/plugins/iframedialog/plugin.js @@ -0,0 +1,8 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("iframedialog",{requires:"dialog",onLoad:function(){CKEDITOR.dialog.addIframe=function(e,d,a,l,f,n,g){a={type:"iframe",src:a,width:"100%",height:"100%"};a.onContentLoad="function"==typeof n?n:function(){var a=this.getElement().$.contentWindow;if(a.onDialogEvent){var b=this.getDialog(),c=function(b){return a.onDialogEvent(b)};b.on("ok",c);b.on("cancel",c);b.on("resize",c);b.on("hide",function(a){b.removeListener("ok",c);b.removeListener("cancel",c);b.removeListener("resize",c); +a.removeListener()});a.onDialogEvent({name:"load",sender:this,editor:b._.editor})}};var h={title:d,minWidth:l,minHeight:f,contents:[{id:"iframe",label:d,expand:!0,elements:[a],style:"width:"+a.width+";height:"+a.height}]},k;for(k in g)h[k]=g[k];this.add(e,function(){return h})};(function(){var e=function(d,a,l){if(!(3>arguments.length)){var f=this._||(this._={}),e=a.onContentLoad&&CKEDITOR.tools.bind(a.onContentLoad,this),g=CKEDITOR.tools.cssLength(a.width),h=CKEDITOR.tools.cssLength(a.height);f.frameId= +CKEDITOR.tools.getNextId()+"_iframe";d.on("load",function(){CKEDITOR.document.getById(f.frameId).getParent().setStyles({width:g,height:h})});var k={src:"%2",id:f.frameId,frameborder:0,allowtransparency:!0},m=[];"function"==typeof a.onContentLoad&&(k.onload="CKEDITOR.tools.callFunction(%1);");CKEDITOR.ui.dialog.uiElement.call(this,d,a,m,"iframe",{width:g,height:h},k,"");l.push('\x3cdiv style\x3d"width:'+g+";height:"+h+';" id\x3d"'+this.domId+'"\x3e\x3c/div\x3e');m=m.join("");d.on("show",function(){var b= +CKEDITOR.document.getById(f.frameId).getParent(),c=CKEDITOR.tools.addFunction(e),c=m.replace("%1",c).replace("%2",CKEDITOR.tools.htmlEncode(a.src));b.setHtml(c)})}};e.prototype=new CKEDITOR.ui.dialog.uiElement;CKEDITOR.dialog.addUIElement("iframe",{build:function(d,a,l){return new e(d,a,l)}})})()}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/image/dialogs/image.js b/src/static/ckeditor/plugins/image/dialogs/image.js index a319e1dd..4e7f6daf 100644 --- a/src/static/ckeditor/plugins/image/dialogs/image.js +++ b/src/static/ckeditor/plugins/image/dialogs/image.js @@ -1,1295 +1,1294 @@ -/** - * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -( function() { - var imageDialog = function( editor, dialogType ) { - // Load image preview. - var IMAGE = 1, - LINK = 2, - PREVIEW = 4, - CLEANUP = 8, - regexGetSize = /^\s*(\d+)((px)|\%)?\s*$/i, - regexGetSizeOrEmpty = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i, - pxLengthRegex = /^\d+px$/; - - var onSizeChange = function() { - var value = this.getValue(), - // This = input element. - dialog = this.getDialog(), - aMatch = value.match( regexGetSize ); // Check value - if ( aMatch ) { - if ( aMatch[ 2 ] == '%' ) // % is allowed - > unlock ratio. - switchLockRatio( dialog, false ); // Unlock. - value = aMatch[ 1 ]; - } - - // Only if ratio is locked - if ( dialog.lockRatio ) { - var oImageOriginal = dialog.originalElement; - if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { - if ( this.id == 'txtHeight' ) { - if ( value && value != '0' ) - value = Math.round( oImageOriginal.$.width * ( value / oImageOriginal.$.height ) ); - if ( !isNaN( value ) ) - dialog.setValueOf( 'info', 'txtWidth', value ); - } - // this.id = txtWidth. - else { - if ( value && value != '0' ) - value = Math.round( oImageOriginal.$.height * ( value / oImageOriginal.$.width ) ); - if ( !isNaN( value ) ) - dialog.setValueOf( 'info', 'txtHeight', value ); - } - } - } - updatePreview( dialog ); - }; - - var updatePreview = function( dialog ) { - //Don't load before onShow. - if ( !dialog.originalElement || !dialog.preview ) - return 1; - - // Read attributes and update imagePreview; - dialog.commitContent( PREVIEW, dialog.preview ); - return 0; - }; - - // Custom commit dialog logic, where we're intended to give inline style - // field (txtdlgGenStyle) higher priority to avoid overwriting styles contribute - // by other fields. - function commitContent() { - var args = arguments; - var inlineStyleField = this.getContentElement( 'advanced', 'txtdlgGenStyle' ); - inlineStyleField && inlineStyleField.commit.apply( inlineStyleField, args ); - - this.foreach( function( widget ) { - if ( widget.commit && widget.id != 'txtdlgGenStyle' ) - widget.commit.apply( widget, args ); - } ); - } - - // Avoid recursions. - var incommit; - - // Synchronous field values to other impacted fields is required, e.g. border - // size change should alter inline-style text as well. - function commitInternally( targetFields ) { - if ( incommit ) - return; - - incommit = 1; - - var dialog = this.getDialog(), - element = dialog.imageElement; - if ( element ) { - // Commit this field and broadcast to target fields. - this.commit( IMAGE, element ); - - targetFields = [].concat( targetFields ); - var length = targetFields.length, - field; - for ( var i = 0; i < length; i++ ) { - field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) ); - // May cause recursion. - field && field.setup( IMAGE, element ); - } - } - - incommit = 0; - } - - var switchLockRatio = function( dialog, value ) { - if ( !dialog.getContentElement( 'info', 'ratioLock' ) ) - return null; - - var oImageOriginal = dialog.originalElement; - - // Dialog may already closed. (https://dev.ckeditor.com/ticket/5505) - if ( !oImageOriginal ) - return null; - - // Check image ratio and original image ratio, but respecting user's preference. - if ( value == 'check' ) { - if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { - var width = dialog.getValueOf( 'info', 'txtWidth' ), - height = dialog.getValueOf( 'info', 'txtHeight' ), - originalRatio = oImageOriginal.$.width / oImageOriginal.$.height, - thisRatio = width / height; - - dialog.lockRatio = false; // Default: unlock ratio - - if ( !width && !height ) { - dialog.lockRatio = true; - } else { - // Round ratio to two decimal places so ratio locking will be less precise (#2254). - var ratioComparison = Math.round( ( originalRatio / thisRatio ) * 100 ) / 100; - - if ( ratioComparison == 1 ) { - dialog.lockRatio = true; - } - } - } - } else if ( value !== undefined ) { - dialog.lockRatio = value; - } else { - dialog.userlockRatio = 1; - dialog.lockRatio = !dialog.lockRatio; - } - - var ratioButton = CKEDITOR.document.getById( btnLockSizesId ); - if ( dialog.lockRatio ) - ratioButton.removeClass( 'cke_btn_unlocked' ); - else - ratioButton.addClass( 'cke_btn_unlocked' ); - - ratioButton.setAttribute( 'aria-checked', dialog.lockRatio ); - - // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE - if ( CKEDITOR.env.hc ) { - var icon = ratioButton.getChild( 0 ); - icon.setHtml( dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0' : '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' ); - } - - return dialog.lockRatio; - }; - - var resetSize = function( dialog, emptyValues ) { - var oImageOriginal = dialog.originalElement, - ready = oImageOriginal.getCustomData( 'isReady' ) == 'true'; - - if ( ready ) { - var widthField = dialog.getContentElement( 'info', 'txtWidth' ), - heightField = dialog.getContentElement( 'info', 'txtHeight' ), - widthValue, heightValue; - - if ( emptyValues ) { - widthValue = 0; - heightValue = 0; - } else { - widthValue = oImageOriginal.$.width; - heightValue = oImageOriginal.$.height; - } - - widthField && widthField.setValue( widthValue ); - heightField && heightField.setValue( heightValue ); - } - updatePreview( dialog ); - }; - - var setupDimension = function( type, element ) { - if ( type != IMAGE ) - return; - - function checkDimension( size, defaultValue ) { - var aMatch = size.match( regexGetSize ); - if ( aMatch ) { - // % is allowed. - if ( aMatch[ 2 ] == '%' ) { - aMatch[ 1 ] += '%'; - switchLockRatio( dialog, false ); // Unlock ratio - } - return aMatch[ 1 ]; - } - return defaultValue; - } - - var dialog = this.getDialog(), - value = '', - dimension = this.id == 'txtWidth' ? 'width' : 'height', - size = element.getAttribute( dimension ); - - if ( size ) - value = checkDimension( size, value ); - value = checkDimension( element.getStyle( dimension ), value ); - - this.setValue( value ); - }; - - var previewPreloader; - - var onImgLoadEvent = function() { - // Image is ready. - var original = this.originalElement, - loader = CKEDITOR.document.getById( imagePreviewLoaderId ); - - original.setCustomData( 'isReady', 'true' ); - original.removeListener( 'load', onImgLoadEvent ); - original.removeListener( 'error', onImgLoadErrorEvent ); - original.removeListener( 'abort', onImgLoadErrorEvent ); - - // Hide loader. - if ( loader ) - loader.setStyle( 'display', 'none' ); - - // New image -> new dimensions - if ( !this.dontResetSize ) { - resetSize( this, editor.config.image_prefillDimensions === false ); - } - - if ( this.firstLoad ) { - CKEDITOR.tools.setTimeout( function() { - switchLockRatio( this, 'check' ); - }, 0, this ); - } - - this.firstLoad = false; - this.dontResetSize = false; - - // Possible fix for https://dev.ckeditor.com/ticket/12818. - updatePreview( this ); - }; - - var onImgLoadErrorEvent = function() { - // Error. Image is not loaded. - var original = this.originalElement, - loader = CKEDITOR.document.getById( imagePreviewLoaderId ); - - original.removeListener( 'load', onImgLoadEvent ); - original.removeListener( 'error', onImgLoadErrorEvent ); - original.removeListener( 'abort', onImgLoadErrorEvent ); - - // Set Error image. - var noimage = CKEDITOR.getUrl( CKEDITOR.plugins.get( 'image' ).path + 'images/noimage.png' ); - - if ( this.preview ) - this.preview.setAttribute( 'src', noimage ); - - // Hide loader. - if ( loader ) - loader.setStyle( 'display', 'none' ); - - switchLockRatio( this, false ); // Unlock. - }; - - var numbering = function( id ) { - return CKEDITOR.tools.getNextId() + '_' + id; - }, - btnLockSizesId = numbering( 'btnLockSizes' ), - btnResetSizeId = numbering( 'btnResetSize' ), - imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ), - previewLinkId = numbering( 'previewLink' ), - previewImageId = numbering( 'previewImage' ); - - return { - title: editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ], - minWidth: ( CKEDITOR.skinName || editor.config.skin ) == 'moono-lisa' ? 500 : 420, - minHeight: 360, - getModel: function( editor ) { - var element = editor.getSelection().getSelectedElement(), - isImage = element && element.getName() === 'img', - isImageInput = element && element.getName() === 'input' && - element.getAttribute( 'type' ) === 'image'; - - if ( isImage ||isImageInput ) { - return element; - } - - return null; - }, - onShow: function() { - this.imageElement = false; - this.linkElement = false; - - // Default: create a new element. - this.imageEditMode = false; - this.linkEditMode = false; - - this.lockRatio = true; - this.userlockRatio = 0; - this.dontResetSize = false; - this.firstLoad = true; - this.addLink = false; - - var editor = this.getParentEditor(), - sel = editor.getSelection(), - element = sel && sel.getSelectedElement(), - link = element && editor.elementPath( element ).contains( 'a', 1 ), - loader = CKEDITOR.document.getById( imagePreviewLoaderId ); - - // Hide loader. - if ( loader ) - loader.setStyle( 'display', 'none' ); - - // Create the preview before setup the dialog contents. - previewPreloader = new CKEDITOR.dom.element( 'img', editor.document ); - this.preview = CKEDITOR.document.getById( previewImageId ); - - // Copy of the image - this.originalElement = editor.document.createElement( 'img' ); - this.originalElement.setAttribute( 'alt', '' ); - this.originalElement.setCustomData( 'isReady', 'false' ); - - if ( link ) { - this.linkElement = link; - this.linkEditMode = true; - - // If there is an existing link, by default keep it (true). - // It will be removed if certain conditions are met and Link tab is enabled. (https://dev.ckeditor.com/ticket/13351) - this.addLink = true; - - // Look for Image element. - var linkChildren = link.getChildren(); - if ( linkChildren.count() == 1 ) { - var childTag = linkChildren.getItem( 0 ); - - if ( childTag.type == CKEDITOR.NODE_ELEMENT ) { - if ( childTag.is( 'img' ) || childTag.is( 'input' ) ) { - this.imageElement = linkChildren.getItem( 0 ); - if ( this.imageElement.is( 'img' ) ) - this.imageEditMode = 'img'; - else if ( this.imageElement.is( 'input' ) ) - this.imageEditMode = 'input'; - } - } - } - // Fill out all fields. - if ( dialogType == 'image' ) - this.setupContent( LINK, link ); - } - - // Edit given image element instead the one from selection. - if ( this.customImageElement ) { - this.imageEditMode = 'img'; - this.imageElement = this.customImageElement; - delete this.customImageElement; - } - else if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) || - element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) { - this.imageEditMode = element.getName(); - this.imageElement = element; - } - - if ( this.imageEditMode ) { - // Use the original element as a buffer from since we don't want - // temporary changes to be committed, e.g. if the dialog is canceled. - this.cleanImageElement = this.imageElement; - this.imageElement = this.cleanImageElement.clone( true, true ); - - // Fill out all fields. - this.setupContent( IMAGE, this.imageElement ); - } - - // Refresh LockRatio button - switchLockRatio( this, true ); - - // Dont show preview if no URL given. - if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) ) { - this.preview.removeAttribute( 'src' ); - this.preview.setStyle( 'display', 'none' ); - } - }, - onOk: function() { - // Edit existing Image. - if ( this.imageEditMode ) { - var imgTagName = this.imageEditMode; - - // Image dialog and Input element. - if ( dialogType == 'image' && imgTagName == 'input' && confirm( editor.lang.image.button2Img ) ) { // jshint ignore:line - // Replace INPUT-> IMG - imgTagName = 'img'; - this.imageElement = editor.document.createElement( 'img' ); - this.imageElement.setAttribute( 'alt', '' ); - editor.insertElement( this.imageElement ); - } - // ImageButton dialog and Image element. - else if ( dialogType != 'image' && imgTagName == 'img' && confirm( editor.lang.image.img2Button ) ) { // jshint ignore:line - // Replace IMG -> INPUT - imgTagName = 'input'; - this.imageElement = editor.document.createElement( 'input' ); - this.imageElement.setAttributes( { - type: 'image', - alt: '' - } ); - editor.insertElement( this.imageElement ); - } else { - // Restore the original element before all commits. - this.imageElement = this.cleanImageElement; - delete this.cleanImageElement; - } - } - // Create a new image. - else { - // Image dialog -> create IMG element. - if ( dialogType == 'image' ) - this.imageElement = editor.document.createElement( 'img' ); - else { - this.imageElement = editor.document.createElement( 'input' ); - this.imageElement.setAttribute( 'type', 'image' ); - } - this.imageElement.setAttribute( 'alt', '' ); - } - - // Create a new link. - if ( !this.linkEditMode ) - this.linkElement = editor.document.createElement( 'a' ); - - // Set attributes. - this.commitContent( IMAGE, this.imageElement ); - this.commitContent( LINK, this.linkElement ); - - // Remove empty style attribute. - if ( !this.imageElement.getAttribute( 'style' ) ) - this.imageElement.removeAttribute( 'style' ); - - // Insert a new Image. - if ( !this.imageEditMode ) { - if ( this.addLink ) { - if ( !this.linkEditMode ) { - // Insert a new link. - editor.insertElement( this.linkElement ); - this.linkElement.append( this.imageElement, false ); - } else { - // We already have a link in editor. - if ( this.linkElement.equals( editor.getSelection().getSelectedElement() ) ) { - // If the link is selected outside, replace it's content rather than the link itself. ([<a>foo</a>]) - this.linkElement.setHtml( '' ); - this.linkElement.append( this.imageElement, false ); - } else { - // Only inside of the link is selected, so replace it with image. (<a>[foo]</a>, <a>[f]oo</a>) - editor.insertElement( this.imageElement ); - } - } - } else { - editor.insertElement( this.imageElement ); - } - } - // Image already exists. - else { - // Add a new link element. - if ( !this.linkEditMode && this.addLink ) { - editor.insertElement( this.linkElement ); - this.imageElement.appendTo( this.linkElement ); - } - // Remove Link, Image exists. - else if ( this.linkEditMode && !this.addLink ) { - editor.getSelection().selectElement( this.linkElement ); - editor.insertElement( this.imageElement ); - } - } - }, - onLoad: function() { - if ( dialogType != 'image' ) - this.hidePage( 'Link' ); //Hide Link tab. - var doc = this._.element.getDocument(); - - if ( this.getContentElement( 'info', 'ratioLock' ) ) { - this.addFocusable( doc.getById( btnResetSizeId ), 5 ); - this.addFocusable( doc.getById( btnLockSizesId ), 5 ); - } - - this.commitContent = commitContent; - }, - onHide: function() { - if ( this.preview ) - this.commitContent( CLEANUP, this.preview ); - - if ( this.originalElement ) { - this.originalElement.removeListener( 'load', onImgLoadEvent ); - this.originalElement.removeListener( 'error', onImgLoadErrorEvent ); - this.originalElement.removeListener( 'abort', onImgLoadErrorEvent ); - this.originalElement.remove(); - this.originalElement = false; // Dialog is closed. - } - - delete this.imageElement; - }, - contents: [ { - id: 'info', - label: editor.lang.image.infoTab, - accessKey: 'I', - elements: [ { - type: 'vbox', - padding: 0, - children: [ { - type: 'hbox', - widths: [ '280px', '110px' ], - align: 'right', - className: 'cke_dialog_image_url', - children: [ { - id: 'txtUrl', - type: 'text', - label: editor.lang.common.url, - required: true, - onChange: function() { - var dialog = this.getDialog(), - newUrl = this.getValue(); - - // Update original image. - // Prevent from load before onShow. - if ( newUrl.length > 0 ) { - dialog = this.getDialog(); - var original = dialog.originalElement; - - if ( dialog.preview ) { - dialog.preview.removeStyle( 'display' ); - } - - original.setCustomData( 'isReady', 'false' ); - // Show loader. - var loader = CKEDITOR.document.getById( imagePreviewLoaderId ); - if ( loader ) - loader.setStyle( 'display', '' ); - - original.on( 'load', onImgLoadEvent, dialog ); - original.on( 'error', onImgLoadErrorEvent, dialog ); - original.on( 'abort', onImgLoadErrorEvent, dialog ); - original.setAttribute( 'src', newUrl ); - - if ( dialog.preview ) { - // Query the preloader to figure out the url impacted by based href. - previewPreloader.setAttribute( 'src', newUrl ); - dialog.preview.setAttribute( 'src', previewPreloader.$.src ); - updatePreview( dialog ); - } - } - // Dont show preview if no URL given. - else if ( dialog.preview ) { - dialog.preview.removeAttribute( 'src' ); - dialog.preview.setStyle( 'display', 'none' ); - } - }, - setup: function( type, element ) { - if ( type == IMAGE ) { - var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' ); - var field = this; - - this.getDialog().dontResetSize = true; - - field.setValue( url ); // And call this.onChange() - // Manually set the initial value.(https://dev.ckeditor.com/ticket/4191) - field.setInitValue(); - } - }, - commit: function( type, element ) { - if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) { - element.data( 'cke-saved-src', this.getValue() ); - element.setAttribute( 'src', this.getValue() ); - } else if ( type == CLEANUP ) { - element.setAttribute( 'src', '' ); // If removeAttribute doesn't work. - element.removeAttribute( 'src' ); - } - }, - validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing ) - }, - { - type: 'button', - id: 'browse', - // v-align with the 'txtUrl' field. - // TODO: We need something better than a fixed size here. - style: 'display:inline-block;margin-top:14px;', - align: 'center', - label: editor.lang.common.browseServer, - hidden: true, - filebrowser: 'info:txtUrl' - } ] - } ] - }, - { - id: 'txtAlt', - type: 'text', - label: editor.lang.image.alt, - accessKey: 'T', - 'default': '', - onChange: function() { - updatePreview( this.getDialog() ); - }, - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'alt' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'alt', this.getValue() ); - } else if ( type == PREVIEW ) - element.setAttribute( 'alt', this.getValue() ); - else if ( type == CLEANUP ) { - element.removeAttribute( 'alt' ); - } - - } - }, - { - type: 'hbox', - children: [ { - id: 'basic', - type: 'vbox', - children: [ { - type: 'hbox', - requiredContent: 'img{width,height}', - widths: [ '50%', '50%' ], - children: [ { - type: 'vbox', - padding: 1, - children: [ { - type: 'text', - width: '45px', - id: 'txtWidth', - label: editor.lang.common.width, - onKeyUp: onSizeChange, - onChange: function() { - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - validate: function() { - var aMatch = this.getValue().match( regexGetSizeOrEmpty ), - isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 ); - if ( !isValid ) - alert( editor.lang.common.invalidLength.replace( '%1', editor.lang.common.width ).replace( '%2', 'px, %' ) ); // jshint ignore:line - return isValid; - }, - setup: setupDimension, - commit: function( type, element ) { - var value = this.getValue(); - if ( type == IMAGE ) { - if ( value && editor.activeFilter.check( 'img{width,height}' ) ) - element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); - else - element.removeStyle( 'width' ); - - element.removeAttribute( 'width' ); - } else if ( type == PREVIEW ) { - var aMatch = value.match( regexGetSize ); - if ( !aMatch ) { - var oImageOriginal = this.getDialog().originalElement; - if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) - element.setStyle( 'width', oImageOriginal.$.width + 'px' ); - } else { - element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); - } - } else if ( type == CLEANUP ) { - element.removeAttribute( 'width' ); - element.removeStyle( 'width' ); - } - } - }, - { - type: 'text', - id: 'txtHeight', - width: '45px', - label: editor.lang.common.height, - onKeyUp: onSizeChange, - onChange: function() { - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - validate: function() { - var aMatch = this.getValue().match( regexGetSizeOrEmpty ), - isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 ); - if ( !isValid ) - alert( editor.lang.common.invalidLength.replace( '%1', editor.lang.common.height ).replace( '%2', 'px, %' ) ); // jshint ignore:line - return isValid; - }, - setup: setupDimension, - commit: function( type, element ) { - var value = this.getValue(); - if ( type == IMAGE ) { - if ( value && editor.activeFilter.check( 'img{width,height}' ) ) - element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); - else - element.removeStyle( 'height' ); - - element.removeAttribute( 'height' ); - } else if ( type == PREVIEW ) { - var aMatch = value.match( regexGetSize ); - if ( !aMatch ) { - var oImageOriginal = this.getDialog().originalElement; - if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) - element.setStyle( 'height', oImageOriginal.$.height + 'px' ); - } else { - element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); - } - } else if ( type == CLEANUP ) { - element.removeAttribute( 'height' ); - element.removeStyle( 'height' ); - } - } - } ] - }, - { - id: 'ratioLock', - type: 'html', - className: 'cke_dialog_image_ratiolock', - style: 'margin-top:30px;width:40px;height:40px;', - onLoad: function() { - // Activate Reset button - var resetButton = CKEDITOR.document.getById( btnResetSizeId ), - ratioButton = CKEDITOR.document.getById( btnLockSizesId ); - if ( resetButton ) { - resetButton.on( 'click', function( evt ) { - resetSize( this ); - evt.data && evt.data.preventDefault(); - }, this.getDialog() ); - resetButton.on( 'mouseover', function() { - this.addClass( 'cke_btn_over' ); - }, resetButton ); - resetButton.on( 'mouseout', function() { - this.removeClass( 'cke_btn_over' ); - }, resetButton ); - } - // Activate (Un)LockRatio button - if ( ratioButton ) { - ratioButton.on( 'click', function( evt ) { - switchLockRatio( this ); - - var oImageOriginal = this.originalElement, - width = this.getValueOf( 'info', 'txtWidth' ); - - if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' && width ) { - var height = oImageOriginal.$.height / oImageOriginal.$.width * width; - if ( !isNaN( height ) ) { - this.setValueOf( 'info', 'txtHeight', Math.round( height ) ); - updatePreview( this ); - } - } - evt.data && evt.data.preventDefault(); - }, this.getDialog() ); - ratioButton.on( 'mouseover', function() { - this.addClass( 'cke_btn_over' ); - }, ratioButton ); - ratioButton.on( 'mouseout', function() { - this.removeClass( 'cke_btn_over' ); - }, ratioButton ); - } - }, - html: '<div>' + - '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio + - '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' + - '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize + - '" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>' + - '</div>' - } ] - }, - { - type: 'vbox', - padding: 1, - children: [ { - type: 'text', - id: 'txtBorder', - requiredContent: 'img{border-width}', - width: '60px', - label: editor.lang.image.border, - 'default': '', - onKeyUp: function() { - updatePreview( this.getDialog() ); - }, - onChange: function() { - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateBorder ), - setup: function( type, element ) { - if ( type == IMAGE ) { - var value, - borderStyle = element.getStyle( 'border-width' ); - borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ ); - value = borderStyle && parseInt( borderStyle[ 1 ], 10 ); - isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) ); - this.setValue( value ); - } - }, - commit: function( type, element ) { - var value = parseInt( this.getValue(), 10 ); - if ( type == IMAGE || type == PREVIEW ) { - if ( !isNaN( value ) ) { - element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) ); - element.setStyle( 'border-style', 'solid' ); - } else if ( !value && this.isChanged() ) { - element.removeStyle( 'border' ); - } - - if ( type == IMAGE ) - element.removeAttribute( 'border' ); - } else if ( type == CLEANUP ) { - element.removeAttribute( 'border' ); - element.removeStyle( 'border-width' ); - element.removeStyle( 'border-style' ); - element.removeStyle( 'border-color' ); - } - } - }, - { - type: 'text', - id: 'txtHSpace', - requiredContent: 'img{margin-left,margin-right}', - width: '60px', - label: editor.lang.image.hSpace, - 'default': '', - onKeyUp: function() { - updatePreview( this.getDialog() ); - }, - onChange: function() { - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateHSpace ), - setup: function( type, element ) { - if ( type == IMAGE ) { - var value, marginLeftPx, marginRightPx, - marginLeftStyle = element.getStyle( 'margin-left' ), - marginRightStyle = element.getStyle( 'margin-right' ); - - marginLeftStyle = marginLeftStyle && marginLeftStyle.match( pxLengthRegex ); - marginRightStyle = marginRightStyle && marginRightStyle.match( pxLengthRegex ); - marginLeftPx = parseInt( marginLeftStyle, 10 ); - marginRightPx = parseInt( marginRightStyle, 10 ); - - value = ( marginLeftPx == marginRightPx ) && marginLeftPx; - isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) ); - - this.setValue( value ); - } - }, - commit: function( type, element ) { - var value = parseInt( this.getValue(), 10 ); - if ( type == IMAGE || type == PREVIEW ) { - if ( !isNaN( value ) ) { - element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) ); - element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) ); - } else if ( !value && this.isChanged() ) { - element.removeStyle( 'margin-left' ); - element.removeStyle( 'margin-right' ); - } - - if ( type == IMAGE ) - element.removeAttribute( 'hspace' ); - } else if ( type == CLEANUP ) { - element.removeAttribute( 'hspace' ); - element.removeStyle( 'margin-left' ); - element.removeStyle( 'margin-right' ); - } - } - }, - { - type: 'text', - id: 'txtVSpace', - requiredContent: 'img{margin-top,margin-bottom}', - width: '60px', - label: editor.lang.image.vSpace, - 'default': '', - onKeyUp: function() { - updatePreview( this.getDialog() ); - }, - onChange: function() { - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateVSpace ), - setup: function( type, element ) { - if ( type == IMAGE ) { - var value, marginTopPx, marginBottomPx, - marginTopStyle = element.getStyle( 'margin-top' ), - marginBottomStyle = element.getStyle( 'margin-bottom' ); - - marginTopStyle = marginTopStyle && marginTopStyle.match( pxLengthRegex ); - marginBottomStyle = marginBottomStyle && marginBottomStyle.match( pxLengthRegex ); - marginTopPx = parseInt( marginTopStyle, 10 ); - marginBottomPx = parseInt( marginBottomStyle, 10 ); - - value = ( marginTopPx == marginBottomPx ) && marginTopPx; - isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) ); - this.setValue( value ); - } - }, - commit: function( type, element ) { - var value = parseInt( this.getValue(), 10 ); - if ( type == IMAGE || type == PREVIEW ) { - if ( !isNaN( value ) ) { - element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) ); - element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) ); - } else if ( !value && this.isChanged() ) { - element.removeStyle( 'margin-top' ); - element.removeStyle( 'margin-bottom' ); - } - - if ( type == IMAGE ) - element.removeAttribute( 'vspace' ); - } else if ( type == CLEANUP ) { - element.removeAttribute( 'vspace' ); - element.removeStyle( 'margin-top' ); - element.removeStyle( 'margin-bottom' ); - } - } - }, - { - id: 'cmbAlign', - requiredContent: 'img{float}', - type: 'select', - widths: [ '35%', '65%' ], - style: 'width:90px', - label: editor.lang.common.align, - 'default': '', - items: [ - [ editor.lang.common.notSet, '' ], - [ editor.lang.common.left, 'left' ], - [ editor.lang.common.right, 'right' ] - // Backward compatible with v2 on setup when specified as attribute value, - // while these values are no more available as select options. - // [ editor.lang.image.alignAbsBottom , 'absBottom'], - // [ editor.lang.image.alignAbsMiddle , 'absMiddle'], - // [ editor.lang.image.alignBaseline , 'baseline'], - // [ editor.lang.image.alignTextTop , 'text-top'], - // [ editor.lang.image.alignBottom , 'bottom'], - // [ editor.lang.image.alignMiddle , 'middle'], - // [ editor.lang.image.alignTop , 'top'] - ], - onChange: function() { - updatePreview( this.getDialog() ); - commitInternally.call( this, 'advanced:txtdlgGenStyle' ); - }, - setup: function( type, element ) { - if ( type == IMAGE ) { - var value = element.getStyle( 'float' ); - switch ( value ) { - // Ignore those unrelated values. - case 'inherit': - case 'none': - value = ''; - } - - !value && ( value = ( element.getAttribute( 'align' ) || '' ).toLowerCase() ); - this.setValue( value ); - } - }, - commit: function( type, element ) { - var value = this.getValue(); - if ( type == IMAGE || type == PREVIEW ) { - if ( value ) - element.setStyle( 'float', value ); - else - element.removeStyle( 'float' ); - - if ( type == IMAGE ) { - value = ( element.getAttribute( 'align' ) || '' ).toLowerCase(); - switch ( value ) { - // we should remove it only if it matches "left" or "right", - // otherwise leave it intact. - case 'left': - case 'right': - element.removeAttribute( 'align' ); - } - } - } else if ( type == CLEANUP ) { - element.removeStyle( 'float' ); - } - } - } ] - } ] - }, - { - type: 'vbox', - height: '250px', - children: [ { - type: 'html', - id: 'htmlPreview', - style: 'width:95%;', - html: '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) + '<br>' + - '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading"></div></div>' + - '<div class="ImagePreviewBox"><table><tr><td>' + - '<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">' + - '<img id="' + previewImageId + '" alt="" /></a>' + - // jscs:disable maximumLineLength - ( editor.config.image_previewText || 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ' + - 'Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, ' + - 'nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.' ) + - // jscs:enable maximumLineLength - '</td></tr></table></div></div>' - } ] - } ] - } ] - }, - { - id: 'Link', - requiredContent: 'a[href]', - label: editor.lang.image.linkTab, - padding: 0, - elements: [ { - id: 'txtUrl', - type: 'text', - label: editor.lang.common.url, - style: 'width: 100%', - 'default': '', - setup: function( type, element ) { - if ( type == LINK ) { - var href = element.data( 'cke-saved-href' ); - if ( !href ) - href = element.getAttribute( 'href' ); - this.setValue( href ); - } - }, - commit: function( type, element ) { - if ( type == LINK ) { - if ( this.getValue() || this.isChanged() ) { - var url = this.getValue(); - element.data( 'cke-saved-href', url ); - element.setAttribute( 'href', url ); - - if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL ) - this.getDialog().addLink = true; - else - this.getDialog().addLink = false; - } - } - } - }, - { - type: 'button', - id: 'browse', - className: 'cke_dialog_image_browse', - filebrowser: { - action: 'Browse', - target: 'Link:txtUrl', - url: editor.config.filebrowserImageBrowseLinkUrl - }, - style: 'float:right', - hidden: true, - label: editor.lang.common.browseServer - }, - { - id: 'cmbTarget', - type: 'select', - requiredContent: 'a[target]', - label: editor.lang.common.target, - 'default': '', - items: [ - [ editor.lang.common.notSet, '' ], - [ editor.lang.common.targetNew, '_blank' ], - [ editor.lang.common.targetTop, '_top' ], - [ editor.lang.common.targetSelf, '_self' ], - [ editor.lang.common.targetParent, '_parent' ] - ], - setup: function( type, element ) { - if ( type == LINK ) - this.setValue( element.getAttribute( 'target' ) || '' ); - }, - commit: function( type, element ) { - if ( type == LINK ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'target', this.getValue() ); - } - } - } ] - }, - { - id: 'Upload', - hidden: true, - filebrowser: 'uploadButton', - label: editor.lang.image.upload, - elements: [ - { - type: 'file', - id: 'upload', - label: editor.lang.image.btnUpload, - style: 'height:40px', - size: 38 - }, - { - type: 'fileButton', - id: 'uploadButton', - filebrowser: 'info:txtUrl', - label: editor.lang.image.btnUpload, - 'for': [ 'Upload', 'upload' ] - }, - { - type: 'button', - id: 'selectfile', - label: '选择服务器文件', - style: editor.config.filebrowserImageBrowseDisabled === true? 'display:none' : '', - size: 38, - onClick: function () { - var w = 800; - var h = 600; - var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX; - var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var systemZoom = width / window.screen.availWidth; - var posLeft = (width - w) / 2 / systemZoom + dualScreenLeft; - var posTop = (height - h) / 2 / systemZoom + dualScreenTop; - window.open("./dialog/select_images.php?noeditor=yes&iseditor=1&f="+editor.name, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + posLeft + ", top=" + posTop); - CKEDITOR.dialog.getCurrent().hide(); - } - }, - ] - }, - { - id: 'advanced', - label: editor.lang.common.advancedTab, - elements: [ { - type: 'hbox', - widths: [ '50%', '25%', '25%' ], - children: [ { - type: 'text', - id: 'linkId', - requiredContent: 'img[id]', - label: editor.lang.common.id, - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'id' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'id', this.getValue() ); - } - } - }, - { - id: 'cmbLangDir', - type: 'select', - requiredContent: 'img[dir]', - style: 'width : 100px;', - label: editor.lang.common.langDir, - 'default': '', - items: [ - [ editor.lang.common.notSet, '' ], - [ editor.lang.common.langDirLtr, 'ltr' ], - [ editor.lang.common.langDirRtl, 'rtl' ] - ], - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'dir' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'dir', this.getValue() ); - } - } - }, - { - type: 'text', - id: 'txtLangCode', - requiredContent: 'img[lang]', - label: editor.lang.common.langCode, - 'default': '', - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'lang' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'lang', this.getValue() ); - } - } - } ] - }, - { - type: 'text', - id: 'txtGenLongDescr', - requiredContent: 'img[longdesc]', - label: editor.lang.common.longDescr, - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'longDesc' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'longDesc', this.getValue() ); - } - } - }, - { - type: 'hbox', - widths: [ '50%', '50%' ], - children: [ { - type: 'text', - id: 'txtGenClass', - requiredContent: 'img(cke-xyz)', // Random text like 'xyz' will check if all are allowed. - label: editor.lang.common.cssClass, - 'default': '', - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'class' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'class', this.getValue() ); - } - } - }, - { - type: 'text', - id: 'txtGenTitle', - requiredContent: 'img[title]', - label: editor.lang.common.advisoryTitle, - 'default': '', - onChange: function() { - updatePreview( this.getDialog() ); - }, - setup: function( type, element ) { - if ( type == IMAGE ) - this.setValue( element.getAttribute( 'title' ) ); - }, - commit: function( type, element ) { - if ( type == IMAGE ) { - if ( this.getValue() || this.isChanged() ) - element.setAttribute( 'title', this.getValue() ); - } else if ( type == PREVIEW ) - element.setAttribute( 'title', this.getValue() ); - else if ( type == CLEANUP ) { - element.removeAttribute( 'title' ); - } - } - } ] - }, - { - type: 'text', - id: 'txtdlgGenStyle', - requiredContent: 'img{cke-xyz}', // Random text like 'xyz' will check if all are allowed. - label: editor.lang.common.cssStyle, - validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ), - 'default': '', - setup: function( type, element ) { - if ( type == IMAGE ) { - var genStyle = element.getAttribute( 'style' ); - if ( !genStyle && element.$.style.cssText ) - genStyle = element.$.style.cssText; - this.setValue( genStyle ); - - var height = element.$.style.height, - width = element.$.style.width, - aMatchH = ( height ? height : '' ).match( regexGetSize ), - aMatchW = ( width ? width : '' ).match( regexGetSize ); - - this.attributesInStyle = { - height: !!aMatchH, - width: !!aMatchW - }; - } - }, - onChange: function() { - commitInternally.call( - this, [ - 'info:cmbFloat', - 'info:cmbAlign', - 'info:txtVSpace', - 'info:txtHSpace', - 'info:txtBorder', - 'info:txtWidth', - 'info:txtHeight' - ] - ); - updatePreview( this ); - }, - commit: function( type, element ) { - if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) - element.setAttribute( 'style', this.getValue() ); - - } - } ] - } ] - }; - }; - - CKEDITOR.dialog.add( 'image', function( editor ) { - return imageDialog( editor, 'image' ); - } ); - - CKEDITOR.dialog.add( 'imagebutton', function( editor ) { - return imageDialog( editor, 'imagebutton' ); - } ); +/** + * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +( function() { + var imageDialog = function( editor, dialogType ) { + // Load image preview. + var IMAGE = 1, + LINK = 2, + PREVIEW = 4, + CLEANUP = 8, + regexGetSize = /^\s*(\d+)((px)|\%)?\s*$/i, + regexGetSizeOrEmpty = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i, + pxLengthRegex = /^\d+px$/; + + var onSizeChange = function() { + var value = this.getValue(), + // This = input element. + dialog = this.getDialog(), + aMatch = value.match( regexGetSize ); // Check value + if ( aMatch ) { + if ( aMatch[ 2 ] == '%' ) // % is allowed - > unlock ratio. + switchLockRatio( dialog, false ); // Unlock. + value = aMatch[ 1 ]; + } + + // Only if ratio is locked + if ( dialog.lockRatio ) { + var oImageOriginal = dialog.originalElement; + if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { + if ( this.id == 'txtHeight' ) { + if ( value && value != '0' ) + value = Math.round( oImageOriginal.$.width * ( value / oImageOriginal.$.height ) ); + if ( !isNaN( value ) ) + dialog.setValueOf( 'info', 'txtWidth', value ); + } + // this.id = txtWidth. + else { + if ( value && value != '0' ) + value = Math.round( oImageOriginal.$.height * ( value / oImageOriginal.$.width ) ); + if ( !isNaN( value ) ) + dialog.setValueOf( 'info', 'txtHeight', value ); + } + } + } + updatePreview( dialog ); + }; + + var updatePreview = function( dialog ) { + //Don't load before onShow. + if ( !dialog.originalElement || !dialog.preview ) + return 1; + + // Read attributes and update imagePreview; + dialog.commitContent( PREVIEW, dialog.preview ); + return 0; + }; + + // Custom commit dialog logic, where we're intended to give inline style + // field (txtdlgGenStyle) higher priority to avoid overwriting styles contribute + // by other fields. + function commitContent() { + var args = arguments; + var inlineStyleField = this.getContentElement( 'advanced', 'txtdlgGenStyle' ); + inlineStyleField && inlineStyleField.commit.apply( inlineStyleField, args ); + + this.foreach( function( widget ) { + if ( widget.commit && widget.id != 'txtdlgGenStyle' ) + widget.commit.apply( widget, args ); + } ); + } + + // Avoid recursions. + var incommit; + + // Synchronous field values to other impacted fields is required, e.g. border + // size change should alter inline-style text as well. + function commitInternally( targetFields ) { + if ( incommit ) + return; + + incommit = 1; + + var dialog = this.getDialog(), + element = dialog.imageElement; + if ( element ) { + // Commit this field and broadcast to target fields. + this.commit( IMAGE, element ); + + targetFields = [].concat( targetFields ); + var length = targetFields.length, + field; + for ( var i = 0; i < length; i++ ) { + field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) ); + // May cause recursion. + field && field.setup( IMAGE, element ); + } + } + + incommit = 0; + } + + var switchLockRatio = function( dialog, value ) { + if ( !dialog.getContentElement( 'info', 'ratioLock' ) ) + return null; + + var oImageOriginal = dialog.originalElement; + + // Dialog may already closed. (https://dev.ckeditor.com/ticket/5505) + if ( !oImageOriginal ) + return null; + + // Check image ratio and original image ratio, but respecting user's preference. + if ( value == 'check' ) { + if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true' ) { + var width = dialog.getValueOf( 'info', 'txtWidth' ), + height = dialog.getValueOf( 'info', 'txtHeight' ), + originalRatio = oImageOriginal.$.width / oImageOriginal.$.height, + thisRatio = width / height; + + dialog.lockRatio = false; // Default: unlock ratio + + if ( !width && !height ) { + dialog.lockRatio = true; + } else { + // Round ratio to two decimal places so ratio locking will be less precise (#2254). + var ratioComparison = Math.round( ( originalRatio / thisRatio ) * 100 ) / 100; + + if ( ratioComparison == 1 ) { + dialog.lockRatio = true; + } + } + } + } else if ( value !== undefined ) { + dialog.lockRatio = value; + } else { + dialog.userlockRatio = 1; + dialog.lockRatio = !dialog.lockRatio; + } + + var ratioButton = CKEDITOR.document.getById( btnLockSizesId ); + if ( dialog.lockRatio ) + ratioButton.removeClass( 'cke_btn_unlocked' ); + else + ratioButton.addClass( 'cke_btn_unlocked' ); + + ratioButton.setAttribute( 'aria-checked', dialog.lockRatio ); + + // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE + if ( CKEDITOR.env.hc ) { + var icon = ratioButton.getChild( 0 ); + icon.setHtml( dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0' : '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' ); + } + + return dialog.lockRatio; + }; + + var resetSize = function( dialog, emptyValues ) { + var oImageOriginal = dialog.originalElement, + ready = oImageOriginal.getCustomData( 'isReady' ) == 'true'; + + if ( ready ) { + var widthField = dialog.getContentElement( 'info', 'txtWidth' ), + heightField = dialog.getContentElement( 'info', 'txtHeight' ), + widthValue, heightValue; + + if ( emptyValues ) { + widthValue = 0; + heightValue = 0; + } else { + widthValue = oImageOriginal.$.width; + heightValue = oImageOriginal.$.height; + } + + widthField && widthField.setValue( widthValue ); + heightField && heightField.setValue( heightValue ); + } + updatePreview( dialog ); + }; + + var setupDimension = function( type, element ) { + if ( type != IMAGE ) + return; + + function checkDimension( size, defaultValue ) { + var aMatch = size.match( regexGetSize ); + if ( aMatch ) { + // % is allowed. + if ( aMatch[ 2 ] == '%' ) { + aMatch[ 1 ] += '%'; + switchLockRatio( dialog, false ); // Unlock ratio + } + return aMatch[ 1 ]; + } + return defaultValue; + } + + var dialog = this.getDialog(), + value = '', + dimension = this.id == 'txtWidth' ? 'width' : 'height', + size = element.getAttribute( dimension ); + + if ( size ) + value = checkDimension( size, value ); + value = checkDimension( element.getStyle( dimension ), value ); + + this.setValue( value ); + }; + + var previewPreloader; + + var onImgLoadEvent = function() { + // Image is ready. + var original = this.originalElement, + loader = CKEDITOR.document.getById( imagePreviewLoaderId ); + + original.setCustomData( 'isReady', 'true' ); + original.removeListener( 'load', onImgLoadEvent ); + original.removeListener( 'error', onImgLoadErrorEvent ); + original.removeListener( 'abort', onImgLoadErrorEvent ); + + // Hide loader. + if ( loader ) + loader.setStyle( 'display', 'none' ); + + // New image -> new dimensions + if ( !this.dontResetSize ) { + resetSize( this, editor.config.image_prefillDimensions === false ); + } + + if ( this.firstLoad ) { + CKEDITOR.tools.setTimeout( function() { + switchLockRatio( this, 'check' ); + }, 0, this ); + } + + this.firstLoad = false; + this.dontResetSize = false; + + // Possible fix for https://dev.ckeditor.com/ticket/12818. + updatePreview( this ); + }; + + var onImgLoadErrorEvent = function() { + // Error. Image is not loaded. + var original = this.originalElement, + loader = CKEDITOR.document.getById( imagePreviewLoaderId ); + + original.removeListener( 'load', onImgLoadEvent ); + original.removeListener( 'error', onImgLoadErrorEvent ); + original.removeListener( 'abort', onImgLoadErrorEvent ); + + // Set Error image. + var noimage = CKEDITOR.getUrl( CKEDITOR.plugins.get( 'image' ).path + 'images/noimage.png' ); + + if ( this.preview ) + this.preview.setAttribute( 'src', noimage ); + + // Hide loader. + if ( loader ) + loader.setStyle( 'display', 'none' ); + + switchLockRatio( this, false ); // Unlock. + }; + + var numbering = function( id ) { + return CKEDITOR.tools.getNextId() + '_' + id; + }, + btnLockSizesId = numbering( 'btnLockSizes' ), + btnResetSizeId = numbering( 'btnResetSize' ), + imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ), + previewLinkId = numbering( 'previewLink' ), + previewImageId = numbering( 'previewImage' ); + + return { + title: editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ], + minWidth: ( CKEDITOR.skinName || editor.config.skin ) == 'moono-lisa' ? 500 : 420, + minHeight: 360, + getModel: function( editor ) { + var element = editor.getSelection().getSelectedElement(), + isImage = element && element.getName() === 'img', + isImageInput = element && element.getName() === 'input' && + element.getAttribute( 'type' ) === 'image'; + + if ( isImage ||isImageInput ) { + return element; + } + + return null; + }, + onShow: function() { + this.imageElement = false; + this.linkElement = false; + + // Default: create a new element. + this.imageEditMode = false; + this.linkEditMode = false; + + this.lockRatio = true; + this.userlockRatio = 0; + this.dontResetSize = false; + this.firstLoad = true; + this.addLink = false; + + var editor = this.getParentEditor(), + sel = editor.getSelection(), + element = sel && sel.getSelectedElement(), + link = element && editor.elementPath( element ).contains( 'a', 1 ), + loader = CKEDITOR.document.getById( imagePreviewLoaderId ); + + // Hide loader. + if ( loader ) + loader.setStyle( 'display', 'none' ); + + // Create the preview before setup the dialog contents. + previewPreloader = new CKEDITOR.dom.element( 'img', editor.document ); + this.preview = CKEDITOR.document.getById( previewImageId ); + + // Copy of the image + this.originalElement = editor.document.createElement( 'img' ); + this.originalElement.setAttribute( 'alt', '' ); + this.originalElement.setCustomData( 'isReady', 'false' ); + + if ( link ) { + this.linkElement = link; + this.linkEditMode = true; + + // If there is an existing link, by default keep it (true). + // It will be removed if certain conditions are met and Link tab is enabled. (https://dev.ckeditor.com/ticket/13351) + this.addLink = true; + + // Look for Image element. + var linkChildren = link.getChildren(); + if ( linkChildren.count() == 1 ) { + var childTag = linkChildren.getItem( 0 ); + + if ( childTag.type == CKEDITOR.NODE_ELEMENT ) { + if ( childTag.is( 'img' ) || childTag.is( 'input' ) ) { + this.imageElement = linkChildren.getItem( 0 ); + if ( this.imageElement.is( 'img' ) ) + this.imageEditMode = 'img'; + else if ( this.imageElement.is( 'input' ) ) + this.imageEditMode = 'input'; + } + } + } + // Fill out all fields. + if ( dialogType == 'image' ) + this.setupContent( LINK, link ); + } + + // Edit given image element instead the one from selection. + if ( this.customImageElement ) { + this.imageEditMode = 'img'; + this.imageElement = this.customImageElement; + delete this.customImageElement; + } + else if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) || + element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) { + this.imageEditMode = element.getName(); + this.imageElement = element; + } + + if ( this.imageEditMode ) { + // Use the original element as a buffer from since we don't want + // temporary changes to be committed, e.g. if the dialog is canceled. + this.cleanImageElement = this.imageElement; + this.imageElement = this.cleanImageElement.clone( true, true ); + + // Fill out all fields. + this.setupContent( IMAGE, this.imageElement ); + } + + // Refresh LockRatio button + switchLockRatio( this, true ); + + // Dont show preview if no URL given. + if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) ) { + this.preview.removeAttribute( 'src' ); + this.preview.setStyle( 'display', 'none' ); + } + }, + onOk: function() { + // Edit existing Image. + if ( this.imageEditMode ) { + var imgTagName = this.imageEditMode; + + // Image dialog and Input element. + if ( dialogType == 'image' && imgTagName == 'input' && confirm( editor.lang.image.button2Img ) ) { // jshint ignore:line + // Replace INPUT-> IMG + imgTagName = 'img'; + this.imageElement = editor.document.createElement( 'img' ); + this.imageElement.setAttribute( 'alt', '' ); + editor.insertElement( this.imageElement ); + } + // ImageButton dialog and Image element. + else if ( dialogType != 'image' && imgTagName == 'img' && confirm( editor.lang.image.img2Button ) ) { // jshint ignore:line + // Replace IMG -> INPUT + imgTagName = 'input'; + this.imageElement = editor.document.createElement( 'input' ); + this.imageElement.setAttributes( { + type: 'image', + alt: '' + } ); + editor.insertElement( this.imageElement ); + } else { + // Restore the original element before all commits. + this.imageElement = this.cleanImageElement; + delete this.cleanImageElement; + } + } + // Create a new image. + else { + // Image dialog -> create IMG element. + if ( dialogType == 'image' ) + this.imageElement = editor.document.createElement( 'img' ); + else { + this.imageElement = editor.document.createElement( 'input' ); + this.imageElement.setAttribute( 'type', 'image' ); + } + this.imageElement.setAttribute( 'alt', '' ); + } + + // Create a new link. + if ( !this.linkEditMode ) + this.linkElement = editor.document.createElement( 'a' ); + + // Set attributes. + this.commitContent( IMAGE, this.imageElement ); + this.commitContent( LINK, this.linkElement ); + + // Remove empty style attribute. + if ( !this.imageElement.getAttribute( 'style' ) ) + this.imageElement.removeAttribute( 'style' ); + + // Insert a new Image. + if ( !this.imageEditMode ) { + if ( this.addLink ) { + if ( !this.linkEditMode ) { + // Insert a new link. + editor.insertElement( this.linkElement ); + this.linkElement.append( this.imageElement, false ); + } else { + // We already have a link in editor. + if ( this.linkElement.equals( editor.getSelection().getSelectedElement() ) ) { + // If the link is selected outside, replace it's content rather than the link itself. ([<a>foo</a>]) + this.linkElement.setHtml( '' ); + this.linkElement.append( this.imageElement, false ); + } else { + // Only inside of the link is selected, so replace it with image. (<a>[foo]</a>, <a>[f]oo</a>) + editor.insertElement( this.imageElement ); + } + } + } else { + editor.insertElement( this.imageElement ); + } + } + // Image already exists. + else { + // Add a new link element. + if ( !this.linkEditMode && this.addLink ) { + editor.insertElement( this.linkElement ); + this.imageElement.appendTo( this.linkElement ); + } + // Remove Link, Image exists. + else if ( this.linkEditMode && !this.addLink ) { + editor.getSelection().selectElement( this.linkElement ); + editor.insertElement( this.imageElement ); + } + } + }, + onLoad: function() { + if ( dialogType != 'image' ) + this.hidePage( 'Link' ); //Hide Link tab. + var doc = this._.element.getDocument(); + + if ( this.getContentElement( 'info', 'ratioLock' ) ) { + this.addFocusable( doc.getById( btnResetSizeId ), 5 ); + this.addFocusable( doc.getById( btnLockSizesId ), 5 ); + } + + this.commitContent = commitContent; + }, + onHide: function() { + if ( this.preview ) + this.commitContent( CLEANUP, this.preview ); + + if ( this.originalElement ) { + this.originalElement.removeListener( 'load', onImgLoadEvent ); + this.originalElement.removeListener( 'error', onImgLoadErrorEvent ); + this.originalElement.removeListener( 'abort', onImgLoadErrorEvent ); + this.originalElement.remove(); + this.originalElement = false; // Dialog is closed. + } + + delete this.imageElement; + }, + contents: [ { + id: 'info', + label: editor.lang.image.infoTab, + accessKey: 'I', + elements: [ { + type: 'vbox', + padding: 0, + children: [ { + type: 'hbox', + widths: [ '280px', '110px' ], + align: 'right', + className: 'cke_dialog_image_url', + children: [ { + id: 'txtUrl', + type: 'text', + label: editor.lang.common.url, + required: true, + onChange: function() { + var dialog = this.getDialog(), + newUrl = this.getValue(); + + // Update original image. + // Prevent from load before onShow. + if ( newUrl.length > 0 ) { + dialog = this.getDialog(); + var original = dialog.originalElement; + + if ( dialog.preview ) { + dialog.preview.removeStyle( 'display' ); + } + + original.setCustomData( 'isReady', 'false' ); + // Show loader. + var loader = CKEDITOR.document.getById( imagePreviewLoaderId ); + if ( loader ) + loader.setStyle( 'display', '' ); + + original.on( 'load', onImgLoadEvent, dialog ); + original.on( 'error', onImgLoadErrorEvent, dialog ); + original.on( 'abort', onImgLoadErrorEvent, dialog ); + original.setAttribute( 'src', newUrl ); + + if ( dialog.preview ) { + // Query the preloader to figure out the url impacted by based href. + previewPreloader.setAttribute( 'src', newUrl ); + dialog.preview.setAttribute( 'src', previewPreloader.$.src ); + updatePreview( dialog ); + } + } + // Dont show preview if no URL given. + else if ( dialog.preview ) { + dialog.preview.removeAttribute( 'src' ); + dialog.preview.setStyle( 'display', 'none' ); + } + }, + setup: function( type, element ) { + if ( type == IMAGE ) { + var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' ); + var field = this; + + this.getDialog().dontResetSize = true; + + field.setValue( url ); // And call this.onChange() + // Manually set the initial value.(https://dev.ckeditor.com/ticket/4191) + field.setInitValue(); + } + }, + commit: function( type, element ) { + if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) { + element.data( 'cke-saved-src', this.getValue() ); + element.setAttribute( 'src', this.getValue() ); + } else if ( type == CLEANUP ) { + element.setAttribute( 'src', '' ); // If removeAttribute doesn't work. + element.removeAttribute( 'src' ); + } + }, + validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing ) + }, + { + type: 'button', + id: 'browse', + // v-align with the 'txtUrl' field. + // TODO: We need something better than a fixed size here. + style: 'display:inline-block;margin-top:14px;', + align: 'center', + label: editor.lang.common.browseServer, + hidden: true, + filebrowser: 'info:txtUrl' + } ] + } ] + }, + { + id: 'txtAlt', + type: 'text', + label: editor.lang.image.alt, + accessKey: 'T', + 'default': '', + onChange: function() { + updatePreview( this.getDialog() ); + }, + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'alt' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'alt', this.getValue() ); + } else if ( type == PREVIEW ) + element.setAttribute( 'alt', this.getValue() ); + else if ( type == CLEANUP ) { + element.removeAttribute( 'alt' ); + } + + } + }, + { + type: 'hbox', + children: [ { + id: 'basic', + type: 'vbox', + children: [ { + type: 'hbox', + requiredContent: 'img{width,height}', + widths: [ '50%', '50%' ], + children: [ { + type: 'vbox', + padding: 1, + children: [ { + type: 'text', + width: '45px', + id: 'txtWidth', + label: editor.lang.common.width, + onKeyUp: onSizeChange, + onChange: function() { + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + validate: function() { + var aMatch = this.getValue().match( regexGetSizeOrEmpty ), + isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 ); + if ( !isValid ) + alert( editor.lang.common.invalidLength.replace( '%1', editor.lang.common.width ).replace( '%2', 'px, %' ) ); // jshint ignore:line + return isValid; + }, + setup: setupDimension, + commit: function( type, element ) { + var value = this.getValue(); + if ( type == IMAGE ) { + if ( value && editor.activeFilter.check( 'img{width,height}' ) ) + element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); + else + element.removeStyle( 'width' ); + + element.removeAttribute( 'width' ); + } else if ( type == PREVIEW ) { + var aMatch = value.match( regexGetSize ); + if ( !aMatch ) { + var oImageOriginal = this.getDialog().originalElement; + if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) + element.setStyle( 'width', oImageOriginal.$.width + 'px' ); + } else { + element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) ); + } + } else if ( type == CLEANUP ) { + element.removeAttribute( 'width' ); + element.removeStyle( 'width' ); + } + } + }, + { + type: 'text', + id: 'txtHeight', + width: '45px', + label: editor.lang.common.height, + onKeyUp: onSizeChange, + onChange: function() { + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + validate: function() { + var aMatch = this.getValue().match( regexGetSizeOrEmpty ), + isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 ); + if ( !isValid ) + alert( editor.lang.common.invalidLength.replace( '%1', editor.lang.common.height ).replace( '%2', 'px, %' ) ); // jshint ignore:line + return isValid; + }, + setup: setupDimension, + commit: function( type, element ) { + var value = this.getValue(); + if ( type == IMAGE ) { + if ( value && editor.activeFilter.check( 'img{width,height}' ) ) + element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); + else + element.removeStyle( 'height' ); + + element.removeAttribute( 'height' ); + } else if ( type == PREVIEW ) { + var aMatch = value.match( regexGetSize ); + if ( !aMatch ) { + var oImageOriginal = this.getDialog().originalElement; + if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) + element.setStyle( 'height', oImageOriginal.$.height + 'px' ); + } else { + element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) ); + } + } else if ( type == CLEANUP ) { + element.removeAttribute( 'height' ); + element.removeStyle( 'height' ); + } + } + } ] + }, + { + id: 'ratioLock', + type: 'html', + className: 'cke_dialog_image_ratiolock', + style: 'margin-top:30px;width:40px;height:40px;', + onLoad: function() { + // Activate Reset button + var resetButton = CKEDITOR.document.getById( btnResetSizeId ), + ratioButton = CKEDITOR.document.getById( btnLockSizesId ); + if ( resetButton ) { + resetButton.on( 'click', function( evt ) { + resetSize( this ); + evt.data && evt.data.preventDefault(); + }, this.getDialog() ); + resetButton.on( 'mouseover', function() { + this.addClass( 'cke_btn_over' ); + }, resetButton ); + resetButton.on( 'mouseout', function() { + this.removeClass( 'cke_btn_over' ); + }, resetButton ); + } + // Activate (Un)LockRatio button + if ( ratioButton ) { + ratioButton.on( 'click', function( evt ) { + switchLockRatio( this ); + + var oImageOriginal = this.originalElement, + width = this.getValueOf( 'info', 'txtWidth' ); + + if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' && width ) { + var height = oImageOriginal.$.height / oImageOriginal.$.width * width; + if ( !isNaN( height ) ) { + this.setValueOf( 'info', 'txtHeight', Math.round( height ) ); + updatePreview( this ); + } + } + evt.data && evt.data.preventDefault(); + }, this.getDialog() ); + ratioButton.on( 'mouseover', function() { + this.addClass( 'cke_btn_over' ); + }, ratioButton ); + ratioButton.on( 'mouseout', function() { + this.removeClass( 'cke_btn_over' ); + }, ratioButton ); + } + }, + html: '<div>' + + '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio + + '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' + + '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize + + '" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>' + + '</div>' + } ] + }, + { + type: 'vbox', + padding: 1, + children: [ { + type: 'text', + id: 'txtBorder', + requiredContent: 'img{border-width}', + width: '60px', + label: editor.lang.image.border, + 'default': '', + onKeyUp: function() { + updatePreview( this.getDialog() ); + }, + onChange: function() { + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateBorder ), + setup: function( type, element ) { + if ( type == IMAGE ) { + var value, + borderStyle = element.getStyle( 'border-width' ); + borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ ); + value = borderStyle && parseInt( borderStyle[ 1 ], 10 ); + isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) ); + this.setValue( value ); + } + }, + commit: function( type, element ) { + var value = parseInt( this.getValue(), 10 ); + if ( type == IMAGE || type == PREVIEW ) { + if ( !isNaN( value ) ) { + element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) ); + element.setStyle( 'border-style', 'solid' ); + } else if ( !value && this.isChanged() ) { + element.removeStyle( 'border' ); + } + + if ( type == IMAGE ) + element.removeAttribute( 'border' ); + } else if ( type == CLEANUP ) { + element.removeAttribute( 'border' ); + element.removeStyle( 'border-width' ); + element.removeStyle( 'border-style' ); + element.removeStyle( 'border-color' ); + } + } + }, + { + type: 'text', + id: 'txtHSpace', + requiredContent: 'img{margin-left,margin-right}', + width: '60px', + label: editor.lang.image.hSpace, + 'default': '', + onKeyUp: function() { + updatePreview( this.getDialog() ); + }, + onChange: function() { + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateHSpace ), + setup: function( type, element ) { + if ( type == IMAGE ) { + var value, marginLeftPx, marginRightPx, + marginLeftStyle = element.getStyle( 'margin-left' ), + marginRightStyle = element.getStyle( 'margin-right' ); + + marginLeftStyle = marginLeftStyle && marginLeftStyle.match( pxLengthRegex ); + marginRightStyle = marginRightStyle && marginRightStyle.match( pxLengthRegex ); + marginLeftPx = parseInt( marginLeftStyle, 10 ); + marginRightPx = parseInt( marginRightStyle, 10 ); + + value = ( marginLeftPx == marginRightPx ) && marginLeftPx; + isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) ); + + this.setValue( value ); + } + }, + commit: function( type, element ) { + var value = parseInt( this.getValue(), 10 ); + if ( type == IMAGE || type == PREVIEW ) { + if ( !isNaN( value ) ) { + element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) ); + element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) ); + } else if ( !value && this.isChanged() ) { + element.removeStyle( 'margin-left' ); + element.removeStyle( 'margin-right' ); + } + + if ( type == IMAGE ) + element.removeAttribute( 'hspace' ); + } else if ( type == CLEANUP ) { + element.removeAttribute( 'hspace' ); + element.removeStyle( 'margin-left' ); + element.removeStyle( 'margin-right' ); + } + } + }, + { + type: 'text', + id: 'txtVSpace', + requiredContent: 'img{margin-top,margin-bottom}', + width: '60px', + label: editor.lang.image.vSpace, + 'default': '', + onKeyUp: function() { + updatePreview( this.getDialog() ); + }, + onChange: function() { + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateVSpace ), + setup: function( type, element ) { + if ( type == IMAGE ) { + var value, marginTopPx, marginBottomPx, + marginTopStyle = element.getStyle( 'margin-top' ), + marginBottomStyle = element.getStyle( 'margin-bottom' ); + + marginTopStyle = marginTopStyle && marginTopStyle.match( pxLengthRegex ); + marginBottomStyle = marginBottomStyle && marginBottomStyle.match( pxLengthRegex ); + marginTopPx = parseInt( marginTopStyle, 10 ); + marginBottomPx = parseInt( marginBottomStyle, 10 ); + + value = ( marginTopPx == marginBottomPx ) && marginTopPx; + isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) ); + this.setValue( value ); + } + }, + commit: function( type, element ) { + var value = parseInt( this.getValue(), 10 ); + if ( type == IMAGE || type == PREVIEW ) { + if ( !isNaN( value ) ) { + element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) ); + element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) ); + } else if ( !value && this.isChanged() ) { + element.removeStyle( 'margin-top' ); + element.removeStyle( 'margin-bottom' ); + } + + if ( type == IMAGE ) + element.removeAttribute( 'vspace' ); + } else if ( type == CLEANUP ) { + element.removeAttribute( 'vspace' ); + element.removeStyle( 'margin-top' ); + element.removeStyle( 'margin-bottom' ); + } + } + }, + { + id: 'cmbAlign', + requiredContent: 'img{float}', + type: 'select', + widths: [ '35%', '65%' ], + style: 'width:90px', + label: editor.lang.common.align, + 'default': '', + items: [ + [ editor.lang.common.notSet, '' ], + [ editor.lang.common.left, 'left' ], + [ editor.lang.common.right, 'right' ] + // Backward compatible with v2 on setup when specified as attribute value, + // while these values are no more available as select options. + // [ editor.lang.image.alignAbsBottom , 'absBottom'], + // [ editor.lang.image.alignAbsMiddle , 'absMiddle'], + // [ editor.lang.image.alignBaseline , 'baseline'], + // [ editor.lang.image.alignTextTop , 'text-top'], + // [ editor.lang.image.alignBottom , 'bottom'], + // [ editor.lang.image.alignMiddle , 'middle'], + // [ editor.lang.image.alignTop , 'top'] + ], + onChange: function() { + updatePreview( this.getDialog() ); + commitInternally.call( this, 'advanced:txtdlgGenStyle' ); + }, + setup: function( type, element ) { + if ( type == IMAGE ) { + var value = element.getStyle( 'float' ); + switch ( value ) { + // Ignore those unrelated values. + case 'inherit': + case 'none': + value = ''; + } + + !value && ( value = ( element.getAttribute( 'align' ) || '' ).toLowerCase() ); + this.setValue( value ); + } + }, + commit: function( type, element ) { + var value = this.getValue(); + if ( type == IMAGE || type == PREVIEW ) { + if ( value ) + element.setStyle( 'float', value ); + else + element.removeStyle( 'float' ); + + if ( type == IMAGE ) { + value = ( element.getAttribute( 'align' ) || '' ).toLowerCase(); + switch ( value ) { + // we should remove it only if it matches "left" or "right", + // otherwise leave it intact. + case 'left': + case 'right': + element.removeAttribute( 'align' ); + } + } + } else if ( type == CLEANUP ) { + element.removeStyle( 'float' ); + } + } + } ] + } ] + }, + { + type: 'vbox', + height: '250px', + children: [ { + type: 'html', + id: 'htmlPreview', + style: 'width:95%;', + html: '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) + '<br>' + + '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div>' + + '<div class="ImagePreviewBox"><table><tr><td>' + + '<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">' + + '<img id="' + previewImageId + '" alt="" /></a>' + + // jscs:disable maximumLineLength + ( editor.config.image_previewText || 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ' + + 'Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, ' + + 'nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.' ) + + // jscs:enable maximumLineLength + '</td></tr></table></div></div>' + } ] + } ] + } ] + }, + { + id: 'Link', + requiredContent: 'a[href]', + label: editor.lang.image.linkTab, + padding: 0, + elements: [ { + id: 'txtUrl', + type: 'text', + label: editor.lang.common.url, + style: 'width: 100%', + 'default': '', + setup: function( type, element ) { + if ( type == LINK ) { + var href = element.data( 'cke-saved-href' ); + if ( !href ) + href = element.getAttribute( 'href' ); + this.setValue( href ); + } + }, + commit: function( type, element ) { + if ( type == LINK ) { + if ( this.getValue() || this.isChanged() ) { + var url = this.getValue(); + element.data( 'cke-saved-href', url ); + element.setAttribute( 'href', url ); + + if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL ) + this.getDialog().addLink = true; + else + this.getDialog().addLink = false; + } + } + } + }, + { + type: 'button', + id: 'browse', + className: 'cke_dialog_image_browse', + filebrowser: { + action: 'Browse', + target: 'Link:txtUrl', + url: editor.config.filebrowserImageBrowseLinkUrl + }, + style: 'float:right', + hidden: true, + label: editor.lang.common.browseServer + }, + { + id: 'cmbTarget', + type: 'select', + requiredContent: 'a[target]', + label: editor.lang.common.target, + 'default': '', + items: [ + [ editor.lang.common.notSet, '' ], + [ editor.lang.common.targetNew, '_blank' ], + [ editor.lang.common.targetTop, '_top' ], + [ editor.lang.common.targetSelf, '_self' ], + [ editor.lang.common.targetParent, '_parent' ] + ], + setup: function( type, element ) { + if ( type == LINK ) + this.setValue( element.getAttribute( 'target' ) || '' ); + }, + commit: function( type, element ) { + if ( type == LINK ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'target', this.getValue() ); + } + } + } ] + }, + { + id: 'Upload', + hidden: true, + filebrowser: 'uploadButton', + label: editor.lang.image.upload, + elements: [ + { + type: 'file', + id: 'upload', + label: editor.lang.image.btnUpload, + style: 'height:40px', + size: 38 + }, + { + type: 'fileButton', + id: 'uploadButton', + filebrowser: 'info:txtUrl', + label: editor.lang.image.btnUpload, + 'for': [ 'Upload', 'upload' ] + }, + { + type: 'button', + id: 'selectfile', + label: '选择服务器文件', + size: 38, + onClick: function () { + var w = 800; + var h = 600; + var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX; + var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY; + + var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; + var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + + var systemZoom = width / window.screen.availWidth; + var posLeft = (width - w) / 2 / systemZoom + dualScreenLeft; + var posTop = (height - h) / 2 / systemZoom + dualScreenTop; + window.open("./dialog/select_images.php?f=body", "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + posLeft + ", top=" + posTop); + CKEDITOR.dialog.getCurrent().hide(); + } + }, + ] + }, + { + id: 'advanced', + label: editor.lang.common.advancedTab, + elements: [ { + type: 'hbox', + widths: [ '50%', '25%', '25%' ], + children: [ { + type: 'text', + id: 'linkId', + requiredContent: 'img[id]', + label: editor.lang.common.id, + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'id' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'id', this.getValue() ); + } + } + }, + { + id: 'cmbLangDir', + type: 'select', + requiredContent: 'img[dir]', + style: 'width : 100px;', + label: editor.lang.common.langDir, + 'default': '', + items: [ + [ editor.lang.common.notSet, '' ], + [ editor.lang.common.langDirLtr, 'ltr' ], + [ editor.lang.common.langDirRtl, 'rtl' ] + ], + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'dir' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'dir', this.getValue() ); + } + } + }, + { + type: 'text', + id: 'txtLangCode', + requiredContent: 'img[lang]', + label: editor.lang.common.langCode, + 'default': '', + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'lang' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'lang', this.getValue() ); + } + } + } ] + }, + { + type: 'text', + id: 'txtGenLongDescr', + requiredContent: 'img[longdesc]', + label: editor.lang.common.longDescr, + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'longDesc' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'longDesc', this.getValue() ); + } + } + }, + { + type: 'hbox', + widths: [ '50%', '50%' ], + children: [ { + type: 'text', + id: 'txtGenClass', + requiredContent: 'img(cke-xyz)', // Random text like 'xyz' will check if all are allowed. + label: editor.lang.common.cssClass, + 'default': '', + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'class' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'class', this.getValue() ); + } + } + }, + { + type: 'text', + id: 'txtGenTitle', + requiredContent: 'img[title]', + label: editor.lang.common.advisoryTitle, + 'default': '', + onChange: function() { + updatePreview( this.getDialog() ); + }, + setup: function( type, element ) { + if ( type == IMAGE ) + this.setValue( element.getAttribute( 'title' ) ); + }, + commit: function( type, element ) { + if ( type == IMAGE ) { + if ( this.getValue() || this.isChanged() ) + element.setAttribute( 'title', this.getValue() ); + } else if ( type == PREVIEW ) + element.setAttribute( 'title', this.getValue() ); + else if ( type == CLEANUP ) { + element.removeAttribute( 'title' ); + } + } + } ] + }, + { + type: 'text', + id: 'txtdlgGenStyle', + requiredContent: 'img{cke-xyz}', // Random text like 'xyz' will check if all are allowed. + label: editor.lang.common.cssStyle, + validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ), + 'default': '', + setup: function( type, element ) { + if ( type == IMAGE ) { + var genStyle = element.getAttribute( 'style' ); + if ( !genStyle && element.$.style.cssText ) + genStyle = element.$.style.cssText; + this.setValue( genStyle ); + + var height = element.$.style.height, + width = element.$.style.width, + aMatchH = ( height ? height : '' ).match( regexGetSize ), + aMatchW = ( width ? width : '' ).match( regexGetSize ); + + this.attributesInStyle = { + height: !!aMatchH, + width: !!aMatchW + }; + } + }, + onChange: function() { + commitInternally.call( + this, [ + 'info:cmbFloat', + 'info:cmbAlign', + 'info:txtVSpace', + 'info:txtHSpace', + 'info:txtBorder', + 'info:txtWidth', + 'info:txtHeight' + ] + ); + updatePreview( this ); + }, + commit: function( type, element ) { + if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) + element.setAttribute( 'style', this.getValue() ); + + } + } ] + } ] + }; + }; + + CKEDITOR.dialog.add( 'image', function( editor ) { + return imageDialog( editor, 'image' ); + } ); + + CKEDITOR.dialog.add( 'imagebutton', function( editor ) { + return imageDialog( editor, 'imagebutton' ); + } ); } )(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/mathjax/dialogs/mathjax.js b/src/static/ckeditor/plugins/mathjax/dialogs/mathjax.js new file mode 100644 index 00000000..563c72f6 --- /dev/null +++ b/src/static/ckeditor/plugins/mathjax/dialogs/mathjax.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("mathjax",function(d){var c,b=d.lang.mathjax;return{title:b.title,minWidth:350,minHeight:100,contents:[{id:"info",elements:[{id:"equation",type:"textarea",label:b.dialogInput,onLoad:function(){var a=this;if(!CKEDITOR.env.ie||8!=CKEDITOR.env.version)this.getInputElement().on("keyup",function(){c.setValue("\\("+a.getInputElement().getValue()+"\\)")})},setup:function(a){this.setValue(CKEDITOR.plugins.mathjax.trim(a.data.math))},commit:function(a){a.setData("math","\\("+this.getValue()+ +"\\)")}},{id:"documentation",type:"html",html:'\x3cdiv style\x3d"width:100%;text-align:right;margin:-8px 0 10px"\x3e\x3ca class\x3d"cke_mathjax_doc" href\x3d"'+b.docUrl+'" target\x3d"_black" style\x3d"cursor:pointer;color:#00B2CE;text-decoration:underline"\x3e'+b.docLabel+"\x3c/a\x3e\x3c/div\x3e"},!(CKEDITOR.env.ie&&8==CKEDITOR.env.version)&&{id:"preview",type:"html",html:'\x3cdiv style\x3d"width:100%;text-align:center;"\x3e\x3ciframe style\x3d"border:0;width:0;height:0;font-size:20px" scrolling\x3d"no" frameborder\x3d"0" allowTransparency\x3d"true" src\x3d"'+ +CKEDITOR.plugins.mathjax.fixSrc+'"\x3e\x3c/iframe\x3e\x3c/div\x3e',onLoad:function(){var a=CKEDITOR.document.getById(this.domId).getChild(0);c=new CKEDITOR.plugins.mathjax.frameWrapper(a,d)},setup:function(a){c.setValue(a.data.math)}}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/mathjax/icons/hidpi/mathjax.png b/src/static/ckeditor/plugins/mathjax/icons/hidpi/mathjax.png new file mode 100644 index 00000000..85b8e11d Binary files /dev/null and b/src/static/ckeditor/plugins/mathjax/icons/hidpi/mathjax.png differ diff --git a/src/static/ckeditor/plugins/mathjax/icons/mathjax.png b/src/static/ckeditor/plugins/mathjax/icons/mathjax.png new file mode 100644 index 00000000..d25081be Binary files /dev/null and b/src/static/ckeditor/plugins/mathjax/icons/mathjax.png differ diff --git a/src/static/ckeditor/plugins/mathjax/images/loader.gif b/src/static/ckeditor/plugins/mathjax/images/loader.gif new file mode 100644 index 00000000..3ffb1811 Binary files /dev/null and b/src/static/ckeditor/plugins/mathjax/images/loader.gif differ diff --git a/src/static/ckeditor/plugins/mathjax/lang/zh-cn.js b/src/static/ckeditor/plugins/mathjax/lang/zh-cn.js new file mode 100644 index 00000000..ea9ad35e --- /dev/null +++ b/src/static/ckeditor/plugins/mathjax/lang/zh-cn.js @@ -0,0 +1 @@ +CKEDITOR.plugins.setLang("mathjax","zh-cn",{title:"TeX 语法的数学公式编辑器",button:"数学公式",dialogInput:"在此编写您的 TeX 指令",docUrl:"http://zh.wikipedia.org/wiki/TeX",docLabel:"TeX 语法(可以参考维基百科自身关于数学公式显示方式的帮助)",loading:"正在加载...",pathName:"数字公式"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/mathjax/plugin.js b/src/static/ckeditor/plugins/mathjax/plugin.js new file mode 100644 index 00000000..b442d0b8 --- /dev/null +++ b/src/static/ckeditor/plugins/mathjax/plugin.js @@ -0,0 +1,15 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){CKEDITOR.plugins.add("mathjax",{lang:"af,ar,az,bg,ca,cs,cy,da,de,de-ch,el,en,en-au,en-gb,eo,es,es-mx,et,eu,fa,fi,fr,gl,he,hr,hu,id,it,ja,km,ko,ku,lt,lv,nb,nl,no,oc,pl,pt,pt-br,ro,ru,sk,sl,sq,sr,sr-latn,sv,tr,tt,ug,uk,vi,zh,zh-cn",requires:"widget,dialog",icons:"mathjax",hidpi:!0,isSupportedEnvironment:function(){return!CKEDITOR.env.ie||8<CKEDITOR.env.version},init:function(b){var c=b.config.mathJaxClass||"math-tex";b.config.mathJaxLib||CKEDITOR.error("mathjax-no-config");b.widgets.add("mathjax", +{inline:!0,dialog:"mathjax",button:b.lang.mathjax.button,mask:!0,allowedContent:"span(!"+c+")",styleToAllowedContentRules:function(a){a=a.getClassesArray();if(!a)return null;a.push("!"+c);return"span("+a.join(",")+")"},pathName:b.lang.mathjax.pathName,template:'\x3cspan class\x3d"'+c+'" style\x3d"display:inline-block" data-cke-survive\x3d1\x3e\x3c/span\x3e',parts:{span:"span"},defaults:{math:"\\(x \x3d {-b \\pm \\sqrt{b^2-4ac} \\over 2a}\\)"},init:function(){var a=this.parts.span.getChild(0);a&&a.type== +CKEDITOR.NODE_ELEMENT&&a.is("iframe")||(a=new CKEDITOR.dom.element("iframe"),a.setAttributes({style:"border:0;width:0;height:0",scrolling:"no",frameborder:0,allowTransparency:!0,src:CKEDITOR.plugins.mathjax.fixSrc}),this.parts.span.append(a));this.once("ready",function(){CKEDITOR.env.ie&&a.setAttribute("src",CKEDITOR.plugins.mathjax.fixSrc);this.frameWrapper=new CKEDITOR.plugins.mathjax.frameWrapper(a,b);this.frameWrapper.setValue(this.data.math)})},data:function(){this.frameWrapper&&this.frameWrapper.setValue(this.data.math)}, +upcast:function(a,b){if("span"==a.name&&a.hasClass(c)&&!(1<a.children.length||a.children[0].type!=CKEDITOR.NODE_TEXT)){b.math=CKEDITOR.tools.htmlDecode(a.children[0].value);var d=a.attributes;d.style=d.style?d.style+";display:inline-block":"display:inline-block";d["data-cke-survive"]=1;a.children[0].remove();return a}},downcast:function(a){a.children[0].replaceWith(new CKEDITOR.htmlParser.text(CKEDITOR.tools.htmlEncode(this.data.math)));var b=a.attributes;b.style=b.style.replace(/display:\s?inline-block;?\s?/, +"");""===b.style&&delete b.style;return a}});CKEDITOR.dialog.add("mathjax",this.path+"dialogs/mathjax.js");b.on("contentPreview",function(a){a.data.dataValue=a.data.dataValue.replace(/<\/head>/,'\x3cscript src\x3d"'+CKEDITOR.getUrl(b.config.mathJaxLib)+'"\x3e\x3c/script\x3e\x3c/head\x3e')});b.on("paste",function(a){a.data.dataValue=a.data.dataValue.replace(new RegExp("\x3cspan[^\x3e]*?"+c+".*?\x3c/span\x3e","ig"),function(a){return a.replace(/(<iframe.*?\/iframe>)/i,"")})})}});CKEDITOR.plugins.mathjax= +{};CKEDITOR.plugins.mathjax.fixSrc=CKEDITOR.env.gecko?"javascript:true":CKEDITOR.env.ie?"javascript:void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+")();document.close();")+"})())":"javascript:void(0)";CKEDITOR.plugins.mathjax.loadingIcon=CKEDITOR.plugins.get("mathjax").path+"images/loader.gif";CKEDITOR.plugins.mathjax.copyStyles=function(b,c){for(var a="color font-family font-style font-weight font-variant font-size".split(" "),e=0;e<a.length;e++){var d=a[e],g= +b.getComputedStyle(d);g&&c.setStyle(d,g)}};CKEDITOR.plugins.mathjax.trim=function(b){var c=b.indexOf("\\(")+2,a=b.lastIndexOf("\\)");return b.substring(c,a)};CKEDITOR.plugins.mathjax.frameWrapper=CKEDITOR.env.ie&&8==CKEDITOR.env.version?function(b,c){b.getFrameDocument().write('\x3c!DOCTYPE html\x3e\x3chtml\x3e\x3chead\x3e\x3cmeta charset\x3d"utf-8"\x3e\x3c/head\x3e\x3cbody style\x3d"padding:0;margin:0;background:transparent;overflow:hidden"\x3e\x3cspan style\x3d"white-space:nowrap;" id\x3d"tex"\x3e\x3c/span\x3e\x3c/body\x3e\x3c/html\x3e'); +return{setValue:function(a){var e=b.getFrameDocument(),d=e.getById("tex");d.setHtml(CKEDITOR.plugins.mathjax.trim(CKEDITOR.tools.htmlEncode(a)));CKEDITOR.plugins.mathjax.copyStyles(b,d);c.fire("lockSnapshot");b.setStyles({width:Math.min(250,d.$.offsetWidth)+"px",height:e.$.body.offsetHeight+"px",display:"inline","vertical-align":"middle"});c.fire("unlockSnapshot")}}}:function(b,c){function a(){f=b.getFrameDocument();f.getById("preview")||(CKEDITOR.env.ie&&b.removeAttribute("src"),f.write('\x3c!DOCTYPE html\x3e\x3chtml\x3e\x3chead\x3e\x3cmeta charset\x3d"utf-8"\x3e\x3cscript type\x3d"text/x-mathjax-config"\x3eMathJax.Hub.Config( {showMathMenu: false,messageStyle: "none"} );function getCKE() {if ( typeof window.parent.CKEDITOR \x3d\x3d \'object\' ) {return window.parent.CKEDITOR;} else {return window.parent.parent.CKEDITOR;}}function update() {MathJax.Hub.Queue([ \'Typeset\', MathJax.Hub, this.buffer ],function() {getCKE().tools.callFunction( '+ +n+" );});}MathJax.Hub.Queue( function() {getCKE().tools.callFunction("+p+');} );\x3c/script\x3e\x3cscript src\x3d"'+c.config.mathJaxLib+'"\x3e\x3c/script\x3e\x3c/head\x3e\x3cbody style\x3d"padding:0;margin:0;background:transparent;overflow:hidden"\x3e\x3cspan id\x3d"preview"\x3e\x3c/span\x3e\x3cspan id\x3d"buffer" style\x3d"display:none"\x3e\x3c/span\x3e\x3c/body\x3e\x3c/html\x3e'))}function e(){m=!0;h=k;c.fire("lockSnapshot");d.setHtml(h);g.setHtml("\x3cimg src\x3d"+CKEDITOR.plugins.mathjax.loadingIcon+ +" alt\x3d"+c.lang.mathjax.loading+"\x3e");b.setStyles({height:"16px",width:"16px",display:"inline","vertical-align":"middle"});c.fire("unlockSnapshot");f.getWindow().$.update(h)}var d,g,h,k,f=b.getFrameDocument(),l=!1,m=!1,p=CKEDITOR.tools.addFunction(function(){g=f.getById("preview");d=f.getById("buffer");l=!0;k&&e();CKEDITOR.fire("mathJaxLoaded",b)}),n=CKEDITOR.tools.addFunction(function(){CKEDITOR.plugins.mathjax.copyStyles(b,g);g.setHtml(d.getHtml());c.fire("lockSnapshot");b.setStyles({height:0, +width:0});var a=Math.max(f.$.body.offsetHeight,f.$.documentElement.offsetHeight),l=Math.max(g.$.offsetWidth,f.$.body.scrollWidth);b.setStyles({height:a+"px",width:l+"px"});c.fire("unlockSnapshot");CKEDITOR.fire("mathJaxUpdateDone",b);h!=k?e():m=!1});b.on("load",a);a();return{setValue:function(a){k=CKEDITOR.tools.htmlEncode(a);l&&!m&&e()}}}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/mentions/plugin.js b/src/static/ckeditor/plugins/mentions/plugin.js new file mode 100644 index 00000000..33c17e9f --- /dev/null +++ b/src/static/ckeditor/plugins/mentions/plugin.js @@ -0,0 +1,9 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function h(a,b){var d=b.feed;this.caseSensitive=b.caseSensitive;this.marker=b.hasOwnProperty("marker")?b.marker:"@";this.minChars=null!==b.minChars&&void 0!==b.minChars?b.minChars:2;var c;if(!(c=b.pattern)){c=this.minChars;var g="\\"+this.marker+"[_a-zA-Z0-9À-ž]",g=(c?g+("{"+c+",}"):g+"*")+"$";c=new RegExp(g)}this.pattern=c;this.cache=void 0!==b.cache?b.cache:!0;this.throttle=void 0!==b.throttle?b.throttle:200;this._autocomplete=new CKEDITOR.plugins.autocomplete(a,{textTestCallback:k(this.marker, +this.minChars,this.pattern),dataCallback:m(d,this),itemTemplate:b.itemTemplate,outputTemplate:b.outputTemplate,throttle:this.throttle,itemsLimit:b.itemsLimit})}function k(a,b,d){function c(b,a){var c=b.slice(0,a).match(d);if(!c)return null;var e=b[c.index-1];return void 0===e||e.match(/\s+/)?{start:c.index,end:a}:null}return function(b){return b.collapsed?CKEDITOR.plugins.textMatch.match(b,c):null}}function m(a,b){return function(d,c){function g(){var c=h(a).filter(function(a){a=a.name;b.caseSensitive|| +(a=a.toLowerCase(),f=f.toLowerCase());return 0===a.indexOf(f)});e(c)}function h(b){var a=1;return CKEDITOR.tools.array.reduce(b,function(b,c){b.push({name:c,id:a++});return b},[])}function k(){var c=(new CKEDITOR.template(a)).output({encodedQuery:encodeURIComponent(f)});if(b.cache&&l[c])return e(l[c]);CKEDITOR.ajax.load(c,function(a){a=JSON.parse(a);b.cache&&null!==a&&(l[c]=a);e(a)})}function e(a){a&&(a=CKEDITOR.tools.array.map(a,function(a){return CKEDITOR.tools.object.merge(a,{name:b.marker+a.name})}), +c(a))}var f=d.query;b.marker&&(f=f.substring(b.marker.length));CKEDITOR.tools.array.isArray(a)?g():"string"===typeof a?k():a({query:f,marker:b.marker},e)}}CKEDITOR._.mentions={cache:{}};var l=CKEDITOR._.mentions.cache;CKEDITOR.plugins.add("mentions",{requires:"autocomplete,textmatch,ajax",instances:[],init:function(a){var b=this;a.on("instanceReady",function(){CKEDITOR.tools.array.forEach(a.config.mentions||[],function(d){b.instances.push(new h(a,d))})})},isSupportedEnvironment:function(a){return a.plugins.autocomplete.isSupportedEnvironment(a)}}); +h.prototype={destroy:function(){this._autocomplete.destroy()}};CKEDITOR.plugins.mentions=h})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/pastefromgdocs/filter/default.js b/src/static/ckeditor/plugins/pastefromgdocs/filter/default.js index eab7cd6e..3c187022 100644 --- a/src/static/ckeditor/plugins/pastefromgdocs/filter/default.js +++ b/src/static/ckeditor/plugins/pastefromgdocs/filter/default.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(){function g(b){return""===b?!1:b}function h(b){if(!/(o|u)l/i.test(b.parent.name))return b;d.elements.replaceWithChildren(b);return!1}function k(b){function d(a,f){var b,c;if(a&&"tr"===a.name){b=a.children;for(c=0;c<f.length&&b[c];c++)b[c].attributes.width=f[c];d(a.next,f)}}var c=b.parent;b=function(a){return CKEDITOR.tools.array.map(a,function(a){return Number(a.attributes.width)})}(b.children);var a=function(a){return CKEDITOR.tools.array.reduce(a,function(a,b){return a+b},0)}(b);c.attributes.width= diff --git a/src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js b/src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js index 5f2aff40..61cec049 100644 --- a/src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js +++ b/src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(){function k(b,c){if(!(b.previous&&g(b.previous)&&b.getFirst().children.length&&1===b.children.length&&g(b.getFirst().getFirst())))return!1;for(var d=l(b.previous),a=0,f=d,r=q();f=f.getAscendant(r);)a++;return(a=m(b,a))?(d.add(a),a.filterChildren(c),!0):!1}function l(b){var c=b.children[b.children.length-1];return g(c)||"li"===c.name?l(c):b}function q(){var b=!1;return function(c){return b?!1:g(c)||"li"===c.name?g(c):(b=!0,!1)}}function m(b,c){return c?m(b.getFirst().getFirst(),--c):b}function g(b){return"ol"=== diff --git a/src/static/ckeditor/plugins/pastefromword/filter/default.js b/src/static/ckeditor/plugins/pastefromword/filter/default.js index f3b9c991..054f7d67 100644 --- a/src/static/ckeditor/plugins/pastefromword/filter/default.js +++ b/src/static/ckeditor/plugins/pastefromword/filter/default.js @@ -1,43 +1,42 @@ /* - Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -(function(){function r(){return!1}var n=CKEDITOR.tools,B=CKEDITOR.plugins.pastetools,t=B.filters.common,k=t.styles,C=t.createAttributeStack,z=t.lists.getElementIndentation,D=["o:p","xml","script","meta","link"],E="v:arc v:curve v:line v:oval v:polyline v:rect v:roundrect v:group".split(" "),A={},y=0,q={},g,p;CKEDITOR.plugins.pastetools.filters.word=q;CKEDITOR.plugins.pastefromword=q;q.rules=function(b,a,c){function e(d){(d.attributes["o:gfxdata"]||"v:group"===d.parent.name)&&l.push(d.attributes.id)} -var f=Boolean(b.match(/mso-list:\s*l\d+\s+level\d+\s+lfo\d+/)),l=[],w={root:function(d){d.filterChildren(c);CKEDITOR.plugins.pastefromword.lists.cleanup(g.createLists(d))},elementNames:[[/^\?xml:namespace$/,""],[/^v:shapetype/,""],[new RegExp(D.join("|")),""]],elements:{a:function(d){if(d.attributes.name){if("_GoBack"==d.attributes.name){delete d.name;return}if(d.attributes.name.match(/^OLE_LINK\d+$/)){delete d.name;return}}if(d.attributes.href&&d.attributes.href.match(/#.+$/)){var a=d.attributes.href.match(/#(.+)$/)[1]; -A[a]=d}d.attributes.name&&A[d.attributes.name]&&(d=A[d.attributes.name],d.attributes.href=d.attributes.href.replace(/.*#(.*)$/,"#$1"))},div:function(d){if(a.plugins.pagebreak&&d.attributes["data-cke-pagebreak"])return d;k.createStyleStack(d,c,a)},img:function(d){if(d.parent&&d.parent.attributes){var a=d.parent.attributes;(a=a.style||a.STYLE)&&a.match(/mso\-list:\s?Ignore/)&&(d.attributes["cke-ignored"]=!0)}k.mapCommonStyles(d);d.attributes.src&&d.attributes.src.match(/^file:\/\//)&&d.attributes.alt&& -d.attributes.alt.match(/^https?:\/\//)&&(d.attributes.src=d.attributes.alt);d=d.attributes["v:shapes"]?d.attributes["v:shapes"].split(" "):[];a=CKEDITOR.tools.array.every(d,function(a){return-1<l.indexOf(a)});if(d.length&&a)return!1},p:function(d){d.filterChildren(c);if(d.attributes.style&&d.attributes.style.match(/display:\s*none/i))return!1;if(g.thisIsAListItem(a,d))p.isEdgeListItem(a,d)&&p.cleanupEdgeListItem(d),g.convertToFakeListItem(a,d),n.array.reduce(d.children,function(a,d){"p"===d.name&& -(0<a&&(new CKEDITOR.htmlParser.element("br")).insertBefore(d),d.replaceWithChildren(),a+=1);return a},0);else{var b=d.getAscendant(function(a){return"ul"==a.name||"ol"==a.name}),e=n.parseCssText(d.attributes.style);b&&!b.attributes["cke-list-level"]&&e["mso-list"]&&e["mso-list"].match(/level/)&&(b.attributes["cke-list-level"]=e["mso-list"].match(/level(\d+)/)[1]);a.config.enterMode==CKEDITOR.ENTER_BR&&(delete d.name,d.add(new CKEDITOR.htmlParser.element("br")))}k.createStyleStack(d,c,a)},pre:function(d){g.thisIsAListItem(a, -d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h1:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h2:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h3:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h4:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h5:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a, -d);k.createStyleStack(d,c,a)},h6:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},font:function(d){if(d.getHtml().match(/^\s*$/))return d.parent.type===CKEDITOR.NODE_ELEMENT&&(new CKEDITOR.htmlParser.text(" ")).insertAfter(d),!1;a&&!0===a.config.pasteFromWordRemoveFontStyles&&d.attributes.size&&delete d.attributes.size;CKEDITOR.dtd.tr[d.parent.name]&&CKEDITOR.tools.arrayCompare(CKEDITOR.tools.object.keys(d.attributes),["class","style"])?k.createStyleStack(d, -c,a):C(d,c)},ul:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},li:function(d){p.correctLevelShift(d);f&&(d.attributes.style=k.normalizedStyles(d,a),k.pushStylesLower(d))},ol:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},span:function(d){d.filterChildren(c);d.attributes.style=k.normalizedStyles(d,a); -if(!d.attributes.style||d.attributes.style.match(/^mso\-bookmark:OLE_LINK\d+$/)||d.getHtml().match(/^(\s| )+$/))return t.elements.replaceWithChildren(d),!1;d.attributes.style.match(/FONT-FAMILY:\s*Symbol/i)&&d.forEach(function(a){a.value=a.value.replace(/ /g,"")},CKEDITOR.NODE_TEXT,!0);k.createStyleStack(d,c,a)},"v:imagedata":r,"v:shape":function(a){var b=!1;if(null===a.getFirst("v:imagedata"))e(a);else{a.parent.find(function(c){"img"==c.name&&c.attributes&&c.attributes["v:shapes"]==a.attributes.id&& -(b=!0)},!0);if(b)return!1;var f="";"v:group"===a.parent.name?e(a):(a.forEach(function(a){a.attributes&&a.attributes.src&&(f=a.attributes.src)},CKEDITOR.NODE_ELEMENT,!0),a.filterChildren(c),a.name="img",a.attributes.src=a.attributes.src||f,delete a.attributes.type)}},style:function(){return!1},object:function(a){return!(!a.attributes||!a.attributes.data)},br:function(b){if(a.plugins.pagebreak&&(b=n.parseCssText(b.attributes.style,!0),"always"===b["page-break-before"]||"page"===b["break-before"]))return b= -CKEDITOR.plugins.pagebreak.createElement(a),CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0]}},attributes:{style:function(b,c){return k.normalizedStyles(c,a)||!1},"class":function(a){a=a.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/ig,"");return""===a?!1:a},cellspacing:r,cellpadding:r,border:r,"v:shapes":r,"o:spid":r},comment:function(a){a.match(/\[if.* supportFields.*\]/)&&y++;"[endif]"==a&&(y=0<y?y-1:0);return!1},text:function(a,b){if(y)return"";var c=b.parent&&b.parent.parent; -return c&&c.attributes&&c.attributes.style&&c.attributes.style.match(/mso-list:\s*ignore/i)?a.replace(/ /g," "):a}};n.array.forEach(E,function(a){w.elements[a]=e});return w};q.lists={thisIsAListItem:function(b,a){return p.isEdgeListItem(b,a)||a.attributes.style&&a.attributes.style.match(/mso\-list:\s?l\d/)&&"li"!==a.parent.name||a.attributes["cke-dissolved"]||a.getHtml().match(/<!\-\-\[if !supportLists]\-\->/)?!0:!1},convertToFakeListItem:function(b,a){p.isDegenerateListItem(b,a)&&p.assignListLevels(b, -a);this.getListItemInfo(a);if(!a.attributes["cke-dissolved"]){var c;a.forEach(function(a){!c&&"img"==a.name&&a.attributes["cke-ignored"]&&"*"==a.attributes.alt&&(c="·",a.remove())},CKEDITOR.NODE_ELEMENT);a.forEach(function(a){c||a.value.match(/^ /)||(c=a.value)},CKEDITOR.NODE_TEXT);if("undefined"==typeof c)return;a.attributes["cke-symbol"]=c.replace(/(?: | ).*$/,"");g.removeSymbolText(a)}var e=a.attributes&&n.parseCssText(a.attributes.style);if(e["margin-left"]){var f=e["margin-left"],l=a.attributes["cke-list-level"]; -(f=Math.max(CKEDITOR.tools.convertToPx(f)-40*l,0))?e["margin-left"]=f+"px":delete e["margin-left"];a.attributes.style=CKEDITOR.tools.writeCssText(e)}a.name="cke:li"},convertToRealListItems:function(b){var a=[];b.forEach(function(b){"cke:li"==b.name&&(b.name="li",a.push(b))},CKEDITOR.NODE_ELEMENT,!1);return a},removeSymbolText:function(b){var a=b.attributes["cke-symbol"],c=b.findOne(function(b){return b.value&&-1<b.value.indexOf(a)},!0),e;c&&(c.value=c.value.replace(a,""),e=c.parent,e.getHtml().match(/^(\s| )*$/)&& -e!==b?e.remove():c.value||c.remove())},setListSymbol:function(b,a,c){c=c||1;var e=n.parseCssText(b.attributes.style);if("ol"==b.name){if(b.attributes.type||e["list-style-type"])return;var f={"[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"},l;for(l in f)if(g.getSubsectionSymbol(a).match(new RegExp(l))){e["list-style-type"]=f[l];break}b.attributes["cke-list-style-type"]=e["list-style-type"]}else f={"·":"disc",o:"circle","§":"square"},!e["list-style-type"]&& -f[a]&&(e["list-style-type"]=f[a]);g.setListSymbol.removeRedundancies(e,c);(b.attributes.style=CKEDITOR.tools.writeCssText(e))||delete b.attributes.style},setListStart:function(b){for(var a=[],c=0,e=0;e<b.children.length;e++)a.push(b.children[e].attributes["cke-symbol"]||"");a[0]||c++;switch(b.attributes["cke-list-style-type"]){case "lower-roman":case "upper-roman":b.attributes.start=g.toArabic(g.getSubsectionSymbol(a[c]))-c;break;case "lower-alpha":case "upper-alpha":b.attributes.start=g.getSubsectionSymbol(a[c]).replace(/\W/g, -"").toLowerCase().charCodeAt(0)-96-c;break;case "decimal":b.attributes.start=parseInt(g.getSubsectionSymbol(a[c]),10)-c||1}"1"==b.attributes.start&&delete b.attributes.start;delete b.attributes["cke-list-style-type"]},numbering:{toNumber:function(b,a){function c(a){a=a.toUpperCase();for(var b=1,c=1;0<a.length;c*=26)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a.charAt(a.length-1))*c,a=a.substr(0,a.length-1);return b}function e(a){var b=[[1E3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50, -"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];a=a.toUpperCase();for(var c=b.length,d=0,e=0;e<c;++e)for(var g=b[e],u=g[1].length;a.substr(0,u)==g[1];a=a.substr(u))d+=g[0];return d}return"decimal"==a?Number(b):"upper-roman"==a||"lower-roman"==a?e(b.toUpperCase()):"lower-alpha"==a||"upper-alpha"==a?c(b):1},getStyle:function(b){b=b.slice(0,1);var a={i:"lower-roman",v:"lower-roman",x:"lower-roman",l:"lower-roman",m:"lower-roman",I:"upper-roman",V:"upper-roman",X:"upper-roman",L:"upper-roman", -M:"upper-roman"}[b];a||(a="decimal",b.match(/[a-z]/)&&(a="lower-alpha"),b.match(/[A-Z]/)&&(a="upper-alpha"));return a}},getSubsectionSymbol:function(b){return(b.match(/([\da-zA-Z]+).?$/)||["placeholder","1"])[1]},setListDir:function(b){var a=0,c=0;b.forEach(function(b){"li"==b.name&&("rtl"==(b.attributes.dir||b.attributes.DIR||"").toLowerCase()?c++:a++)},CKEDITOR.ELEMENT_NODE);c>a&&(b.attributes.dir="rtl")},createList:function(b){return(b.attributes["cke-symbol"].match(/([\da-np-zA-NP-Z]).?/)||[])[1]? -new CKEDITOR.htmlParser.element("ol"):new CKEDITOR.htmlParser.element("ul")},createLists:function(b){function a(a){return CKEDITOR.tools.array.reduce(a,function(a,b){if(b.attributes&&b.attributes.style)var c=CKEDITOR.tools.parseCssText(b.attributes.style)["margin-left"];return c?a+parseInt(c,10):a},0)}var c,e,f,l=g.convertToRealListItems(b);if(0===l.length)return[];var k=g.groupLists(l);for(b=0;b<k.length;b++){var d=k[b],h=d[0];for(f=0;f<d.length;f++)if(1==d[f].attributes["cke-list-level"]){h=d[f]; -break}var h=[g.createList(h)],m=h[0],u=[h[0]];m.insertBefore(d[0]);for(f=0;f<d.length;f++){c=d[f];for(e=c.attributes["cke-list-level"];e>h.length;){var v=g.createList(c),x=m.children;0<x.length?x[x.length-1].add(v):(x=new CKEDITOR.htmlParser.element("li",{style:"list-style-type:none"}),x.add(v),m.add(x));h.push(v);u.push(v);m=v;e==h.length&&g.setListSymbol(v,c.attributes["cke-symbol"],e)}for(;e<h.length;)h.pop(),m=h[h.length-1],e==h.length&&g.setListSymbol(m,c.attributes["cke-symbol"],e);c.remove(); -m.add(c)}h[0].children.length&&(f=h[0].children[0].attributes["cke-symbol"],!f&&1<h[0].children.length&&(f=h[0].children[1].attributes["cke-symbol"]),f&&g.setListSymbol(h[0],f));for(f=0;f<u.length;f++)g.setListStart(u[f]);for(f=0;f<d.length;f++)this.determineListItemValue(d[f])}CKEDITOR.tools.array.forEach(l,function(b){for(var c=[],d=b.parent;d;)"li"===d.name&&c.push(d),d=d.parent;var c=a(c),e;c&&(b.attributes=b.attributes||{},d=CKEDITOR.tools.parseCssText(b.attributes.style),e=d["margin-left"]|| -0,(e=Math.max(parseInt(e,10)-c,0))?d["margin-left"]=e+"px":delete d["margin-left"],b.attributes.style=CKEDITOR.tools.writeCssText(d))});return l},cleanup:function(b){var a=["cke-list-level","cke-symbol","cke-list-id","cke-indentation","cke-dissolved"],c,e;for(c=0;c<b.length;c++)for(e=0;e<a.length;e++)delete b[c].attributes[a[e]]},determineListItemValue:function(b){if("ol"===b.parent.name){var a=this.calculateValue(b),c=b.attributes["cke-symbol"].match(/[a-z0-9]+/gi),e;c&&(c=c[c.length-1],e=b.parent.attributes["cke-list-style-type"]|| -this.numbering.getStyle(c),c=this.numbering.toNumber(c,e),c!==a&&(b.attributes.value=c))}},calculateValue:function(b){if(!b.parent)return 1;var a=b.parent;b=b.getIndex();var c=null,e,f,g;for(g=b;0<=g&&null===c;g--)f=a.children[g],f.attributes&&void 0!==f.attributes.value&&(e=g,c=parseInt(f.attributes.value,10));null===c&&(c=void 0!==a.attributes.start?parseInt(a.attributes.start,10):1,e=0);return c+(b-e)},dissolveList:function(b){function a(b){return 50<=b?"l"+a(b-50):40<=b?"xl"+a(b-40):10<=b?"x"+ -a(b-10):9==b?"ix":5<=b?"v"+a(b-5):4==b?"iv":1<=b?"i"+a(b-1):""}function c(a,b){function c(b,d){return b&&b.parent?a(b.parent)?c(b.parent,d+1):c(b.parent,d):d}return c(b,0)}var e=function(a){return function(b){return b.name==a}},f=function(a){return e("ul")(a)||e("ol")(a)},g=CKEDITOR.tools.array,w=[],d,h;b.forEach(function(a){w.push(a)},CKEDITOR.NODE_ELEMENT,!1);d=g.filter(w,e("li"));var m=g.filter(w,f);g.forEach(m,function(b){var d=b.attributes.type,h=parseInt(b.attributes.start,10)||1,m=c(f,b)+1; -d||(d=n.parseCssText(b.attributes.style)["list-style-type"]);g.forEach(g.filter(b.children,e("li")),function(c,e){var f;switch(d){case "disc":f="·";break;case "circle":f="o";break;case "square":f="§";break;case "1":case "decimal":f=h+e+".";break;case "a":case "lower-alpha":f=String.fromCharCode(97+h-1+e)+".";break;case "A":case "upper-alpha":f=String.fromCharCode(65+h-1+e)+".";break;case "i":case "lower-roman":f=a(h+e)+".";break;case "I":case "upper-roman":f=a(h+e).toUpperCase()+".";break;default:f= -"ul"==b.name?"·":h+e+"."}c.attributes["cke-symbol"]=f;c.attributes["cke-list-level"]=m})});d=g.reduce(d,function(a,b){var c=b.children[0];if(c&&c.name&&c.attributes.style&&c.attributes.style.match(/mso-list:/i)){k.pushStylesLower(b,{"list-style-type":!0,display:!0});var d=n.parseCssText(c.attributes.style,!0);k.setStyle(b,"mso-list",d["mso-list"],!0);k.setStyle(c,"mso-list","");delete b["cke-list-level"];(c=d.display?"display":d.DISPLAY?"DISPLAY":"")&&k.setStyle(b,"display",d[c],!0)}if(1===b.children.length&& -f(b.children[0]))return a;b.name="p";b.attributes["cke-dissolved"]=!0;a.push(b);return a},[]);for(h=d.length-1;0<=h;h--)d[h].insertAfter(b);for(h=m.length-1;0<=h;h--)delete m[h].name},groupLists:function(b){var a,c,e=[[b[0]]],f=e[0];c=b[0];c.attributes["cke-indentation"]=c.attributes["cke-indentation"]||z(c);for(a=1;a<b.length;a++){c=b[a];var l=b[a-1];c.attributes["cke-indentation"]=c.attributes["cke-indentation"]||z(c);c.previous!==l&&(g.chopDiscontinuousLists(f,e),e.push(f=[]));f.push(c)}g.chopDiscontinuousLists(f, -e);return e},chopDiscontinuousLists:function(b,a){for(var c={},e=[[]],f,l=0;l<b.length;l++){var k=c[b[l].attributes["cke-list-level"]],d=this.getListItemInfo(b[l]),h,m;k?(m=k.type.match(/alpha/)&&7==k.index?"alpha":m,m="o"==b[l].attributes["cke-symbol"]&&14==k.index?"alpha":m,h=g.getSymbolInfo(b[l].attributes["cke-symbol"],m),d=this.getListItemInfo(b[l]),(k.type!=h.type||f&&d.id!=f.id&&!this.isAListContinuation(b[l]))&&e.push([])):h=g.getSymbolInfo(b[l].attributes["cke-symbol"]);for(f=parseInt(b[l].attributes["cke-list-level"], -10)+1;20>f;f++)c[f]&&delete c[f];c[b[l].attributes["cke-list-level"]]=h;e[e.length-1].push(b[l]);f=d}[].splice.apply(a,[].concat([n.indexOf(a,b),1],e))},isAListContinuation:function(b){var a=b;do if((a=a.previous)&&a.type===CKEDITOR.NODE_ELEMENT){if(void 0===a.attributes["cke-list-level"])break;if(a.attributes["cke-list-level"]===b.attributes["cke-list-level"])return a.attributes["cke-list-id"]===b.attributes["cke-list-id"]}while(a);return!1},toArabic:function(b){return b.match(/[ivxl]/i)?b.match(/^l/i)? -50+g.toArabic(b.slice(1)):b.match(/^lx/i)?40+g.toArabic(b.slice(1)):b.match(/^x/i)?10+g.toArabic(b.slice(1)):b.match(/^ix/i)?9+g.toArabic(b.slice(2)):b.match(/^v/i)?5+g.toArabic(b.slice(1)):b.match(/^iv/i)?4+g.toArabic(b.slice(2)):b.match(/^i/i)?1+g.toArabic(b.slice(1)):g.toArabic(b.slice(1)):0},getSymbolInfo:function(b,a){var c=b.toUpperCase()==b?"upper-":"lower-",e={"·":["disc",-1],o:["circle",-2],"§":["square",-3]};if(b in e||a&&a.match(/(disc|circle|square)/))return{index:e[b][1],type:e[b][0]}; -if(b.match(/\d/))return{index:b?parseInt(g.getSubsectionSymbol(b),10):0,type:"decimal"};b=b.replace(/\W/g,"").toLowerCase();return!a&&b.match(/[ivxl]+/i)||a&&"alpha"!=a||"roman"==a?{index:g.toArabic(b),type:c+"roman"}:b.match(/[a-z]/i)?{index:b.charCodeAt(0)-97,type:c+"alpha"}:{index:-1,type:"disc"}},getListItemInfo:function(b){if(void 0!==b.attributes["cke-list-id"])return{id:b.attributes["cke-list-id"],level:b.attributes["cke-list-level"]};var a=n.parseCssText(b.attributes.style)["mso-list"],c= -{id:"0",level:"1"};a&&(a+=" ",c.level=a.match(/level(.+?)\s+/)[1],c.id=a.match(/l(\d+?)\s+/)[1]);b.attributes["cke-list-level"]=void 0!==b.attributes["cke-list-level"]?b.attributes["cke-list-level"]:c.level;b.attributes["cke-list-id"]=c.id;return c}};g=q.lists;q.images={extractFromRtf:function(b){var a=[],c=/\{\\pict[\s\S]+?\\bliptag\-?\d+(\\blipupi\-?\d+)?(\{\\\*\\blipuid\s?[\da-fA-F]+)?[\s\}]*?/,e;b=b.match(new RegExp("(?:("+c.source+"))([\\da-fA-F\\s]+)\\}","g"));if(!b)return a;for(var f=0;f<b.length;f++)if(c.test(b[f])){if(-1!== -b[f].indexOf("\\pngblip"))e="image/png";else if(-1!==b[f].indexOf("\\jpegblip"))e="image/jpeg";else continue;a.push({hex:e?b[f].replace(c,"").replace(/[^\da-fA-F]/g,""):null,type:e})}return a},extractTagsFromHtml:function(b){for(var a=/<img[^>]+src="([^"]+)[^>]+/g,c=[],e;e=a.exec(b);)c.push(e[1]);return c}};q.heuristics={isEdgeListItem:function(b,a){if(!CKEDITOR.env.edge||!b.config.pasteFromWord_heuristicsEdgeList)return!1;var c="";a.forEach&&a.forEach(function(a){c+=a.value},CKEDITOR.NODE_TEXT); -return c.match(/^(?: | )*\(?[a-zA-Z0-9]+?[\.\)](?: | ){2,}/)?!0:p.isDegenerateListItem(b,a)},cleanupEdgeListItem:function(b){var a=!1;b.forEach(function(b){a||(b.value=b.value.replace(/^(?: |[\s])+/,""),b.value.length&&(a=!0))},CKEDITOR.NODE_TEXT)},isDegenerateListItem:function(b,a){return!!a.attributes["cke-list-level"]||a.attributes.style&&!a.attributes.style.match(/mso\-list/)&&!!a.find(function(b){if(b.type==CKEDITOR.NODE_ELEMENT&&a.name.match(/h\d/i)&&b.getHtml().match(/^[a-zA-Z0-9]+?[\.\)]$/))return!0; -var e=n.parseCssText(b.attributes&&b.attributes.style,!0);if(!e)return!1;var f=e["font-family"]||"";return(e.font||e["font-size"]||"").match(/7pt/i)&&!!b.previous||f.match(/symbol/i)},!0).length},assignListLevels:function(b,a){if(!a.attributes||void 0===a.attributes["cke-list-level"]){for(var c=[z(a)],e=[a],f=[],g=CKEDITOR.tools.array,k=g.map;a.next&&a.next.attributes&&!a.next.attributes["cke-list-level"]&&p.isDegenerateListItem(b,a.next);)a=a.next,c.push(z(a)),e.push(a);var d=k(c,function(a,b){return 0=== -b?0:a-c[b-1]}),h=this.guessIndentationStep(g.filter(c,function(a){return 0!==a})),f=k(c,function(a){return Math.round(a/h)});-1!==g.indexOf(f,0)&&(f=k(f,function(a){return a+1}));g.forEach(e,function(a,b){a.attributes["cke-list-level"]=f[b]});return{indents:c,levels:f,diffs:d}}},guessIndentationStep:function(b){return b.length?Math.min.apply(null,b):null},correctLevelShift:function(b){if(this.isShifted(b)){var a=CKEDITOR.tools.array.filter(b.children,function(a){return"ul"==a.name||"ol"==a.name}), -c=CKEDITOR.tools.array.reduce(a,function(a,b){return(b.children&&1==b.children.length&&p.isShifted(b.children[0])?[b]:b.children).concat(a)},[]);CKEDITOR.tools.array.forEach(a,function(a){a.remove()});CKEDITOR.tools.array.forEach(c,function(a){b.add(a)});delete b.name}},isShifted:function(b){return"li"!==b.name?!1:0===CKEDITOR.tools.array.filter(b.children,function(a){return a.name&&("ul"==a.name||"ol"==a.name||"p"==a.name&&0===a.children.length)?!1:!0}).length}};p=q.heuristics;g.setListSymbol.removeRedundancies= -function(b,a){(1===a&&"disc"===b["list-style-type"]||"decimal"===b["list-style-type"])&&delete b["list-style-type"]};CKEDITOR.cleanWord=CKEDITOR.pasteFilters.word=B.createFilter({rules:[t.rules,q.rules],additionalTransforms:function(b){CKEDITOR.plugins.clipboard.isCustomDataTypesSupported&&(b=t.styles.inliner.inline(b).getBody().getHtml());return b.replace(/<!\[/g,"\x3c!--[").replace(/\]>/g,"]--\x3e")}});CKEDITOR.config.pasteFromWord_heuristicsEdgeList=!0})(); \ No newline at end of file +(function(){function r(){return!1}var n=CKEDITOR.tools,B=CKEDITOR.plugins.pastetools,t=B.filters.common,k=t.styles,C=t.createAttributeStack,z=t.lists.getElementIndentation,D=["o:p","xml","script","meta","link"],E="v:arc v:curve v:line v:oval v:polyline v:rect v:roundrect v:group".split(" "),A={},y=0,q={},g,p;CKEDITOR.plugins.pastetools.filters.word=q;CKEDITOR.plugins.pastefromword=q;q.rules=function(c,b,d){function e(a){(a.attributes["o:gfxdata"]||"v:group"===a.parent.name)&&l.push(a.attributes.id)} +var f=Boolean(c.match(/mso-list:\s*l\d+\s+level\d+\s+lfo\d+/)),l=[],w={root:function(a){a.filterChildren(d);CKEDITOR.plugins.pastefromword.lists.cleanup(g.createLists(a))},elementNames:[[/^\?xml:namespace$/,""],[/^v:shapetype/,""],[new RegExp(D.join("|")),""]],elements:{a:function(a){if(a.attributes.name){if("_GoBack"==a.attributes.name){delete a.name;return}if(a.attributes.name.match(/^OLE_LINK\d+$/)){delete a.name;return}}if(a.attributes.href&&a.attributes.href.match(/#.+$/)){var b=a.attributes.href.match(/#(.+)$/)[1]; +A[b]=a}a.attributes.name&&A[a.attributes.name]&&(a=A[a.attributes.name],a.attributes.href=a.attributes.href.replace(/.*#(.*)$/,"#$1"))},div:function(a){if(b.plugins.pagebreak&&a.attributes["data-cke-pagebreak"])return a;k.createStyleStack(a,d,b)},img:function(a){if(a.parent&&a.parent.attributes){var b=a.parent.attributes;(b=b.style||b.STYLE)&&b.match(/mso\-list:\s?Ignore/)&&(a.attributes["cke-ignored"]=!0)}k.mapCommonStyles(a);a.attributes.src&&a.attributes.src.match(/^file:\/\//)&&a.attributes.alt&& +a.attributes.alt.match(/^https?:\/\//)&&(a.attributes.src=a.attributes.alt);a=a.attributes["v:shapes"]?a.attributes["v:shapes"].split(" "):[];b=CKEDITOR.tools.array.every(a,function(a){return-1<l.indexOf(a)});if(a.length&&b)return!1},p:function(a){a.filterChildren(d);if(a.attributes.style&&a.attributes.style.match(/display:\s*none/i))return!1;if(g.thisIsAListItem(b,a))p.isEdgeListItem(b,a)&&p.cleanupEdgeListItem(a),g.convertToFakeListItem(b,a),n.array.reduce(a.children,function(a,b){"p"===b.name&& +(0<a&&(new CKEDITOR.htmlParser.element("br")).insertBefore(b),b.replaceWithChildren(),a+=1);return a},0);else{var c=a.getAscendant(function(a){return"ul"==a.name||"ol"==a.name}),f=n.parseCssText(a.attributes.style);c&&!c.attributes["cke-list-level"]&&f["mso-list"]&&f["mso-list"].match(/level/)&&(c.attributes["cke-list-level"]=f["mso-list"].match(/level(\d+)/)[1]);b.config.enterMode==CKEDITOR.ENTER_BR&&(delete a.name,a.add(new CKEDITOR.htmlParser.element("br")))}k.createStyleStack(a,d,b)},pre:function(a){g.thisIsAListItem(b, +a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},h1:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},h2:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},h3:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},h4:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},h5:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b, +a);k.createStyleStack(a,d,b)},h6:function(a){g.thisIsAListItem(b,a)&&g.convertToFakeListItem(b,a);k.createStyleStack(a,d,b)},font:function(a){if(a.getHtml().match(/^\s*$/))return a.parent.type===CKEDITOR.NODE_ELEMENT&&(new CKEDITOR.htmlParser.text(" ")).insertAfter(a),!1;b&&!0===b.config.pasteFromWordRemoveFontStyles&&a.attributes.size&&delete a.attributes.size;CKEDITOR.dtd.tr[a.parent.name]&&CKEDITOR.tools.arrayCompare(CKEDITOR.tools.object.keys(a.attributes),["class","style"])?k.createStyleStack(a, +d,b):C(a,d)},ul:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},li:function(a){p.correctLevelShift(a);f&&(a.attributes.style=k.normalizedStyles(a,b),k.pushStylesLower(a))},ol:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},span:function(a){a.filterChildren(d);a.attributes.style=k.normalizedStyles(a,b); +if(!a.attributes.style||a.attributes.style.match(/^mso\-bookmark:OLE_LINK\d+$/)||a.getHtml().match(/^(\s| )+$/))return t.elements.replaceWithChildren(a),!1;a.attributes.style.match(/FONT-FAMILY:\s*Symbol/i)&&a.forEach(function(a){a.value=a.value.replace(/ /g,"")},CKEDITOR.NODE_TEXT,!0);k.createStyleStack(a,d,b)},"v:imagedata":r,"v:shape":function(a){var b=!1;if(null===a.getFirst("v:imagedata"))e(a);else{a.parent.find(function(c){"img"==c.name&&c.attributes&&c.attributes["v:shapes"]==a.attributes.id&& +(b=!0)},!0);if(b)return!1;var c="";"v:group"===a.parent.name?e(a):(a.forEach(function(a){a.attributes&&a.attributes.src&&(c=a.attributes.src)},CKEDITOR.NODE_ELEMENT,!0),a.filterChildren(d),a.name="img",a.attributes.src=a.attributes.src||c,delete a.attributes.type)}},style:function(){return!1},object:function(a){return!(!a.attributes||!a.attributes.data)},br:function(a){if(b.plugins.pagebreak&&(a=n.parseCssText(a.attributes.style,!0),"always"===a["page-break-before"]||"page"===a["break-before"]))return a= +CKEDITOR.plugins.pagebreak.createElement(b),CKEDITOR.htmlParser.fragment.fromHtml(a.getOuterHtml()).children[0]}},attributes:{style:function(a,c){return k.normalizedStyles(c,b)||!1},"class":function(a){a=a.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/ig,"");return""===a?!1:a},cellspacing:r,cellpadding:r,border:r,"v:shapes":r,"o:spid":r},comment:function(a){a.match(/\[if.* supportFields.*\]/)&&y++;"[endif]"==a&&(y=0<y?y-1:0);return!1},text:function(a,b){if(y)return"";var c=b.parent&&b.parent.parent; +return c&&c.attributes&&c.attributes.style&&c.attributes.style.match(/mso-list:\s*ignore/i)?a.replace(/ /g," "):a}};n.array.forEach(E,function(a){w.elements[a]=e});return w};q.lists={thisIsAListItem:function(c,b){return p.isEdgeListItem(c,b)||b.attributes.style&&b.attributes.style.match(/mso\-list:\s?l\d/)&&"li"!==b.parent.name||b.attributes["cke-dissolved"]||b.getHtml().match(/<!\-\-\[if !supportLists]\-\->/)?!0:!1},convertToFakeListItem:function(c,b){p.isDegenerateListItem(c,b)&&p.assignListLevels(c, +b);this.getListItemInfo(b);if(!b.attributes["cke-dissolved"]){var d;b.forEach(function(b){!d&&"img"==b.name&&b.attributes["cke-ignored"]&&"*"==b.attributes.alt&&(d="·",b.remove())},CKEDITOR.NODE_ELEMENT);b.forEach(function(b){d||b.value.match(/^ /)||(d=b.value)},CKEDITOR.NODE_TEXT);if("undefined"==typeof d)return;b.attributes["cke-symbol"]=d.replace(/(?: | ).*$/,"");g.removeSymbolText(b)}var e=b.attributes&&n.parseCssText(b.attributes.style);if(e["margin-left"]){var f=e["margin-left"],l=b.attributes["cke-list-level"]; +(f=Math.max(CKEDITOR.tools.convertToPx(f)-40*l,0))?e["margin-left"]=f+"px":delete e["margin-left"];b.attributes.style=CKEDITOR.tools.writeCssText(e)}b.name="cke:li"},convertToRealListItems:function(c){var b=[];c.forEach(function(c){"cke:li"==c.name&&(c.name="li",b.push(c))},CKEDITOR.NODE_ELEMENT,!1);return b},removeSymbolText:function(c){var b=c.attributes["cke-symbol"],d=c.findOne(function(c){return c.value&&-1<c.value.indexOf(b)},!0),e;d&&(d.value=d.value.replace(b,""),e=d.parent,e.getHtml().match(/^(\s| )*$/)&& +e!==c?e.remove():d.value||d.remove())},setListSymbol:function(c,b,d){d=d||1;var e=n.parseCssText(c.attributes.style);if("ol"==c.name){if(c.attributes.type||e["list-style-type"])return;var f={"[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"},l;for(l in f)if(g.getSubsectionSymbol(b).match(new RegExp(l))){e["list-style-type"]=f[l];break}c.attributes["cke-list-style-type"]=e["list-style-type"]}else f={"·":"disc",o:"circle","§":"square"},!e["list-style-type"]&& +f[b]&&(e["list-style-type"]=f[b]);g.setListSymbol.removeRedundancies(e,d);(c.attributes.style=CKEDITOR.tools.writeCssText(e))||delete c.attributes.style},setListStart:function(c){for(var b=[],d=0,e=0;e<c.children.length;e++)b.push(c.children[e].attributes["cke-symbol"]||"");b[0]||d++;switch(c.attributes["cke-list-style-type"]){case "lower-roman":case "upper-roman":c.attributes.start=g.toArabic(g.getSubsectionSymbol(b[d]))-d;break;case "lower-alpha":case "upper-alpha":c.attributes.start=g.getSubsectionSymbol(b[d]).replace(/\W/g, +"").toLowerCase().charCodeAt(0)-96-d;break;case "decimal":c.attributes.start=parseInt(g.getSubsectionSymbol(b[d]),10)-d||1}"1"==c.attributes.start&&delete c.attributes.start;delete c.attributes["cke-list-style-type"]},numbering:{toNumber:function(c,b){function d(b){b=b.toUpperCase();for(var c=1,d=1;0<b.length;d*=26)c+="ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(b.charAt(b.length-1))*d,b=b.substr(0,b.length-1);return c}function e(b){var c=[[1E3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50, +"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];b=b.toUpperCase();for(var d=c.length,a=0,e=0;e<d;++e)for(var g=c[e],u=g[1].length;b.substr(0,u)==g[1];b=b.substr(u))a+=g[0];return a}return"decimal"==b?Number(c):"upper-roman"==b||"lower-roman"==b?e(c.toUpperCase()):"lower-alpha"==b||"upper-alpha"==b?d(c):1},getStyle:function(c){c=c.slice(0,1);var b={i:"lower-roman",v:"lower-roman",x:"lower-roman",l:"lower-roman",m:"lower-roman",I:"upper-roman",V:"upper-roman",X:"upper-roman",L:"upper-roman", +M:"upper-roman"}[c];b||(b="decimal",c.match(/[a-z]/)&&(b="lower-alpha"),c.match(/[A-Z]/)&&(b="upper-alpha"));return b}},getSubsectionSymbol:function(c){return(c.match(/([\da-zA-Z]+).?$/)||["placeholder","1"])[1]},setListDir:function(c){var b=0,d=0;c.forEach(function(c){"li"==c.name&&("rtl"==(c.attributes.dir||c.attributes.DIR||"").toLowerCase()?d++:b++)},CKEDITOR.ELEMENT_NODE);d>b&&(c.attributes.dir="rtl")},createList:function(c){return(c.attributes["cke-symbol"].match(/([\da-np-zA-NP-Z]).?/)||[])[1]? +new CKEDITOR.htmlParser.element("ol"):new CKEDITOR.htmlParser.element("ul")},createLists:function(c){function b(b){return CKEDITOR.tools.array.reduce(b,function(b,a){if(a.attributes&&a.attributes.style)var c=CKEDITOR.tools.parseCssText(a.attributes.style)["margin-left"];return c?b+parseInt(c,10):b},0)}var d,e,f,l=g.convertToRealListItems(c);if(0===l.length)return[];var k=g.groupLists(l);for(c=0;c<k.length;c++){var a=k[c],h=a[0];for(f=0;f<a.length;f++)if(1==a[f].attributes["cke-list-level"]){h=a[f]; +break}var h=[g.createList(h)],m=h[0],u=[h[0]];m.insertBefore(a[0]);for(f=0;f<a.length;f++){d=a[f];for(e=d.attributes["cke-list-level"];e>h.length;){var v=g.createList(d),x=m.children;0<x.length?x[x.length-1].add(v):(x=new CKEDITOR.htmlParser.element("li",{style:"list-style-type:none"}),x.add(v),m.add(x));h.push(v);u.push(v);m=v;e==h.length&&g.setListSymbol(v,d.attributes["cke-symbol"],e)}for(;e<h.length;)h.pop(),m=h[h.length-1],e==h.length&&g.setListSymbol(m,d.attributes["cke-symbol"],e);d.remove(); +m.add(d)}h[0].children.length&&(f=h[0].children[0].attributes["cke-symbol"],!f&&1<h[0].children.length&&(f=h[0].children[1].attributes["cke-symbol"]),f&&g.setListSymbol(h[0],f));for(f=0;f<u.length;f++)g.setListStart(u[f]);for(f=0;f<a.length;f++)this.determineListItemValue(a[f])}CKEDITOR.tools.array.forEach(l,function(a){for(var c=[],d=a.parent;d;)"li"===d.name&&c.push(d),d=d.parent;var c=b(c),e;c&&(a.attributes=a.attributes||{},d=CKEDITOR.tools.parseCssText(a.attributes.style),e=d["margin-left"]|| +0,(e=Math.max(parseInt(e,10)-c,0))?d["margin-left"]=e+"px":delete d["margin-left"],a.attributes.style=CKEDITOR.tools.writeCssText(d))});return l},cleanup:function(c){var b=["cke-list-level","cke-symbol","cke-list-id","cke-indentation","cke-dissolved"],d,e;for(d=0;d<c.length;d++)for(e=0;e<b.length;e++)delete c[d].attributes[b[e]]},determineListItemValue:function(c){if("ol"===c.parent.name){var b=this.calculateValue(c),d=c.attributes["cke-symbol"].match(/[a-z0-9]+/gi),e;d&&(d=d[d.length-1],e=c.parent.attributes["cke-list-style-type"]|| +this.numbering.getStyle(d),d=this.numbering.toNumber(d,e),d!==b&&(c.attributes.value=d))}},calculateValue:function(c){if(!c.parent)return 1;var b=c.parent;c=c.getIndex();var d=null,e,f,g;for(g=c;0<=g&&null===d;g--)f=b.children[g],f.attributes&&void 0!==f.attributes.value&&(e=g,d=parseInt(f.attributes.value,10));null===d&&(d=void 0!==b.attributes.start?parseInt(b.attributes.start,10):1,e=0);return d+(c-e)},dissolveList:function(c){function b(a){return 50<=a?"l"+b(a-50):40<=a?"xl"+b(a-40):10<=a?"x"+ +b(a-10):9==a?"ix":5<=a?"v"+b(a-5):4==a?"iv":1<=a?"i"+b(a-1):""}function d(a,b){function c(b,d){return b&&b.parent?a(b.parent)?c(b.parent,d+1):c(b.parent,d):d}return c(b,0)}var e=function(b){return function(a){return a.name==b}},f=function(b){return e("ul")(b)||e("ol")(b)},g=CKEDITOR.tools.array,w=[],a,h;c.forEach(function(b){w.push(b)},CKEDITOR.NODE_ELEMENT,!1);a=g.filter(w,e("li"));var m=g.filter(w,f);g.forEach(m,function(a){var c=a.attributes.type,h=parseInt(a.attributes.start,10)||1,m=d(f,a)+1; +c||(c=n.parseCssText(a.attributes.style)["list-style-type"]);g.forEach(g.filter(a.children,e("li")),function(d,e){var f;switch(c){case "disc":f="·";break;case "circle":f="o";break;case "square":f="§";break;case "1":case "decimal":f=h+e+".";break;case "a":case "lower-alpha":f=String.fromCharCode(97+h-1+e)+".";break;case "A":case "upper-alpha":f=String.fromCharCode(65+h-1+e)+".";break;case "i":case "lower-roman":f=b(h+e)+".";break;case "I":case "upper-roman":f=b(h+e).toUpperCase()+".";break;default:f= +"ul"==a.name?"·":h+e+"."}d.attributes["cke-symbol"]=f;d.attributes["cke-list-level"]=m})});a=g.reduce(a,function(b,a){var c=a.children[0];if(c&&c.name&&c.attributes.style&&c.attributes.style.match(/mso-list:/i)){k.pushStylesLower(a,{"list-style-type":!0,display:!0});var d=n.parseCssText(c.attributes.style,!0);k.setStyle(a,"mso-list",d["mso-list"],!0);k.setStyle(c,"mso-list","");delete a["cke-list-level"];(c=d.display?"display":d.DISPLAY?"DISPLAY":"")&&k.setStyle(a,"display",d[c],!0)}if(1===a.children.length&& +f(a.children[0]))return b;a.name="p";a.attributes["cke-dissolved"]=!0;b.push(a);return b},[]);for(h=a.length-1;0<=h;h--)a[h].insertAfter(c);for(h=m.length-1;0<=h;h--)delete m[h].name},groupLists:function(c){var b,d,e=[[c[0]]],f=e[0];d=c[0];d.attributes["cke-indentation"]=d.attributes["cke-indentation"]||z(d);for(b=1;b<c.length;b++){d=c[b];var l=c[b-1];d.attributes["cke-indentation"]=d.attributes["cke-indentation"]||z(d);d.previous!==l&&(g.chopDiscontinuousLists(f,e),e.push(f=[]));f.push(d)}g.chopDiscontinuousLists(f, +e);return e},chopDiscontinuousLists:function(c,b){for(var d={},e=[[]],f,l=0;l<c.length;l++){var k=d[c[l].attributes["cke-list-level"]],a=this.getListItemInfo(c[l]),h,m;k?(m=k.type.match(/alpha/)&&7==k.index?"alpha":m,m="o"==c[l].attributes["cke-symbol"]&&14==k.index?"alpha":m,h=g.getSymbolInfo(c[l].attributes["cke-symbol"],m),a=this.getListItemInfo(c[l]),(k.type!=h.type||f&&a.id!=f.id&&!this.isAListContinuation(c[l]))&&e.push([])):h=g.getSymbolInfo(c[l].attributes["cke-symbol"]);for(f=parseInt(c[l].attributes["cke-list-level"], +10)+1;20>f;f++)d[f]&&delete d[f];d[c[l].attributes["cke-list-level"]]=h;e[e.length-1].push(c[l]);f=a}[].splice.apply(b,[].concat([n.indexOf(b,c),1],e))},isAListContinuation:function(c){var b=c;do if((b=b.previous)&&b.type===CKEDITOR.NODE_ELEMENT){if(void 0===b.attributes["cke-list-level"])break;if(b.attributes["cke-list-level"]===c.attributes["cke-list-level"])return b.attributes["cke-list-id"]===c.attributes["cke-list-id"]}while(b);return!1},toArabic:function(c){return c.match(/[ivxl]/i)?c.match(/^l/i)? +50+g.toArabic(c.slice(1)):c.match(/^lx/i)?40+g.toArabic(c.slice(1)):c.match(/^x/i)?10+g.toArabic(c.slice(1)):c.match(/^ix/i)?9+g.toArabic(c.slice(2)):c.match(/^v/i)?5+g.toArabic(c.slice(1)):c.match(/^iv/i)?4+g.toArabic(c.slice(2)):c.match(/^i/i)?1+g.toArabic(c.slice(1)):g.toArabic(c.slice(1)):0},getSymbolInfo:function(c,b){var d=c.toUpperCase()==c?"upper-":"lower-",e={"·":["disc",-1],o:["circle",-2],"§":["square",-3]};if(c in e||b&&b.match(/(disc|circle|square)/))return{index:e[c][1],type:e[c][0]}; +if(c.match(/\d/))return{index:c?parseInt(g.getSubsectionSymbol(c),10):0,type:"decimal"};c=c.replace(/\W/g,"").toLowerCase();return!b&&c.match(/[ivxl]+/i)||b&&"alpha"!=b||"roman"==b?{index:g.toArabic(c),type:d+"roman"}:c.match(/[a-z]/i)?{index:c.charCodeAt(0)-97,type:d+"alpha"}:{index:-1,type:"disc"}},getListItemInfo:function(c){if(void 0!==c.attributes["cke-list-id"])return{id:c.attributes["cke-list-id"],level:c.attributes["cke-list-level"]};var b=n.parseCssText(c.attributes.style)["mso-list"],d= +{id:"0",level:"1"};b&&(b+=" ",d.level=b.match(/level(.+?)\s+/)[1],d.id=b.match(/l(\d+?)\s+/)[1]);c.attributes["cke-list-level"]=void 0!==c.attributes["cke-list-level"]?c.attributes["cke-list-level"]:d.level;c.attributes["cke-list-id"]=d.id;return d}};g=q.lists;q.heuristics={isEdgeListItem:function(c,b){if(!CKEDITOR.env.edge||!c.config.pasteFromWord_heuristicsEdgeList)return!1;var d="";b.forEach&&b.forEach(function(b){d+=b.value},CKEDITOR.NODE_TEXT);return d.match(/^(?: | )*\(?[a-zA-Z0-9]+?[\.\)](?: | ){2,}/)? +!0:p.isDegenerateListItem(c,b)},cleanupEdgeListItem:function(c){var b=!1;c.forEach(function(c){b||(c.value=c.value.replace(/^(?: |[\s])+/,""),c.value.length&&(b=!0))},CKEDITOR.NODE_TEXT)},isDegenerateListItem:function(c,b){return!!b.attributes["cke-list-level"]||b.attributes.style&&!b.attributes.style.match(/mso\-list/)&&!!b.find(function(c){if(c.type==CKEDITOR.NODE_ELEMENT&&b.name.match(/h\d/i)&&c.getHtml().match(/^[a-zA-Z0-9]+?[\.\)]$/))return!0;var e=n.parseCssText(c.attributes&&c.attributes.style, +!0);if(!e)return!1;var f=e["font-family"]||"";return(e.font||e["font-size"]||"").match(/7pt/i)&&!!c.previous||f.match(/symbol/i)},!0).length},assignListLevels:function(c,b){if(!b.attributes||void 0===b.attributes["cke-list-level"]){for(var d=[z(b)],e=[b],f=[],g=CKEDITOR.tools.array,k=g.map;b.next&&b.next.attributes&&!b.next.attributes["cke-list-level"]&&p.isDegenerateListItem(c,b.next);)b=b.next,d.push(z(b)),e.push(b);var a=k(d,function(a,b){return 0===b?0:a-d[b-1]}),h=this.guessIndentationStep(g.filter(d, +function(a){return 0!==a})),f=k(d,function(a){return Math.round(a/h)});-1!==g.indexOf(f,0)&&(f=k(f,function(a){return a+1}));g.forEach(e,function(a,b){a.attributes["cke-list-level"]=f[b]});return{indents:d,levels:f,diffs:a}}},guessIndentationStep:function(c){return c.length?Math.min.apply(null,c):null},correctLevelShift:function(c){if(this.isShifted(c)){var b=CKEDITOR.tools.array.filter(c.children,function(b){return"ul"==b.name||"ol"==b.name}),d=CKEDITOR.tools.array.reduce(b,function(b,c){return(c.children&& +1==c.children.length&&p.isShifted(c.children[0])?[c]:c.children).concat(b)},[]);CKEDITOR.tools.array.forEach(b,function(b){b.remove()});CKEDITOR.tools.array.forEach(d,function(b){c.add(b)});delete c.name}},isShifted:function(c){return"li"!==c.name?!1:0===CKEDITOR.tools.array.filter(c.children,function(b){return b.name&&("ul"==b.name||"ol"==b.name||"p"==b.name&&0===b.children.length)?!1:!0}).length}};p=q.heuristics;g.setListSymbol.removeRedundancies=function(c,b){(1===b&&"disc"===c["list-style-type"]|| +"decimal"===c["list-style-type"])&&delete c["list-style-type"]};CKEDITOR.cleanWord=CKEDITOR.pasteFilters.word=B.createFilter({rules:[t.rules,q.rules],additionalTransforms:function(c){CKEDITOR.plugins.clipboard.isCustomDataTypesSupported&&(c=t.styles.inliner.inline(c).getBody().getHtml());return c.replace(/<!\[/g,"\x3c!--[").replace(/\]>/g,"]--\x3e")}});CKEDITOR.config.pasteFromWord_heuristicsEdgeList=!0})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/pastetools/filter/common.js b/src/static/ckeditor/plugins/pastetools/filter/common.js index c2e83385..bce639a9 100644 --- a/src/static/ckeditor/plugins/pastetools/filter/common.js +++ b/src/static/ckeditor/plugins/pastetools/filter/common.js @@ -1,22 +1,24 @@ /* - Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -(function(){function q(a){return/%$/.test(a)?a:a+"px"}function r(a){var b=a.margin?"margin":a.MARGIN?"MARGIN":!1,c,e;if(b){e=CKEDITOR.tools.style.parse.margin(a[b]);for(c in e)a["margin-"+c]=e[c];delete a[b]}}function t(a){var b="background-color:transparent;background:transparent;background-color:none;background:none;background-position:initial initial;background-repeat:initial initial;caret-color;font-family:-webkit-standard;font-variant-caps;letter-spacing:normal;orphans;widows;text-transform:none;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;text-indent:0px;margin-bottom:0in".split(";"), -c=CKEDITOR.tools.parseCssText(a.attributes.style),e,f;for(e in c)f=e+":"+c[e],CKEDITOR.tools.array.some(b,function(a){return f.substring(0,a.length).toLowerCase()===a})&&delete c[e];c=CKEDITOR.tools.writeCssText(c);""!==c?a.attributes.style=c:delete a.attributes.style}function u(a){a=a.config.font_names;var b=[];if(!a||!a.length)return!1;b=CKEDITOR.tools.array.map(a.split(";"),function(a){return-1===a.indexOf("/")?a:a.split("/")[1]});return b.length?b:!1}function v(a,b){var c=a.split(",");return CKEDITOR.tools.array.find(b, -function(a){for(var f=0;f<c.length;f++)if(-1===a.indexOf(CKEDITOR.tools.trim(c[f])))return!1;return!0})||a}var h,l=CKEDITOR.tools,p={};CKEDITOR.plugins.pastetools.filters.common=p;p.rules=function(a,b,c){var e=u(b);return{elements:{"^":function(a){t(a);if(a.attributes.bgcolor){var b=CKEDITOR.tools.parseCssText(a.attributes.style);b["background-color"]||(b["background-color"]=a.attributes.bgcolor,a.attributes.style=CKEDITOR.tools.writeCssText(b))}},span:function(a){if(a.hasClass("Apple-converted-space"))return new CKEDITOR.htmlParser.text(" ")}, -table:function(a){a.filterChildren(c);var b=a.parent,d=b&&b.parent,e,k;if(b.name&&"div"===b.name&&b.attributes.align&&1===l.object.keys(b.attributes).length&&1===b.children.length){a.attributes.align=b.attributes.align;e=b.children.splice(0);a.remove();for(k=e.length-1;0<=k;k--)d.add(e[k],b.getIndex());b.remove()}h.convertStyleToPx(a)},tr:function(a){a.attributes={}},td:function(a){var g=a.getAscendant("table"),g=l.parseCssText(g.attributes.style,!0),d=g.background;d&&h.setStyle(a,"background",d, -!0);(g=g["background-color"])&&h.setStyle(a,"background-color",g,!0);var g=l.parseCssText(a.attributes.style,!0),d=g.border?CKEDITOR.tools.style.border.fromCssRule(g.border):{},d=l.style.border.splitCssValues(g,d),e=CKEDITOR.tools.clone(g),k;for(k in e)0==k.indexOf("border")&&delete e[k];a.attributes.style=CKEDITOR.tools.writeCssText(e);g.background&&(k=CKEDITOR.tools.style.parse.background(g.background),k.color&&(h.setStyle(a,"background-color",k.color,!0),h.setStyle(a,"background","")));for(var m in d)k= -g[m]?CKEDITOR.tools.style.border.fromCssRule(g[m]):d[m],"none"===k.style?h.setStyle(a,m,"none"):h.setStyle(a,m,k.toString());h.mapCommonStyles(a);h.convertStyleToPx(a);h.createStyleStack(a,c,b,/margin|text\-align|padding|list\-style\-type|width|height|border|white\-space|vertical\-align|background/i)},font:function(a){a.attributes.face&&e&&(a.attributes.face=v(a.attributes.face,e))}}}};p.styles={setStyle:function(a,b,c,e){var f=l.parseCssText(a.attributes.style);e&&f[b]||(""===c?delete f[b]:f[b]= -c,a.attributes.style=CKEDITOR.tools.writeCssText(f))},convertStyleToPx:function(a){var b=a.attributes.style;b&&(a.attributes.style=b.replace(/\d+(\.\d+)?pt/g,function(a){return CKEDITOR.tools.convertToPx(a)+"px"}))},mapStyles:function(a,b){for(var c in b)if(a.attributes[c]){if("function"===typeof b[c])b[c](a.attributes[c]);else h.setStyle(a,b[c],a.attributes[c]);delete a.attributes[c]}},mapCommonStyles:function(a){return h.mapStyles(a,{vAlign:function(b){h.setStyle(a,"vertical-align",b)},width:function(b){h.setStyle(a, -"width",q(b))},height:function(b){h.setStyle(a,"height",q(b))}})},normalizedStyles:function(a,b){var c="background-color:transparent border-image:none color:windowtext direction:ltr mso- visibility:visible div:border:none".split(" "),e="font-family font font-size color background-color line-height text-decoration".split(" "),f=function(){for(var a=[],b=0;b<arguments.length;b++)arguments[b]&&a.push(arguments[b]);return-1!==l.indexOf(c,a.join(":"))},g=!0===CKEDITOR.plugins.pastetools.getConfigValue(b, -"removeFontStyles"),d=l.parseCssText(a.attributes.style);"cke:li"==a.name&&(d["TEXT-INDENT"]&&d.MARGIN?(a.attributes["cke-indentation"]=p.lists.getElementIndentation(a),d.MARGIN=d.MARGIN.replace(/(([\w\.]+ ){3,3})[\d\.]+(\w+$)/,"$10$3")):delete d["TEXT-INDENT"],delete d["text-indent"]);for(var n=l.object.keys(d),k=0;k<n.length;k++){var m=n[k].toLowerCase(),h=d[n[k]],q=CKEDITOR.tools.indexOf;(g&&-1!==q(e,m.toLowerCase())||f(null,m,h)||f(null,m.replace(/\-.*$/,"-"))||f(null,m)||f(a.name,m,h)||f(a.name, -m.replace(/\-.*$/,"-"))||f(a.name,m)||f(h))&&delete d[n[k]]}var t=CKEDITOR.plugins.pastetools.getConfigValue(b,"keepZeroMargins");r(d);(function(){CKEDITOR.tools.array.forEach(["top","right","bottom","left"],function(a){a="margin-"+a;if(a in d){var b=CKEDITOR.tools.convertToPx(d[a]);b||t?d[a]=b?b+"px":0:delete d[a]}})})();return CKEDITOR.tools.writeCssText(d)},createStyleStack:function(a,b,c,e){var f=[];a.filterChildren(b);for(b=a.children.length-1;0<=b;b--)f.unshift(a.children[b]),a.children[b].remove(); -h.sortStyles(a);b=l.parseCssText(h.normalizedStyles(a,c));c=a;var g="span"===a.name,d;for(d in b)if(!d.match(e||/margin((?!-)|-left|-top|-bottom|-right)|text-indent|text-align|width|border|padding/i))if(g)g=!1;else{var n=new CKEDITOR.htmlParser.element("span");n.attributes.style=d+":"+b[d];c.add(n);c=n;delete b[d]}CKEDITOR.tools.isEmpty(b)?delete a.attributes.style:a.attributes.style=CKEDITOR.tools.writeCssText(b);for(b=0;b<f.length;b++)c.add(f[b])},sortStyles:function(a){for(var b=["border","border-bottom", -"font-size","background"],c=l.parseCssText(a.attributes.style),e=l.object.keys(c),f=[],g=[],d=0;d<e.length;d++)-1!==l.indexOf(b,e[d].toLowerCase())?f.push(e[d]):g.push(e[d]);f.sort(function(a,c){var d=l.indexOf(b,a.toLowerCase()),f=l.indexOf(b,c.toLowerCase());return d-f});e=[].concat(f,g);f={};for(d=0;d<e.length;d++)f[e[d]]=c[e[d]];a.attributes.style=CKEDITOR.tools.writeCssText(f)},pushStylesLower:function(a,b,c){if(!a.attributes.style||0===a.children.length)return!1;b=b||{};var e={"list-style-type":!0, -width:!0,height:!0,border:!0,"border-":!0},f=l.parseCssText(a.attributes.style),g;for(g in f)if(!(g.toLowerCase()in e||e[g.toLowerCase().replace(/\-.*$/,"-")]||g.toLowerCase()in b)){for(var d=!1,n=0;n<a.children.length;n++){var k=a.children[n];if(k.type===CKEDITOR.NODE_TEXT&&c){var m=new CKEDITOR.htmlParser.element("span");m.setHtml(k.value);k.replaceWith(m);k=m}k.type===CKEDITOR.NODE_ELEMENT&&(d=!0,h.setStyle(k,g,f[g]))}d&&delete f[g]}a.attributes.style=CKEDITOR.tools.writeCssText(f);return!0},inliner:{filtered:"break-before break-after break-inside page-break page-break-before page-break-after page-break-inside".split(" "), -parse:function(a){function b(a){var b=new CKEDITOR.dom.element("style"),c=new CKEDITOR.dom.element("iframe");c.hide();CKEDITOR.document.getBody().append(c);c.$.contentDocument.documentElement.appendChild(b.$);b.$.textContent=a;c.remove();return b.$.sheet}function c(a){var b=a.indexOf("{"),c=a.indexOf("}");return e(a.substring(b+1,c),!0)}var e=CKEDITOR.tools.parseCssText,f=h.inliner.filter,g=a.is?a.$.sheet:b(a);a=[];var d;if(g)for(g=g.cssRules,d=0;d<g.length;d++)g[d].type===window.CSSRule.STYLE_RULE&& -a.push({selector:g[d].selectorText,styles:f(c(g[d].cssText))});return a},filter:function(a){var b=h.inliner.filtered,c=l.array.indexOf,e={},f;for(f in a)-1===c(b,f)&&(e[f]=a[f]);return e},sort:function(a){return a.sort(function(a){var c=CKEDITOR.tools.array.map(a,function(a){return a.selector});return function(a,b){var g=-1!==(""+a.selector).indexOf(".")?1:0,g=(-1!==(""+b.selector).indexOf(".")?1:0)-g;return 0!==g?g:c.indexOf(b.selector)-c.indexOf(a.selector)}}(a))},inline:function(a){var b=h.inliner.parse, -c=h.inliner.sort,e=function(a){a=(new DOMParser).parseFromString(a,"text/html");return new CKEDITOR.dom.document(a)}(a);a=e.find("style");c=c(function(a){var c=[],d;for(d=0;d<a.count();d++)c=c.concat(b(a.getItem(d)));return c}(a));CKEDITOR.tools.array.forEach(c,function(a){var b=a.styles;a=e.find(a.selector);var c,h,k;r(b);for(k=0;k<a.count();k++)c=a.getItem(k),h=CKEDITOR.tools.parseCssText(c.getAttribute("style")),r(h),h=CKEDITOR.tools.extend({},h,b),c.setAttribute("style",CKEDITOR.tools.writeCssText(h))}); -return e}}};h=p.styles;p.lists={getElementIndentation:function(a){a=l.parseCssText(a.attributes.style);if(a.margin||a.MARGIN){a.margin=a.margin||a.MARGIN;var b={styles:{margin:a.margin}};CKEDITOR.filter.transformationsTools.splitMarginShorthand(b);a["margin-left"]=b.styles["margin-left"]}return parseInt(l.convertToPx(a["margin-left"]||"0px"),10)}};p.elements={replaceWithChildren:function(a){for(var b=a.children.length-1;0<=b;b--)a.children[b].insertAfter(a)}};p.createAttributeStack=function(a,b){var c, -e=[];a.filterChildren(b);for(c=a.children.length-1;0<=c;c--)e.unshift(a.children[c]),a.children[c].remove();c=a.attributes;var f=a,g=!0,d;for(d in c)if(g)g=!1;else{var h=new CKEDITOR.htmlParser.element(a.name);h.attributes[d]=c[d];f.add(h);f=h;delete c[d]}for(c=0;c<e.length;c++)f.add(e[c])};p.parseShorthandMargins=r})(); \ No newline at end of file +(function(){function q(a,b,c){b+=c;for(var d=a[b],e=/[\s]/;d&&e.test(d);)b+=c,d=a[b];return d}function r(a){return/%$/.test(a)?a:a+"px"}function t(a){var b=a.margin?"margin":a.MARGIN?"MARGIN":!1,c,d;if(b){d=CKEDITOR.tools.style.parse.margin(a[b]);for(c in d)a["margin-"+c]=d[c];delete a[b]}}function u(a){var b="background-color:transparent;background:transparent;background-color:none;background:none;background-position:initial initial;background-repeat:initial initial;caret-color;font-family:-webkit-standard;font-variant-caps;letter-spacing:normal;orphans;widows;text-transform:none;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;text-indent:0px;margin-bottom:0in".split(";"), +c=CKEDITOR.tools.parseCssText(a.attributes.style),d,e;for(d in c)e=d+":"+c[d],CKEDITOR.tools.array.some(b,function(a){return e.substring(0,a.length).toLowerCase()===a})&&delete c[d];c=CKEDITOR.tools.writeCssText(c);""!==c?a.attributes.style=c:delete a.attributes.style}function v(a){a=a.config.font_names;var b=[];if(!a||!a.length)return!1;b=CKEDITOR.tools.array.map(a.split(";"),function(a){return-1===a.indexOf("/")?a:a.split("/")[1]});return b.length?b:!1}function w(a,b){var c=a.split(",");return CKEDITOR.tools.array.find(b, +function(a){for(var e=0;e<c.length;e++)if(-1===a.indexOf(CKEDITOR.tools.trim(c[e])))return!1;return!0})||a}var g,m=CKEDITOR.tools,p={};CKEDITOR.plugins.pastetools.filters.common=p;p.rules=function(a,b,c){var d=v(b);return{elements:{"^":function(a){u(a);if(a.attributes.bgcolor){var b=CKEDITOR.tools.parseCssText(a.attributes.style);b["background-color"]||(b["background-color"]=a.attributes.bgcolor,a.attributes.style=CKEDITOR.tools.writeCssText(b))}},span:function(a){if(a.hasClass("Apple-converted-space"))return new CKEDITOR.htmlParser.text(" ")}, +table:function(a){a.filterChildren(c);var b=a.parent,f=b&&b.parent,d,h;if(b.name&&"div"===b.name&&b.attributes.align&&1===m.object.keys(b.attributes).length&&1===b.children.length){a.attributes.align=b.attributes.align;d=b.children.splice(0);a.remove();for(h=d.length-1;0<=h;h--)f.add(d[h],b.getIndex());b.remove()}g.convertStyleToPx(a)},tr:function(a){a.attributes={}},td:function(a){var d=a.getAscendant("table"),d=m.parseCssText(d.attributes.style,!0),f=d.background;f&&g.setStyle(a,"background",f, +!0);(d=d["background-color"])&&g.setStyle(a,"background-color",d,!0);var d=m.parseCssText(a.attributes.style,!0),f=d.border?CKEDITOR.tools.style.border.fromCssRule(d.border):{},f=m.style.border.splitCssValues(d,f),l=CKEDITOR.tools.clone(d),h;for(h in l)0==h.indexOf("border")&&delete l[h];a.attributes.style=CKEDITOR.tools.writeCssText(l);d.background&&(h=CKEDITOR.tools.style.parse.background(d.background),h.color&&(g.setStyle(a,"background-color",h.color,!0),g.setStyle(a,"background","")));for(var n in f)h= +d[n]?CKEDITOR.tools.style.border.fromCssRule(d[n]):f[n],"none"===h.style?g.setStyle(a,n,"none"):g.setStyle(a,n,h.toString());g.mapCommonStyles(a);g.convertStyleToPx(a);g.createStyleStack(a,c,b,/margin|text\-align|padding|list\-style\-type|width|height|border|white\-space|vertical\-align|background/i)},font:function(a){a.attributes.face&&d&&(a.attributes.face=w(a.attributes.face,d))}}}};p.styles={setStyle:function(a,b,c,d){var e=m.parseCssText(a.attributes.style);d&&e[b]||(""===c?delete e[b]:e[b]= +c,a.attributes.style=CKEDITOR.tools.writeCssText(e))},convertStyleToPx:function(a){var b=a.attributes.style;b&&(a.attributes.style=b.replace(/\d+(\.\d+)?pt/g,function(a){return CKEDITOR.tools.convertToPx(a)+"px"}))},mapStyles:function(a,b){for(var c in b)if(a.attributes[c]){if("function"===typeof b[c])b[c](a.attributes[c]);else g.setStyle(a,b[c],a.attributes[c]);delete a.attributes[c]}},mapCommonStyles:function(a){return g.mapStyles(a,{vAlign:function(b){g.setStyle(a,"vertical-align",b)},width:function(b){g.setStyle(a, +"width",r(b))},height:function(b){g.setStyle(a,"height",r(b))}})},normalizedStyles:function(a,b){var c="background-color:transparent border-image:none color:windowtext direction:ltr mso- visibility:visible div:border:none".split(" "),d="font-family font font-size color background-color line-height text-decoration".split(" "),e=function(){for(var a=[],b=0;b<arguments.length;b++)arguments[b]&&a.push(arguments[b]);return-1!==m.indexOf(c,a.join(":"))},k=!0===CKEDITOR.plugins.pastetools.getConfigValue(b, +"removeFontStyles"),f=m.parseCssText(a.attributes.style);"cke:li"==a.name&&(f["TEXT-INDENT"]&&f.MARGIN?(a.attributes["cke-indentation"]=p.lists.getElementIndentation(a),f.MARGIN=f.MARGIN.replace(/(([\w\.]+ ){3,3})[\d\.]+(\w+$)/,"$10$3")):delete f["TEXT-INDENT"],delete f["text-indent"]);for(var l=m.object.keys(f),h=0;h<l.length;h++){var n=l[h].toLowerCase(),g=f[l[h]],q=CKEDITOR.tools.indexOf;(k&&-1!==q(d,n.toLowerCase())||e(null,n,g)||e(null,n.replace(/\-.*$/,"-"))||e(null,n)||e(a.name,n,g)||e(a.name, +n.replace(/\-.*$/,"-"))||e(a.name,n)||e(g))&&delete f[l[h]]}var r=CKEDITOR.plugins.pastetools.getConfigValue(b,"keepZeroMargins");t(f);(function(){CKEDITOR.tools.array.forEach(["top","right","bottom","left"],function(a){a="margin-"+a;if(a in f){var b=CKEDITOR.tools.convertToPx(f[a]);b||r?f[a]=b?b+"px":0:delete f[a]}})})();return CKEDITOR.tools.writeCssText(f)},createStyleStack:function(a,b,c,d){var e=[];a.filterChildren(b);for(b=a.children.length-1;0<=b;b--)e.unshift(a.children[b]),a.children[b].remove(); +g.sortStyles(a);b=m.parseCssText(g.normalizedStyles(a,c));c=a;var k="span"===a.name,f;for(f in b)if(!f.match(d||/margin((?!-)|-left|-top|-bottom|-right)|text-indent|text-align|width|border|padding/i))if(k)k=!1;else{var l=new CKEDITOR.htmlParser.element("span");l.attributes.style=f+":"+b[f];c.add(l);c=l;delete b[f]}CKEDITOR.tools.isEmpty(b)?delete a.attributes.style:a.attributes.style=CKEDITOR.tools.writeCssText(b);for(b=0;b<e.length;b++)c.add(e[b])},sortStyles:function(a){for(var b=["border","border-bottom", +"font-size","background"],c=m.parseCssText(a.attributes.style),d=m.object.keys(c),e=[],k=[],f=0;f<d.length;f++)-1!==m.indexOf(b,d[f].toLowerCase())?e.push(d[f]):k.push(d[f]);e.sort(function(a,c){var d=m.indexOf(b,a.toLowerCase()),e=m.indexOf(b,c.toLowerCase());return d-e});d=[].concat(e,k);e={};for(f=0;f<d.length;f++)e[d[f]]=c[d[f]];a.attributes.style=CKEDITOR.tools.writeCssText(e)},pushStylesLower:function(a,b,c){if(!a.attributes.style||0===a.children.length)return!1;b=b||{};var d={"list-style-type":!0, +width:!0,height:!0,border:!0,"border-":!0},e=m.parseCssText(a.attributes.style),k;for(k in e)if(!(k.toLowerCase()in d||d[k.toLowerCase().replace(/\-.*$/,"-")]||k.toLowerCase()in b)){for(var f=!1,l=0;l<a.children.length;l++){var h=a.children[l];if(h.type===CKEDITOR.NODE_TEXT&&c){var n=new CKEDITOR.htmlParser.element("span");n.setHtml(h.value);h.replaceWith(n);h=n}h.type===CKEDITOR.NODE_ELEMENT&&(f=!0,g.setStyle(h,k,e[k]))}f&&delete e[k]}a.attributes.style=CKEDITOR.tools.writeCssText(e);return!0},inliner:{filtered:"break-before break-after break-inside page-break page-break-before page-break-after page-break-inside".split(" "), +parse:function(a){function b(a){var b=new CKEDITOR.dom.element("style"),c=new CKEDITOR.dom.element("iframe");c.hide();CKEDITOR.document.getBody().append(c);c.$.contentDocument.documentElement.appendChild(b.$);b.$.textContent=a;c.remove();return b.$.sheet}function c(a){var b=a.indexOf("{"),c=a.indexOf("}");return d(a.substring(b+1,c),!0)}var d=CKEDITOR.tools.parseCssText,e=g.inliner.filter,k=a.is?a.$.sheet:b(a);a=[];var f;if(k)for(k=k.cssRules,f=0;f<k.length;f++)k[f].type===window.CSSRule.STYLE_RULE&& +a.push({selector:k[f].selectorText,styles:e(c(k[f].cssText))});return a},filter:function(a){var b=g.inliner.filtered,c=m.array.indexOf,d={},e;for(e in a)-1===c(b,e)&&(d[e]=a[e]);return d},sort:function(a){return a.sort(function(a){var c=CKEDITOR.tools.array.map(a,function(a){return a.selector});return function(a,b){var k=-1!==(""+a.selector).indexOf(".")?1:0,k=(-1!==(""+b.selector).indexOf(".")?1:0)-k;return 0!==k?k:c.indexOf(b.selector)-c.indexOf(a.selector)}}(a))},inline:function(a){var b=g.inliner.parse, +c=g.inliner.sort,d=function(a){a=(new DOMParser).parseFromString(a,"text/html");return new CKEDITOR.dom.document(a)}(a);a=d.find("style");c=c(function(a){var c=[],d;for(d=0;d<a.count();d++)c=c.concat(b(a.getItem(d)));return c}(a));CKEDITOR.tools.array.forEach(c,function(a){var b=a.styles;a=d.find(a.selector);var c,g,h;t(b);for(h=0;h<a.count();h++)c=a.getItem(h),g=CKEDITOR.tools.parseCssText(c.getAttribute("style")),t(g),g=CKEDITOR.tools.extend({},g,b),c.setAttribute("style",CKEDITOR.tools.writeCssText(g))}); +return d}}};g=p.styles;p.lists={getElementIndentation:function(a){a=m.parseCssText(a.attributes.style);if(a.margin||a.MARGIN){a.margin=a.margin||a.MARGIN;var b={styles:{margin:a.margin}};CKEDITOR.filter.transformationsTools.splitMarginShorthand(b);a["margin-left"]=b.styles["margin-left"]}return parseInt(m.convertToPx(a["margin-left"]||"0px"),10)}};p.elements={replaceWithChildren:function(a){for(var b=a.children.length-1;0<=b;b--)a.children[b].insertAfter(a)}};p.createAttributeStack=function(a,b){var c, +d=[];a.filterChildren(b);for(c=a.children.length-1;0<=c;c--)d.unshift(a.children[c]),a.children[c].remove();c=a.attributes;var e=a,g=!0,f;for(f in c)if(g)g=!1;else{var l=new CKEDITOR.htmlParser.element(a.name);l.attributes[f]=c[f];e.add(l);e=l;delete c[f]}for(c=0;c<d.length;c++)e.add(d[c])};p.parseShorthandMargins=t;p.rtf={getGroups:function(a,b){for(var c=[],d,e=0;d=p.rtf.getGroup(a,b,{start:e});)e=d.end,c.push(d);return c},removeGroups:function(a,b){for(var c;c=p.rtf.getGroup(a,b);){var d=a.substring(0, +c.start);c=a.substring(c.end);a=d+c}return a},getGroup:function(a,b,c){var d=0;b=new RegExp("\\{\\\\"+b,"g");var e;c=CKEDITOR.tools.object.merge({start:0},c||{});b.lastIndex=c.start;c=b.exec(a);if(!c)return null;b=c.index;e=a[b];do{var g="{"===e&&"\\"!==q(a,b,-1)&&"\\"===q(a,b,1);e="}"===e&&"\\"!==q(a,b,-1)&&0<d;g?d++:e&&d--;e=a[++b]}while(e&&0<d);return{start:c.index,end:b,content:a.substring(c.index,b)}},extractGroupContent:function(a){var b;b=(b=a.match(/^\{\\(\w+)/))?b[1]:null;a=a.replace(/\}([^{\s]+)/g, +"} $1");a=p.rtf.removeGroups(a,"(?!"+b+")");a=CKEDITOR.tools.trim(a.replace(/^\{(\\[\w-]+\s*)+/g,""));return a.replace(/}$/,"")}}})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/pastetools/filter/image.js b/src/static/ckeditor/plugins/pastetools/filter/image.js index 67648abf..7d0203a8 100644 --- a/src/static/ckeditor/plugins/pastetools/filter/image.js +++ b/src/static/ckeditor/plugins/pastetools/filter/image.js @@ -1,6 +1,12 @@ /* - Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -(function(){function f(b){var c=[],a=/(\{\\pict[^{}]+?|\{\\\*\\shppict\{\\pict\{\\\*[^*]+?)\\(?:jpeg|png)blip/,d;b=b.match(new RegExp("(?:("+a.source+"))([\\da-fA-F\\s]+)\\}","g"));if(!b)return c;for(var e=0;e<b.length;e++)if(a.test(b[e])){if(-1!==b[e].indexOf("\\pngblip"))d="image/png";else if(-1!==b[e].indexOf("\\jpegblip"))d="image/jpeg";else continue;c.push({hex:d?b[e].replace(a,"").replace(/[^\da-fA-F]/g,""):null,type:d})}return c}function g(b){for(var c=/<img[^>]+src="([^"]+)[^>]+/g,a=[],d;d= -c.exec(b);)a.push(d[1]);return a}CKEDITOR.pasteFilters.image=function(b,c,a){var d=[];if(!a)return b;c=g(b);if(0===c.length)return b;a=f(a);if(0===a.length)return b;CKEDITOR.tools.array.forEach(a,function(a){d.push(a.type?"data:"+a.type+";base64,"+CKEDITOR.tools.convertBytesToBase64(CKEDITOR.tools.convertHexStringToBytes(a.hex)):null)},this);if(c.length===d.length)for(a=0;a<c.length;a++)0===c[a].indexOf("file://")&&d[a]&&(b=b.replace(c[a],d[a]));return b}})(); \ No newline at end of file +(function(){function u(a,c,b){c=l(c);var e,d;if(0===c.length)return a;e=CKEDITOR.tools.array.map(c,function(a){return h(a)},this);if(b.length!==e.length)return CKEDITOR.error("pastetools-failed-image-extraction",{rtf:c.length,html:b.length}),a;for(d=0;d<b.length;d++)if(0===b[d].indexOf("file://"))if(e[d]){var k=b[d].replace(/\\/g,"\\\\");a=a.replace(new RegExp("(\x3cimg [^\x3e]*src\x3d[\"']?)"+k),"$1"+e[d])}else CKEDITOR.error("pastetools-unsupported-image",{type:c[d].type,index:d});return a}function v(a, +c,b){var e=CKEDITOR.tools.array.unique(CKEDITOR.tools.array.filter(b,function(a){return a.match(/^blob:/i)}));b=CKEDITOR.tools.array.map(e,m);CKEDITOR.tools.promise.all(b).then(function(b){CKEDITOR.tools.array.forEach(b,function(b,c){if(b){var d=e[c],d=a.editable().find('img[src\x3d"'+d+'"]').toArray();CKEDITOR.tools.array.forEach(d,function(a){a.setAttribute("src",b);a.setAttribute("data-cke-saved-src",b)},this)}else CKEDITOR.error("pastetools-unsupported-image",{type:"blob",index:c})})});return c} +function l(a){function c(a){return"string"!==typeof a?-1:CKEDITOR.tools.array.indexOf(d,function(b){return b.id===a})}function b(a){var b=a.match(/\\blipuid (\w+)\}/);a=a.match(/\\bliptag(-?\d+)/);return b?b[1]:a?a[1]:null}var e=CKEDITOR.plugins.pastetools.filters.common.rtf,d=[];a=e.removeGroups(a,"(?:(?:header|footer)[lrf]?|nonshppict|shprslt)");a=e.getGroups(a,"pict");if(!a)return d;for(var k=0;k<a.length;k++){var f=a[k].content,h=b(f),n=t(f),g=c(h),p=-1!==g&&d[g].hex,l=p&&d[g].type===n,p=p&&d[g].type!== +n&&g===d.length-1,m=-1!==f.indexOf("\\defshp"),q=-1!==CKEDITOR.tools.array.indexOf(CKEDITOR.pasteFilters.image.supportedImageTypes,n),r=-1!==CKEDITOR.tools.indexOf(f,"fHorizRule");l?d.push(d[g]):p||m||r||(f={id:h,hex:q?e.extractGroupContent(f).replace(/\s/g,""):null,type:n},-1!==g?d.splice(g,1,f):d.push(f))}return d}function q(a){for(var c=/<img[^>]+src="([^"]+)[^>]+/g,b=[],e;e=c.exec(a);)b.push(e[1]);return b}function t(a){var c=CKEDITOR.tools.array.find(CKEDITOR.pasteFilters.image.recognizableImageTypes, +function(b){return b.marker.test(a)});return c?c.type:"unknown"}function h(a){var c=-1!==CKEDITOR.tools.array.indexOf(CKEDITOR.pasteFilters.image.supportedImageTypes,a.type),b=a.hex;if(!c)return null;"string"===typeof b&&(b=CKEDITOR.tools.convertHexStringToBytes(a.hex));return a.type?"data:"+a.type+";base64,"+CKEDITOR.tools.convertBytesToBase64(b):null}function m(a){return new CKEDITOR.tools.promise(function(c){CKEDITOR.ajax.load(a,function(a){a=new Uint8Array(a);var e=r(a);a=h({type:e,hex:a});c(a)}, +"arraybuffer")})}function r(a){a=a.subarray(0,4);var c=CKEDITOR.tools.array.map(a,function(a){return a.toString(16)}).join("");return(a=CKEDITOR.tools.array.find(CKEDITOR.pasteFilters.image.recognizableImageSignatures,function(a){return 0===c.indexOf(a.signature)}))?a.type:null}CKEDITOR.pasteFilters.image=function(a,c,b){var e;if(c.activeFilter&&!c.activeFilter.check("img[src]"))return a;e=q(a);return 0===e.length?a:b?u(a,b,e):v(c,a,e)};CKEDITOR.pasteFilters.image.extractFromRtf=l;CKEDITOR.pasteFilters.image.extractTagsFromHtml= +q;CKEDITOR.pasteFilters.image.getImageType=t;CKEDITOR.pasteFilters.image.createSrcWithBase64=h;CKEDITOR.pasteFilters.image.convertBlobUrlToBase64=m;CKEDITOR.pasteFilters.image.getImageTypeFromSignature=r;CKEDITOR.pasteFilters.image.supportedImageTypes=["image/png","image/jpeg","image/gif"];CKEDITOR.pasteFilters.image.recognizableImageTypes=[{marker:/\\pngblip/,type:"image/png"},{marker:/\\jpegblip/,type:"image/jpeg"},{marker:/\\emfblip/,type:"image/emf"},{marker:/\\wmetafile\d/,type:"image/wmf"}]; +CKEDITOR.pasteFilters.image.recognizableImageSignatures=[{signature:"ffd8ff",type:"image/jpeg"},{signature:"47494638",type:"image/gif"},{signature:"89504e47",type:"image/png"}]})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/preview/images/pagebreak.gif b/src/static/ckeditor/plugins/preview/images/pagebreak.gif new file mode 100644 index 00000000..a27b1684 Binary files /dev/null and b/src/static/ckeditor/plugins/preview/images/pagebreak.gif differ diff --git a/src/static/ckeditor/plugins/preview/preview.html b/src/static/ckeditor/plugins/preview/preview.html new file mode 100644 index 00000000..7eb8082c --- /dev/null +++ b/src/static/ckeditor/plugins/preview/preview.html @@ -0,0 +1,13 @@ +<script> + +// Prevent from DOM clobbering. +if ( typeof window.opener._cke_htmlToLoad == 'string' ) { + var doc = document; + doc.open(); + doc.write( window.opener._cke_htmlToLoad ); + doc.close(); + + delete window.opener._cke_htmlToLoad; +} + +</script> diff --git a/src/static/ckeditor/plugins/preview/styles/screen.css b/src/static/ckeditor/plugins/preview/styles/screen.css new file mode 100644 index 00000000..b9b07f3c --- /dev/null +++ b/src/static/ckeditor/plugins/preview/styles/screen.css @@ -0,0 +1,10 @@ +div[style*="page-break-after"] { + background:url( ../images/pagebreak.gif ) no-repeat center center; + clear:both; + width:100%; + border-top:#999 1px dotted; + border-bottom:#999 1px dotted; + padding:0; + height:7px; + cursor:default; +} diff --git a/src/static/ckeditor/plugins/scayt/CHANGELOG.md b/src/static/ckeditor/plugins/scayt/CHANGELOG.md new file mode 100644 index 00000000..b07ce7fc --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/CHANGELOG.md @@ -0,0 +1,4 @@ +SCAYT plugin for CKEditor 4 Changelog +==================== + +The full changelog of the SCAYT plugin for CKEditor 4 can be found on our website under the [release notes](https://webspellchecker.com/release-notes/) section. diff --git a/src/static/ckeditor/plugins/scayt/LICENSE.md b/src/static/ckeditor/plugins/scayt/LICENSE.md new file mode 100644 index 00000000..610c8078 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/LICENSE.md @@ -0,0 +1,28 @@ +Software License Agreement +========================== + +**CKEditor SCAYT Plugin** +Copyright © 2012, [CKSource](http://cksource.com) - Frederico Knabben. All rights reserved. + +Licensed under the terms of any of the following licenses at your choice: + +* GNU General Public License Version 2 or later (the "GPL"): + http://www.gnu.org/licenses/gpl.html + +* GNU Lesser General Public License Version 2.1 or later (the "LGPL"): + http://www.gnu.org/licenses/lgpl.html + +* Mozilla Public License Version 1.1 or later (the "MPL"): + http://www.mozilla.org/MPL/MPL-1.1.html + +You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. + +Sources of Intellectual Property Included in this plugin +-------------------------------------------------------- + +Where not otherwise indicated, all plugin content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, the plugin will incorporate work done by developers outside of CKSource with their express permission. + +Trademarks +---------- + +CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. diff --git a/src/static/ckeditor/plugins/scayt/README.md b/src/static/ckeditor/plugins/scayt/README.md new file mode 100644 index 00000000..62e5e620 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/README.md @@ -0,0 +1,81 @@ +SCAYT plugin for CKEditor 4 +===================== + +SpellCheckAsYouType (SCAYT) instantly underlines spelling and grammar errors while users type. To correct spelling or grammar error, a user simply needs to right-click the marked word to select from suggested corrections. +![SCAYT Plugin for CKEditor 4 View](https://webspellchecker.com/app/images/scayt_plugin_for_ckeditor4.png) + +This plugin brings the multi-language SCAYT functionality into CKEditor 4. It is integrated by default starting with [Standard Package of CKEditor 4](https://ckeditor.com/ckeditor-4/download/). You can find it on the CKEditor 4 toolbar panel under the ABC button (Enable SCAYT). + +If your version of CKEditor doesn’t have SCAYT built-in, you can easily add it by following the steps outlined in the Get Started section. + +The default version of SCAYT plugin for CKEditor 4 is using the free services of WebSpellChecker. It is provided with a banner ad and has some [limitations](https://docs.webspellchecker.net/display/WebSpellCheckerCloud/Free+and+Paid+WebSpellChecker+Cloud+Services+Comparison+for+CKEditor). + +To lift the limitations and get rid of the banner, [obtain a license](https://webspellchecker.com/wsc-scayt-ckeditor4/#pricing). Depending on your needs, you can choose a Cloud-based or Server (self-hosted) solution. + +Demo +------------ +SCAYT plugin for CKEditor 4: https://webspellchecker.com/wsc-scayt-ckeditor4/ + +Supported languages +------------ + +The SCAYT plugin for CKEditor as a part of the free services supports the next languages for check spelling: American English, British English, Canadian English, Canadian French, Danish, Dutch, Finnish, French, German, Greek, Italian, Norwegian Bokmal, Spanish, Swedish. + +There are also additional languages and specialized dictionaries available for a commercial license, you can check the full list [here](https://webspellchecker.com/additional-dictionaries/). + +Get started +------------ + +1. Clone/copy this repository contents in a new "plugins/scayt" folder in your CKEditor installation. +2. Enable the "scayt" plugin in the CKEditor configuration file (config.js): + + config.extraPlugins = 'scayt'; + +That's all. SCAYT will appear on the editor toolbar under the ABC button and will be ready to use. + +Supported browsers +------- + +This is the list of officially supported browsers for the SCAYT plugin for CKEditor 4. SCAYT may also work in other browsers and environments but we unable to check all of them and guarantee proper work. + +* Chrome (the latest) +* Firefox (the latest) +* Safari (the latest) +* MS Edge (the latest) +* Internet Explorer 8.0 (limited support) +* Internet Explorer 9.0+ (close to full support) + +Note: All browsers are to be supported for web pages that work in Standards Mode. + +Resources +------- + +* Demo: https://webspellchecker.com/wsc-scayt-ckeditor4/ +* Documentation: https://docs.webspellchecker.net/ +* YouTube video “How to Configure CKEditor 4 and SpellCheckAsYouType Plugin”: https://youtu.be/D0ahmVjYBq8 +* Term of Service: https://webspellchecker.com/terms-of-service/ +* CKEditor’s How-Tos for SCAYT: https://ckeditor.com/docs/ckeditor4/latest/guide/dev_howtos_scayt.html +* CKEditor’s example of SCAYT: https://ckeditor.com/docs/ckeditor4/latest/examples/spellchecker.html + +Technical support or questions +------- + +In cooperation with the CKEditor team, during the past 10 years we have simplified the installation and built the extensive amount of documentation devoted to SCAYT plugin for CKEditor 4 and less. + +If you are experiencing any difficulties with the setup of the plugin, please check the links provided in the Resources section. + +Holders of an active subscription to the services or a commercial license have access to professional technical assistance directly from the WebSpellChecker team. [Contact us here](https://webspellchecker.com/contact-us/)! + +Reporting issues +------- + +Please use the [SCAYT plugin for CKEditor 4 GitHub issue page](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues) to report bugs and feature requests. We will do our best to reply at our earliest convenience. + +License +------- + +This plugin is licensed under the terms of any of the following licenses at your choice: [GPL](http://www.gnu.org/licenses/gpl.html), [LGPL](http://www.gnu.org/licenses/lgpl.html) and [MPL](http://www.mozilla.org/MPL/MPL-1.1.html). + +See LICENSE.md for more information. + +Developed by [WebSpellChecker](https://webspellchecker.com/) in cooperation with CKSource. diff --git a/src/static/ckeditor/plugins/scayt/dialogs/dialog.css b/src/static/ckeditor/plugins/scayt/dialogs/dialog.css new file mode 100644 index 00000000..427c4b42 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/dialogs/dialog.css @@ -0,0 +1,23 @@ +div.cke_dialog_ui_scaytItemList { + border: 1px solid #c9cccf; +} + +.cke_scaytItemList-child { + position: relative; + padding: 6px 30px 6px 5px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.cke_scaytItemList-child:hover { + background: #ebebeb; +} + +.cke_scaytItemList-child .cke_scaytItemList_remove { + position: absolute; + top: 0; + right: 5px; + width: 26px; + height: 26px; +} diff --git a/src/static/ckeditor/plugins/scayt/dialogs/options.js b/src/static/ckeditor/plugins/scayt/dialogs/options.js new file mode 100644 index 00000000..e47c97e9 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/dialogs/options.js @@ -0,0 +1,32 @@ +CKEDITOR.dialog.add("scaytDialog",function(d){var c=d.scayt,k='\x3cp\x3e\x3cimg alt\x3d"logo" title\x3d"logo" src\x3d"'+c.getLogo()+'" /\x3e\x3c/p\x3e\x3cp\x3e'+c.getLocal("version")+c.getVersion()+'\x3c/p\x3e\x3cp\x3e\x3ca href\x3d"'+c.getOption("CKUserManual")+'" target\x3d"_blank" style\x3d"text-decoration: underline; color: blue; cursor: pointer;"\x3e'+c.getLocal("btn_userManual")+"\x3c/a\x3e\x3c/p\x3e\x3cp\x3e"+c.getLocal("text_copyrights")+"\x3c/p\x3e",n=CKEDITOR.document,l={isChanged:function(){return null=== +this.newLang||this.currentLang===this.newLang?!1:!0},currentLang:c.getLang(),newLang:null,reset:function(){this.currentLang=c.getLang();this.newLang=null},id:"lang"},k=[{id:"options",label:c.getLocal("tab_options"),onShow:function(){},elements:[{type:"vbox",id:"scaytOptions",children:function(){var b=c.getApplicationConfig(),a=[],g={"ignore-all-caps-words":"label_allCaps","ignore-domain-names":"label_ignoreDomainNames","ignore-words-with-mixed-cases":"label_mixedCase","ignore-words-with-numbers":"label_mixedWithDigits"}, +h;for(h in b)b={type:"checkbox"},b.id=h,b.label=c.getLocal(g[h]),a.push(b);return a}(),onShow:function(){this.getChild();for(var b=d.scayt,a=0;a<this.getChild().length;a++)this.getChild()[a].setValue(b.getApplicationConfig()[this.getChild()[a].id])}}]},{id:"langs",label:c.getLocal("tab_languages"),elements:[{id:"leftLangColumn",type:"vbox",align:"left",widths:["100"],children:[{type:"html",id:"langBox",style:"overflow: hidden; white-space: normal;margin-bottom:15px;",html:'\x3cdiv\x3e\x3cdiv style\x3d"float:left;width:45%;margin-left:5px;" id\x3d"left-col-'+ +d.name+'" class\x3d"scayt-lang-list"\x3e\x3c/div\x3e\x3cdiv style\x3d"float:left;width:45%;margin-left:15px;" id\x3d"right-col-'+d.name+'" class\x3d"scayt-lang-list"\x3e\x3c/div\x3e\x3c/div\x3e',onShow:function(){var b=d.scayt.getLang();n.getById("scaytLang_"+d.name+"_"+b).$.checked=!0}}]}]},{id:"dictionaries",label:c.getLocal("tab_dictionaries"),elements:[{type:"vbox",id:"rightCol_col__left",children:[{type:"html",id:"dictionaryNote",html:""},{type:"text",id:"dictionaryName",label:c.getLocal("label_fieldNameDic")|| +"Dictionary name",onShow:function(b){var a=b.sender,g=d.scayt;b=SCAYT.prototype.UILib;var h=a.getContentElement("dictionaries","dictionaryName").getInputElement().$;g.isLicensed()||(h.disabled=!0,b.css(h,{cursor:"not-allowed"}));setTimeout(function(){a.getContentElement("dictionaries","dictionaryNote").getElement().setText("");null!=g.getUserDictionaryName()&&""!=g.getUserDictionaryName()&&a.getContentElement("dictionaries","dictionaryName").setValue(g.getUserDictionaryName())},0)}},{type:"hbox", +id:"udButtonsHolder",align:"left",widths:["auto"],style:"width:auto;",children:[{type:"button",id:"createDic",label:c.getLocal("btn_createDic"),title:c.getLocal("btn_createDic"),onLoad:function(){this.getDialog();var b=d.scayt,a=SCAYT.prototype.UILib,g=this.getElement().$,h=this.getElement().getChild(0).$;b.isLicensed()||(a.css(g,{cursor:"not-allowed"}),a.css(h,{cursor:"not-allowed"}))},onClick:function(){var b=this.getDialog(),a=f,g=d.scayt,h=b.getContentElement("dictionaries","dictionaryName").getValue(); +g.isLicensed()&&g.createUserDictionary(h,function(e){e.error||a.toggleDictionaryState.call(b,"dictionaryState");e.dialog=b;e.command="create";e.name=h;d.fire("scaytUserDictionaryAction",e)},function(a){a.dialog=b;a.command="create";a.name=h;d.fire("scaytUserDictionaryActionError",a)})}},{type:"button",id:"restoreDic",label:c.getLocal("btn_connectDic"),title:c.getLocal("btn_connectDic"),onLoad:function(){this.getDialog();var b=d.scayt,a=SCAYT.prototype.UILib,g=this.getElement().$,h=this.getElement().getChild(0).$; +b.isLicensed()||(a.css(g,{cursor:"not-allowed"}),a.css(h,{cursor:"not-allowed"}))},onClick:function(){var b=this.getDialog(),a=d.scayt,g=f,h=b.getContentElement("dictionaries","dictionaryName").getValue();a.isLicensed()&&a.restoreUserDictionary(h,function(a){a.dialog=b;a.error||g.toggleDictionaryState.call(b,"dictionaryState");a.command="restore";a.name=h;d.fire("scaytUserDictionaryAction",a)},function(a){a.dialog=b;a.command="restore";a.name=h;d.fire("scaytUserDictionaryActionError",a)})}},{type:"button", +id:"disconnectDic",label:c.getLocal("btn_disconnectDic"),title:c.getLocal("btn_disconnectDic"),onClick:function(){var b=this.getDialog(),a=d.scayt,g=f,h=b.getContentElement("dictionaries","dictionaryName"),e=h.getValue();a.isLicensed()&&(a.disconnectFromUserDictionary({}),h.setValue(""),g.toggleDictionaryState.call(b,"initialState"),d.fire("scaytUserDictionaryAction",{dialog:b,command:"disconnect",name:e}))}},{type:"button",id:"removeDic",label:c.getLocal("btn_deleteDic"),title:c.getLocal("btn_deleteDic"), +onClick:function(){var b=this.getDialog(),a=d.scayt,g=f,h=b.getContentElement("dictionaries","dictionaryName"),e=h.getValue();a.isLicensed()&&a.removeUserDictionary(e,function(a){h.setValue("");a.error||g.toggleDictionaryState.call(b,"initialState");a.dialog=b;a.command="remove";a.name=e;d.fire("scaytUserDictionaryAction",a)},function(a){a.dialog=b;a.command="remove";a.name=e;d.fire("scaytUserDictionaryActionError",a)})}},{type:"button",id:"renameDic",label:c.getLocal("btn_renameDic"),title:c.getLocal("btn_renameDic"), +onClick:function(){var b=this.getDialog(),a=d.scayt,g=b.getContentElement("dictionaries","dictionaryName").getValue();a.isLicensed()&&a.renameUserDictionary(g,function(a){a.dialog=b;a.command="rename";a.name=g;d.fire("scaytUserDictionaryAction",a)},function(a){a.dialog=b;a.command="rename";a.name=g;d.fire("scaytUserDictionaryActionError",a)})}},{type:"button",id:"editDic",label:c.getLocal("btn_goToDic"),title:c.getLocal("btn_goToDic"),onLoad:function(){this.getDialog()},onClick:function(){var b=this.getDialog(), +a=b.getContentElement("dictionaries","addWordField");f.clearWordList.call(b);a.setValue("");f.getUserDictionary.call(b);f.toggleDictionaryState.call(b,"wordsState")}}]},{type:"hbox",id:"dicInfo",align:"left",children:[{type:"html",id:"dicInfoHtml",html:'\x3cdiv id\x3d"dic_info_editor1" style\x3d"margin:5px auto; width:95%;white-space:normal;"\x3e'+(d.scayt.isLicensed&&d.scayt.isLicensed()?'\x3ca href\x3d"'+c.getOption("CKUserManual")+'" target\x3d"_blank" style\x3d"text-decoration: underline; color: blue; cursor: pointer;"\x3e'+ +c.getLocal("text_descriptionDicForPaid")+"\x3c/a\x3e":c.getLocal("text_descriptionDicForFree"))+"\x3c/div\x3e"}]},{id:"addWordAction",type:"hbox",style:"width: 100%; margin-bottom: 0;",widths:["40%","60%"],children:[{id:"addWord",type:"vbox",style:"min-width: 150px;",children:[{type:"text",id:"addWordField",label:"Add word",maxLength:"64"}]},{id:"addWordButtons",type:"vbox",style:"margin-top: 20px;",children:[{type:"hbox",id:"addWordButton",align:"left",children:[{type:"button",id:"addWord",label:c.getLocal("btn_addWord"), +title:c.getLocal("btn_addWord"),onClick:function(){var b=this.getDialog(),a=d.scayt,g=b.getContentElement("dictionaries","itemList"),h=b.getContentElement("dictionaries","addWordField"),e=h.getValue(),c=a.getOption("wordBoundaryRegex"),f=this;e&&(-1!==e.search(c)?d.fire("scaytUserDictionaryAction",{dialog:b,command:"wordWithBannedSymbols",name:e,error:!0}):g.inChildren(e)?(h.setValue(""),d.fire("scaytUserDictionaryAction",{dialog:b,command:"wordAlreadyAdded",name:e})):(this.disable(),a.addWordToUserDictionary(e, +function(a){a.error||(h.setValue(""),g.addChild(e,!0));a.dialog=b;a.command="addWord";a.name=e;f.enable();d.fire("scaytUserDictionaryAction",a)},function(a){a.dialog=b;a.command="addWord";a.name=e;f.enable();d.fire("scaytUserDictionaryActionError",a)})))}},{type:"button",id:"backToDic",label:c.getLocal("btn_dictionaryPreferences"),title:c.getLocal("btn_dictionaryPreferences"),align:"right",onClick:function(){var b=this.getDialog(),a=d.scayt;null!=a.getUserDictionaryName()&&""!=a.getUserDictionaryName()? +f.toggleDictionaryState.call(b,"dictionaryState"):f.toggleDictionaryState.call(b,"initialState")}}]}]}]},{id:"wordsHolder",type:"hbox",style:"width: 100%; height: 170px; margin-bottom: 0;",children:[{type:"scaytItemList",id:"itemList",align:"left",style:"width: 100%; height: 170px; overflow: auto",onClick:function(b){var a=b.data.$;b=d.scayt;var g=SCAYT.prototype.UILib,a=a.target||a.srcElement,h=g.parent(a)[0],e=g.attr(h,"data-cke-scayt-ud-word"),c=this.getDialog(),f=c.getContentElement("dictionaries", +"itemList"),q=this;g.hasClass(a,"cke_scaytItemList_remove")&&!this.isBlocked()&&(this.block(),b.deleteWordFromUserDictionary(e,function(a){a.error||f.removeChild(h,e);q.unblock();a.dialog=c;a.command="deleteWord";a.name=e;d.fire("scaytUserDictionaryAction",a)},function(a){q.unblock();a.dialog=c;a.command="deleteWord";a.name=e;d.fire("scaytUserDictionaryActionError",a)}))}}]}]}]},{id:"about",label:c.getLocal("tab_about"),elements:[{type:"html",id:"about",style:"margin: 5px 5px;",html:'\x3cdiv\x3e\x3cdiv id\x3d"scayt_about_"\x3e'+ +k+"\x3c/div\x3e\x3c/div\x3e"}]}];d.on("scaytUserDictionaryAction",function(b){var a=SCAYT.prototype.UILib,g=b.data.dialog,d=g.getContentElement("dictionaries","dictionaryNote").getElement(),e=b.editor.scayt,c;void 0===b.data.error?(c=e.getLocal("message_success_"+b.data.command+"Dic"),c=c.replace("%s",b.data.name),d.setText(c),a.css(d.$,{color:"blue"})):(""===b.data.name?d.setText(e.getLocal("message_info_emptyDic")):(c=e.getLocal("message_error_"+b.data.command+"Dic"),c=c.replace("%s",b.data.name), +d.setText(c)),a.css(d.$,{color:"red"}),null!=e.getUserDictionaryName()&&""!=e.getUserDictionaryName()?g.getContentElement("dictionaries","dictionaryName").setValue(e.getUserDictionaryName()):g.getContentElement("dictionaries","dictionaryName").setValue(""))});d.on("scaytUserDictionaryActionError",function(b){var a=SCAYT.prototype.UILib,g=b.data.dialog,d=g.getContentElement("dictionaries","dictionaryNote").getElement(),c=b.editor.scayt,f;""===b.data.name?d.setText(c.getLocal("message_info_emptyDic")): +(f=c.getLocal("message_error_"+b.data.command+"Dic"),f=f.replace("%s",b.data.name),d.setText(f));a.css(d.$,{color:"red"});null!=c.getUserDictionaryName()&&""!=c.getUserDictionaryName()?g.getContentElement("dictionaries","dictionaryName").setValue(c.getUserDictionaryName()):g.getContentElement("dictionaries","dictionaryName").setValue("")});var f={title:"SCAYT",resizable:CKEDITOR.DIALOG_RESIZE_BOTH,minWidth:"moono-lisa"==(CKEDITOR.skinName||d.config.skin)?450:340,minHeight:300,onLoad:function(){if(0!= +d.config.scayt_uiTabs[1]){var b=f,a=b.getLangBoxes.call(this);this.getContentElement("dictionaries","addWordField");a.getParent().setStyle("white-space","normal");b.renderLangList(a);this.definition.minWidth=this.getSize().width;this.resize(this.definition.minWidth,this.definition.minHeight)}},onCancel:function(){l.reset()},onHide:function(){d.unlockSelection()},onShow:function(){d.fire("scaytDialogShown",this);if(0!=d.config.scayt_uiTabs[2]){var b=this.getContentElement("dictionaries","addWordField"); +f.clearWordList.call(this);b.setValue("");f.getUserDictionary.call(this);f.toggleDictionaryState.call(this,"wordsState")}},onOk:function(){var b=f,a=d.scayt;this.getContentElement("options","scaytOptions");b=b.getChangedOption.call(this);a.commitOption({changedOptions:b})},toggleDictionaryButtons:function(b){var a=this.getContentElement("dictionaries","existDic").getElement().getParent(),d=this.getContentElement("dictionaries","notExistDic").getElement().getParent();b?(a.show(),d.hide()):(a.hide(), +d.show())},getChangedOption:function(){var b={};if(1==d.config.scayt_uiTabs[0])for(var a=this.getContentElement("options","scaytOptions").getChild(),c=0;c<a.length;c++)a[c].isChanged()&&(b[a[c].id]=a[c].getValue());l.isChanged()&&(b[l.id]=d.config.scayt_sLang=l.currentLang=l.newLang);return b},buildRadioInputs:function(b,a,c){c=new CKEDITOR.dom.element("div");var h="scaytLang_"+d.name+"_"+a,e=CKEDITOR.dom.element.createFromHtml('\x3cinput id\x3d"'+h+'" type\x3d"radio" value\x3d"'+a+'" name\x3d"scayt_lang" /\x3e'), +f=new CKEDITOR.dom.element("label"),k=d.scayt;c.setStyles({"white-space":"normal",position:"relative","padding-bottom":"2px"});e.on("click",function(a){l.newLang=a.sender.getValue()});f.appendText(b);f.setAttribute("for",h);c.append(e);c.append(f);a===k.getLang()&&(e.setAttribute("checked",!0),e.setAttribute("defaultChecked","defaultChecked"));return c},renderLangList:function(b){var a=d.name.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1"),g=b.find("#left-col-"+a).getItem(0);b=b.find("#right-col-"+a).getItem(0); +var h=c.getScaytLangList(),a=c.getGraytLangList(),e={},f=[],k=0,l=!1,m;for(m in h.ltr)e[m]=h.ltr[m];for(m in h.rtl)e[m]=h.rtl[m];for(m in e)f.push([m,e[m]]);f.sort(function(a,b){var c=0;a[1]>b[1]?c=1:a[1]<b[1]&&(c=-1);return c});e={};for(l=0;l<f.length;l++)e[f[l][0]]=f[l][1];f=Math.round(f.length/2);for(m in e)k++,l=m in a.ltr||m in a.rtl,this.buildRadioInputs(e[m],m,l).appendTo(k<=f?g:b)},getLangBoxes:function(){return this.getContentElement("langs","langBox").getElement()},toggleDictionaryState:function(b){var a= +this.getContentElement("dictionaries","dictionaryName").getElement().getParent(),c=this.getContentElement("dictionaries","udButtonsHolder").getElement().getParent(),d=this.getContentElement("dictionaries","createDic").getElement().getParent(),e=this.getContentElement("dictionaries","restoreDic").getElement().getParent(),f=this.getContentElement("dictionaries","disconnectDic").getElement().getParent(),l=this.getContentElement("dictionaries","removeDic").getElement().getParent(),k=this.getContentElement("dictionaries", +"renameDic").getElement().getParent(),m=this.getContentElement("dictionaries","dicInfo").getElement().getParent(),n=this.getContentElement("dictionaries","addWordAction").getElement().getParent(),p=this.getContentElement("dictionaries","wordsHolder").getElement().getParent();switch(b){case "initialState":a.show();c.show();d.show();e.show();f.hide();l.hide();k.hide();m.show();n.hide();p.hide();break;case "wordsState":a.hide();c.hide();m.hide();n.show();p.show();break;case "dictionaryState":a.show(), +c.show(),d.hide(),e.hide(),f.show(),l.show(),k.show(),m.show(),n.hide(),p.hide()}},clearWordList:function(){this.getContentElement("dictionaries","itemList").removeAllChild()},getUserDictionary:function(){var b=this,a=d.scayt;a.getUserDictionary(a.getUserDictionaryName(),function(a){a.error||f.renderItemList.call(b,a.wordlist)})},renderItemList:function(b){for(var a=this.getContentElement("dictionaries","itemList"),c=0;c<b.length;c++)a.addChild(b[c])},contents:function(b,a){var c=[],d=a.config.scayt_uiTabs; +if(d){for(var e in d)1==d[e]&&c.push(b[e]);c.push(b[b.length-1])}else return b;return c}(k,d)};return f});CKEDITOR.tools.extend(CKEDITOR.ui.dialog,{scaytItemList:function(d,c,k){if(arguments.length){var n=this;d.on("load",function(){n.getElement().on("click",function(c){})});CKEDITOR.ui.dialog.uiElement.call(this,d,c,k,"",null,null,function(){var d=['\x3cp class\x3d"cke_dialog_ui_',c.type,'"'];c.style&&d.push('style\x3d"'+c.style+'" ');d.push("\x3e");d.push("\x3c/p\x3e");return d.join("")})}}}); +CKEDITOR.ui.dialog.scaytItemList.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement,{children:[],blocked:!1,addChild:function(d,c){var k=new CKEDITOR.dom.element("p"),n=new CKEDITOR.dom.element("a"),l=this.getElement().getChildren().getItem(0);this.children.push(d);k.addClass("cke_scaytItemList-child");k.setAttribute("data-cke-scayt-ud-word",d);k.appendText(d);n.addClass("cke_scaytItemList_remove");n.addClass("cke_dialog_close_button");n.setAttribute("href","javascript:void(0)");k.append(n); +l.append(k,c?!0:!1)},inChildren:function(d){return SCAYT.prototype.Utils.inArray(this.children,d)},removeChild:function(d,c){this.children.splice(SCAYT.prototype.Utils.indexOf(this.children,c),1);this.getElement().getChildren().getItem(0).$.removeChild(d)},removeAllChild:function(){this.children=[];this.getElement().getChildren().getItem(0).setHtml("")},block:function(){this.blocked=!0},unblock:function(){this.blocked=!1},isBlocked:function(){return this.blocked}}); +(function(){commonBuilder={build:function(d,c,k){return new CKEDITOR.ui.dialog[c.type](d,c,k)}};CKEDITOR.dialog.addUIElement("scaytItemList",commonBuilder)})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/scayt/dialogs/toolbar.css b/src/static/ckeditor/plugins/scayt/dialogs/toolbar.css new file mode 100644 index 00000000..861f43e3 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/dialogs/toolbar.css @@ -0,0 +1,71 @@ +a +{ + text-decoration:none; + padding: 2px 4px 4px 6px; + display : block; + border-width: 1px; + border-style: solid; + margin : 0px; +} + +a.cke_scayt_toogle:hover, +a.cke_scayt_toogle:focus, +a.cke_scayt_toogle:active +{ + border-color: #316ac5; + background-color: #dff1ff; + color : #000; + cursor: pointer; + margin : 0px; +} +a.cke_scayt_toogle { + color : #316ac5; + border-color: #fff; +} +.scayt_enabled a.cke_scayt_item { + color : #316ac5; + border-color: #fff; + margin : 0px; +} +.scayt_disabled a.cke_scayt_item { + color : gray; + border-color : #fff; +} +.scayt_enabled a.cke_scayt_item:hover, +.scayt_enabled a.cke_scayt_item:focus, +.scayt_enabled a.cke_scayt_item:active +{ + border-color: #316ac5; + background-color: #dff1ff; + color : #000; + cursor: pointer; +} +.scayt_disabled a.cke_scayt_item:hover, +.scayt_disabled a.cke_scayt_item:focus, +.scayt_disabled a.cke_scayt_item:active +{ + border-color: gray; + background-color: #dff1ff; + color : gray; + cursor: no-drop; +} +.cke_scayt_set_on, .cke_scayt_set_off +{ + display: none; +} +.scayt_enabled .cke_scayt_set_on +{ + display: none; +} +.scayt_disabled .cke_scayt_set_on +{ + display: inline; +} +.scayt_disabled .cke_scayt_set_off +{ + display: none; +} +.scayt_enabled .cke_scayt_set_off +{ + display: inline; +} diff --git a/src/static/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css b/src/static/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css new file mode 100644 index 00000000..53f52220 --- /dev/null +++ b/src/static/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css @@ -0,0 +1,25 @@ +.scayt-lang-list > div +{ + padding-bottom: 6px !important; +} + +.scayt-lang-list > div input +{ + margin-right: 4px; +} + +#scayt_about_ +{ + margin: 30px auto 0 auto; +} + +#scayt_about_ p +{ + text-align: center; + margin-bottom: 10px; +} + +.cke_dialog_contents_body div[name=dictionaries] .cke_dialog_ui_hbox_last > a.cke_dialog_ui_button +{ + margin-top: 0; +} diff --git a/src/static/ckeditor/plugins/sharedspace/plugin.js b/src/static/ckeditor/plugins/sharedspace/plugin.js new file mode 100644 index 00000000..ff8b09eb --- /dev/null +++ b/src/static/ckeditor/plugins/sharedspace/plugin.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function f(a,b,c){var e,d;if(c="string"==typeof c?CKEDITOR.document.getById(c):new CKEDITOR.dom.element(c))if(e=a.fire("uiSpace",{space:b,html:""}).html)a.on("uiSpace",function(a){a.data.space==b&&a.cancel()},null,null,1),d=c.append(CKEDITOR.dom.element.createFromHtml(g.output({id:a.id,name:a.name,langDir:a.lang.dir,langCode:a.langCode,space:b,spaceId:a.ui.spaceId(b),content:e}))),c.getCustomData("cke_hasshared")?d.hide():c.setCustomData("cke_hasshared",1),d.unselectable(),d.on("mousedown", +function(a){a=a.data;a.getTarget().hasAscendant("a",1)||a.preventDefault()}),a.focusManager.add(d,1),a.on("focus",function(){for(var a=0,b,e=c.getChildren();b=e.getItem(a);a++)b.type==CKEDITOR.NODE_ELEMENT&&!b.equals(d)&&b.hasClass("cke_shared")&&b.hide();d.show()}),a.on("destroy",function(){d.remove()})}var g=CKEDITOR.addTemplate("sharedcontainer",'\x3cdiv id\x3d"cke_{name}" class\x3d"cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_shared cke_detached cke_{langDir} '+CKEDITOR.env.cssClass+ +'" dir\x3d"{langDir}" title\x3d"'+(CKEDITOR.env.gecko?" ":"")+'" lang\x3d"{langCode}" role\x3d"presentation"\x3e\x3cdiv class\x3d"cke_inner"\x3e\x3cdiv id\x3d"{spaceId}" class\x3d"cke_{space}" role\x3d"presentation"\x3e{content}\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e');CKEDITOR.plugins.add("sharedspace",{init:function(a){a.on("loaded",function(){var b=a.config.sharedSpaces;if(b)for(var c in b)f(a,c,b[c])},null,null,9)}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/showblocks/images/block_address.png b/src/static/ckeditor/plugins/showblocks/images/block_address.png new file mode 100644 index 00000000..5abdae12 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_address.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_blockquote.png b/src/static/ckeditor/plugins/showblocks/images/block_blockquote.png new file mode 100644 index 00000000..a8f49735 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_blockquote.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_div.png b/src/static/ckeditor/plugins/showblocks/images/block_div.png new file mode 100644 index 00000000..87b3c171 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_div.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h1.png b/src/static/ckeditor/plugins/showblocks/images/block_h1.png new file mode 100644 index 00000000..3933325c Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h1.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h2.png b/src/static/ckeditor/plugins/showblocks/images/block_h2.png new file mode 100644 index 00000000..c99894c2 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h2.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h3.png b/src/static/ckeditor/plugins/showblocks/images/block_h3.png new file mode 100644 index 00000000..cb73d679 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h3.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h4.png b/src/static/ckeditor/plugins/showblocks/images/block_h4.png new file mode 100644 index 00000000..7af6bb49 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h4.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h5.png b/src/static/ckeditor/plugins/showblocks/images/block_h5.png new file mode 100644 index 00000000..ce5bec16 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h5.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_h6.png b/src/static/ckeditor/plugins/showblocks/images/block_h6.png new file mode 100644 index 00000000..e67b9829 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_h6.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_p.png b/src/static/ckeditor/plugins/showblocks/images/block_p.png new file mode 100644 index 00000000..63a58202 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_p.png differ diff --git a/src/static/ckeditor/plugins/showblocks/images/block_pre.png b/src/static/ckeditor/plugins/showblocks/images/block_pre.png new file mode 100644 index 00000000..955a8689 Binary files /dev/null and b/src/static/ckeditor/plugins/showblocks/images/block_pre.png differ diff --git a/src/static/ckeditor/plugins/smiley/dialogs/smiley.js b/src/static/ckeditor/plugins/smiley/dialogs/smiley.js new file mode 100644 index 00000000..3048f31c --- /dev/null +++ b/src/static/ckeditor/plugins/smiley/dialogs/smiley.js @@ -0,0 +1,11 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("smiley",function(f){for(var e=f.config,a=f.lang.smiley,h=e.smiley_images,g=e.smiley_columns||8,k,m=function(l){var c=l.data.getTarget(),b=c.getName();if("a"==b)c=c.getChild(0);else if("img"!=b)return;var b=c.getAttribute("cke_src"),a=c.getAttribute("title"),c=f.document.createElement("img",{attributes:{src:b,"data-cke-saved-src":b,title:a,alt:a,width:c.$.width,height:c.$.height}});f.insertElement(c);k.hide();l.data.preventDefault()},q=CKEDITOR.tools.addFunction(function(a,c){a= +new CKEDITOR.dom.event(a);c=new CKEDITOR.dom.element(c);var b;b=a.getKeystroke();var d="rtl"==f.lang.dir;switch(b){case 38:if(b=c.getParent().getParent().getPrevious())b=b.getChild([c.getParent().getIndex(),0]),b.focus();a.preventDefault();break;case 40:(b=c.getParent().getParent().getNext())&&(b=b.getChild([c.getParent().getIndex(),0]))&&b.focus();a.preventDefault();break;case 32:m({data:a});a.preventDefault();break;case d?37:39:if(b=c.getParent().getNext())b=b.getChild(0),b.focus(),a.preventDefault(!0); +else if(b=c.getParent().getParent().getNext())(b=b.getChild([0,0]))&&b.focus(),a.preventDefault(!0);break;case d?39:37:if(b=c.getParent().getPrevious())b=b.getChild(0),b.focus(),a.preventDefault(!0);else if(b=c.getParent().getParent().getPrevious())b=b.getLast().getChild(0),b.focus(),a.preventDefault(!0)}}),d=CKEDITOR.tools.getNextId()+"_smiley_emtions_label",d=['\x3cdiv\x3e\x3cspan id\x3d"'+d+'" class\x3d"cke_voice_label"\x3e'+a.options+"\x3c/span\x3e",'\x3ctable role\x3d"listbox" aria-labelledby\x3d"'+ +d+'" style\x3d"width:100%;height:100%;border-collapse:separate;" cellspacing\x3d"2" cellpadding\x3d"2"',CKEDITOR.env.ie&&CKEDITOR.env.quirks?' style\x3d"position:absolute;"':"","\x3e\x3ctbody\x3e"],n=h.length,a=0;a<n;a++){0===a%g&&d.push('\x3ctr role\x3d"presentation"\x3e');var p="cke_smile_label_"+a+"_"+CKEDITOR.tools.getNextNumber();d.push('\x3ctd class\x3d"cke_dark_background cke_centered" style\x3d"vertical-align: middle;" role\x3d"presentation"\x3e\x3ca href\x3d"javascript:void(0)" role\x3d"option"', +' aria-posinset\x3d"'+(a+1)+'"',' aria-setsize\x3d"'+n+'"',' aria-labelledby\x3d"'+p+'"',' class\x3d"cke_smile cke_hand" tabindex\x3d"-1" onkeydown\x3d"CKEDITOR.tools.callFunction( ',q,', event, this );"\x3e','\x3cimg class\x3d"cke_hand" title\x3d"',e.smiley_descriptions[a],'" cke_src\x3d"',CKEDITOR.tools.htmlEncode(e.smiley_path+h[a]),'" alt\x3d"',e.smiley_descriptions[a],'"',' src\x3d"',CKEDITOR.tools.htmlEncode(e.smiley_path+h[a]),'"',CKEDITOR.env.ie?" onload\x3d\"this.setAttribute('width', 2); this.removeAttribute('width');\" ": +"",'\x3e\x3cspan id\x3d"'+p+'" class\x3d"cke_voice_label"\x3e'+e.smiley_descriptions[a]+"\x3c/span\x3e\x3c/a\x3e","\x3c/td\x3e");a%g==g-1&&d.push("\x3c/tr\x3e")}if(a<g-1){for(;a<g-1;a++)d.push("\x3ctd\x3e\x3c/td\x3e");d.push("\x3c/tr\x3e")}d.push("\x3c/tbody\x3e\x3c/table\x3e\x3c/div\x3e");e={type:"html",id:"smileySelector",html:d.join(""),onLoad:function(a){k=a.sender},focus:function(){var a=this;setTimeout(function(){a.getElement().getElementsByTag("a").getItem(0).focus()},0)},onClick:m,style:"width: 100%; border-collapse: separate;"}; +return{title:f.lang.smiley.title,minWidth:270,minHeight:120,contents:[{id:"tab1",label:"",title:"",expand:!0,padding:0,elements:[e]}],buttons:[CKEDITOR.dialog.cancelButton]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/smiley/images/angel_smile.gif b/src/static/ckeditor/plugins/smiley/images/angel_smile.gif new file mode 100644 index 00000000..21f81a2f Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/angel_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/angel_smile.png b/src/static/ckeditor/plugins/smiley/images/angel_smile.png new file mode 100644 index 00000000..559e5e71 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/angel_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/angry_smile.gif b/src/static/ckeditor/plugins/smiley/images/angry_smile.gif new file mode 100644 index 00000000..c912d99b Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/angry_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/angry_smile.png b/src/static/ckeditor/plugins/smiley/images/angry_smile.png new file mode 100644 index 00000000..c05d2be3 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/angry_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/broken_heart.gif b/src/static/ckeditor/plugins/smiley/images/broken_heart.gif new file mode 100644 index 00000000..4162a7b2 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/broken_heart.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/broken_heart.png b/src/static/ckeditor/plugins/smiley/images/broken_heart.png new file mode 100644 index 00000000..a711c0d8 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/broken_heart.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/confused_smile.gif b/src/static/ckeditor/plugins/smiley/images/confused_smile.gif new file mode 100644 index 00000000..0e420cba Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/confused_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/confused_smile.png b/src/static/ckeditor/plugins/smiley/images/confused_smile.png new file mode 100644 index 00000000..e0b8e5c6 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/confused_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/cry_smile.gif b/src/static/ckeditor/plugins/smiley/images/cry_smile.gif new file mode 100644 index 00000000..b5133427 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/cry_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/cry_smile.png b/src/static/ckeditor/plugins/smiley/images/cry_smile.png new file mode 100644 index 00000000..a1891a34 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/cry_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/devil_smile.gif b/src/static/ckeditor/plugins/smiley/images/devil_smile.gif new file mode 100644 index 00000000..9b2a1005 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/devil_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/devil_smile.png b/src/static/ckeditor/plugins/smiley/images/devil_smile.png new file mode 100644 index 00000000..53247a88 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/devil_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/embaressed_smile.gif b/src/static/ckeditor/plugins/smiley/images/embaressed_smile.gif new file mode 100644 index 00000000..8d39f252 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/embaressed_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.gif b/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.gif new file mode 100644 index 00000000..8d39f252 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.png b/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.png new file mode 100644 index 00000000..34904b66 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/embarrassed_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/envelope.gif b/src/static/ckeditor/plugins/smiley/images/envelope.gif new file mode 100644 index 00000000..5294ec48 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/envelope.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/envelope.png b/src/static/ckeditor/plugins/smiley/images/envelope.png new file mode 100644 index 00000000..44398ad1 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/envelope.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/heart.gif b/src/static/ckeditor/plugins/smiley/images/heart.gif new file mode 100644 index 00000000..160be8ef Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/heart.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/heart.png b/src/static/ckeditor/plugins/smiley/images/heart.png new file mode 100644 index 00000000..df409e62 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/heart.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/kiss.gif b/src/static/ckeditor/plugins/smiley/images/kiss.gif new file mode 100644 index 00000000..ffb23db0 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/kiss.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/kiss.png b/src/static/ckeditor/plugins/smiley/images/kiss.png new file mode 100644 index 00000000..a4f2f363 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/kiss.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/lightbulb.gif b/src/static/ckeditor/plugins/smiley/images/lightbulb.gif new file mode 100644 index 00000000..ceb6e2d9 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/lightbulb.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/lightbulb.png b/src/static/ckeditor/plugins/smiley/images/lightbulb.png new file mode 100644 index 00000000..0c4a9240 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/lightbulb.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/omg_smile.gif b/src/static/ckeditor/plugins/smiley/images/omg_smile.gif new file mode 100644 index 00000000..3177355f Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/omg_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/omg_smile.png b/src/static/ckeditor/plugins/smiley/images/omg_smile.png new file mode 100644 index 00000000..abc4e2d0 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/omg_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/regular_smile.gif b/src/static/ckeditor/plugins/smiley/images/regular_smile.gif new file mode 100644 index 00000000..fdcf5c33 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/regular_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/regular_smile.png b/src/static/ckeditor/plugins/smiley/images/regular_smile.png new file mode 100644 index 00000000..0f2649b7 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/regular_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/sad_smile.gif b/src/static/ckeditor/plugins/smiley/images/sad_smile.gif new file mode 100644 index 00000000..cca0729d Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/sad_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/sad_smile.png b/src/static/ckeditor/plugins/smiley/images/sad_smile.png new file mode 100644 index 00000000..f20f3bf3 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/sad_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/shades_smile.gif b/src/static/ckeditor/plugins/smiley/images/shades_smile.gif new file mode 100644 index 00000000..7d93474c Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/shades_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/shades_smile.png b/src/static/ckeditor/plugins/smiley/images/shades_smile.png new file mode 100644 index 00000000..fdaa28b7 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/shades_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/teeth_smile.gif b/src/static/ckeditor/plugins/smiley/images/teeth_smile.gif new file mode 100644 index 00000000..44c37996 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/teeth_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/teeth_smile.png b/src/static/ckeditor/plugins/smiley/images/teeth_smile.png new file mode 100644 index 00000000..5e63785e Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/teeth_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/thumbs_down.gif b/src/static/ckeditor/plugins/smiley/images/thumbs_down.gif new file mode 100644 index 00000000..5c8bee30 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/thumbs_down.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/thumbs_down.png b/src/static/ckeditor/plugins/smiley/images/thumbs_down.png new file mode 100644 index 00000000..1823481f Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/thumbs_down.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/thumbs_up.gif b/src/static/ckeditor/plugins/smiley/images/thumbs_up.gif new file mode 100644 index 00000000..9cc37029 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/thumbs_up.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/thumbs_up.png b/src/static/ckeditor/plugins/smiley/images/thumbs_up.png new file mode 100644 index 00000000..d4e8b22a Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/thumbs_up.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/tongue_smile.gif b/src/static/ckeditor/plugins/smiley/images/tongue_smile.gif new file mode 100644 index 00000000..81e05b0f Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/tongue_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/tongue_smile.png b/src/static/ckeditor/plugins/smiley/images/tongue_smile.png new file mode 100644 index 00000000..56553fbe Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/tongue_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/tounge_smile.gif b/src/static/ckeditor/plugins/smiley/images/tounge_smile.gif new file mode 100644 index 00000000..81e05b0f Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/tounge_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif b/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif new file mode 100644 index 00000000..eef4fc00 Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png b/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png new file mode 100644 index 00000000..f9714d1b Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png differ diff --git a/src/static/ckeditor/plugins/smiley/images/wink_smile.gif b/src/static/ckeditor/plugins/smiley/images/wink_smile.gif new file mode 100644 index 00000000..6d3d64bd Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/wink_smile.gif differ diff --git a/src/static/ckeditor/plugins/smiley/images/wink_smile.png b/src/static/ckeditor/plugins/smiley/images/wink_smile.png new file mode 100644 index 00000000..7c99c3fc Binary files /dev/null and b/src/static/ckeditor/plugins/smiley/images/wink_smile.png differ diff --git a/src/static/ckeditor/plugins/sourcedialog/dialogs/sourcedialog.js b/src/static/ckeditor/plugins/sourcedialog/dialogs/sourcedialog.js new file mode 100644 index 00000000..3fd47085 --- /dev/null +++ b/src/static/ckeditor/plugins/sourcedialog/dialogs/sourcedialog.js @@ -0,0 +1,6 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("sourcedialog",function(a){var b=CKEDITOR.document.getWindow().getViewPaneSize(),e=Math.min(b.width-70,800),b=b.height/1.5,d;return{title:a.lang.sourcedialog.title,minWidth:100,minHeight:100,onShow:function(){this.setValueOf("main","data",d=a.getData())},onOk:function(){function b(f,c){a.focus();a.setData(c,function(){f.hide();var b=a.createRange();b.moveToElementEditStart(a.editable());b.select()})}return function(){var a=this.getValueOf("main","data").replace(/\r/g,""),c=this; +if(a===d)return!0;setTimeout(function(){b(c,a)});return!1}}(),contents:[{id:"main",label:a.lang.sourcedialog.title,elements:[{type:"textarea",id:"data",dir:"ltr",inputStyle:"cursor:auto;width:"+e+"px;height:"+b+"px;tab-size:4;text-align:left;","class":"cke_source"}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog-rtl.png b/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog-rtl.png new file mode 100644 index 00000000..c95da32d Binary files /dev/null and b/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog-rtl.png differ diff --git a/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog.png b/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog.png new file mode 100644 index 00000000..2f3eae1a Binary files /dev/null and b/src/static/ckeditor/plugins/sourcedialog/icons/hidpi/sourcedialog.png differ diff --git a/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog-rtl.png b/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog-rtl.png new file mode 100644 index 00000000..5353eee7 Binary files /dev/null and b/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog-rtl.png differ diff --git a/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog.png b/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog.png new file mode 100644 index 00000000..0783e85c Binary files /dev/null and b/src/static/ckeditor/plugins/sourcedialog/icons/sourcedialog.png differ diff --git a/src/static/ckeditor/plugins/sourcedialog/lang/zh-cn.js b/src/static/ckeditor/plugins/sourcedialog/lang/zh-cn.js new file mode 100644 index 00000000..fc5bb0d8 --- /dev/null +++ b/src/static/ckeditor/plugins/sourcedialog/lang/zh-cn.js @@ -0,0 +1 @@ +CKEDITOR.plugins.setLang("sourcedialog","zh-cn",{toolbar:"源码",title:"源码"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/sourcedialog/plugin.js b/src/static/ckeditor/plugins/sourcedialog/plugin.js new file mode 100644 index 00000000..0e5efbb5 --- /dev/null +++ b/src/static/ckeditor/plugins/sourcedialog/plugin.js @@ -0,0 +1,6 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("sourcedialog",{lang:"af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",requires:"dialog",icons:"sourcedialog,sourcedialog-rtl",hidpi:!0,init:function(a){a.addCommand("sourcedialog",new CKEDITOR.dialogCommand("sourcedialog"));CKEDITOR.dialog.add("sourcedialog",this.path+"dialogs/sourcedialog.js"); +a.ui.addButton&&a.ui.addButton("Sourcedialog",{label:a.lang.sourcedialog.toolbar,command:"sourcedialog",toolbar:"mode,10"})}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-au.js b/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-au.js deleted file mode 100644 index 2c03bce6..00000000 --- a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-au.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license -*/ -CKEDITOR.plugins.setLang("specialchar","en-au",{euro:"Euro sign",lsquo:"Left single quotation mark",rsquo:"Right single quotation mark",ldquo:"Left double quotation mark",rdquo:"Right double quotation mark",ndash:"En dash",mdash:"Em dash",iexcl:"Inverted exclamation mark",cent:"Cent sign",pound:"Pound sign",curren:"Currency sign",yen:"Yen sign",brvbar:"Broken bar",sect:"Section sign",uml:"Diaeresis",copy:"Copyright sign",ordf:"Feminine ordinal indicator",laquo:"Left-pointing double angle quotation mark", -not:"Not sign",reg:"Registered sign",macr:"Macron",deg:"Degree sign",sup2:"Superscript two",sup3:"Superscript three",acute:"Acute accent",micro:"Micro sign",para:"Pilcrow sign",middot:"Middle dot",cedil:"Cedilla",sup1:"Superscript one",ordm:"Masculine ordinal indicator",raquo:"Right-pointing double angle quotation mark",frac14:"Vulgar fraction one quarter",frac12:"Vulgar fraction one half",frac34:"Vulgar fraction three quarters",iquest:"Inverted question mark",Agrave:"Latin capital letter A with grave accent", -Aacute:"Latin capital letter A with acute accent",Acirc:"Latin capital letter A with circumflex",Atilde:"Latin capital letter A with tilde",Auml:"Latin capital letter A with diaeresis",Aring:"Latin capital letter A with ring above",AElig:"Latin capital letter Æ",Ccedil:"Latin capital letter C with cedilla",Egrave:"Latin capital letter E with grave accent",Eacute:"Latin capital letter E with acute accent",Ecirc:"Latin capital letter E with circumflex",Euml:"Latin capital letter E with diaeresis",Igrave:"Latin capital letter I with grave accent", -Iacute:"Latin capital letter I with acute accent",Icirc:"Latin capital letter I with circumflex",Iuml:"Latin capital letter I with diaeresis",ETH:"Latin capital letter Eth",Ntilde:"Latin capital letter N with tilde",Ograve:"Latin capital letter O with grave accent",Oacute:"Latin capital letter O with acute accent",Ocirc:"Latin capital letter O with circumflex",Otilde:"Latin capital letter O with tilde",Ouml:"Latin capital letter O with diaeresis",times:"Multiplication sign",Oslash:"Latin capital letter O with stroke", -Ugrave:"Latin capital letter U with grave accent",Uacute:"Latin capital letter U with acute accent",Ucirc:"Latin capital letter U with circumflex",Uuml:"Latin capital letter U with diaeresis",Yacute:"Latin capital letter Y with acute accent",THORN:"Latin capital letter Thorn",szlig:"Latin small letter sharp s",agrave:"Latin small letter a with grave accent",aacute:"Latin small letter a with acute accent",acirc:"Latin small letter a with circumflex",atilde:"Latin small letter a with tilde",auml:"Latin small letter a with diaeresis", -aring:"Latin small letter a with ring above",aelig:"Latin small letter æ",ccedil:"Latin small letter c with cedilla",egrave:"Latin small letter e with grave accent",eacute:"Latin small letter e with acute accent",ecirc:"Latin small letter e with circumflex",euml:"Latin small letter e with diaeresis",igrave:"Latin small letter i with grave accent",iacute:"Latin small letter i with acute accent",icirc:"Latin small letter i with circumflex",iuml:"Latin small letter i with diaeresis",eth:"Latin small letter eth", -ntilde:"Latin small letter n with tilde",ograve:"Latin small letter o with grave accent",oacute:"Latin small letter o with acute accent",ocirc:"Latin small letter o with circumflex",otilde:"Latin small letter o with tilde",ouml:"Latin small letter o with diaeresis",divide:"Division sign",oslash:"Latin small letter o with stroke",ugrave:"Latin small letter u with grave accent",uacute:"Latin small letter u with acute accent",ucirc:"Latin small letter u with circumflex",uuml:"Latin small letter u with diaeresis", -yacute:"Latin small letter y with acute accent",thorn:"Latin small letter thorn",yuml:"Latin small letter y with diaeresis",OElig:"Latin capital ligature OE",oelig:"Latin small ligature oe",372:"Latin capital letter W with circumflex",374:"Latin capital letter Y with circumflex",373:"Latin small letter w with circumflex",375:"Latin small letter y with circumflex",sbquo:"Single low-9 quotation mark",8219:"Single high-reversed-9 quotation mark",bdquo:"Double low-9 quotation mark",hellip:"Horizontal ellipsis", -trade:"Trade mark sign",9658:"Black right-pointing pointer",bull:"Bullet",rarr:"Rightwards arrow",rArr:"Rightwards double arrow",hArr:"Left right double arrow",diams:"Black diamond suit",asymp:"Almost equal to"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js b/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js deleted file mode 100644 index ca807e43..00000000 --- a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license -*/ -CKEDITOR.plugins.setLang("specialchar","en-ca",{euro:"Euro sign",lsquo:"Left single quotation mark",rsquo:"Right single quotation mark",ldquo:"Left double quotation mark",rdquo:"Right double quotation mark",ndash:"En dash",mdash:"Em dash",iexcl:"Inverted exclamation mark",cent:"Cent sign",pound:"Pound sign",curren:"Currency sign",yen:"Yen sign",brvbar:"Broken bar",sect:"Section sign",uml:"Diaeresis",copy:"Copyright sign",ordf:"Feminine ordinal indicator",laquo:"Left-pointing double angle quotation mark", -not:"Not sign",reg:"Registered sign",macr:"Macron",deg:"Degree sign",sup2:"Superscript two",sup3:"Superscript three",acute:"Acute accent",micro:"Micro sign",para:"Pilcrow sign",middot:"Middle dot",cedil:"Cedilla",sup1:"Superscript one",ordm:"Masculine ordinal indicator",raquo:"Right-pointing double angle quotation mark",frac14:"Vulgar fraction one quarter",frac12:"Vulgar fraction one half",frac34:"Vulgar fraction three quarters",iquest:"Inverted question mark",Agrave:"Latin capital letter A with grave accent", -Aacute:"Latin capital letter A with acute accent",Acirc:"Latin capital letter A with circumflex",Atilde:"Latin capital letter A with tilde",Auml:"Latin capital letter A with diaeresis",Aring:"Latin capital letter A with ring above",AElig:"Latin capital letter Æ",Ccedil:"Latin capital letter C with cedilla",Egrave:"Latin capital letter E with grave accent",Eacute:"Latin capital letter E with acute accent",Ecirc:"Latin capital letter E with circumflex",Euml:"Latin capital letter E with diaeresis",Igrave:"Latin capital letter I with grave accent", -Iacute:"Latin capital letter I with acute accent",Icirc:"Latin capital letter I with circumflex",Iuml:"Latin capital letter I with diaeresis",ETH:"Latin capital letter Eth",Ntilde:"Latin capital letter N with tilde",Ograve:"Latin capital letter O with grave accent",Oacute:"Latin capital letter O with acute accent",Ocirc:"Latin capital letter O with circumflex",Otilde:"Latin capital letter O with tilde",Ouml:"Latin capital letter O with diaeresis",times:"Multiplication sign",Oslash:"Latin capital letter O with stroke", -Ugrave:"Latin capital letter U with grave accent",Uacute:"Latin capital letter U with acute accent",Ucirc:"Latin capital letter U with circumflex",Uuml:"Latin capital letter U with diaeresis",Yacute:"Latin capital letter Y with acute accent",THORN:"Latin capital letter Thorn",szlig:"Latin small letter sharp s",agrave:"Latin small letter a with grave accent",aacute:"Latin small letter a with acute accent",acirc:"Latin small letter a with circumflex",atilde:"Latin small letter a with tilde",auml:"Latin small letter a with diaeresis", -aring:"Latin small letter a with ring above",aelig:"Latin small letter æ",ccedil:"Latin small letter c with cedilla",egrave:"Latin small letter e with grave accent",eacute:"Latin small letter e with acute accent",ecirc:"Latin small letter e with circumflex",euml:"Latin small letter e with diaeresis",igrave:"Latin small letter i with grave accent",iacute:"Latin small letter i with acute accent",icirc:"Latin small letter i with circumflex",iuml:"Latin small letter i with diaeresis",eth:"Latin small letter eth", -ntilde:"Latin small letter n with tilde",ograve:"Latin small letter o with grave accent",oacute:"Latin small letter o with acute accent",ocirc:"Latin small letter o with circumflex",otilde:"Latin small letter o with tilde",ouml:"Latin small letter o with diaeresis",divide:"Division sign",oslash:"Latin small letter o with stroke",ugrave:"Latin small letter u with grave accent",uacute:"Latin small letter u with acute accent",ucirc:"Latin small letter u with circumflex",uuml:"Latin small letter u with diaeresis", -yacute:"Latin small letter y with acute accent",thorn:"Latin small letter thorn",yuml:"Latin small letter y with diaeresis",OElig:"Latin capital ligature OE",oelig:"Latin small ligature oe",372:"Latin capital letter W with circumflex",374:"Latin capital letter Y with circumflex",373:"Latin small letter w with circumflex",375:"Latin small letter y with circumflex",sbquo:"Single low-9 quotation mark",8219:"Single high-reversed-9 quotation mark",bdquo:"Double low-9 quotation mark",hellip:"Horizontal ellipsis", -trade:"Trade mark sign",9658:"Black right-pointing pointer",bull:"Bullet",rarr:"Rightwards arrow",rArr:"Rightwards double arrow",hArr:"Left right double arrow",diams:"Black diamond suit",asymp:"Almost equal to"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js b/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js deleted file mode 100644 index e6b649ff..00000000 --- a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license -*/ -CKEDITOR.plugins.setLang("specialchar","en-gb",{euro:"Euro sign",lsquo:"Left single quotation mark",rsquo:"Right single quotation mark",ldquo:"Left double quotation mark",rdquo:"Right double quotation mark",ndash:"En dash",mdash:"Em dash",iexcl:"Inverted exclamation mark",cent:"Cent sign",pound:"Pound sign",curren:"Currency sign",yen:"Yen sign",brvbar:"Broken bar",sect:"Section sign",uml:"Diaeresis",copy:"Copyright sign",ordf:"Feminine ordinal indicator",laquo:"Left-pointing double angle quotation mark", -not:"Not sign",reg:"Registered sign",macr:"Macron",deg:"Degree sign",sup2:"Superscript two",sup3:"Superscript three",acute:"Acute accent",micro:"Micro sign",para:"Pilcrow sign",middot:"Middle dot",cedil:"Cedilla",sup1:"Superscript one",ordm:"Masculine ordinal indicator",raquo:"Right-pointing double angle quotation mark",frac14:"Vulgar fraction one quarter",frac12:"Vulgar fraction one half",frac34:"Vulgar fraction three quarters",iquest:"Inverted question mark",Agrave:"Latin capital letter A with grave accent", -Aacute:"Latin capital letter A with acute accent",Acirc:"Latin capital letter A with circumflex",Atilde:"Latin capital letter A with tilde",Auml:"Latin capital letter A with diaeresis",Aring:"Latin capital letter A with ring above",AElig:"Latin capital letter Æ",Ccedil:"Latin capital letter C with cedilla",Egrave:"Latin capital letter E with grave accent",Eacute:"Latin capital letter E with acute accent",Ecirc:"Latin capital letter E with circumflex",Euml:"Latin capital letter E with diaeresis",Igrave:"Latin capital letter I with grave accent", -Iacute:"Latin capital letter I with acute accent",Icirc:"Latin capital letter I with circumflex",Iuml:"Latin capital letter I with diaeresis",ETH:"Latin capital letter Eth",Ntilde:"Latin capital letter N with tilde",Ograve:"Latin capital letter O with grave accent",Oacute:"Latin capital letter O with acute accent",Ocirc:"Latin capital letter O with circumflex",Otilde:"Latin capital letter O with tilde",Ouml:"Latin capital letter O with diaeresis",times:"Multiplication sign",Oslash:"Latin capital letter O with stroke", -Ugrave:"Latin capital letter U with grave accent",Uacute:"Latin capital letter U with acute accent",Ucirc:"Latin capital letter U with circumflex",Uuml:"Latin capital letter U with diaeresis",Yacute:"Latin capital letter Y with acute accent",THORN:"Latin capital letter Thorn",szlig:"Latin small letter sharp s",agrave:"Latin small letter a with grave accent",aacute:"Latin small letter a with acute accent",acirc:"Latin small letter a with circumflex",atilde:"Latin small letter a with tilde",auml:"Latin small letter a with diaeresis", -aring:"Latin small letter a with ring above",aelig:"Latin small letter æ",ccedil:"Latin small letter c with cedilla",egrave:"Latin small letter e with grave accent",eacute:"Latin small letter e with acute accent",ecirc:"Latin small letter e with circumflex",euml:"Latin small letter e with diaeresis",igrave:"Latin small letter i with grave accent",iacute:"Latin small letter i with acute accent",icirc:"Latin small letter i with circumflex",iuml:"Latin small letter i with diaeresis",eth:"Latin small letter eth", -ntilde:"Latin small letter n with tilde",ograve:"Latin small letter o with grave accent",oacute:"Latin small letter o with acute accent",ocirc:"Latin small letter o with circumflex",otilde:"Latin small letter o with tilde",ouml:"Latin small letter o with diaeresis",divide:"Division sign",oslash:"Latin small letter o with stroke",ugrave:"Latin small letter u with grave accent",uacute:"Latin small letter u with acute accent",ucirc:"Latin small letter u with circumflex",uuml:"Latin small letter u with diaeresis", -yacute:"Latin small letter y with acute accent",thorn:"Latin small letter thorn",yuml:"Latin small letter y with diaeresis",OElig:"Latin capital ligature OE",oelig:"Latin small ligature oe",372:"Latin capital letter W with circumflex",374:"Latin capital letter Y with circumflex",373:"Latin small letter w with circumflex",375:"Latin small letter y with circumflex",sbquo:"Single low-9 quotation mark",8219:"Single high-reversed-9 quotation mark",bdquo:"Double low-9 quotation mark",hellip:"Horizontal ellipsis", -trade:"Trade mark sign",9658:"Black right-pointing pointer",bull:"Bullet",rarr:"Rightwards arrow",rArr:"Rightwards double arrow",hArr:"Left right double arrow",diams:"Black diamond suit",asymp:"Almost equal to"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en.js b/src/static/ckeditor/plugins/specialchar/dialogs/lang/en.js deleted file mode 100644 index b5d78fd4..00000000 --- a/src/static/ckeditor/plugins/specialchar/dialogs/lang/en.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license -*/ -CKEDITOR.plugins.setLang("specialchar","en",{euro:"Euro sign",lsquo:"Left single quotation mark",rsquo:"Right single quotation mark",ldquo:"Left double quotation mark",rdquo:"Right double quotation mark",ndash:"En dash",mdash:"Em dash",iexcl:"Inverted exclamation mark",cent:"Cent sign",pound:"Pound sign",curren:"Currency sign",yen:"Yen sign",brvbar:"Broken bar",sect:"Section sign",uml:"Diaeresis",copy:"Copyright sign",ordf:"Feminine ordinal indicator",laquo:"Left-pointing double angle quotation mark", -not:"Not sign",reg:"Registered sign",macr:"Macron",deg:"Degree sign",sup2:"Superscript two",sup3:"Superscript three",acute:"Acute accent",micro:"Micro sign",para:"Pilcrow sign",middot:"Middle dot",cedil:"Cedilla",sup1:"Superscript one",ordm:"Masculine ordinal indicator",raquo:"Right-pointing double angle quotation mark",frac14:"Vulgar fraction one quarter",frac12:"Vulgar fraction one half",frac34:"Vulgar fraction three quarters",iquest:"Inverted question mark",Agrave:"Latin capital letter A with grave accent", -Aacute:"Latin capital letter A with acute accent",Acirc:"Latin capital letter A with circumflex",Atilde:"Latin capital letter A with tilde",Auml:"Latin capital letter A with diaeresis",Aring:"Latin capital letter A with ring above",AElig:"Latin capital letter Æ",Ccedil:"Latin capital letter C with cedilla",Egrave:"Latin capital letter E with grave accent",Eacute:"Latin capital letter E with acute accent",Ecirc:"Latin capital letter E with circumflex",Euml:"Latin capital letter E with diaeresis",Igrave:"Latin capital letter I with grave accent", -Iacute:"Latin capital letter I with acute accent",Icirc:"Latin capital letter I with circumflex",Iuml:"Latin capital letter I with diaeresis",ETH:"Latin capital letter Eth",Ntilde:"Latin capital letter N with tilde",Ograve:"Latin capital letter O with grave accent",Oacute:"Latin capital letter O with acute accent",Ocirc:"Latin capital letter O with circumflex",Otilde:"Latin capital letter O with tilde",Ouml:"Latin capital letter O with diaeresis",times:"Multiplication sign",Oslash:"Latin capital letter O with stroke", -Ugrave:"Latin capital letter U with grave accent",Uacute:"Latin capital letter U with acute accent",Ucirc:"Latin capital letter U with circumflex",Uuml:"Latin capital letter U with diaeresis",Yacute:"Latin capital letter Y with acute accent",THORN:"Latin capital letter Thorn",szlig:"Latin small letter sharp s",agrave:"Latin small letter a with grave accent",aacute:"Latin small letter a with acute accent",acirc:"Latin small letter a with circumflex",atilde:"Latin small letter a with tilde",auml:"Latin small letter a with diaeresis", -aring:"Latin small letter a with ring above",aelig:"Latin small letter æ",ccedil:"Latin small letter c with cedilla",egrave:"Latin small letter e with grave accent",eacute:"Latin small letter e with acute accent",ecirc:"Latin small letter e with circumflex",euml:"Latin small letter e with diaeresis",igrave:"Latin small letter i with grave accent",iacute:"Latin small letter i with acute accent",icirc:"Latin small letter i with circumflex",iuml:"Latin small letter i with diaeresis",eth:"Latin small letter eth", -ntilde:"Latin small letter n with tilde",ograve:"Latin small letter o with grave accent",oacute:"Latin small letter o with acute accent",ocirc:"Latin small letter o with circumflex",otilde:"Latin small letter o with tilde",ouml:"Latin small letter o with diaeresis",divide:"Division sign",oslash:"Latin small letter o with stroke",ugrave:"Latin small letter u with grave accent",uacute:"Latin small letter u with acute accent",ucirc:"Latin small letter u with circumflex",uuml:"Latin small letter u with diaeresis", -yacute:"Latin small letter y with acute accent",thorn:"Latin small letter thorn",yuml:"Latin small letter y with diaeresis",OElig:"Latin capital ligature OE",oelig:"Latin small ligature oe",372:"Latin capital letter W with circumflex",374:"Latin capital letter Y with circumflex",373:"Latin small letter w with circumflex",375:"Latin small letter y with circumflex",sbquo:"Single low-9 quotation mark",8219:"Single high-reversed-9 quotation mark",bdquo:"Double low-9 quotation mark",hellip:"Horizontal ellipsis", -trade:"Trade mark sign",9658:"Black right-pointing pointer",bull:"Bullet",rarr:"Rightwards arrow",rArr:"Rightwards double arrow",hArr:"Left right double arrow",diams:"Black diamond suit",asymp:"Almost equal to"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/specialchar/dialogs/lang/zh.js b/src/static/ckeditor/plugins/specialchar/dialogs/lang/zh.js deleted file mode 100644 index fbcdb362..00000000 --- a/src/static/ckeditor/plugins/specialchar/dialogs/lang/zh.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. - For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license -*/ -CKEDITOR.plugins.setLang("specialchar","zh",{euro:"歐元符號",lsquo:"左單引號",rsquo:"右單引號",ldquo:"左雙引號",rdquo:"右雙引號",ndash:"短破折號",mdash:"長破折號",iexcl:"倒置的驚嘆號",cent:"美分符號",pound:"英鎊符號",curren:"貨幣符號",yen:"日圓符號",brvbar:"破折號",sect:"章節符號",uml:"分音符號",copy:"版權符號",ordf:"雌性符號",laquo:"左雙角括號",not:"Not 符號",reg:"註冊商標符號",macr:"長音符號",deg:"度數符號",sup2:"上標字 2",sup3:"上標字 3",acute:"尖音符號",micro:"微",para:"段落符號",middot:"中間點",cedil:"字母 C 下面的尾型符號 ",sup1:"上標",ordm:"雄性符號",raquo:"右雙角括號",frac14:"四分之一符號",frac12:"二分之一符號",frac34:"四分之三符號", -iquest:"倒置的問號",Agrave:"拉丁大寫字母 A 帶抑音符號",Aacute:"拉丁大寫字母 A 帶尖音符號",Acirc:"拉丁大寫字母 A 帶揚抑符",Atilde:"拉丁大寫字母 A 帶波浪號",Auml:"拉丁大寫字母 A 帶分音符號",Aring:"拉丁大寫字母 A 帶上圓圈",AElig:"拉丁大寫字母 Æ",Ccedil:"拉丁大寫字母 C 帶下尾符號",Egrave:"拉丁大寫字母 E 帶抑音符號",Eacute:"拉丁大寫字母 E 帶尖音符號",Ecirc:"拉丁大寫字母 E 帶揚抑符",Euml:"拉丁大寫字母 E 帶分音符號",Igrave:"拉丁大寫字母 I 帶抑音符號",Iacute:"拉丁大寫字母 I 帶尖音符號",Icirc:"拉丁大寫字母 I 帶揚抑符",Iuml:"拉丁大寫字母 I 帶分音符號",ETH:"拉丁大寫字母 Eth",Ntilde:"拉丁大寫字母 N 帶波浪號",Ograve:"拉丁大寫字母 O 帶抑音符號",Oacute:"拉丁大寫字母 O 帶尖音符號",Ocirc:"拉丁大寫字母 O 帶揚抑符",Otilde:"拉丁大寫字母 O 帶波浪號", -Ouml:"拉丁大寫字母 O 帶分音符號",times:"乘號",Oslash:"拉丁大寫字母 O 帶粗線符號",Ugrave:"拉丁大寫字母 U 帶抑音符號",Uacute:"拉丁大寫字母 U 帶尖音符號",Ucirc:"拉丁大寫字母 U 帶揚抑符",Uuml:"拉丁大寫字母 U 帶分音符號",Yacute:"拉丁大寫字母 Y 帶尖音符號",THORN:"拉丁大寫字母 Thorn",szlig:"拉丁小寫字母 s",agrave:"拉丁小寫字母 a 帶抑音符號",aacute:"拉丁小寫字母 a 帶尖音符號",acirc:"拉丁小寫字母 a 帶揚抑符",atilde:"拉丁小寫字母 a 帶波浪號",auml:"拉丁小寫字母 a 帶分音符號",aring:"拉丁小寫字母 a 帶上圓圈",aelig:"拉丁小寫字母 æ",ccedil:"拉丁小寫字母 c 帶下尾符號",egrave:"拉丁小寫字母 e 帶抑音符號",eacute:"拉丁小寫字母 e 帶尖音符號",ecirc:"拉丁小寫字母 e 帶揚抑符",euml:"拉丁小寫字母 e 帶分音符號",igrave:"拉丁小寫字母 i 帶抑音符號", -iacute:"拉丁小寫字母 i 帶尖音符號",icirc:"拉丁小寫字母 i 帶揚抑符",iuml:"拉丁小寫字母 i 帶分音符號",eth:"拉丁小寫字母 eth",ntilde:"拉丁小寫字母 n 帶波浪號",ograve:"拉丁小寫字母 o 帶抑音符號",oacute:"拉丁小寫字母 o 帶尖音符號",ocirc:"拉丁小寫字母 o 帶揚抑符",otilde:"拉丁小寫字母 o 帶波浪號",ouml:"拉丁小寫字母 o 帶分音符號",divide:"除號",oslash:"拉丁小寫字母 o 帶粗線符號",ugrave:"拉丁小寫字母 u 帶抑音符號",uacute:"拉丁小寫字母 u 帶尖音符號",ucirc:"拉丁小寫字母 u 帶揚抑符",uuml:"拉丁小寫字母 u 帶分音符號",yacute:"拉丁小寫字母 y 帶尖音符號",thorn:"拉丁小寫字母 thorn",yuml:"拉丁小寫字母 y 帶分音符號",OElig:"拉丁大寫字母 OE",oelig:"拉丁小寫字母 oe",372:"拉丁大寫字母 W 帶揚抑符",374:"拉丁大寫字母 Y 帶揚抑符",373:"拉丁小寫字母 w 帶揚抑符", -375:"拉丁小寫字母 y 帶揚抑符",sbquo:"低 9 單引號",8219:"高 9 反轉單引號",bdquo:"低 9 雙引號",hellip:"水平刪節號",trade:"商標符號",9658:"黑色向右指箭號",bull:"項目符號",rarr:"向右箭號",rArr:"向右雙箭號",hArr:"左右雙箭號",diams:"黑鑽套裝",asymp:"約等於"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/stylesheetparser/plugin.js b/src/static/ckeditor/plugins/stylesheetparser/plugin.js new file mode 100644 index 00000000..1122a9f1 --- /dev/null +++ b/src/static/ckeditor/plugins/stylesheetparser/plugin.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){function h(b,e,c){var k=[],g=[],a;for(a=0;a<b.styleSheets.length;a++){var d=b.styleSheets[a];if(!((d.ownerNode||d.owningElement).getAttribute("data-cke-temp")||d.href&&"chrome://"==d.href.substr(0,9)))try{for(var f=d.cssRules||d.rules,d=0;d<f.length;d++)g.push(f[d].selectorText)}catch(h){}}a=g.join(" ");a=a.replace(/(,|>|\+|~)/g," ");a=a.replace(/\[[^\]]*/g,"");a=a.replace(/#[^\s]*/g,"");a=a.replace(/\:{1,2}[^\s]*/g,"");a=a.replace(/\s+/g," ");a=a.split(" ");b=[];for(g=0;g<a.length;g++)f= +a[g],c.test(f)&&!e.test(f)&&-1==CKEDITOR.tools.indexOf(b,f)&&b.push(f);for(a=0;a<b.length;a++)c=b[a].split("."),e=c[0].toLowerCase(),c=c[1],k.push({name:e+"."+c,element:e,attributes:{"class":c}});return k}CKEDITOR.plugins.add("stylesheetparser",{init:function(b){b.filter.disable();var e;b.once("stylesSet",function(c){c.cancel();b.once("contentDom",function(){b.getStylesSet(function(c){e=c.concat(h(b.document.$,b.config.stylesheetParser_skipSelectors||/(^body\.|^\.)/i,b.config.stylesheetParser_validSelectors|| +/\w+\.\w+/));b.getStylesSet=function(b){if(e)return b(e)};b.fire("stylesSet",{styles:e})})})},null,null,1)}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/templates/dialogs/templates.css b/src/static/ckeditor/plugins/templates/dialogs/templates.css new file mode 100644 index 00000000..2a442da4 --- /dev/null +++ b/src/static/ckeditor/plugins/templates/dialogs/templates.css @@ -0,0 +1,84 @@ +/* +Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ + +.cke_tpl_list +{ + border: #dcdcdc 2px solid; + background-color: #ffffff; + overflow-y: auto; + overflow-x: hidden; + width: 100%; + height: 220px; +} + +.cke_tpl_item +{ + margin: 5px; + padding: 7px; + border: #eeeeee 1px solid; + *width: 88%; +} + +.cke_tpl_preview +{ + border-collapse: separate; + text-indent:0; + width: 100%; +} +.cke_tpl_preview td +{ + padding: 2px; + vertical-align: middle; +} +.cke_tpl_preview .cke_tpl_preview_img +{ + width: 100px; +} +.cke_tpl_preview span +{ + white-space: normal; +} + +.cke_tpl_title +{ + font-weight: bold; +} + +.cke_tpl_list a:hover .cke_tpl_item, +.cke_tpl_list a:focus .cke_tpl_item, +.cke_tpl_list a:active .cke_tpl_item +{ + border: #ff9933 1px solid; + background-color: #fffacd; +} + +.cke_tpl_list a:hover *, +.cke_tpl_list a:focus *, +.cke_tpl_list a:active * +{ + cursor: pointer; +} + +/* IE Quirks contextual selectors children will not get :hover transition until + the hover style of the link itself contains certain CSS declarations. */ +.cke_browser_quirks .cke_tpl_list a:active, +.cke_browser_quirks .cke_tpl_list a:hover, +.cke_browser_quirks .cke_tpl_list a:focus +{ + background-position: 0 0; +} + +.cke_hc .cke_tpl_list a:hover .cke_tpl_item, +.cke_hc .cke_tpl_list a:focus .cke_tpl_item, +.cke_hc .cke_tpl_list a:active .cke_tpl_item +{ + border-width: 3px; +} + +.cke_tpl_empty, .cke_tpl_loading +{ + text-align: center; + padding: 5px; +} diff --git a/src/static/ckeditor/plugins/templates/dialogs/templates.js b/src/static/ckeditor/plugins/templates/dialogs/templates.js new file mode 100644 index 00000000..d778e7eb --- /dev/null +++ b/src/static/ckeditor/plugins/templates/dialogs/templates.js @@ -0,0 +1,11 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +(function(){CKEDITOR.dialog.add("templates",function(c){function r(a,b){var n=CKEDITOR.dom.element.createFromHtml('\x3ca href\x3d"javascript:void(0)" tabIndex\x3d"-1" role\x3d"option" \x3e\x3cdiv class\x3d"cke_tpl_item"\x3e\x3c/div\x3e\x3c/a\x3e'),d='\x3ctable style\x3d"width:350px;" class\x3d"cke_tpl_preview" role\x3d"presentation"\x3e\x3ctr\x3e';a.image&&b&&(d+='\x3ctd class\x3d"cke_tpl_preview_img"\x3e\x3cimg src\x3d"'+CKEDITOR.getUrl(b+a.image)+'"'+(CKEDITOR.env.ie6Compat?' onload\x3d"this.width\x3dthis.width"': +"")+' alt\x3d"" title\x3d""\x3e\x3c/td\x3e');d+='\x3ctd style\x3d"white-space:normal;"\x3e\x3cspan class\x3d"cke_tpl_title"\x3e'+a.title+"\x3c/span\x3e\x3cbr/\x3e";a.description&&(d+="\x3cspan\x3e"+a.description+"\x3c/span\x3e");d+="\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e";n.getFirst().setHtml(d);n.on("click",function(){if(a.htmlFile){var b=CKEDITOR.dialog.getCurrent();b.setState(CKEDITOR.DIALOG_STATE_BUSY);CKEDITOR.ajax.loadText(a.htmlFile,function(a){l(a);b.setState(CKEDITOR.DIALOG_STATE_IDLE)})}else l(a.html)}); +return n}function l(a){var b=CKEDITOR.dialog.getCurrent();b.getValueOf("selectTpl","chkInsertOpt")?(c.fire("saveSnapshot"),c.setData(a,function(){b.hide();var a=c.createRange();a.moveToElementEditStart(c.editable());a.select();setTimeout(function(){c.fire("saveSnapshot")},0)})):(c.insertHtml(a),b.hide())}function k(a){var b=a.data.getTarget(),c=g.equals(b);if(c||g.contains(b)){var d=a.data.getKeystroke(),f=g.getElementsByTag("a"),e;if(f){if(c)e=f.getItem(0);else switch(d){case 40:e=b.getNext();break; +case 38:e=b.getPrevious();break;case 13:case 32:b.fire("click")}e&&(e.focus(),a.data.preventDefault())}}}var h=CKEDITOR.plugins.get("templates");CKEDITOR.document.appendStyleSheet(CKEDITOR.getUrl(h.path+"dialogs/templates.css"));var g,h="cke_tpl_list_label_"+CKEDITOR.tools.getNextNumber(),f=c.lang.templates,p=c.config;return{title:c.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:"selectTpl",label:f.title,elements:[{type:"vbox",padding:5,children:[{id:"chkInsertOpt", +type:"checkbox",label:f.insertOption,"default":p.templates_replaceContent},{id:"selectTplText",type:"html",html:"\x3cspan\x3e"+f.selectPromptMsg+"\x3c/span\x3e"},{id:"templatesList",type:"html",focus:!0,html:'\x3cdiv class\x3d"cke_tpl_list" tabIndex\x3d"-1" role\x3d"listbox" aria-labelledby\x3d"'+h+'"\x3e\x3cdiv class\x3d"cke_tpl_loading"\x3e\x3cspan\x3e\x3c/span\x3e\x3c/div\x3e\x3c/div\x3e\x3cspan class\x3d"cke_voice_label" id\x3d"'+h+'"\x3e'+f.options+"\x3c/span\x3e"}]}]}],buttons:[CKEDITOR.dialog.cancelButton], +onShow:function(){var a=this.getContentElement("selectTpl","templatesList");g=a.getElement();CKEDITOR.loadTemplates(p.templates_files,function(){var b=(p.templates||"default").split(",");if(b.length){var c=g;c.setHtml("");for(var d=0,h=b.length;d<h;d++)for(var e=CKEDITOR.getTemplates(b[d]),l=e.imagesPath,e=e.templates,k=e.length,m=0;m<k;m++){var q=r(e[m],l);q.setAttribute("aria-posinset",m+1);q.setAttribute("aria-setsize",k);c.append(q)}a.focus()}else g.setHtml('\x3cdiv class\x3d"cke_tpl_empty"\x3e\x3cspan\x3e'+ +f.emptyListMsg+"\x3c/span\x3e\x3c/div\x3e")});this._.element.on("keydown",k)},onHide:function(){this._.element.removeListener("keydown",k)}}})})(); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/templates/templatedefinition.js b/src/static/ckeditor/plugins/templates/templatedefinition.js new file mode 100644 index 00000000..9361af4b --- /dev/null +++ b/src/static/ckeditor/plugins/templates/templatedefinition.js @@ -0,0 +1,4 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ diff --git a/src/static/ckeditor/plugins/templates/templates/default.js b/src/static/ckeditor/plugins/templates/templates/default.js new file mode 100644 index 00000000..8fe17ffc --- /dev/null +++ b/src/static/ckeditor/plugins/templates/templates/default.js @@ -0,0 +1,7 @@ +/* + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.addTemplates("default",{imagesPath:CKEDITOR.getUrl(CKEDITOR.plugins.getPath("templates")+"templates/images/"),templates:[{title:"Image and Title",image:"template1.gif",description:"One main image with a title and text that surround the image.",html:'\x3ch3\x3e\x3cimg src\x3d" " alt\x3d"" style\x3d"margin-right: 10px" height\x3d"100" width\x3d"100" align\x3d"left" /\x3eType the title here\x3c/h3\x3e\x3cp\x3eType the text here\x3c/p\x3e'},{title:"Strange Template",image:"template2.gif",description:"A template that defines two columns, each one with a title, and some text.", +html:'\x3ctable cellspacing\x3d"0" cellpadding\x3d"0" style\x3d"width:100%" border\x3d"0"\x3e\x3ctr\x3e\x3ctd style\x3d"width:50%"\x3e\x3ch3\x3eTitle 1\x3c/h3\x3e\x3c/td\x3e\x3ctd\x3e\x3c/td\x3e\x3ctd style\x3d"width:50%"\x3e\x3ch3\x3eTitle 2\x3c/h3\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3eText 1\x3c/td\x3e\x3ctd\x3e\x3c/td\x3e\x3ctd\x3eText 2\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cp\x3eMore text goes here.\x3c/p\x3e'},{title:"Text and Table",image:"template3.gif",description:"A title with some text and a table.", +html:'\x3cdiv style\x3d"width: 80%"\x3e\x3ch3\x3eTitle goes here\x3c/h3\x3e\x3ctable style\x3d"width:150px;float: right" cellspacing\x3d"0" cellpadding\x3d"0" border\x3d"1"\x3e\x3ccaption style\x3d"border:solid 1px black"\x3e\x3cstrong\x3eTable title\x3c/strong\x3e\x3c/caption\x3e\x3ctr\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3ctd\x3e\x26nbsp;\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cp\x3eType the text here\x3c/p\x3e\x3c/div\x3e'}]}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/templates/templates/images/template1.gif b/src/static/ckeditor/plugins/templates/templates/images/template1.gif new file mode 100644 index 00000000..428c5a6a Binary files /dev/null and b/src/static/ckeditor/plugins/templates/templates/images/template1.gif differ diff --git a/src/static/ckeditor/plugins/templates/templates/images/template2.gif b/src/static/ckeditor/plugins/templates/templates/images/template2.gif new file mode 100644 index 00000000..c494efe2 Binary files /dev/null and b/src/static/ckeditor/plugins/templates/templates/images/template2.gif differ diff --git a/src/static/ckeditor/plugins/templates/templates/images/template3.gif b/src/static/ckeditor/plugins/templates/templates/images/template3.gif new file mode 100644 index 00000000..d5a40cef Binary files /dev/null and b/src/static/ckeditor/plugins/templates/templates/images/template3.gif differ diff --git a/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.css b/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.css new file mode 100644 index 00000000..9cb97126 --- /dev/null +++ b/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.css @@ -0,0 +1,20 @@ +/** + * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +.cke_colordialog_colorcell { + width: 12px; /* All cells have equal width which depends on parent width (in this case table parent). Width works more like max-width. */ + height: 14px; + padding: 1px; /* Padding is replaced by border for focused cells. Prevents 'jumping' when adding borders. */ +} + +.cke_colordialog_colorcell.cke_colordialog_focused_light, +.cke_colordialog_colorcell.cke_colordialog_focused_dark { + padding: 0; /* Shrink cell to allow 1px border indicating focus. */ + border: 1px dotted #000; +} + +.cke_colordialog_colorcell.cke_colordialog_focused_dark { + border-color: #FFF; +} diff --git a/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.js b/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.js new file mode 100644 index 00000000..a0c94bc8 --- /dev/null +++ b/src/static/ckeditor/plugins/uicolor/dialogs/uicolor.js @@ -0,0 +1,17 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.dialog.add("uicolor",function(f){function B(a){a=a.data.getTarget();var c;"td"==a.getName()&&(c=a.getChild(0).getHtml())&&(n(),r(a),m(c))}function r(a){a&&(g=a,g.setAttribute("aria-selected",!0),g.addClass("cke_colordialog_selected"))}function n(){g&&(g.removeClass("cke_colordialog_selected"),g.removeAttribute("aria-selected"),g=null)}function m(a){k.getContentElement("picker","selectedColor").setValue(a);a||l.getById(t).removeStyle("background-color")}function C(a){!a.name&&(a=new CKEDITOR.event(a)); +var c=!/mouse/.test(a.name),b=a.data.getTarget(),h;"td"==b.getName()&&(h=b.getChild(0).getHtml())&&(u(a),c?e=b:D=b,c&&b.addClass(G(h)?"cke_colordialog_focused_light":"cke_colordialog_focused_dark"),v(h))}function u(a){if(a=!/mouse/.test(a.name)&&e)a.removeClass("cke_colordialog_focused_light"),a.removeClass("cke_colordialog_focused_dark");e||D||v(!1)}function v(a){a?(l.getById(w).setStyle("background-color",a),l.getById(x).setHtml(a)):(l.getById(w).removeStyle("background-color"),l.getById(x).setHtml("\x26nbsp;"))} +function G(a){a=a.replace(/^#/,"");for(var c=0,b=[];2>=c;c++)b[c]=parseInt(a.substr(2*c,2),16);return 165<=.2126*b[0]+.7152*b[1]+.0722*b[2]}function H(a){var c=a.data,b=c.getTarget(),h=c.getKeystroke(),d="rtl"==f.lang.dir;switch(h){case 38:if(a=b.getParent().getPrevious())a=a.getChild([b.getIndex()]),a.focus();c.preventDefault();break;case 40:(a=b.getParent().getNext())&&(a=a.getChild([b.getIndex()]))&&1==a.type&&a.focus();c.preventDefault();break;case 32:case 13:B(a);c.preventDefault();break;case d? +37:39:(a=b.getNext())?1==a.type&&(a.focus(),c.preventDefault(!0)):(a=b.getParent().getNext())&&(a=a.getChild([0]))&&1==a.type&&(a.focus(),c.preventDefault(!0));break;case d?39:37:if(a=b.getPrevious())a.focus(),c.preventDefault(!0);else if(a=b.getParent().getPrevious())a=a.getLast(),a.focus(),c.preventDefault(!0)}}function p(a){return CKEDITOR.tools.getNextId()+"_"+a}function E(a){var c=null;q&&a&&(c=q.findOne('td[data-color\x3d"'+a+'"]'));return c}function F(a,c){var b=a||c;f.setUiColor(b);k.getContentElement("picker", +"configBox").setValue(b);if(a&&k.getContentElement("picker","predefined").getValue()!==b)k.getContentElement("picker","predefined").setValue(b);else if(c){var d=E(b);d?r(d):n();k.getContentElement("picker","selectedColor").getValue()!==b&&m(b)}}function y(a){return a.getUiColor()?CKEDITOR.tools.parseCssText("color:"+a.getUiColor(),!0).color:null}var z=CKEDITOR.dom.element,l=CKEDITOR.document,d=f.lang.uicolor,w=p("hicolor"),x=p("hicolortext"),t=p("selhicolor"),k,q,g,e,D;q=function(){function a(a,d){for(var A= +a;A<a+3;A++){var f=new z(b.$.insertRow(-1));f.setAttribute("role","row");for(var e=d;e<d+3;e++)for(var g=0;6>g;g++)c(f.$,"#"+h[e]+h[g]+h[A])}}function c(a,c){var b=new z(a.insertCell(-1));b.setAttribute("class","ColorCell cke_colordialog_colorcell");b.setAttribute("tabIndex",-1);b.setAttribute("role","gridcell");b.setAttribute("data-color",c);b.on("keydown",H);b.on("click",B);b.on("focus",C);b.on("blur",u);b.setStyle("background-color",c);var d=p("color_table_cell");b.setAttribute("aria-labelledby", +d);b.append(CKEDITOR.dom.element.createFromHtml('\x3cspan id\x3d"'+d+'" class\x3d"cke_voice_label"\x3e'+c+"\x3c/span\x3e",CKEDITOR.document))}var b=CKEDITOR.dom.element.createFromHtml('\x3ctable tabIndex\x3d"-1" class\x3d"cke_colordialog_table" aria-label\x3d"'+d.options+'" role\x3d"grid" style\x3d"border-collapse:separate;" cellspacing\x3d"0"\x3e\x3ccaption class\x3d"cke_voice_label"\x3e'+d.options+'\x3c/caption\x3e\x3ctbody role\x3d"presentation"\x3e\x3c/tbody\x3e\x3c/table\x3e');b.on("mouseover", +C);b.on("mouseout",u);var h="00 33 66 99 cc ff".split(" ");a(0,0);a(3,0);a(0,3);a(3,3);var e=new z(b.$.insertRow(-1));e.setAttribute("role","row");c(e.$,"#000000");for(var g=0;16>g;g++){var f=g.toString(16);c(e.$,"#"+f+f+f+f+f+f)}c(e.$,"#ffffff");return b}();CKEDITOR.document.appendStyleSheet(CKEDITOR.getUrl(CKEDITOR.plugins.get("uicolor").path+"dialogs/uicolor.css"));return{title:d.title,minWidth:360,minHeight:220,buttons:[CKEDITOR.dialog.okButton],onLoad:function(){k=this},onHide:function(){n(); +m(null);e&&(e.removeClass("cke_colordialog_focused_light"),e.removeClass("cke_colordialog_focused_dark"),e=null,v(null))},contents:[{id:"picker",label:d.title,accessKey:"I",elements:[{type:"hbox",padding:0,widths:["70%","10%","30%"],children:[{type:"html",html:"\x3cdiv\x3e\x3c/div\x3e",onLoad:function(){CKEDITOR.document.getById(this.domId).append(q)},focus:function(){var a=y(f),c=a?E(a):e||this.getElement().getElementsByTag("td").getItem(0);c&&(c&&c.focus(),a&&(r(c),m(a)))}},{type:"html",html:"\x26nbsp;"}, +{type:"vbox",padding:0,widths:["70%","5%","25%"],children:[{type:"html",html:"\x3cspan\x3e"+d.highlight+'\x3c/span\x3e\x3cdiv id\x3d"'+w+'" style\x3d"border: 1px solid; height: 74px; width: 74px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"'+x+'"\x3e\x26nbsp;\x3c/div\x3e\x3cspan\x3e'+d.selected+'\x3c/span\x3e\x3cdiv id\x3d"'+t+'" style\x3d"border: 1px solid; height: 20px; width: 74px;"\x3e\x3c/div\x3e'},{type:"text",label:d.selected,labelStyle:"display:none",id:"selectedColor",style:"width: 76px;margin-top:4px", +onChange:function(){try{var a=this.getValue();a&&(l.getById(t).setStyle("background-color",a),F(a))}catch(c){n(),m(null)}}}]}]},{type:"vbox",children:[{type:"hbox",padding:0,children:[{id:"predefined",type:"select","default":"",width:"100%",label:d.predefined,items:[[""],["Light blue","#9ab8f3"],["Sand","#d2b48c"],["Metallic","#949aaa"],["Purple","#c2a3c7"],["Olive","#a2c980"],["Happy green","#9bd446"],["Jezebel Blue","#14b8c4"],["Burn","#ff89a"],["Easy red","#ff6969"],["Pisces 3","#48b4f2"],["Aquarius 5", +"#487ed4"],["Absinthe","#a8cf76"],["Scrambled Egg","#c7a622"],["Hello monday","#8e8d80"],["Lovely sunshine","#f1e8b1"],["Recycled air","#b3c593"],["Down","#bcbca4"],["Mark Twain","#cfe91d"],["Specks of dust","#d1b596"],["Lollipop","#f6ce23"]],onShow:function(){this.setValue(y(f))},onChange:function(){var a=this.getValue();a&&(F(null,a),this.focus())}}]},{id:"configBox",type:"text",label:d.config,onShow:function(){this.getInputElement().setAttribute("readonly",!0);this.setValue(y(f))},onChange:function(){var a= +this.getValue();a&&CKEDITOR.tools.style.parse._findColor(a).length&&this.setValue('config.uiColor \x3d "'+a.toLowerCase()+'"',!0)}}]}]}]}}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/uicolor/icons/hidpi/uicolor.png b/src/static/ckeditor/plugins/uicolor/icons/hidpi/uicolor.png new file mode 100644 index 00000000..9caa62be Binary files /dev/null and b/src/static/ckeditor/plugins/uicolor/icons/hidpi/uicolor.png differ diff --git a/src/static/ckeditor/plugins/uicolor/icons/uicolor.png b/src/static/ckeditor/plugins/uicolor/icons/uicolor.png new file mode 100644 index 00000000..f2f1de9e Binary files /dev/null and b/src/static/ckeditor/plugins/uicolor/icons/uicolor.png differ diff --git a/src/static/ckeditor/plugins/uicolor/lang/_translationstatus.txt b/src/static/ckeditor/plugins/uicolor/lang/_translationstatus.txt new file mode 100644 index 00000000..39acf9f1 --- /dev/null +++ b/src/static/ckeditor/plugins/uicolor/lang/_translationstatus.txt @@ -0,0 +1,27 @@ +Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + +bg.js Found: 4 Missing: 0 +cs.js Found: 4 Missing: 0 +cy.js Found: 4 Missing: 0 +da.js Found: 4 Missing: 0 +de.js Found: 4 Missing: 0 +el.js Found: 4 Missing: 0 +eo.js Found: 4 Missing: 0 +et.js Found: 4 Missing: 0 +fa.js Found: 4 Missing: 0 +fi.js Found: 4 Missing: 0 +fr.js Found: 4 Missing: 0 +he.js Found: 4 Missing: 0 +hr.js Found: 4 Missing: 0 +it.js Found: 4 Missing: 0 +mk.js Found: 4 Missing: 0 +nb.js Found: 4 Missing: 0 +nl.js Found: 4 Missing: 0 +no.js Found: 4 Missing: 0 +pl.js Found: 4 Missing: 0 +tr.js Found: 4 Missing: 0 +ug.js Found: 4 Missing: 0 +uk.js Found: 4 Missing: 0 +vi.js Found: 4 Missing: 0 +zh-cn.js Found: 4 Missing: 0 diff --git a/src/static/ckeditor/plugins/uicolor/lang/zh-cn.js b/src/static/ckeditor/plugins/uicolor/lang/zh-cn.js new file mode 100644 index 00000000..a7f39a0e --- /dev/null +++ b/src/static/ckeditor/plugins/uicolor/lang/zh-cn.js @@ -0,0 +1,5 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang("uicolor","zh-cn",{title:"用户界面颜色选择器",options:"颜色选项",highlight:"高亮",selected:"已选颜色",predefined:"预定义颜色集",config:"粘贴此字符串到您的 config.js 文件"}); \ No newline at end of file diff --git a/src/static/ckeditor/plugins/uicolor/plugin.js b/src/static/ckeditor/plugins/uicolor/plugin.js new file mode 100644 index 00000000..5aa11ed7 --- /dev/null +++ b/src/static/ckeditor/plugins/uicolor/plugin.js @@ -0,0 +1,6 @@ +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.add("uicolor",{requires:"dialog",lang:"af,ar,az,bg,ca,cs,cy,da,de,de-ch,el,en,en-au,en-gb,eo,es,es-mx,et,eu,fa,fi,fr,fr-ca,gl,he,hr,hu,id,it,ja,km,ko,ku,lv,mk,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,tr,tt,ug,uk,vi,zh,zh-cn",icons:"uicolor",hidpi:!0,init:function(a){var b=new CKEDITOR.dialogCommand("uicolor");b.editorFocus=!1;CKEDITOR.dialog.add("uicolor",this.path+"dialogs/uicolor.js");a.addCommand("uicolor",b);a.ui.addButton&&a.ui.addButton("UIColor",{label:a.lang.uicolor.title, +command:"uicolor",toolbar:"tools,1"})}}); \ No newline at end of file