From 17e65da61866c7bf1455f15202808a048b8f29b7 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 2 Nov 2016 12:19:00 -0400 Subject: [PATCH] (js) Add CKEditor pastefromexcel plugin Fixes #3854 --- NEWS | 3 ++- .../js/vendor/ckeditor/build-config.js | 5 +++-- UI/WebServerResources/js/vendor/ckeditor/ckeditor.js | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 3b786024b9..bb23af9fd5 100644 --- a/NEWS +++ b/NEWS @@ -25,9 +25,10 @@ Bug fixes - [web] fixed auto-completion of list members (#3870) - [web] added missing options to subscribed addressbooks (#3850) - [web] added missing options to subscribed calendars (#3863) - - [web] fixed resource conflict error handling (403 vs 409 HTTP code) + - [web] fixed resource conflict error handling (403 vs 409 HTTP code) (#3837) - [web] restored immediate deletion of messages (without moving them to the trash) - [web] avoid mail notifications on superfluous event changes (#3790) + - [web] CKEditor: added the pastefromexcel plugin (#3854) - [eas] improve handling of email folders without a parent - [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016 - [core] only consider SMTP addresses for AD's proxyAddresses (#3842) diff --git a/UI/WebServerResources/js/vendor/ckeditor/build-config.js b/UI/WebServerResources/js/vendor/ckeditor/build-config.js index c3347165fd..434024fa79 100644 --- a/UI/WebServerResources/js/vendor/ckeditor/build-config.js +++ b/UI/WebServerResources/js/vendor/ckeditor/build-config.js @@ -13,10 +13,10 @@ * (1) http://ckeditor.com/builder * Visit online builder to build CKEditor from scratch. * - * (2) http://ckeditor.com/builder/d97b6d42ea158d15ebe90da9451162c5 + * (2) http://ckeditor.com/builder/1f054d16e7bf94d785cd4a259c345f4c * Visit online builder to build CKEditor, starting with the same setup as before. * - * (3) http://ckeditor.com/builder/download/d97b6d42ea158d15ebe90da9451162c5 + * (3) http://ckeditor.com/builder/download/1f054d16e7bf94d785cd4a259c345f4c * Straight download link to the latest version of CKEditor (Optimized) with the same setup as before. * * NOTE: @@ -80,6 +80,7 @@ var CKBUILDER_CONFIG = { 'onchange' : 1, 'panel' : 1, 'panelbutton' : 1, + 'pastefromexcel' : 1, 'pastefromword' : 1, 'pastetext' : 1, 'richcombo' : 1, diff --git a/UI/WebServerResources/js/vendor/ckeditor/ckeditor.js b/UI/WebServerResources/js/vendor/ckeditor/ckeditor.js index 27ae7d7b1d..a5c53f3453 100644 --- a/UI/WebServerResources/js/vendor/ckeditor/ckeditor.js +++ b/UI/WebServerResources/js/vendor/ckeditor/ckeditor.js @@ -832,7 +832,9 @@ d.reset(),d.evaluator=G,a=d.previous()),c=a,e.moveToElementEditEnd(c),e.moveToPo G(h)?h:c,g=0,(a=d.next())&&a.type==CKEDITOR.NODE_ELEMENT&&a.getName()in v&&a.equals(h)?(g=1,a=d.next()):f.checkBoundaryOfElement(k,CKEDITOR.END)&&(g=2),g&&a){f=f.clone();f.moveToElementEditStart(a);if(1==g&&(e.optimize(),!e.startContainer.equals(c))){for(c=e.startContainer;c.is(CKEDITOR.dtd.$inline);)p=c,c=c.getParent();p&&e.moveToPosition(p,CKEDITOR.POSITION_AFTER_END)}2==g&&(e.moveToPosition(e.endPath().block,CKEDITOR.POSITION_BEFORE_END),f.endPath().block&&f.moveToPosition(f.endPath().block,CKEDITOR.POSITION_AFTER_START)); C(b,e,f);m.cancel()}}else d.range.setEndAt(h,CKEDITOR.POSITION_BEFORE_END),(a=d.next())&&a.type==CKEDITOR.NODE_ELEMENT&&a.is(v)&&(a=a.getFirst(u),g.block&&f.checkStartOfBlock()&&f.checkEndOfBlock()?(g.block.remove(),f.moveToElementEditStart(a),f.select()):A(a)?(f.moveToElementEditStart(a),f.select()):(f=f.clone(),f.moveToElementEditStart(a),C(b,e,f)),m.cancel());setTimeout(function(){b.selectionChange(1)})}}}))}})})();CKEDITOR.plugins.add("menubutton",{requires:"button,menu",onLoad:function(){var d=function(c){var a=this._,b=a.menu;a.state!==CKEDITOR.TRISTATE_DISABLED&&(a.on&&b?b.hide():(a.previousState=a.state,b||(b=a.menu=new CKEDITOR.menu(c,{panel:{className:"cke_menu_panel",attributes:{"aria-label":c.lang.common.options}}}),b.onHide=CKEDITOR.tools.bind(function(){var b=this.command?c.getCommand(this.command).modes:this.modes;this.setState(!b||b[c.mode]?a.previousState:CKEDITOR.TRISTATE_DISABLED);a.on=0},this), this.onMenu&&b.addListener(this.onMenu)),this.setState(CKEDITOR.TRISTATE_ON),a.on=1,setTimeout(function(){b.show(CKEDITOR.document.getById(a.id),4)},0)))};CKEDITOR.ui.menuButton=CKEDITOR.tools.createClass({base:CKEDITOR.ui.button,$:function(c){delete c.panel;this.base(c);this.hasArrow=!0;this.click=d},statics:{handler:{create:function(c){return new CKEDITOR.ui.menuButton(c)}}}})},beforeInit:function(d){d.ui.addHandler(CKEDITOR.UI_MENUBUTTON,CKEDITOR.ui.menuButton.handler)}}); -CKEDITOR.UI_MENUBUTTON="menubutton";(function(){function h(a,d,f){var b=CKEDITOR.cleanWord;b?f():(a=CKEDITOR.getUrl(a.config.pasteFromWordCleanupFile||d+"filter/default.js"),CKEDITOR.scriptLoader.load(a,f,null,!0));return!b}function k(a){a.data.type="html"}CKEDITOR.plugins.add("pastefromword",{requires:"clipboard",init:function(a){var d=0,f=this.path;a.addCommand("pastefromword",{canUndo:!1,async:!0,exec:function(a){var e=this;d=1;a.once("beforePaste",k);a.getClipboardData({title:a.lang.pastefromword.title},function(c){c&&a.fire("paste", +CKEDITOR.UI_MENUBUTTON="menubutton";CKEDITOR.plugins.add("onchange",{init:function(a){function b(){a.readOnly||d||(d=setTimeout(function(){d=0;a.fire("change")},a.config.minimumChangeMilliseconds||100))}var d,g=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,f;a.on("destroy",function(){d&&clearTimeout(d);d=null});a.on("saveSnapshot",function(a){(!a.data||!a.data.contentOnly)&&b()});var e=a.getCommand("undo");e&&e.on("afterUndo",b);(e=a.getCommand("redo"))&&e.on("afterRedo",b);a.on("afterCommandExec", +function(a){"source"!=a.data.name&&!1!==a.data.command.canUndo&&b()});g&&(f=new g(function(){b()}),window.console&&window.console.log&&console.log("Detecting changes using MutationObservers"));a.on("contentDom",function(){if(f)var c=setInterval(function(){if(typeof a.document==="object"){f.observe(a.document.getBody().$,{attributes:true,childList:true,characterData:true});clearInterval(c)}},100);a.document.on("keydown",function(a){if(!a.data.$.ctrlKey&&!a.data.$.metaKey){a=a.data.$.keyCode;(a==8|| +a==13||a==32||a>=46&&a<=90||a>=96&&a<=111||a>=186&&a<=222||a==229)&&b()}});a.document.on("drop",b);a.document.getBody().on("drop",b)});a.on("mode",function(){if(a.mode=="source"){var c=a.textarea||a._.editable;c.on("keydown",function(a){!a.data.$.ctrlKey&&!a.data.$.metaKey&&b()});c.on("drop",b);c.on("input",b);if(CKEDITOR.env.ie){c.on("cut",b);c.on("paste",b)}}})}});(function(){function h(a,d,f){var b=CKEDITOR.cleanWord;b?f():(a=CKEDITOR.getUrl(a.config.pasteFromWordCleanupFile||d+"filter/default.js"),CKEDITOR.scriptLoader.load(a,f,null,!0));return!b}function k(a){a.data.type="html"}CKEDITOR.plugins.add("pastefromword",{requires:"clipboard",init:function(a){var d=0,f=this.path;a.addCommand("pastefromword",{canUndo:!1,async:!0,exec:function(a){var e=this;d=1;a.once("beforePaste",k);a.getClipboardData({title:a.lang.pastefromword.title},function(c){c&&a.fire("paste", {type:"html",dataValue:c.dataValue,method:"paste",dataTransfer:CKEDITOR.plugins.clipboard.initPasteDataTransfer()});a.fire("afterCommandExec",{name:"pastefromword",command:e,returnValue:!!c})})}});a.ui.addButton&&a.ui.addButton("PasteFromWord",{label:a.lang.pastefromword.toolbar,command:"pastefromword",toolbar:"clipboard,50"});a.on("pasteState",function(b){a.getCommand("pastefromword").setState(b.data)});a.on("paste",function(b){var e=b.data,c=e.dataValue;if(c&&(d||/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c))){e.dontFilter= !0;var g=h(a,f,function(){if(g)a.fire("paste",e);else if(!a.config.pasteFromWordPromptCleanup||d||confirm(a.lang.pastefromword.confirmCleanup))e.dataValue=CKEDITOR.cleanWord(c,a);d=0});g&&b.cancel()}},null,null,3)}})})();(function(){var c={canUndo:!1,async:!0,exec:function(a){a.getClipboardData({title:a.lang.pastetext.title},function(b){b&&a.fire("paste",{type:"text",dataValue:b.dataValue,method:"paste",dataTransfer:CKEDITOR.plugins.clipboard.initPasteDataTransfer()});a.fire("afterCommandExec",{name:"pastetext",command:c,returnValue:!!b})})}};CKEDITOR.plugins.add("pastetext",{requires:"clipboard",init:function(a){a.addCommand("pastetext",c);a.ui.addButton&&a.ui.addButton("PasteText",{label:a.lang.pastetext.button, command:"pastetext",toolbar:"clipboard,40"});if(a.config.forcePasteAsPlainText)a.on("beforePaste",function(a){"html"!=a.data.type&&(a.data.type="text")});a.on("pasteState",function(b){a.getCommand("pastetext").setState(b.data)})}})})();CKEDITOR.plugins.add("scayt",{requires:"menubutton,dialog",tabToOpen:null,dialogName:"scaytDialog",init:function(a){var c=this,d=CKEDITOR.plugins.scayt;this.bindEvents(a);this.parseConfig(a);this.addRule(a);CKEDITOR.dialog.add(this.dialogName,CKEDITOR.getUrl(this.path+"dialogs/options.js"));this.addMenuItems(a);var b=a.lang.scayt,e=CKEDITOR.env;a.ui.add("Scayt",CKEDITOR.UI_MENUBUTTON,{label:b.text_title,title:a.plugins.wsc?a.lang.wsc.title:b.text_title,modes:{wysiwyg:!(e.ie&&(8>e.version||e.quirks))}, @@ -975,6 +977,6 @@ e+a):a=c.docType+'\x3chtml dir\x3d"'+c.contentsLangDirection+'" lang\x3d"'+(c.co c='\x3cscript id\x3d"cke_actscrpt" type\x3d"text/javascript"'+(CKEDITOR.env.ie?' defer\x3d"defer" ':"")+"\x3evar wasLoaded\x3d0;function onload(){if(!wasLoaded)window.parent.CKEDITOR.tools.callFunction("+this._.frameLoadedHandler+",window);wasLoaded\x3d1;}"+(CKEDITOR.env.ie?"onload();":'document.addEventListener("DOMContentLoaded", onload, false );')+"\x3c/script\x3e";CKEDITOR.env.ie&&9>CKEDITOR.env.version&&(c+='\x3cscript id\x3d"cke_shimscrpt"\x3ewindow.parent.CKEDITOR.tools.enableHtml5Elements(document)\x3c/script\x3e'); h&&CKEDITOR.env.ie&&10>CKEDITOR.env.version&&(c+='\x3cscript id\x3d"cke_basetagscrpt"\x3evar baseTag \x3d document.querySelector( "base" );baseTag.href \x3d baseTag.href;\x3c/script\x3e');a=a.replace(/(?=\s*<\/(:?head)>)/,c);this.clearCustomData();this.clearListeners();b.fire("contentDomUnload");var k=this.getDocument();try{k.write(a)}catch(l){setTimeout(function(){k.write(a)},0)}}},getData:function(a){if(a)return this.getHtml();a=this.editor;var f=a.config,b=f.fullPage,c=b&&a.docType,d=b&&a.xmlDeclaration, e=this.getDocument(),b=b?e.getDocumentElement().getOuterHtml():e.getBody().getHtml();CKEDITOR.env.gecko&&f.enterMode!=CKEDITOR.ENTER_BR&&(b=b.replace(/
(?=\s*(:?$|<\/body>))/,""));b=a.dataProcessor.toDataFormat(b);d&&(b=d+"\n"+b);c&&(b=c+"\n"+b);return b},focus:function(){this._.isLoadingData?this._.isPendingFocus=!0:l.baseProto.focus.call(this)},detach:function(){var a=this.editor,f=a.document,b;try{b=a.window.getFrame()}catch(c){}l.baseProto.detach.call(this);this.clearCustomData();f.getDocumentElement().clearCustomData(); -CKEDITOR.tools.removeFunction(this._.frameLoadedHandler);b&&b.getParent()?(b.clearCustomData(),(a=b.removeCustomData("onResize"))&&a.removeListener(),b.remove()):CKEDITOR.warn("editor-destroy-iframe")}}})})();CKEDITOR.config.disableObjectResizing=!1;CKEDITOR.config.disableNativeTableHandles=!0;CKEDITOR.config.disableNativeSpellChecker=!0;CKEDITOR.plugins.add("onchange",{init:function(a){function b(){a.readOnly||d||(d=setTimeout(function(){d=0;a.fire("change")},a.config.minimumChangeMilliseconds||100))}var d,g=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,f;a.on("destroy",function(){d&&clearTimeout(d);d=null});a.on("saveSnapshot",function(a){(!a.data||!a.data.contentOnly)&&b()});var e=a.getCommand("undo");e&&e.on("afterUndo",b);(e=a.getCommand("redo"))&&e.on("afterRedo",b);a.on("afterCommandExec", -function(a){"source"!=a.data.name&&!1!==a.data.command.canUndo&&b()});g&&(f=new g(function(){b()}),window.console&&window.console.log&&console.log("Detecting changes using MutationObservers"));a.on("contentDom",function(){if(f)var c=setInterval(function(){if(typeof a.document==="object"){f.observe(a.document.getBody().$,{attributes:true,childList:true,characterData:true});clearInterval(c)}},100);a.document.on("keydown",function(a){if(!a.data.$.ctrlKey&&!a.data.$.metaKey){a=a.data.$.keyCode;(a==8|| -a==13||a==32||a>=46&&a<=90||a>=96&&a<=111||a>=186&&a<=222||a==229)&&b()}});a.document.on("drop",b);a.document.getBody().on("drop",b)});a.on("mode",function(){if(a.mode=="source"){var c=a.textarea||a._.editable;c.on("keydown",function(a){!a.data.$.ctrlKey&&!a.data.$.metaKey&&b()});c.on("drop",b);c.on("input",b);if(CKEDITOR.env.ie){c.on("cut",b);c.on("paste",b)}}})}});CKEDITOR.config.plugins='dialogui,dialog,about,base64image,basicstyles,blockquote,button,clipboard,panelbutton,panel,floatpanel,colorbutton,colordialog,menu,contextmenu,div,enterkey,entities,fakeobjects,floatingspace,listblock,richcombo,font,format,image,indent,indentlist,justify,link,list,menubutton,pastefromword,pastetext,scayt,sourcearea,tab,table,tabletools,tableresize,toolbar,undo,wsc,wysiwygarea,onchange';CKEDITOR.config.skin='minimalist';(function() {var setIcons = function(icons, strip) {var path = CKEDITOR.getUrl( 'plugins/' + strip );icons = icons.split( ',' );for ( var i = 0; i < icons.length; i++ )CKEDITOR.skin.icons[ icons[ i ] ] = { path: path, offset: -icons[ ++i ], bgsize : icons[ ++i ] };};if (CKEDITOR.env.hidpi) setIcons('about,0,,base64image,24,,bold,48,,italic,72,,strike,96,,subscript,120,,superscript,144,,underline,168,,blockquote,192,,copy-rtl,216,,copy,240,,cut-rtl,264,,cut,288,,paste-rtl,312,,paste,336,,bgcolor,360,,textcolor,384,,creatediv,408,,image,432,,indent-rtl,456,,indent,480,,outdent-rtl,504,,outdent,528,,justifyblock,552,,justifycenter,576,,justifyleft,600,,justifyright,624,,anchor-rtl,648,,anchor,672,,link,696,,unlink,720,,bulletedlist-rtl,744,,bulletedlist,768,,numberedlist-rtl,792,,numberedlist,816,,pastefromword-rtl,840,,pastefromword,864,,pastetext-rtl,888,,pastetext,912,,scayt,936,,source-rtl,960,,source,984,,table,1008,,redo-rtl,1032,,redo,1056,,undo-rtl,1080,,undo,1104,,spellchecker,1128,','icons_hidpi.png');else setIcons('about,0,auto,base64image,24,auto,bold,48,auto,italic,72,auto,strike,96,auto,subscript,120,auto,superscript,144,auto,underline,168,auto,blockquote,192,auto,copy-rtl,216,auto,copy,240,auto,cut-rtl,264,auto,cut,288,auto,paste-rtl,312,auto,paste,336,auto,bgcolor,360,auto,textcolor,384,auto,creatediv,408,auto,image,432,auto,indent-rtl,456,auto,indent,480,auto,outdent-rtl,504,auto,outdent,528,auto,justifyblock,552,auto,justifycenter,576,auto,justifyleft,600,auto,justifyright,624,auto,anchor-rtl,648,auto,anchor,672,auto,link,696,auto,unlink,720,auto,bulletedlist-rtl,744,auto,bulletedlist,768,auto,numberedlist-rtl,792,auto,numberedlist,816,auto,pastefromword-rtl,840,auto,pastefromword,864,auto,pastetext-rtl,888,auto,pastetext,912,auto,scayt,936,auto,source-rtl,960,auto,source,984,auto,table,1008,auto,redo-rtl,1032,auto,redo,1056,auto,undo-rtl,1080,auto,undo,1104,auto,spellchecker,1128,auto','icons.png');})();CKEDITOR.lang.languages={"ar":1,"ca":1,"cs":1,"cy":1,"da":1,"de":1,"en":1,"es":1,"eu":1,"fi":1,"fr":1,"hr":1,"hu":1,"is":1,"it":1,"lt":1,"mk":1,"nb":1,"nl":1,"no":1,"pl":1,"pt":1,"pt-br":1,"ru":1,"sk":1,"sl":1,"sr":1,"sv":1,"tr":1,"uk":1,"zh":1,"zh-cn":1};}()); \ No newline at end of file +CKEDITOR.tools.removeFunction(this._.frameLoadedHandler);b&&b.getParent()?(b.clearCustomData(),(a=b.removeCustomData("onResize"))&&a.removeListener(),b.remove()):CKEDITOR.warn("editor-destroy-iframe")}}})})();CKEDITOR.config.disableObjectResizing=!1;CKEDITOR.config.disableNativeTableHandles=!0;CKEDITOR.config.disableNativeSpellChecker=!0;CKEDITOR.plugins.add("pastefromexcel",{requires:"clipboard",init:function(g){if(!CKEDITOR.env.ie){var h=function(b){b=this._.normalizeType(b);var a=this._.data[b];if(void 0===a||null===a||""===a)try{a=this.$.getData(b)}catch(g){}if(void 0===a||null===a||""===a)a="";if("text/html"==b){a=a.replace(this._.metaRegExp,"");if(-1!=a.search(//)||-1!=a.search(//)){var c=a,c=c.substring(c.indexOf("\x3chtml "),c.length),c=c.substring(0,c.lastIndexOf("\x3c/html\x3e")+ +7),a=document.createElement("iframe");a.style.display="none";document.body.appendChild(a);b=a.contentDocument||a.contentWindow.document;b.open();b.write(c);b.close();for(var d,f=b.styleSheets[b.styleSheets.length-1].cssRules,e=0;e