dijit._editor.RichText._getIframeDocTxt
dojo.require("dijit._editor.RichText");
defined in dijit/_editor/RichText.js
Usage
function (/*String*/ html) (view source)
var _cs = dojo.getComputedStyle(this.domNode); if(dojo.isIE || (!this.height && !dojo.isMoz)){ html="<div>"+html+"</div>"; } var font = [ _cs.fontWeight, _cs.fontSize, _cs.fontFamily ].join(" "); // line height is tricky - applying a units value will mess things up. // if we can't get a non-units value, bail out. var lineHeight = _cs.lineHeight; if(lineHeight.indexOf("px") >= 0){ lineHeight = parseFloat(lineHeight)/parseFloat(_cs.fontSize); // console.debug(lineHeight); }else if(lineHeight.indexOf("em")>=0){ lineHeight = parseFloat(lineHeight); }else{ lineHeight = "1.0"; } return [ this.isLeftToRight() ? "<html><head>" : "<html dir='rtl'><head>", (dojo.isMoz ? "<title>" + this._localizedIframeTitles.iframeEditTitle + "</title>" : ""), "<style>", "body,html {", " background:transparent;", " font:", font, ";", " padding: 1em 0 0 0;", " margin: -1em 0 0 0;", // remove extraneous vertical scrollbar on safari and firefox " height: 100%;", "}", // TODO: left positioning will cause contents to disappear out of view // if it gets too wide for the visible area "body{", " top:0px; left:0px; right:0px;", ((this.height||dojo.isOpera) ? "" : "position: fixed;"), // FIXME: IE 6 won't understand min-height? " min-height:", this.minHeight, ";", " line-height:", lineHeight, "}", "p{ margin: 1em 0 !important; }", (this.height ? // height:auto undoes the height:100% "" : "body,html{height:auto;overflow-y:hidden;/*for IE*/} body > div {overflow-x:auto;/*for FF to show vertical scrollbar*/}" ), "li > ul:-moz-first-node, li > ol:-moz-first-node{ padding-top: 1.2em; } ", "li{ min-height:1.2em; }", "</style>", this._applyEditingAreaStyleSheets(), "</head><body>"+html+"</body></html>" ].join(""); // String
parameter | type | description |
---|---|---|
html | String |