X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-bootstrap-debug.js;h=09a40facf165b3a127dae39fa47a3ba34777c887;hb=7191a9a64df4775b1fa5b15bc938e10303c67ace;hp=69b1f3fe8abb24c7030961e744ea490cb95d2c5e;hpb=c1ef414decde1a42ffaa7da3a3415000fad0653b;p=roojs1 diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 69b1f3fe8a..09a40facf1 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -27035,6 +27035,37 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { text : "Source: ", xns : rooui.Toolbar //Boostrap? }, + { + xtype : 'Button', + text: 'Edit Src', + name : 'image_src', + + listeners : { + click: function (btn, state) + { + + + Roo.MessageBox.show({ + title : "Image Source URL", + msg : "Enter the url for the image", + buttons: this.OKCANCEL, + fn: function(val){ + block().image_src = val; + block().updateElement(); + syncValue(); + toolbar.editorcore.onEditorEvent(); + }, + minWidth:250, + prompt:true, + //multiline: multiline, + modal : true, + value : block().image_src + }); + } + }, + xns : rooui.Toolbar + }, + { xtype : 'TextField', allowBlank : false, @@ -27173,8 +27204,9 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { var img = { tag : 'img', + contenteditable : 'false', src : this.image_src, - alt : d.innerText.replace(/\n/g, " "), // removeHTML.. + alt : d.innerText.replace(/\n/g, " ").replace(/\s+/g, ' ').trim(), // removeHTML and reduce spaces.. style: { width : 'auto', 'max-width': '100%', @@ -27195,6 +27227,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { img = { tag : 'a', href: this.href, + contenteditable : 'true', cn : [ img ] @@ -27259,7 +27292,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { readElement : function(node) { // this should not really come from the link... - this.video_src = this.getVal(node, 'div', 'src'); + this.video_url = this.getVal(node, 'div', 'src'); this.cls = this.getVal(node, 'div', 'class'); this.href = this.getVal(node, 'a', 'href'); @@ -28721,14 +28754,16 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { st += ''; - - var cls = 'roo-htmleditor-body'; + + st += ''; + + var cls = 'notranslate roo-htmleditor-body'; if(this.bodyCls.length){ cls += ' ' + this.bodyCls; } - return '' + st + + return '' + st + //' + @@ -28855,7 +28890,8 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { * @param {String} html The HTML to be cleaned * return {String} The cleaned HTML */ - cleanHtml : function(html){ + cleanHtml : function(html) + { html = String(html); if(html.length > 5){ if(Roo.isSafari){ // strip safari nonsense @@ -28884,18 +28920,27 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { var bd = (this.doc.body || this.doc.documentElement); + var sel = this.win.getSelection(); var div = document.createElement('div'); div.innerHTML = bd.innerHTML; - + var gtx = div.getElementsByClassName('gtx-trans-icon'); // google translate - really annoying and difficult to get rid of. + if (gtx.length > 0) { + var rm = gtx.item(0).parentNode; + rm.parentNode.removeChild(rm); + } + if (this.enableBlocks) { new Roo.htmleditor.FilterBlock({ node : div }); } //?? tidy? + var tidy = new Roo.htmleditor.TidySerializer({ + inner: true + }); + var html = tidy.serialize(div); - var html = div.innerHTML; if(Roo.isSafari){ var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element! var m = bs ? bs.match(/text-align:(.*?);/i) : false; @@ -29034,9 +29079,11 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { //var ss = this.el.getStyles( 'background-image', 'background-repeat'); //ss['background-attachment'] = 'fixed'; // w3c dbody.bgProperties = 'fixed'; // ie + dbody.setAttribute("translate", "no"); + //Roo.DomHelper.applyStyles(dbody, ss); Roo.EventManager.on(this.doc, { - 'mousedown': this.onMouseDown, + 'mouseup': this.onEditorEvent, 'dblclick': this.onEditorEvent, 'click': this.onEditorEvent, @@ -29068,15 +29115,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { this.pushValue(); }, // this is to prevent a href clicks resulting in a redirect? - onMouseDown : function(e) - { - if (e.target.closest('a')) { - e.preventDefault(); - return true; - } - - - }, + onPasteEvent : function(e,v) { // I think we better assume paste is going to be a dirty load of rubish from word.. @@ -29235,6 +29274,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { onEditorEvent : function(e) { + if (e && (e.ctrlKey || e.metaKey) && e.keyCode === 90) { return; // we do not handle this.. (undo manager does..)