Files
mes-ui-d2/public/lib/UEditor/dialogs/internal.js
liyang 7be7f98586 feat: ueditor
Former-commit-id: 89fa8e42f2e153e6c9b676d668779718714ac333 [formerly 89fa8e42f2e153e6c9b676d668779718714ac333 [formerly 89fa8e42f2e153e6c9b676d668779718714ac333 [formerly 89fa8e42f2e153e6c9b676d668779718714ac333 [formerly 955c03c4e108cbd8aa597fc947a9454e749d904f [formerly 5d8b1d73e78953d5f8e7fe4302764addfc2af0e8]]]]]
Former-commit-id: 002ba25940eac6b1db5af8aa03a75ab43c3eccf3
Former-commit-id: 43f3ff50fc9a0d54bf21479e87da9b72b7fe20c3
Former-commit-id: 32ed9ae714fec2fdd3ba08fb40187e81e837edcb [formerly f34f58804fd798c1e271250f06f245b83f5e7c3e]
Former-commit-id: 17640172e9d4f7b75dc2410e2faa6a93a90e09ac
Former-commit-id: 521e6c1695e24e315d368d27db8f8232fbe30999
Former-commit-id: 3dd3d0a15ab7c64f29148a25fc8c4a0a5eb77497
Former-commit-id: 0753ae560b4ec27771a5b052f73a0a94436f9e0f
Former-commit-id: 9a6f11a43fab5a79df9ab9527453c0f66ad7888d
2018-11-17 18:07:48 +08:00

82 lines
2.6 KiB
JavaScript

(function () {
var parent = window.parent;
//dialog对象
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
//当前打开dialog的编辑器实例
editor = dialog.editor;
UE = parent.UE;
domUtils = UE.dom.domUtils;
utils = UE.utils;
browser = UE.browser;
ajax = UE.ajax;
$G = function ( id ) {
return document.getElementById( id )
};
//focus元素
$focus = function ( node ) {
setTimeout( function () {
if ( browser.ie ) {
var r = node.createTextRange();
r.collapse( false );
r.select();
} else {
node.focus()
}
}, 0 )
};
utils.loadFile(document,{
href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(),
tag:"link",
type:"text/css",
rel:"stylesheet"
});
lang = editor.getLang(dialog.className.split( "-" )[2]);
if(lang){
domUtils.on(window,'load',function () {
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
//针对静态资源
for ( var i in lang["static"] ) {
var dom = $G( i );
if(!dom) continue;
var tagName = dom.tagName,
content = lang["static"][i];
if(content.src){
//clone
content = utils.extend({},content,false);
content.src = langImgPath + content.src;
}
if(content.style){
content = utils.extend({},content,false);
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
}
switch ( tagName.toLowerCase() ) {
case "var":
dom.parentNode.replaceChild( document.createTextNode( content ), dom );
break;
case "select":
var ops = dom.options;
for ( var j = 0, oj; oj = ops[j]; ) {
oj.innerHTML = content.options[j++];
}
for ( var p in content ) {
p != "options" && dom.setAttribute( p, content[p] );
}
break;
default :
domUtils.setAttributes( dom, content);
}
}
} );
}
})();