spire.officejs-vue-test 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -14,11 +14,11 @@ npm install spire.officejs-vue
|
|
|
14
14
|
// main.ts
|
|
15
15
|
import { createApp } from 'vue'
|
|
16
16
|
import App from './App.vue'
|
|
17
|
-
import
|
|
17
|
+
import officejsEditor from 'spire.officejs-vue'
|
|
18
18
|
|
|
19
19
|
const app = createApp(App)
|
|
20
20
|
|
|
21
|
-
app.use(
|
|
21
|
+
app.use(officejsEditor)
|
|
22
22
|
app.mount('#app')
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -35,8 +35,8 @@ import { ref, onMounted, onBeforeMount } from "vue";
|
|
|
35
35
|
let serverUrl;
|
|
36
36
|
let originUrl;
|
|
37
37
|
let config;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
let file = file; // 此处需要替换为真实的File数据, 通过用户手动选择的文件
|
|
39
|
+
let fileUint8Data = fileUint8Data; // 此处需要替换为真实的File的Uint8Array数据
|
|
40
40
|
const editorTypes = {
|
|
41
41
|
document: "document",
|
|
42
42
|
pdf: "pdf",
|
|
@@ -53,15 +53,16 @@ onBeforeMount(() => {
|
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
function initConfig() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
let tempUrl = new URL(import.meta.url);
|
|
57
|
+
let editorType = '';
|
|
58
|
+
let ext = getFileExtension();
|
|
59
|
+
|
|
59
60
|
if (import.meta.env.DEV) {
|
|
60
61
|
serverUrl = `http://127.0.0.1:3001`;
|
|
61
62
|
originUrl = `http://127.0.0.1:3001`;
|
|
62
63
|
} else if (import.meta.env.PROD) {
|
|
63
|
-
serverUrl = `${tempUrl.origin}/
|
|
64
|
-
originUrl = `${tempUrl.origin}/
|
|
64
|
+
serverUrl = `${tempUrl.origin}/spire.officejs`;
|
|
65
|
+
originUrl = `${tempUrl.origin}/spire.officejs`;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
if(exts_document.includes(ext))
|
|
@@ -143,7 +144,7 @@ function getFileExtension() {
|
|
|
143
144
|
|
|
144
145
|
function onFileSave(data) {
|
|
145
146
|
// 自定义保存逻辑
|
|
146
|
-
console.log("save
|
|
147
|
+
console.log("save successfully!", data);
|
|
147
148
|
}
|
|
148
149
|
<script>
|
|
149
150
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as g, onMounted as m, openBlock as h, createElementBlock as E, createElementVNode as v } from "vue";
|
|
2
2
|
import "./style/index.css";
|
|
3
|
-
import r from "spire.officejs-editors-test";
|
|
3
|
+
import r from "spire.officejs-core-editors-test";
|
|
4
4
|
const w = { class: "spire-officejs-EditorWarpper" }, S = ["id"], A = /* @__PURE__ */ g({
|
|
5
5
|
name: "spire-officejs-Editor",
|
|
6
6
|
__name: "officeJs-editor",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");require("./style/index.css");const n=require("spire.officejs-editors-test"),v={class:"spire-officejs-EditorWarpper"},h=["id"],m=t.defineComponent({name:"spire-officejs-Editor",__name:"officeJs-editor",props:{id:{type:String,default:"SpireofficejsEditor"},config:{type:Object,required:!0},serverUrl:{type:String,default:"http://127.0.0.1:3001"}},setup(o){let s,r,l;const i=o;t.onMounted(()=>{c()});function c(){i.config&&i.config.editorAttrs?(u(),a(),f()):setTimeout(()=>{c()},100)}function p(){if(n&&n.OpenApi){const e=n.OpenApi;s=new e(i.id,l),window.Api=s.GetOpenApi(),g()}}function f(){var e=document.createElement("script"),d=`${r}/editors/spireapi/SpireCloudEditor.js`;e.setAttribute("src",d),e.onload=()=>p(),document.body.appendChild(e)}function u(){l=i.config}function a(){i.serverUrl?i.serverUrl.endsWith("/")?r=i.serverUrl.substring(0,i.serverUrl.length-1):r=i.serverUrl:r=window.location.origin}function g(){let e=document.getElementsByClassName("spire-officejs-EditorWarpper");e.length&&(e[0]&&(e[0].style.height=screen.availHeight+"px"),window.scrollTo(0,-1),e[0]&&(e[0].style.height=window.innerHeight+"px"))}return(e,d)=>(t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("div",{id:o.id},null,8,h)]))}});exports.default=m;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");require("./style/index.css");const n=require("spire.officejs-core-editors-test"),v={class:"spire-officejs-EditorWarpper"},h=["id"],m=t.defineComponent({name:"spire-officejs-Editor",__name:"officeJs-editor",props:{id:{type:String,default:"SpireofficejsEditor"},config:{type:Object,required:!0},serverUrl:{type:String,default:"http://127.0.0.1:3001"}},setup(o){let s,r,l;const i=o;t.onMounted(()=>{c()});function c(){i.config&&i.config.editorAttrs?(u(),a(),f()):setTimeout(()=>{c()},100)}function p(){if(n&&n.OpenApi){const e=n.OpenApi;s=new e(i.id,l),window.Api=s.GetOpenApi(),g()}}function f(){var e=document.createElement("script"),d=`${r}/editors/spireapi/SpireCloudEditor.js`;e.setAttribute("src",d),e.onload=()=>p(),document.body.appendChild(e)}function u(){l=i.config}function a(){i.serverUrl?i.serverUrl.endsWith("/")?r=i.serverUrl.substring(0,i.serverUrl.length-1):r=i.serverUrl:r=window.location.origin}function g(){let e=document.getElementsByClassName("spire-officejs-EditorWarpper");e.length&&(e[0]&&(e[0].style.height=screen.availHeight+"px"),window.scrollTo(0,-1),e[0]&&(e[0].style.height=window.innerHeight+"px"))}return(e,d)=>(t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("div",{id:o.id},null,8,h)]))}});exports.default=m;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spire.officejs-vue-test",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -18,14 +18,7 @@
|
|
|
18
18
|
"**/*.css"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"spire.officejs-
|
|
22
|
-
"spire.officejs-externs-test": "*",
|
|
23
|
-
"spire.officejs-fonts-test": "*",
|
|
24
|
-
"spire.officejs-document-test": "*",
|
|
25
|
-
"spire.officejs-pdf-test": "*",
|
|
26
|
-
"spire.officejs-presentation-test": "*",
|
|
27
|
-
"spire.officejs-common-test": "*",
|
|
28
|
-
"spire.officejs-spreadsheet-test": "*"
|
|
21
|
+
"spire.officejs-core-test": "*"
|
|
29
22
|
},
|
|
30
23
|
"author": "e-iceblue",
|
|
31
24
|
"license": "MIT",
|