sur-onlyoffice 1.0.7 → 1.0.9

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as A, ref as g, onMounted as N, onBeforeUnmount as x, createElementBlock as L, openBlock as S, createCommentVNode as v, createElementVNode as P } from "vue";
2
- const Y = { class: "onlyoffice-box" }, m = "https://test.xuandou.vip:126", R = "https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx", _ = "asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}", j = /* @__PURE__ */ A({
1
+ import { defineComponent as v, ref as b, onMounted as P, onBeforeUnmount as L, createElementBlock as Y, openBlock as R, createCommentVNode as B, createElementVNode as _ } from "vue";
2
+ const j = { class: "onlyoffice-box" }, M = "asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}", U = /* @__PURE__ */ v({
3
3
  __name: "onlyoffice",
4
4
  props: {
5
5
  config: {
@@ -9,7 +9,7 @@ const Y = { class: "onlyoffice-box" }, m = "https://test.xuandou.vip:126", R = "
9
9
  },
10
10
  documentServerUrl: {
11
11
  type: String,
12
- default: "camunda"
12
+ default: ""
13
13
  },
14
14
  onLoadComponentError: {
15
15
  type: Object,
@@ -17,79 +17,86 @@ const Y = { class: "onlyoffice-box" }, m = "https://test.xuandou.vip:126", R = "
17
17
  }
18
18
  }
19
19
  },
20
- setup(B) {
21
- let a = null;
22
- const c = g(!1), d = m + "/web-apps/apps/api/documents/api.js", u = m + "/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";
23
- function p() {
20
+ setup($) {
21
+ let i = null;
22
+ const d = b(!1), a = $;
23
+ console.log(a, "props", a?.documentServerUrl);
24
+ const r = a?.documentServerUrl || "https://test.xuandou.vip:126", f = r + "/web-apps/apps/api/documents/api.js", I = r + "/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";
25
+ function y() {
24
26
  return new Promise((o, e) => {
25
27
  if (window.DocsAPI) return o();
26
28
  const n = document.createElement("script");
27
- n.src = d, n.onload = () => o(), n.onerror = () => e(new Error("加载 DocsAPI 失败:" + d)), document.head.appendChild(n);
29
+ n.src = f, n.onload = () => o(), n.onerror = () => e(new Error("加载 DocsAPI 失败:" + f)), document.head.appendChild(n);
28
30
  });
29
31
  }
30
- const s = [];
31
- let i = null;
32
- function r() {
33
- i === null && (i = window.setInterval(() => {
34
- if (!(!a || typeof a.serviceCommand != "function") && c.value) {
35
- for (; s.length; ) {
36
- const { cmd: o, payload: e } = s.shift();
32
+ const g = [];
33
+ let l = null;
34
+ function m() {
35
+ l === null && (l = window.setInterval(() => {
36
+ if (!(!i || typeof i.serviceCommand != "function") && d.value) {
37
+ for (; g.length; ) {
38
+ const { cmd: o, payload: e } = g.shift();
37
39
  try {
38
- console.log("[ONLYOFFICE] 发送排队指令:", o, e), a.serviceCommand(o, e);
40
+ console.log("[ONLYOFFICE] 发送排队指令:", o, e), i.serviceCommand(o, e);
39
41
  } catch (n) {
40
42
  console.error("[ONLYOFFICE] 队列指令发送失败:", o, n);
41
43
  }
42
44
  }
43
- i !== null && (clearInterval(i), i = null);
45
+ l !== null && (clearInterval(l), l = null);
44
46
  }
45
47
  }, 300));
46
48
  }
47
- async function b() {
48
- await p();
49
- const o = window.DocsAPI;
50
- a?.destroyEditor && a.destroyEditor(), c.value = !1;
51
- const e = {
52
- document: {
53
- fileType: "docx",
54
- title: "Demo.docx",
55
- url: R,
56
- key: "test-key",
57
- permissions: { edit: !0 }
49
+ function u(o, e) {
50
+ const n = { ...o };
51
+ for (const t in e)
52
+ e.hasOwnProperty(t) && (n.hasOwnProperty(t) && typeof n[t] == "object" && n[t] !== null && !Array.isArray(n[t]) && typeof e[t] == "object" && e[t] !== null && !Array.isArray(e[t]) ? n[t] = u(n[t], e[t]) : n[t] = e[t]);
53
+ return n;
54
+ }
55
+ let s = {
56
+ document: {
57
+ fileType: "docx",
58
+ title: "Demo.docx",
59
+ url: "https://qiniu2.xuandou.vip/new.docx",
60
+ key: "test-key",
61
+ permissions: { edit: !0 }
62
+ },
63
+ documentType: "word",
64
+ editorConfig: {
65
+ lang: "zh-CN",
66
+ mode: "edit",
67
+ user: { id: "u1", name: "Tester" },
68
+ plugins: {
69
+ //!
70
+ autostart: [M],
71
+ pluginsData: [{ url: I + "?v=2.0." + Date.now() }]
72
+ // 强刷缓存
73
+ }
74
+ },
75
+ width: "100%",
76
+ height: "100%",
77
+ events: {
78
+ onPluginsReady: () => {
79
+ console.log("[ONLYOFFICE] 插件资源已加载,但不代表已初始化");
58
80
  },
59
- documentType: "word",
60
- editorConfig: {
61
- lang: "zh-CN",
62
- mode: "edit",
63
- user: { id: "u1", name: "Tester" },
64
- plugins: {
65
- //!
66
- autostart: [_],
67
- pluginsData: [{ url: u + "?v=2.0." + Date.now() }]
68
- // 强刷缓存
69
- }
81
+ onDocumentReady: () => {
82
+ console.log("[ONLYOFFICE] 文档已就绪"), C(), m(), console.log("window.Asc.plugin1", window?.Asc?.plugin), setTimeout(() => {
83
+ console.log("window.Asc.plugin2", window), console.log("window.Asc.plugin3-editor", i.serviceCommand), i.serviceCommand("event_onAddComment", { id: 111 });
84
+ }, 2e3);
70
85
  },
71
- width: "100%",
72
- height: "100%",
73
- events: {
74
- onPluginsReady: () => {
75
- console.log("[ONLYOFFICE] 插件资源已加载,但不代表已初始化");
76
- },
77
- onDocumentReady: () => {
78
- console.log("[ONLYOFFICE] 文档已就绪"), $(), r(), console.log("window.Asc.plugin1", window?.Asc?.plugin), setTimeout(() => {
79
- console.log("window.Asc.plugin2", window), console.log("window.Asc.plugin3-editor", a.serviceCommand), a.serviceCommand("event_onAddComment", { id: 111 });
80
- }, 2e3);
81
- },
82
- onInfo: (n) => {
83
- const t = n?.data;
84
- console.log("[ONLYOFFICE] Info 事件:", n.data), n && (t?.command === "openPlugin" && (console.log("[ONLYOFFICE] openPlugin"), a.frame?.contentWindow?.Common?.Gateway?.sendInfo(t)), n.data.command === "pluginInitialized" && (c.value = !0, console.log("[ONLYOFFICE] 插件初始化完成"), r()), n.data.command === "pluginAck" && console.log("[ONLYOFFICE] 插件确认收到:", n.data), n.data.command === "pluginError" && console.error("[ONLYOFFICE] 插件错误:", n.data), n.data.command === "linkClicked" && (console.log("[ONLYOFFICE] 链接被点击,数据:", n.data.data), I(n.data.data)), n.data.command === "wordArtInserted" && (console.log("[ONLYOFFICE] WordArt 插入成功:", n.data.data), h(n.data.data)), n.data.command === "wordArtError" && (console.error("[ONLYOFFICE] WordArt 插入失败:", n.data.data), y(n.data.data)), n.data.command === "tableClicked" && (console.log("[ONLYOFFICE] 表格被点击,数据:", n.data.data), C(n.data.data)), n.data.command === "selectionAnalyzed" && (console.log("[ONLYOFFICE] 选中内容分析结果:", n.data.data), D(n.data.data)), n.data.command === "selectionBound" && (console.log("[ONLYOFFICE] 选中内容绑定完成:", n.data.data), E(n.data.data)), n.data.command === "bindingClicked" && (console.log("[ONLYOFFICE] 绑定控件被点击:", n.data.data), w(n.data.data)), n.data.command === "elementClicked" && (console.log("[ONLYOFFICE] 元素被点击:", n.data.data), F(n.data.data)), n.data.command === "preciseTableCellClicked" && (console.log("[ONLYOFFICE] 精确表格单元格被点击:", n.data.data), O(n.data.data)), n.data.command === "chartClicked" && (console.log("[ONLYOFFICE] 图表被点击:", n.data.data), T(n.data.data)));
85
- }
86
+ onInfo: (o) => {
87
+ const e = o?.data;
88
+ console.log("[ONLYOFFICE] Info 事件:", o.data), o && (e?.command === "openPlugin" && (console.log("[ONLYOFFICE] openPlugin"), i.frame?.contentWindow?.Common?.Gateway?.sendInfo(e)), o.data.command === "pluginInitialized" && (d.value = !0, console.log("[ONLYOFFICE] 插件初始化完成"), m()), o.data.command === "pluginAck" && console.log("[ONLYOFFICE] 插件确认收到:", o.data), o.data.command === "pluginError" && console.error("[ONLYOFFICE] 插件错误:", o.data), o.data.command === "linkClicked" && (console.log("[ONLYOFFICE] 链接被点击,数据:", o.data.data), D(o.data.data)), o.data.command === "wordArtInserted" && (console.log("[ONLYOFFICE] WordArt 插入成功:", o.data.data), O(o.data.data)), o.data.command === "wordArtError" && (console.error("[ONLYOFFICE] WordArt 插入失败:", o.data.data), E(o.data.data)), o.data.command === "tableClicked" && (console.log("[ONLYOFFICE] 表格被点击,数据:", o.data.data), w(o.data.data)), o.data.command === "selectionAnalyzed" && (console.log("[ONLYOFFICE] 选中内容分析结果:", o.data.data), F(o.data.data)), o.data.command === "selectionBound" && (console.log("[ONLYOFFICE] 选中内容绑定完成:", o.data.data), T(o.data.data)), o.data.command === "bindingClicked" && (console.log("[ONLYOFFICE] 绑定控件被点击:", o.data.data), x(o.data.data)), o.data.command === "elementClicked" && (console.log("[ONLYOFFICE] 元素被点击:", o.data.data), A(o.data.data)), o.data.command === "preciseTableCellClicked" && (console.log("[ONLYOFFICE] 精确表格单元格被点击:", o.data.data), k(o.data.data)), o.data.command === "chartClicked" && (console.log("[ONLYOFFICE] 图表被点击:", o.data.data), N(o.data.data)));
86
89
  }
87
- };
88
- a = new o.DocEditor("editor", e);
90
+ }
91
+ };
92
+ async function h() {
93
+ await y();
94
+ const o = window.DocsAPI;
95
+ i?.destroyEditor && i.destroyEditor(), d.value = !1, a.config && (s = u(s, a.config)), i = new o.DocEditor("editor", s);
89
96
  }
90
- function $() {
97
+ function C() {
91
98
  try {
92
- a.executeCommand && a.executeCommand("focus"), console.log("autoOpenPluginSidePanel", a), a.serviceCommand && a.serviceCommand("sidePanel", {
99
+ i.executeCommand && i.executeCommand("focus"), console.log("autoOpenPluginSidePanel", i), i.serviceCommand && i.serviceCommand("sidePanel", {
93
100
  action: "toggle",
94
101
  state: !1
95
102
  });
@@ -97,10 +104,10 @@ const Y = { class: "onlyoffice-box" }, m = "https://test.xuandou.vip:126", R = "
97
104
  console.error("auto-open plugin failed:", o);
98
105
  }
99
106
  }
100
- function I(o) {
107
+ function D(o) {
101
108
  console.log("处理链接点击事件,收到数据:", o), o && typeof o == "object" && (`${o.controlId || "unknown"}${o.controlTitle || "无标题"}${o.tag || "无Tag"}${JSON.stringify(o.data, null, 2)}${JSON.stringify(o, null, 2)}`, o.data && o.data.name && console.log("检测到用户名:", o.data.name));
102
109
  }
103
- function h(o) {
110
+ function O(o) {
104
111
  if (console.log("WordArt 插入成功,数据:", o), o && o.success) {
105
112
  const e = `WordArt 插入成功!
106
113
 
@@ -115,10 +122,10 @@ ${o.message || ""}`;
115
122
  点击"确定"可继续插入更多WordArt`) && console.log("用户选择继续操作WordArt");
116
123
  }
117
124
  }
118
- function y(o) {
125
+ function E(o) {
119
126
  console.error("WordArt 插入失败,错误:", o), o?.error;
120
127
  }
121
- function C(o) {
128
+ function w(o) {
122
129
  if (console.log("处理表格点击事件,收到数据:", o), o && o.success && o.data) {
123
130
  const e = o.data;
124
131
  let n = `表格被点击!
@@ -136,8 +143,8 @@ ${o.message || ""}`;
136
143
  `, n += `- 列数: ${e.tableData.columns}
137
144
  `, e.tableData.content && e.tableData.content.length > 0 && (n += `
138
145
  表格内容预览:
139
- `, e.tableData.content.slice(0, 3).forEach((t, l) => {
140
- n += `第${l + 1}行: [${t.join(", ")}]
146
+ `, e.tableData.content.slice(0, 3).forEach((t, c) => {
147
+ n += `第${c + 1}行: [${t.join(", ")}]
141
148
  `;
142
149
  }), e.tableData.content.length > 3 && (n += `... 还有 ${e.tableData.content.length - 3} 行
143
150
  `)))) : (n += `点击类型: 非表格区域
@@ -149,7 +156,7 @@ ${o.message || ""}`;
149
156
  } else
150
157
  console.log("表格点击检测失败:", o?.error || "未知错误");
151
158
  }
152
- function D(o) {
159
+ function F(o) {
153
160
  if (console.log("处理选中内容分析结果,收到数据:", o), o && o.success && o.data) {
154
161
  const e = o.data;
155
162
  let n = `选中内容分析结果!
@@ -160,8 +167,8 @@ ${o.message || ""}`;
160
167
  `, n += `选中内容: "${e.content.substring(0, 50)}${e.content.length > 50 ? "..." : ""}"
161
168
 
162
169
  `, e.suggestedBindings && e.suggestedBindings.length > 0 && (n += `建议的绑定方式:
163
- `, e.suggestedBindings.slice(0, 3).forEach((t, l) => {
164
- n += `${l + 1}. ${t.description} (${t.category})
170
+ `, e.suggestedBindings.slice(0, 3).forEach((t, c) => {
171
+ n += `${c + 1}. ${t.description} (${t.category})
165
172
  `;
166
173
  }), e.suggestedBindings.length > 3 && (n += `... 还有 ${e.suggestedBindings.length - 3} 种绑定方式
167
174
  `)), n += `
@@ -169,7 +176,7 @@ ${o.message || ""}`;
169
176
  } else
170
177
  console.log("选中内容分析失败:", o?.error || "未知错误");
171
178
  }
172
- function E(o) {
179
+ function T(o) {
173
180
  if (console.log("处理选中内容绑定完成,收到数据:", o), o && o.success) {
174
181
  const e = o.data;
175
182
  let n = `数据绑定完成!
@@ -185,7 +192,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
185
192
  } else
186
193
  console.log("数据绑定失败:", o?.error || "未知错误");
187
194
  }
188
- function F(o) {
195
+ function A(o) {
189
196
  if (console.log("🎯 处理通用元素点击事件,收到数据:", o), o && o.success && o.data) {
190
197
  const e = o.data;
191
198
  let n = `🎯 元素点击检测结果!
@@ -202,8 +209,8 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
202
209
  `, n += `- 单元格内容: "${e.elementInfo.clickedCellInfo?.content || "空"}"
203
210
  `), e.elementInfo.sampleContent && e.elementInfo.sampleContent.length > 0 && (n += `
204
211
  📋 表格内容预览:
205
- `, e.elementInfo.sampleContent.slice(0, 2).forEach((t, l) => {
206
- n += `第${l + 1}行: [${t.slice(0, 3).join(", ")}${t.length > 3 ? "..." : ""}]
212
+ `, e.elementInfo.sampleContent.slice(0, 2).forEach((t, c) => {
213
+ n += `第${c + 1}行: [${t.slice(0, 3).join(", ")}${t.length > 3 ? "..." : ""}]
207
214
  `;
208
215
  }))) : e.clickType === "paragraph" ? (n += `📝 段落信息:
209
216
  `, n += `- 段落索引: ${e.elementInfo.paragraphIndex}
@@ -226,7 +233,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
226
233
  } else
227
234
  console.log("❌ 通用元素检测失败:", o?.error || "未知错误");
228
235
  }
229
- function O(o) {
236
+ function k(o) {
230
237
  if (console.log("📊 处理精确表格单元格点击事件,收到数据:", o), o && o.success && o.data) {
231
238
  const e = o.data;
232
239
  let n = `📊 精确表格单元格点击!
@@ -251,7 +258,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
251
258
  } else
252
259
  console.log("❌ 精确表格单元格检测失败:", o?.error || "未知错误");
253
260
  }
254
- function T(o) {
261
+ function N(o) {
255
262
  if (console.log("📈 处理图表点击事件,收到数据:", o), o && o.success && o.data) {
256
263
  const e = o.data;
257
264
  let n = `📈 图表点击检测结果!
@@ -315,7 +322,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
315
322
  `), console.log("📈 图表绑定数据:", e.boundData), e.boundData && (e.boundData.type === "line-chart" ? console.log("📈 这是线图,可以显示趋势分析") : e.boundData.type === "bar-chart" && console.log("📊 这是柱状图,可以显示比较分析"), e.boundData.dataSource === "ERP系统" && console.log("🔄 可以触发ERP系统数据刷新"));
316
323
  } else o && o.success === !1 && console.log("❌ 图表检测失败或无图表:", o.error || "未知错误");
317
324
  }
318
- function w(o) {
325
+ function x(o) {
319
326
  if (console.log("处理绑定控件点击事件,收到数据:", o), o && o.success && o.data) {
320
327
  const e = o.data;
321
328
  let n = "绑定控件被点击!\\n\\n";
@@ -326,17 +333,17 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
326
333
  } else
327
334
  console.log("绑定控件点击检测失败或无绑定控件:", o?.error || "未知错误"), o?.data?.clickType === "non-binding" && console.log("当前点击位置不是绑定控件");
328
335
  }
329
- let f = g(!1);
330
- const k = (o) => {
336
+ let p = b(!1);
337
+ const S = (o) => {
331
338
  o.data.eventType === "customEventReplay" && console.info(o, "DDD11"), o.data.eventType === "customEventCommon" && console.info(o, "DDD22");
332
339
  };
333
- return N(async () => {
334
- await b(), f.value ? console.warn("⚠️ 消息监听器已存在,跳过重复注册") : (window.addEventListener("message", k), f.value = !0, console.log("✅ 消息监听器已注册"));
335
- }), x(() => {
336
- a?.destroyEditor && a.destroyEditor(), i !== null && clearInterval(i);
337
- }), (o, e) => (S(), L("div", Y, [
338
- v("", !0),
339
- e[1] || (e[1] = P("div", {
340
+ return P(async () => {
341
+ await h(), p.value ? console.warn("⚠️ 消息监听器已存在,跳过重复注册") : (window.addEventListener("message", S), p.value = !0, console.log("✅ 消息监听器已注册"));
342
+ }), L(() => {
343
+ i?.destroyEditor && i.destroyEditor(), l !== null && clearInterval(l);
344
+ }), (o, e) => (R(), Y("div", j, [
345
+ B("", !0),
346
+ e[1] || (e[1] = _("div", {
340
347
  id: "editor",
341
348
  style: { flex: "1" }
342
349
  }, null, -1))
@@ -344,5 +351,5 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
344
351
  }
345
352
  });
346
353
  export {
347
- j as onlyoffice
354
+ U as onlyoffice
348
355
  };
@@ -1,4 +1,4 @@
1
- (function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.OnlyofficeUI={},l.Vue))})(this,(function(l,a){"use strict";const p={class:"onlyoffice-box"},r="https://test.xuandou.vip:126",b="https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx",$="asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}",I=a.defineComponent({__name:"onlyoffice",props:{config:{type:Object,default:()=>{}},documentServerUrl:{type:String,default:"camunda"},onLoadComponentError:{type:Object,default:()=>{}}},setup(P){let i=null;const s=a.ref(!1),f=r+"/web-apps/apps/api/documents/api.js",h=r+"/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";function y(){return new Promise((o,e)=>{if(window.DocsAPI)return o();const n=document.createElement("script");n.src=f,n.onload=()=>o(),n.onerror=()=>e(new Error("加载 DocsAPI 失败:"+f)),document.head.appendChild(n)})}const g=[];let c=null;function m(){c===null&&(c=window.setInterval(()=>{if(!(!i||typeof i.serviceCommand!="function")&&s.value){for(;g.length;){const{cmd:o,payload:e}=g.shift();try{console.log("[ONLYOFFICE] 发送排队指令:",o,e),i.serviceCommand(o,e)}catch(n){console.error("[ONLYOFFICE] 队列指令发送失败:",o,n)}}c!==null&&(clearInterval(c),c=null)}},300))}async function C(){await y();const o=window.DocsAPI;i?.destroyEditor&&i.destroyEditor(),s.value=!1;const e={document:{fileType:"docx",title:"Demo.docx",url:b,key:"test-key",permissions:{edit:!0}},documentType:"word",editorConfig:{lang:"zh-CN",mode:"edit",user:{id:"u1",name:"Tester"},plugins:{autostart:[$],pluginsData:[{url:h+"?v=2.0."+Date.now()}]}},width:"100%",height:"100%",events:{onPluginsReady:()=>{console.log("[ONLYOFFICE] 插件资源已加载,但不代表已初始化")},onDocumentReady:()=>{console.log("[ONLYOFFICE] 文档已就绪"),D(),m(),console.log("window.Asc.plugin1",window?.Asc?.plugin),setTimeout(()=>{console.log("window.Asc.plugin2",window),console.log("window.Asc.plugin3-editor",i.serviceCommand),i.serviceCommand("event_onAddComment",{id:111})},2e3)},onInfo:n=>{const t=n?.data;console.log("[ONLYOFFICE] Info 事件:",n.data),n&&(t?.command==="openPlugin"&&(console.log("[ONLYOFFICE] openPlugin"),i.frame?.contentWindow?.Common?.Gateway?.sendInfo(t)),n.data.command==="pluginInitialized"&&(s.value=!0,console.log("[ONLYOFFICE] 插件初始化完成"),m()),n.data.command==="pluginAck"&&console.log("[ONLYOFFICE] 插件确认收到:",n.data),n.data.command==="pluginError"&&console.error("[ONLYOFFICE] 插件错误:",n.data),n.data.command==="linkClicked"&&(console.log("[ONLYOFFICE] 链接被点击,数据:",n.data.data),O(n.data.data)),n.data.command==="wordArtInserted"&&(console.log("[ONLYOFFICE] WordArt 插入成功:",n.data.data),T(n.data.data)),n.data.command==="wordArtError"&&(console.error("[ONLYOFFICE] WordArt 插入失败:",n.data.data),E(n.data.data)),n.data.command==="tableClicked"&&(console.log("[ONLYOFFICE] 表格被点击,数据:",n.data.data),F(n.data.data)),n.data.command==="selectionAnalyzed"&&(console.log("[ONLYOFFICE] 选中内容分析结果:",n.data.data),w(n.data.data)),n.data.command==="selectionBound"&&(console.log("[ONLYOFFICE] 选中内容绑定完成:",n.data.data),k(n.data.data)),n.data.command==="bindingClicked"&&(console.log("[ONLYOFFICE] 绑定控件被点击:",n.data.data),S(n.data.data)),n.data.command==="elementClicked"&&(console.log("[ONLYOFFICE] 元素被点击:",n.data.data),A(n.data.data)),n.data.command==="preciseTableCellClicked"&&(console.log("[ONLYOFFICE] 精确表格单元格被点击:",n.data.data),N(n.data.data)),n.data.command==="chartClicked"&&(console.log("[ONLYOFFICE] 图表被点击:",n.data.data),x(n.data.data)))}}};i=new o.DocEditor("editor",e)}function D(){try{i.executeCommand&&i.executeCommand("focus"),console.log("autoOpenPluginSidePanel",i),i.serviceCommand&&i.serviceCommand("sidePanel",{action:"toggle",state:!1})}catch(o){console.error("auto-open plugin failed:",o)}}function O(o){console.log("处理链接点击事件,收到数据:",o),o&&typeof o=="object"&&(`${o.controlId||"unknown"}${o.controlTitle||"无标题"}${o.tag||"无Tag"}${JSON.stringify(o.data,null,2)}${JSON.stringify(o,null,2)}`,o.data&&o.data.name&&console.log("检测到用户名:",o.data.name))}function T(o){if(console.log("WordArt 插入成功,数据:",o),o&&o.success){const e=`WordArt 插入成功!
1
+ (function(a,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(a=typeof globalThis<"u"?globalThis:a||self,l(a.OnlyofficeUI={},a.Vue))})(this,(function(a,l){"use strict";const y={class:"onlyoffice-box"},I="asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}",h=l.defineComponent({__name:"onlyoffice",props:{config:{type:Object,default:()=>{}},documentServerUrl:{type:String,default:""},onLoadComponentError:{type:Object,default:()=>{}}},setup(C){let i=null;const r=l.ref(!1),d=C;console.log(d,"props",d?.documentServerUrl);const g=d?.documentServerUrl||"https://test.xuandou.vip:126",u=g+"/web-apps/apps/api/documents/api.js",D=g+"/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";function O(){return new Promise((o,e)=>{if(window.DocsAPI)return o();const n=document.createElement("script");n.src=u,n.onload=()=>o(),n.onerror=()=>e(new Error("加载 DocsAPI 失败:"+u)),document.head.appendChild(n)})}const m=[];let c=null;function p(){c===null&&(c=window.setInterval(()=>{if(!(!i||typeof i.serviceCommand!="function")&&r.value){for(;m.length;){const{cmd:o,payload:e}=m.shift();try{console.log("[ONLYOFFICE] 发送排队指令:",o,e),i.serviceCommand(o,e)}catch(n){console.error("[ONLYOFFICE] 队列指令发送失败:",o,n)}}c!==null&&(clearInterval(c),c=null)}},300))}function b(o,e){const n={...o};for(const t in e)e.hasOwnProperty(t)&&(n.hasOwnProperty(t)&&typeof n[t]=="object"&&n[t]!==null&&!Array.isArray(n[t])&&typeof e[t]=="object"&&e[t]!==null&&!Array.isArray(e[t])?n[t]=b(n[t],e[t]):n[t]=e[t]);return n}let f={document:{fileType:"docx",title:"Demo.docx",url:"https://qiniu2.xuandou.vip/new.docx",key:"test-key",permissions:{edit:!0}},documentType:"word",editorConfig:{lang:"zh-CN",mode:"edit",user:{id:"u1",name:"Tester"},plugins:{autostart:[I],pluginsData:[{url:D+"?v=2.0."+Date.now()}]}},width:"100%",height:"100%",events:{onPluginsReady:()=>{console.log("[ONLYOFFICE] 插件资源已加载,但不代表已初始化")},onDocumentReady:()=>{console.log("[ONLYOFFICE] 文档已就绪"),E(),p(),console.log("window.Asc.plugin1",window?.Asc?.plugin),setTimeout(()=>{console.log("window.Asc.plugin2",window),console.log("window.Asc.plugin3-editor",i.serviceCommand),i.serviceCommand("event_onAddComment",{id:111})},2e3)},onInfo:o=>{const e=o?.data;console.log("[ONLYOFFICE] Info 事件:",o.data),o&&(e?.command==="openPlugin"&&(console.log("[ONLYOFFICE] openPlugin"),i.frame?.contentWindow?.Common?.Gateway?.sendInfo(e)),o.data.command==="pluginInitialized"&&(r.value=!0,console.log("[ONLYOFFICE] 插件初始化完成"),p()),o.data.command==="pluginAck"&&console.log("[ONLYOFFICE] 插件确认收到:",o.data),o.data.command==="pluginError"&&console.error("[ONLYOFFICE] 插件错误:",o.data),o.data.command==="linkClicked"&&(console.log("[ONLYOFFICE] 链接被点击,数据:",o.data.data),w(o.data.data)),o.data.command==="wordArtInserted"&&(console.log("[ONLYOFFICE] WordArt 插入成功:",o.data.data),F(o.data.data)),o.data.command==="wordArtError"&&(console.error("[ONLYOFFICE] WordArt 插入失败:",o.data.data),A(o.data.data)),o.data.command==="tableClicked"&&(console.log("[ONLYOFFICE] 表格被点击,数据:",o.data.data),k(o.data.data)),o.data.command==="selectionAnalyzed"&&(console.log("[ONLYOFFICE] 选中内容分析结果:",o.data.data),N(o.data.data)),o.data.command==="selectionBound"&&(console.log("[ONLYOFFICE] 选中内容绑定完成:",o.data.data),S(o.data.data)),o.data.command==="bindingClicked"&&(console.log("[ONLYOFFICE] 绑定控件被点击:",o.data.data),v(o.data.data)),o.data.command==="elementClicked"&&(console.log("[ONLYOFFICE] 元素被点击:",o.data.data),x(o.data.data)),o.data.command==="preciseTableCellClicked"&&(console.log("[ONLYOFFICE] 精确表格单元格被点击:",o.data.data),P(o.data.data)),o.data.command==="chartClicked"&&(console.log("[ONLYOFFICE] 图表被点击:",o.data.data),L(o.data.data)))}}};async function T(){await O();const o=window.DocsAPI;i?.destroyEditor&&i.destroyEditor(),r.value=!1,d.config&&(f=b(f,d.config)),i=new o.DocEditor("editor",f)}function E(){try{i.executeCommand&&i.executeCommand("focus"),console.log("autoOpenPluginSidePanel",i),i.serviceCommand&&i.serviceCommand("sidePanel",{action:"toggle",state:!1})}catch(o){console.error("auto-open plugin failed:",o)}}function w(o){console.log("处理链接点击事件,收到数据:",o),o&&typeof o=="object"&&(`${o.controlId||"unknown"}${o.controlTitle||"无标题"}${o.tag||"无Tag"}${JSON.stringify(o.data,null,2)}${JSON.stringify(o,null,2)}`,o.data&&o.data.name&&console.log("检测到用户名:",o.data.name))}function F(o){if(console.log("WordArt 插入成功,数据:",o),o&&o.success){const e=`WordArt 插入成功!
2
2
 
3
3
  文本: ${o.parameters?.text||"未知"}
4
4
  字体大小: ${o.parameters?.fontSize||"未知"}
@@ -7,7 +7,7 @@
7
7
 
8
8
  ${o.message||""}`;confirm(e+`
9
9
 
10
- 点击"确定"可继续插入更多WordArt`)&&console.log("用户选择继续操作WordArt")}}function E(o){console.error("WordArt 插入失败,错误:",o),o?.error}function F(o){if(console.log("处理表格点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`表格被点击!
10
+ 点击"确定"可继续插入更多WordArt`)&&console.log("用户选择继续操作WordArt")}}function A(o){console.error("WordArt 插入失败,错误:",o),o?.error}function k(o){if(console.log("处理表格点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`表格被点击!
11
11
 
12
12
  `;e.clickType==="table"?(n+=`点击类型: 表格内容
13
13
  `,n+=`表格索引: ${e.tableIndex>=0?e.tableIndex:"未知"}
@@ -21,21 +21,21 @@ ${o.message||""}`;confirm(e+`
21
21
  `,n+=`- 列数: ${e.tableData.columns}
22
22
  `,e.tableData.content&&e.tableData.content.length>0&&(n+=`
23
23
  表格内容预览:
24
- `,e.tableData.content.slice(0,3).forEach((t,d)=>{n+=`第${d+1}行: [${t.join(", ")}]
24
+ `,e.tableData.content.slice(0,3).forEach((t,s)=>{n+=`第${s+1}行: [${t.join(", ")}]
25
25
  `}),e.tableData.content.length>3&&(n+=`... 还有 ${e.tableData.content.length-3} 行
26
26
  `)))):(n+=`点击类型: 非表格区域
27
27
  `,n+=`点击时间: ${e.timestamp}
28
- `),e.clickType==="table"&&e.tableData&&console.log("检测到表格点击,可以执行相关操作:",{tableIndex:e.tableIndex,tableData:e.tableData})}else console.log("表格点击检测失败:",o?.error||"未知错误")}function w(o){if(console.log("处理选中内容分析结果,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`选中内容分析结果!
28
+ `),e.clickType==="table"&&e.tableData&&console.log("检测到表格点击,可以执行相关操作:",{tableIndex:e.tableIndex,tableData:e.tableData})}else console.log("表格点击检测失败:",o?.error||"未知错误")}function N(o){if(console.log("处理选中内容分析结果,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`选中内容分析结果!
29
29
 
30
30
  `;n+=`选择类型: ${e.selectionType}
31
31
  `,n+=`是否可绑定: ${e.bindable?"是":"否"}
32
32
  `,n+=`选中内容: "${e.content.substring(0,50)}${e.content.length>50?"...":""}"
33
33
 
34
34
  `,e.suggestedBindings&&e.suggestedBindings.length>0&&(n+=`建议的绑定方式:
35
- `,e.suggestedBindings.slice(0,3).forEach((t,d)=>{n+=`${d+1}. ${t.description} (${t.category})
35
+ `,e.suggestedBindings.slice(0,3).forEach((t,s)=>{n+=`${s+1}. ${t.description} (${t.category})
36
36
  `}),e.suggestedBindings.length>3&&(n+=`... 还有 ${e.suggestedBindings.length-3} 种绑定方式
37
37
  `)),n+=`
38
- 分析时间: ${e.timestamp}`,e.bindable&&console.log("内容可以绑定,建议绑定方式:",e.suggestedBindings)}else console.log("选中内容分析失败:",o?.error||"未知错误")}function k(o){if(console.log("处理选中内容绑定完成,收到数据:",o),o&&o.success){const e=o.data;let n=`数据绑定完成!
38
+ 分析时间: ${e.timestamp}`,e.bindable&&console.log("内容可以绑定,建议绑定方式:",e.suggestedBindings)}else console.log("选中内容分析失败:",o?.error||"未知错误")}function S(o){if(console.log("处理选中内容绑定完成,收到数据:",o),o&&o.success){const e=o.data;let n=`数据绑定完成!
39
39
 
40
40
  `;n+=`绑定方法: ${e.method}
41
41
  `,n+=`绑定类型: ${e.binding?.type||"未知"}
@@ -43,7 +43,7 @@ ${o.message||""}`;confirm(e+`
43
43
  `),e.binding.dataType&&(n+=`数据类型: ${e.binding.dataType}
44
44
  `),e.binding.originalValue&&(n+=`原始值: "${e.binding.originalValue}"
45
45
  `)),n+=`
46
- ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else console.log("数据绑定失败:",o?.error||"未知错误")}function A(o){if(console.log("🎯 处理通用元素点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`🎯 元素点击检测结果!
46
+ ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else console.log("数据绑定失败:",o?.error||"未知错误")}function x(o){if(console.log("🎯 处理通用元素点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`🎯 元素点击检测结果!
47
47
 
48
48
  `;n+=`点击类型: ${e.clickType}
49
49
  `,n+=`检测时间: ${e.timestamp}
@@ -56,7 +56,7 @@ ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else c
56
56
  `,n+=`- 单元格内容: "${e.elementInfo.clickedCellInfo?.content||"空"}"
57
57
  `),e.elementInfo.sampleContent&&e.elementInfo.sampleContent.length>0&&(n+=`
58
58
  📋 表格内容预览:
59
- `,e.elementInfo.sampleContent.slice(0,2).forEach((t,d)=>{n+=`第${d+1}行: [${t.slice(0,3).join(", ")}${t.length>3?"...":""}]
59
+ `,e.elementInfo.sampleContent.slice(0,2).forEach((t,s)=>{n+=`第${s+1}行: [${t.slice(0,3).join(", ")}${t.length>3?"...":""}]
60
60
  `}))):e.clickType==="paragraph"?(n+=`📝 段落信息:
61
61
  `,n+=`- 段落索引: ${e.elementInfo.paragraphIndex}
62
62
  `,n+=`- 对齐方式: ${e.elementInfo.alignment}
@@ -74,7 +74,7 @@ ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else c
74
74
  `,n+=`- 表格: ${e.fullScanResults.tablesFound}个
75
75
  `,n+=`- 段落: ${e.fullScanResults.paragraphsFound}个
76
76
  `,n+=`- 图形: ${e.fullScanResults.shapesFound}个
77
- `),console.log("🎯 元素类型:",e.clickType,"详细信息:",e.elementInfo)}else console.log("❌ 通用元素检测失败:",o?.error||"未知错误")}function N(o){if(console.log("📊 处理精确表格单元格点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`📊 精确表格单元格点击!
77
+ `),console.log("🎯 元素类型:",e.clickType,"详细信息:",e.elementInfo)}else console.log("❌ 通用元素检测失败:",o?.error||"未知错误")}function P(o){if(console.log("📊 处理精确表格单元格点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`📊 精确表格单元格点击!
78
78
 
79
79
  `;n+=`🎯 单元格位置:
80
80
  `,n+=`- 行: 第${e.cellPosition.row}行
@@ -86,7 +86,7 @@ ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else c
86
86
  `,n+=`- 总列数: ${e.tableInfo.totalColumns}
87
87
  `,n+=`- 检测方法: ${e.detectionMethod}
88
88
  `,n+=`- 检测时间: ${e.timestamp}
89
- `,console.log("📊 精确单元格信息:",{row:e.cellPosition.row,column:e.cellPosition.column,content:e.cellContent,tableInfo:e.tableInfo}),e.cellPosition.row===1?console.log("🎯 点击了表头行,可以执行排序等操作"):console.log("🎯 点击了数据行,可以执行编辑等操作")}else console.log("❌ 精确表格单元格检测失败:",o?.error||"未知错误")}function x(o){if(console.log("📈 处理图表点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`📈 图表点击检测结果!
89
+ `,console.log("📊 精确单元格信息:",{row:e.cellPosition.row,column:e.cellPosition.column,content:e.cellContent,tableInfo:e.tableInfo}),e.cellPosition.row===1?console.log("🎯 点击了表头行,可以执行排序等操作"):console.log("🎯 点击了数据行,可以执行编辑等操作")}else console.log("❌ 精确表格单元格检测失败:",o?.error||"未知错误")}function L(o){if(console.log("📈 处理图表点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n=`📈 图表点击检测结果!
90
90
 
91
91
  `;if(n+=`点击类型: ${e.clickType}
92
92
  `,n+=`检测时间: ${e.timestamp}
@@ -126,4 +126,4 @@ ${e.message}`,console.log("数据绑定成功,绑定信息:",e.binding)}else c
126
126
  `,n+=`- 文档中图表总数: ${e.detectionSummary.totalChartsFound}
127
127
  `,n+=`- 有数据的图表: ${e.detectionSummary.chartsWithData}
128
128
  `,n+=`- 有选区: ${e.detectionSummary.hasSelection?"是":"否"}
129
- `),console.log("📈 图表绑定数据:",e.boundData),e.boundData&&(e.boundData.type==="line-chart"?console.log("📈 这是线图,可以显示趋势分析"):e.boundData.type==="bar-chart"&&console.log("📊 这是柱状图,可以显示比较分析"),e.boundData.dataSource==="ERP系统"&&console.log("🔄 可以触发ERP系统数据刷新"))}else o&&o.success===!1&&console.log("❌ 图表检测失败或无图表:",o.error||"未知错误")}function S(o){if(console.log("处理绑定控件点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n="绑定控件被点击!\\n\\n";n+=`点击类型: ${e.clickType}\\n`,n+=`绑定类型: ${e.bindingType}\\n`,n+=`控件索引: ${e.controlIndex}\\n`,n+=`控件别名: ${e.controlAlias||"无"}\\n`,n+=`控件内容: "${e.controlContent||"空"}"\\n`,n+=`点击时间: ${e.timestamp}\\n`,e.bindingData&&(n+="\\n绑定数据详情:\\n",e.bindingType==="data-binding"?(n+=`- 字段名称: ${e.bindingData.fieldName}\\n`,n+=`- 数据类型: ${e.bindingData.dataType}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="template-variable"?(n+=`- 变量名: ${e.bindingData.variableName}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="table-data-binding"?(n+=`- 表格名称: ${e.bindingData.tableName}\\n`,n+=`- 绑定模式: ${e.bindingData.bindingMode}\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="paragraph-template"?(n+=`- 模板名称: ${e.bindingData.templateName}\\n`,n+=`- 原始内容: "${e.bindingData.originalContent?.substring(0,50)}${e.bindingData.originalContent?.length>50?"...":""}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="custom-binding"&&(n+=`- 自定义类型: ${e.bindingData.customType}\\n`,n+=`- 字段名称: ${e.bindingData.fieldName}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`)),console.log("检测到绑定控件点击,可以执行相关操作:",{bindingType:e.bindingType,bindingData:e.bindingData}),e.bindingType==="data-binding"?console.log("数据字段绑定被点击,可以打开数据编辑界面"):e.bindingType==="template-variable"?console.log("模板变量绑定被点击,可以打开变量设置界面"):e.bindingType==="table-data-binding"&&console.log("表格数据源绑定被点击,可以打开数据源配置界面")}else console.log("绑定控件点击检测失败或无绑定控件:",o?.error||"未知错误"),o?.data?.clickType==="non-binding"&&console.log("当前点击位置不是绑定控件")}let u=a.ref(!1);const L=o=>{o.data.eventType==="customEventReplay"&&console.info(o,"DDD11"),o.data.eventType==="customEventCommon"&&console.info(o,"DDD22")};return a.onMounted(async()=>{await C(),u.value?console.warn("⚠️ 消息监听器已存在,跳过重复注册"):(window.addEventListener("message",L),u.value=!0,console.log("✅ 消息监听器已注册"))}),a.onBeforeUnmount(()=>{i?.destroyEditor&&i.destroyEditor(),c!==null&&clearInterval(c)}),(o,e)=>(a.openBlock(),a.createElementBlock("div",p,[a.createCommentVNode("",!0),e[1]||(e[1]=a.createElementVNode("div",{id:"editor",style:{flex:"1"}},null,-1))]))}});l.onlyoffice=I,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
129
+ `),console.log("📈 图表绑定数据:",e.boundData),e.boundData&&(e.boundData.type==="line-chart"?console.log("📈 这是线图,可以显示趋势分析"):e.boundData.type==="bar-chart"&&console.log("📊 这是柱状图,可以显示比较分析"),e.boundData.dataSource==="ERP系统"&&console.log("🔄 可以触发ERP系统数据刷新"))}else o&&o.success===!1&&console.log("❌ 图表检测失败或无图表:",o.error||"未知错误")}function v(o){if(console.log("处理绑定控件点击事件,收到数据:",o),o&&o.success&&o.data){const e=o.data;let n="绑定控件被点击!\\n\\n";n+=`点击类型: ${e.clickType}\\n`,n+=`绑定类型: ${e.bindingType}\\n`,n+=`控件索引: ${e.controlIndex}\\n`,n+=`控件别名: ${e.controlAlias||"无"}\\n`,n+=`控件内容: "${e.controlContent||"空"}"\\n`,n+=`点击时间: ${e.timestamp}\\n`,e.bindingData&&(n+="\\n绑定数据详情:\\n",e.bindingType==="data-binding"?(n+=`- 字段名称: ${e.bindingData.fieldName}\\n`,n+=`- 数据类型: ${e.bindingData.dataType}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="template-variable"?(n+=`- 变量名: ${e.bindingData.variableName}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="table-data-binding"?(n+=`- 表格名称: ${e.bindingData.tableName}\\n`,n+=`- 绑定模式: ${e.bindingData.bindingMode}\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="paragraph-template"?(n+=`- 模板名称: ${e.bindingData.templateName}\\n`,n+=`- 原始内容: "${e.bindingData.originalContent?.substring(0,50)}${e.bindingData.originalContent?.length>50?"...":""}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`):e.bindingType==="custom-binding"&&(n+=`- 自定义类型: ${e.bindingData.customType}\\n`,n+=`- 字段名称: ${e.bindingData.fieldName}\\n`,n+=`- 原始值: "${e.bindingData.originalValue}"\\n`,n+=`- 绑定时间: ${e.bindingData.boundAt}\\n`)),console.log("检测到绑定控件点击,可以执行相关操作:",{bindingType:e.bindingType,bindingData:e.bindingData}),e.bindingType==="data-binding"?console.log("数据字段绑定被点击,可以打开数据编辑界面"):e.bindingType==="template-variable"?console.log("模板变量绑定被点击,可以打开变量设置界面"):e.bindingType==="table-data-binding"&&console.log("表格数据源绑定被点击,可以打开数据源配置界面")}else console.log("绑定控件点击检测失败或无绑定控件:",o?.error||"未知错误"),o?.data?.clickType==="non-binding"&&console.log("当前点击位置不是绑定控件")}let $=l.ref(!1);const Y=o=>{o.data.eventType==="customEventReplay"&&console.info(o,"DDD11"),o.data.eventType==="customEventCommon"&&console.info(o,"DDD22")};return l.onMounted(async()=>{await T(),$.value?console.warn("⚠️ 消息监听器已存在,跳过重复注册"):(window.addEventListener("message",Y),$.value=!0,console.log("✅ 消息监听器已注册"))}),l.onBeforeUnmount(()=>{i?.destroyEditor&&i.destroyEditor(),c!==null&&clearInterval(c)}),(o,e)=>(l.openBlock(),l.createElementBlock("div",y,[l.createCommentVNode("",!0),e[1]||(e[1]=l.createElementVNode("div",{id:"editor",style:{flex:"1"}},null,-1))]))}});a.onlyoffice=h,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
package/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <!-- 替换为你自己的 DocumentServer 地址 -->
8
8
  <!-- 例如: http://222.187.11.98:8918/web-apps/apps/api/documents/api.js -->
9
9
  <!-- <script src="http://192.168.1.103:9998/web-apps/apps/api/documents/api.js"></script> -->
10
- <script src="https://test.xuandou.vip:126/web-apps/apps/api/documents/api.js"></script>
10
+ <!-- <script src="https://test.xuandou.vip:126/web-apps/apps/api/documents/api.js"></script> -->
11
11
  <!-- <script src="https://prev.xuandou.vip:126/web-apps/apps/api/documents/api.js"></script> -->
12
12
  </head>
13
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sur-onlyoffice",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "文档",
5
5
  "main": "dist/onlyoffice.umd.js",
6
6
  "module": "dist/onlyoffice.es.js",
package/src/App.vue ADDED
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div class="onlyoffice-test">
3
+ <onlyoffice :documentServerUrl="'https://test.xuandou.vip:126'" />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import onlyoffice from './package/onlyoffice.vue'
9
+ </script>
package/src/index.ts CHANGED
@@ -8,9 +8,11 @@
8
8
 
9
9
  // 测试
10
10
  // import { createApp } from 'vue'
11
- // import App from './package/onlyoffice.vue'
11
+ // import App from './App.vue'
12
12
  // createApp(App).mount('#app')
13
13
 
14
+
15
+
14
16
  import onlyoffice from "./package/onlyoffice.vue";
15
17
  export { onlyoffice };
16
18
 
@@ -97,7 +97,7 @@ const props = defineProps({
97
97
  },
98
98
  documentServerUrl: {
99
99
  type: String,
100
- default: 'camunda'
100
+ default: ''
101
101
  },
102
102
  onLoadComponentError: {
103
103
  type: Object,
@@ -105,13 +105,15 @@ const props = defineProps({
105
105
  },
106
106
  })
107
107
 
108
+ console.log(props,'props',props?.documentServerUrl)
109
+
108
110
  // === 按你的环境修改 ===
109
- // const DOCUMENT_SERVER = 'http://192.168.1.103:9998'
110
- const DOCUMENT_SERVER = 'https://test.xuandou.vip:126'
111
+ const DOCUMENT_SERVER = props?.documentServerUrl || 'https://test.xuandou.vip:126'
111
112
  // const DOCUMENT_SERVER = 'https://prev.xuandou.vip:126'
112
113
  //const DOCUMENT_SERVER = 'http://222.187.11.98:8918'
114
+
115
+
113
116
  const DOCS_API = DOCUMENT_SERVER + '/web-apps/apps/api/documents/api.js'
114
- const FILE_URL = 'https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx'
115
117
  // https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx
116
118
  // 插件 GUID(需与插件 config.json 一致)
117
119
  //9.0.4-9ade76efaf7465c8db6be392804370a8
@@ -208,20 +210,38 @@ function scheduleFlush() {
208
210
  }, 300)
209
211
  }
210
212
 
211
- // ---- 创建编辑器 ----
212
- async function createEditor() {
213
- await loadDocsApi()
214
- // @ts-ignore
215
- const DocsAPI = (window as any).DocsAPI
216
213
 
217
- if (editor?.destroyEditor) editor.destroyEditor()
218
- pluginReady.value = false
214
+ function deepMerge(original, updates) {
215
+ const result = { ...original };
216
+
217
+ for (const key in updates) {
218
+ if (updates.hasOwnProperty(key)) {
219
+ // 如果原对象有该属性且都是对象类型,则递归合并
220
+ if (
221
+ result.hasOwnProperty(key) &&
222
+ typeof result[key] === 'object' &&
223
+ result[key] !== null &&
224
+ !Array.isArray(result[key]) &&
225
+ typeof updates[key] === 'object' &&
226
+ updates[key] !== null &&
227
+ !Array.isArray(updates[key])
228
+ ) {
229
+ result[key] = deepMerge(result[key], updates[key]);
230
+ } else {
231
+ // 否则直接替换(包括数组和基本类型)
232
+ result[key] = updates[key];
233
+ }
234
+ }
235
+ }
236
+
237
+ return result;
238
+ }
219
239
 
220
- const cfg = {
240
+ let cfg = {
221
241
  document: {
222
242
  fileType: 'docx',
223
243
  title: 'Demo.docx',
224
- url: FILE_URL,
244
+ url: 'https://qiniu2.xuandou.vip/new.docx',
225
245
  key: 'test-key',
226
246
  permissions: { edit: true }
227
247
  },
@@ -326,9 +346,21 @@ async function createEditor() {
326
346
  }
327
347
  }
328
348
 
329
- editor = new DocsAPI.DocEditor('editor', cfg)
349
+ // ---- 创建编辑器 ----
350
+ async function createEditor() {
351
+ await loadDocsApi()
352
+ // @ts-ignore
353
+ const DocsAPI = (window as any).DocsAPI
354
+
355
+ if (editor?.destroyEditor) editor.destroyEditor()
356
+ pluginReady.value = false
330
357
 
358
+
359
+ if(props.config){
360
+ cfg = deepMerge(cfg, props.config);
361
+ }
331
362
 
363
+ editor = new DocsAPI.DocEditor('editor', cfg)
332
364
 
333
365
  }
334
366