///import core ///commands 预览 ///commandsName Preview ///commandsTitle 预览 /** * 预览 * @function * @name baidu.editor.execCommand * @param {String} cmdName preview预览编辑器内容 */ UE.commands['preview'] = { execCommand : function(){ var me = this, w = window.open('', '_blank', ""), d = w.document, css = me.document.getElementById("syntaxhighlighter_css"), js = document.getElementById("syntaxhighlighter_js"), // style = "", style = "", cont = me.getContent(); if(browser.ie){ cont = cont.replace(/<\s*br\s*\/?\s*>/gi,'

') } d.open(); d.write(''+style+''+ (css ? '' : '') + (css&&js ? ' ':'') +'' + cont + (css && js ? '':'') + ''); d.close(); }, notNeedUndo : 1 };