view.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="renderer" content="webkit">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
  8. <link rel="mobile-prefetch" href=""/>
  9. <title>文档信息</title>
  10. <script type="text/javascript" src="{$office.onlyoffice}/web-apps/apps/api/documents/api.js"></script>
  11. </head>
  12. <body style="width:100%;height:100vh; margin:0; padding:0">
  13. <div id="placeholder"></div>
  14. <script type="text/javascript">
  15. const url = "{$url}";
  16. const word = ['djvu','doc','docm','docx','docxf','dot','dotm','dotx','epub','fb2','fodt','htm','html','mht','mhtml','odt','oform','ott','oxps','pdf','rtf','stw','sxw','txt','wps','wpt','xml','xps'];
  17. const cell = ['csv','et','ett','fods','ods','ots','sxc','xls','xlsb','xlsm','xlsx','xlt','xltm','xltx','xml'];
  18. const slide = ['dps','dpt','fodp','odp','otp','pot','potm','potx','pps','ppsm','ppsx','ppt','pptm','pptx','sxi'];
  19. let suffix = url.split('.').pop();
  20. let documentType = "word";
  21. if (cell.indexOf(suffix) !== -1) {
  22. documentType = "cell";
  23. }
  24. if (slide.indexOf(suffix) !== -1) {
  25. documentType = "slide";
  26. }
  27. new DocsAPI.DocEditor("placeholder", {
  28. "type" : "desktop",
  29. "documentType" : documentType,//word,cell,side
  30. "document" : {
  31. "title" : "{$title}",
  32. "url" : url,
  33. "key" : "{$key}",
  34. //"fileType" : "doc",
  35. "permissions" : {
  36. "chat": true,
  37. "comment": true,
  38. "copy": true,
  39. "deleteCommentAuthorOnly": false,
  40. "download": true,
  41. "edit": true,
  42. "editCommentAuthorOnly": false,
  43. "fillForms": true,
  44. "modifyContentControl": true,
  45. "modifyFilter": true,
  46. "print": true,
  47. "protect": true,
  48. "review": true
  49. }
  50. },
  51. "editorConfig":{
  52. "lang":"zh-CN",
  53. "mode" : "{$mode}",//view,edit
  54. "forcesave":true,
  55. "createUrl" : "",
  56. "customization": {
  57. "autosave": true,//是否自动保存
  58. "comments": false,
  59. "help": false
  60. },
  61. "user" : {
  62. "id" : "{$admin.id}",
  63. "name" :"{$admin.name}"
  64. },
  65. "callbackUrl":"{$callbackUrl}"
  66. },
  67. "token": "{$token}"
  68. });
  69. </script>
  70. </body>
  71. </html>