From 80e5d427d5b84534ebb1c903cf9a297509a1949b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 31 Aug 2017 16:30:57 +0200 Subject: [PATCH] CKEditor: config Hack bei inline initialisierung MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Aus irgendeinem Grund ignoriert der Inline Modus sämtliche Dimensionsangaben in der Konfiguration, und zwar dokumentiert. Das sorgt aber im textarea Modus dafür, dass das erzeugte Editor
völlig falsch dimensioniert ist, und nachträglich angepasst werden muss. Die CKEDITOR.editor.prototype.resize funktioniert dafür auch nicht. Nachträglich machen sorgt für optische Unruhe. Dieser Hack fügt im minified Code in der Datei core/creators/inline.js im Konstruktor die folgenden Anweisungen ein: if (config.width) element.setStyle('width', CKEDITOR.tools.cssLength(config.width)); if (config.height) element.setStyle('height', CKEDITOR.tools.cssLength(config.height)); kurz bevor das Element ins DOM eingefügt wird. (cherry picked from commit a2575f3bc76c9286fcb8447c2b7f674d6d9bfa61) (cherry-pick von odyn) --- js/ckeditor/ckeditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ckeditor/ckeditor.js b/js/ckeditor/ckeditor.js index 6c04f7a55..58baecaa7 100644 --- a/js/ckeditor/ckeditor.js +++ b/js/ckeditor/ckeditor.js @@ -338,7 +338,7 @@ b&&k.find&&(d=d.concat(k.find(a,b)))}return d},addClass:function(a){if(!this.has CKEDITOR.add=function(a){CKEDITOR.instances[a.name]=a;a.on("focus",function(){CKEDITOR.currentInstance!=a&&(CKEDITOR.currentInstance=a,CKEDITOR.fire("currentInstance"))});a.on("blur",function(){CKEDITOR.currentInstance==a&&(CKEDITOR.currentInstance=null,CKEDITOR.fire("currentInstance"))});CKEDITOR.fire("instance",null,a)};CKEDITOR.remove=function(a){delete CKEDITOR.instances[a.name]}; (function(){var a={};CKEDITOR.addTemplate=function(d,b){var c=a[d];if(c)return c;c={name:d,source:b};CKEDITOR.fire("template",c);return a[d]=new CKEDITOR.template(c.source)};CKEDITOR.getTemplate=function(d){return a[d]}})();(function(){var a=[];CKEDITOR.addCss=function(d){a.push(d)};CKEDITOR.getCss=function(){return a.join("\n")}})();CKEDITOR.on("instanceDestroyed",function(){CKEDITOR.tools.isEmpty(this.instances)&&CKEDITOR.fire("reset")});CKEDITOR.TRISTATE_ON=1;CKEDITOR.TRISTATE_OFF=2; CKEDITOR.TRISTATE_DISABLED=0; -(function(){CKEDITOR.inline=function(a,d){if(!CKEDITOR.env.isCompatible)return null;a=CKEDITOR.dom.element.get(a);if(a.getEditor())throw'The editor instance "'+a.getEditor().name+'" is already attached to the provided element.';var b=new CKEDITOR.editor(d,a,CKEDITOR.ELEMENT_MODE_INLINE),c=a.is("textarea")?a:null;c?(b.setData(c.getValue(),null,!0),a=CKEDITOR.dom.element.createFromHtml('\x3cdiv contenteditable\x3d"'+!!b.readOnly+'" class\x3d"cke_textarea_inline"\x3e'+c.getValue()+"\x3c/div\x3e",CKEDITOR.document), +(function(){CKEDITOR.inline=function(a,d){if(!CKEDITOR.env.isCompatible)return null;a=CKEDITOR.dom.element.get(a);if(a.getEditor())throw'The editor instance "'+a.getEditor().name+'" is already attached to the provided element.';var b=new CKEDITOR.editor(d,a,CKEDITOR.ELEMENT_MODE_INLINE),c=a.is("textarea")?a:null;c?(b.setData(c.getValue(),null,!0),a=CKEDITOR.dom.element.createFromHtml('\x3cdiv contenteditable\x3d"'+!!b.readOnly+'" class\x3d"cke_textarea_inline"\x3e'+c.getValue()+"\x3c/div\x3e",CKEDITOR.document),(d.width&&a.setStyle('width',CKEDITOR.tools.cssLength(d.width))),(d.height&&a.setStyle('height',CKEDITOR.tools.cssLength(d.height))), a.insertAfter(c),c.hide(),c.$.form&&b._attachToForm()):b.setData(a.getHtml(),null,!0);b.on("loaded",function(){b.fire("uiReady");b.editable(a);b.container=a;b.ui.contentsElement=a;b.setData(b.getData(1));b.resetDirty();b.fire("contentDom");b.mode="wysiwyg";b.fire("mode");b.status="ready";b.fireOnce("instanceReady");CKEDITOR.fire("instanceReady",null,b)},null,null,1E4);b.on("destroy",function(){c&&(b.container.clearCustomData(),b.container.remove(),c.show());b.element.clearCustomData();delete b.element}); return b};CKEDITOR.inlineAll=function(){var a,d,b;for(b in CKEDITOR.dtd.$editable)for(var c=CKEDITOR.document.getElementsByTag(b),e=0,g=c.count();e