X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsrc%2FRoo_HtmlEditorCore.js.html;h=806a0ecf8f5acf877dd2d6918d7589f5e2af46a6;hb=1fabf2900a91b646b5406619aac5cf18e1550d53;hp=3db7cdcafbc04fb61693cbd8849fb1a073370121;hpb=42f8fea01a43e6eba8c36f5cc9b7318081be8001;p=roojs1 diff --git a/docs/src/Roo_HtmlEditorCore.js.html b/docs/src/Roo_HtmlEditorCore.js.html index 3db7cdcafb..806a0ecf8f 100644 --- a/docs/src/Roo_HtmlEditorCore.js.html +++ b/docs/src/Roo_HtmlEditorCore.js.html @@ -123,6 +123,11 @@ * */ stylesheets: false, + /** + * @cfg {String} language default en - language of text (usefull for rtl languages) + * + */ + language: 'en', /** * @cfg {boolean} allowComments - default false - allow comments in HTML source @@ -191,13 +196,15 @@ 'IMG { cursor: pointer } ' + '</style>'; - var cls = 'roo-htmleditor-body'; + st += '<meta name="google" content="notranslate">' + + var cls = 'notranslate roo-htmleditor-body'; if(this.bodyCls.length){ cls += ' ' + this.bodyCls; } - return '<html><head>' + st + + return '<html class="notranslate" translate="no"><head>' + st + //<style type="text/css">' + //'body{border:0;margin:0;padding:3px;height:98%;cursor:text;}' + //'</style>' + @@ -324,7 +331,8 @@ * @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 @@ -353,18 +361,27 @@ 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; @@ -433,6 +450,7 @@ } Roo.htmleditor.Block.initAll(this.doc.body); + this.updateLanguage(); var lc = this.doc.body.lastChild; if (lc && lc.nodeType == 1 && lc.getAttribute("contenteditable") == "false") { @@ -502,9 +520,11 @@ //var ss = this.el.getStyles( 'background-image', 'background-repeat'); //ss['background-attachment'] = 'fixed'; // w3c dbody.bgProperties = 'fixed'; // ie - //Roo.DomHelper.applyStyles(dbody, ss); + dbody.setAttribute("translate", "no"); + + //Roo.DomHelper.applyStyles(dbody, ss); Roo.EventManager.on(this.doc, { - //'mousedown': this.onEditorEvent, + 'mouseup': this.onEditorEvent, 'dblclick': this.onEditorEvent, 'click': this.onEditorEvent, @@ -535,6 +555,7 @@ this.owner.fireEvent('initialize', this); this.pushValue(); }, + // this is to prevent a href clicks resulting in a redirect? onPasteEvent : function(e,v) { @@ -695,6 +716,7 @@ onEditorEvent : function(e) { + if (e && (e.ctrlKey || e.metaKey) && e.keyCode === 90) { return; // we do not handle this.. (undo manager does..) } @@ -1050,7 +1072,6 @@ - var range = this.createRange(this.getSelection()).cloneRange(); if (Roo.isIE) { @@ -1113,6 +1134,8 @@ return nodes[0]; }, + + createRange: function(sel) { // this has strange effects when using with @@ -1424,6 +1447,16 @@ }, + + updateLanguage : function() + { + if (!this.iframe || !this.iframe.contentDocument) { + return; + } + Roo.get(this.iframe.contentDocument.body).attr("lang", this.language); + }, + + removeStylesheets : function() { var _this = this;