preview.js 813 B

123456789101112131415161718192021222324252627282930313233343536
  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(
  22. '<!DOCTYPE html><html><head><meta charset="utf-8"/><script src="' +
  23. this.options.UEDITOR_HOME_URL +
  24. 'ueditor.parse.js"></script><script>' +
  25. "setTimeout(function(){uParse('div',{rootPath: '" +
  26. this.options.UEDITOR_HOME_URL +
  27. "'})},300)" +
  28. "</script></head><body><div>" +
  29. this.getContent(null, null, true) +
  30. "</div></body></html>"
  31. );
  32. d.close();
  33. },
  34. notNeedUndo: 1
  35. };