preview.js 778 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * 预览
  3. * @file
  4. * @since 1.2.6.1
  5. */
  6. /**
  7. * 预览
  8. * @command preview
  9. * @method execCommand
  10. * @param { String } cmd 命令字符串
  11. * @example
  12. * ```javascript
  13. * editor.execCommand( 'preview' );
  14. * ```
  15. */
  16. UE.commands['preview'] = {
  17. execCommand : function(){
  18. var w = window.open('', '_blank', ''),
  19. d = w.document;
  20. d.open();
  21. d.write('<!DOCTYPE html><html><head><meta charset="utf-8"/><script src="'+this.options.UEDITOR_HOME_URL+'ueditor.parse.js"></script><script>' +
  22. "setTimeout(function(){uParse('div',{rootPath: '"+ this.options.UEDITOR_HOME_URL +"'})},300)" +
  23. '</script></head><body><div>'+this.getContent(null,null,true)+'</div></body></html>');
  24. d.close();
  25. },
  26. notNeedUndo : 1
  27. };