preview.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <style>
  7. html,body{
  8. height:100%;
  9. width:100%;
  10. padding:0;
  11. margin:0;
  12. }
  13. #preview{
  14. width:100%;
  15. height:100%;
  16. padding:0;
  17. margin:0;
  18. }
  19. #preview *{font-family:sans-serif;font-size:16px;}
  20. </style>
  21. <script type="text/javascript" src="../internal.js"></script>
  22. <script src="../../ueditor.parse.js"></script>
  23. <title></title>
  24. </head>
  25. <body class="view">
  26. <div id="preview" style="margin:8px">
  27. </div>
  28. </body>
  29. <script>
  30. var content = editor.getContent();
  31. //前导符号转换 此处用正则会出现异常,无法完全转换成功,暂时使用此方法进行处理
  32. var data_part = content.split("../../");
  33. if(data_part.length>0){
  34. content="";
  35. for(var i = 0;i<data_part.length;i++){
  36. if(i!=data_part.length-1){
  37. content+=data_part[i]+"../../../";
  38. }else{
  39. content+=data_part[i];
  40. }
  41. }
  42. }
  43. document.getElementById('preview').innerHTML = content;
  44. uParse('#preview',{
  45. rootPath : '../../',
  46. chartContainerHeight:500
  47. })
  48. dialog.oncancel = function(){
  49. document.getElementById('preview').innerHTML = '';
  50. }
  51. </script>
  52. </html>