sur-onlyoffice 1.0.6 → 1.0.7

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,10 +1,26 @@
1
- import { defineComponent as O, ref as w, onMounted as k, onBeforeUnmount as A, createElementBlock as N, openBlock as x, createCommentVNode as L, createElementVNode as S } from "vue";
2
- const P = { class: "onlyoffice-box" }, f = "https://test.xuandou.vip:126", v = "https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx", Y = "asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}", B = /* @__PURE__ */ O({
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({
3
3
  __name: "onlyoffice",
4
- setup(R) {
5
- let i = null;
6
- const c = w(!1), d = f + "/web-apps/apps/api/documents/api.js", g = f + "/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";
7
- function m() {
4
+ props: {
5
+ config: {
6
+ type: Object,
7
+ default: () => {
8
+ }
9
+ },
10
+ documentServerUrl: {
11
+ type: String,
12
+ default: "camunda"
13
+ },
14
+ onLoadComponentError: {
15
+ type: Object,
16
+ default: () => {
17
+ }
18
+ }
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() {
8
24
  return new Promise((o, e) => {
9
25
  if (window.DocsAPI) return o();
10
26
  const n = document.createElement("script");
@@ -12,31 +28,31 @@ const P = { class: "onlyoffice-box" }, f = "https://test.xuandou.vip:126", v = "
12
28
  });
13
29
  }
14
30
  const s = [];
15
- let a = null;
31
+ let i = null;
16
32
  function r() {
17
- a === null && (a = window.setInterval(() => {
18
- if (!(!i || typeof i.serviceCommand != "function") && c.value) {
33
+ i === null && (i = window.setInterval(() => {
34
+ if (!(!a || typeof a.serviceCommand != "function") && c.value) {
19
35
  for (; s.length; ) {
20
36
  const { cmd: o, payload: e } = s.shift();
21
37
  try {
22
- console.log("[ONLYOFFICE] 发送排队指令:", o, e), i.serviceCommand(o, e);
38
+ console.log("[ONLYOFFICE] 发送排队指令:", o, e), a.serviceCommand(o, e);
23
39
  } catch (n) {
24
40
  console.error("[ONLYOFFICE] 队列指令发送失败:", o, n);
25
41
  }
26
42
  }
27
- a !== null && (clearInterval(a), a = null);
43
+ i !== null && (clearInterval(i), i = null);
28
44
  }
29
45
  }, 300));
30
46
  }
31
- async function u() {
32
- await m();
47
+ async function b() {
48
+ await p();
33
49
  const o = window.DocsAPI;
34
- i?.destroyEditor && i.destroyEditor(), c.value = !1;
50
+ a?.destroyEditor && a.destroyEditor(), c.value = !1;
35
51
  const e = {
36
52
  document: {
37
53
  fileType: "docx",
38
54
  title: "Demo.docx",
39
- url: v,
55
+ url: R,
40
56
  key: "test-key",
41
57
  permissions: { edit: !0 }
42
58
  },
@@ -47,8 +63,8 @@ const P = { class: "onlyoffice-box" }, f = "https://test.xuandou.vip:126", v = "
47
63
  user: { id: "u1", name: "Tester" },
48
64
  plugins: {
49
65
  //!
50
- autostart: [Y],
51
- pluginsData: [{ url: g + "?v=2.0." + Date.now() }]
66
+ autostart: [_],
67
+ pluginsData: [{ url: u + "?v=2.0." + Date.now() }]
52
68
  // 强刷缓存
53
69
  }
54
70
  },
@@ -59,23 +75,21 @@ const P = { class: "onlyoffice-box" }, f = "https://test.xuandou.vip:126", v = "
59
75
  console.log("[ONLYOFFICE] 插件资源已加载,但不代表已初始化");
60
76
  },
61
77
  onDocumentReady: () => {
62
- console.log("[ONLYOFFICE] 文档已就绪"), b(), r(), console.log("window.Asc.plugin1", window?.Asc?.plugin), setTimeout(() => {
63
- console.log("window.Asc.plugin2", window), console.log("window.Asc.plugin3-editor", i.serviceCommand), i.serviceCommand("event_onAddComment", { id: 111 });
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 });
64
80
  }, 2e3);
65
81
  },
66
82
  onInfo: (n) => {
67
83
  const t = n?.data;
68
- 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" && (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), p(n.data.data)), n.data.command === "wordArtInserted" && (console.log("[ONLYOFFICE] WordArt 插入成功:", n.data.data), $(n.data.data)), n.data.command === "wordArtError" && (console.error("[ONLYOFFICE] WordArt 插入失败:", n.data.data), I(n.data.data)), n.data.command === "tableClicked" && (console.log("[ONLYOFFICE] 表格被点击,数据:", n.data.data), h(n.data.data)), n.data.command === "selectionAnalyzed" && (console.log("[ONLYOFFICE] 选中内容分析结果:", n.data.data), y(n.data.data)), n.data.command === "selectionBound" && (console.log("[ONLYOFFICE] 选中内容绑定完成:", n.data.data), D(n.data.data)), n.data.command === "bindingClicked" && (console.log("[ONLYOFFICE] 绑定控件被点击:", n.data.data), T(n.data.data)), n.data.command === "elementClicked" && (console.log("[ONLYOFFICE] 元素被点击:", n.data.data), C(n.data.data)), n.data.command === "preciseTableCellClicked" && (console.log("[ONLYOFFICE] 精确表格单元格被点击:", n.data.data), E(n.data.data)), n.data.command === "chartClicked" && (console.log("[ONLYOFFICE] 图表被点击:", n.data.data), F(n.data.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)));
69
85
  }
70
86
  }
71
87
  };
72
- i = new o.DocEditor("editor", e), window.addEventListener("message", (n) => {
73
- console.log(n, "event123"), n.data.eventType === "customEventReplay" && console.info(n, "DDD1"), n.data.eventType === "customEventCommon" && console.info(n, "DDD2");
74
- });
88
+ a = new o.DocEditor("editor", e);
75
89
  }
76
- function b() {
90
+ function $() {
77
91
  try {
78
- i.executeCommand && i.executeCommand("focus"), console.log("123autoOpenPluginSidePanel", i), i.serviceCommand && i.serviceCommand("sidePanel", {
92
+ a.executeCommand && a.executeCommand("focus"), console.log("autoOpenPluginSidePanel", a), a.serviceCommand && a.serviceCommand("sidePanel", {
79
93
  action: "toggle",
80
94
  state: !1
81
95
  });
@@ -83,10 +97,10 @@ const P = { class: "onlyoffice-box" }, f = "https://test.xuandou.vip:126", v = "
83
97
  console.error("auto-open plugin failed:", o);
84
98
  }
85
99
  }
86
- function p(o) {
100
+ function I(o) {
87
101
  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));
88
102
  }
89
- function $(o) {
103
+ function h(o) {
90
104
  if (console.log("WordArt 插入成功,数据:", o), o && o.success) {
91
105
  const e = `WordArt 插入成功!
92
106
 
@@ -101,10 +115,10 @@ ${o.message || ""}`;
101
115
  点击"确定"可继续插入更多WordArt`) && console.log("用户选择继续操作WordArt");
102
116
  }
103
117
  }
104
- function I(o) {
118
+ function y(o) {
105
119
  console.error("WordArt 插入失败,错误:", o), o?.error;
106
120
  }
107
- function h(o) {
121
+ function C(o) {
108
122
  if (console.log("处理表格点击事件,收到数据:", o), o && o.success && o.data) {
109
123
  const e = o.data;
110
124
  let n = `表格被点击!
@@ -135,7 +149,7 @@ ${o.message || ""}`;
135
149
  } else
136
150
  console.log("表格点击检测失败:", o?.error || "未知错误");
137
151
  }
138
- function y(o) {
152
+ function D(o) {
139
153
  if (console.log("处理选中内容分析结果,收到数据:", o), o && o.success && o.data) {
140
154
  const e = o.data;
141
155
  let n = `选中内容分析结果!
@@ -155,7 +169,7 @@ ${o.message || ""}`;
155
169
  } else
156
170
  console.log("选中内容分析失败:", o?.error || "未知错误");
157
171
  }
158
- function D(o) {
172
+ function E(o) {
159
173
  if (console.log("处理选中内容绑定完成,收到数据:", o), o && o.success) {
160
174
  const e = o.data;
161
175
  let n = `数据绑定完成!
@@ -171,7 +185,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
171
185
  } else
172
186
  console.log("数据绑定失败:", o?.error || "未知错误");
173
187
  }
174
- function C(o) {
188
+ function F(o) {
175
189
  if (console.log("🎯 处理通用元素点击事件,收到数据:", o), o && o.success && o.data) {
176
190
  const e = o.data;
177
191
  let n = `🎯 元素点击检测结果!
@@ -212,7 +226,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
212
226
  } else
213
227
  console.log("❌ 通用元素检测失败:", o?.error || "未知错误");
214
228
  }
215
- function E(o) {
229
+ function O(o) {
216
230
  if (console.log("📊 处理精确表格单元格点击事件,收到数据:", o), o && o.success && o.data) {
217
231
  const e = o.data;
218
232
  let n = `📊 精确表格单元格点击!
@@ -237,7 +251,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
237
251
  } else
238
252
  console.log("❌ 精确表格单元格检测失败:", o?.error || "未知错误");
239
253
  }
240
- function F(o) {
254
+ function T(o) {
241
255
  if (console.log("📈 处理图表点击事件,收到数据:", o), o && o.success && o.data) {
242
256
  const e = o.data;
243
257
  let n = `📈 图表点击检测结果!
@@ -301,7 +315,7 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
301
315
  `), 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系统数据刷新"));
302
316
  } else o && o.success === !1 && console.log("❌ 图表检测失败或无图表:", o.error || "未知错误");
303
317
  }
304
- function T(o) {
318
+ function w(o) {
305
319
  if (console.log("处理绑定控件点击事件,收到数据:", o), o && o.success && o.data) {
306
320
  const e = o.data;
307
321
  let n = "绑定控件被点击!\\n\\n";
@@ -312,11 +326,17 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
312
326
  } else
313
327
  console.log("绑定控件点击检测失败或无绑定控件:", o?.error || "未知错误"), o?.data?.clickType === "non-binding" && console.log("当前点击位置不是绑定控件");
314
328
  }
315
- return k(() => u()), A(() => {
316
- i?.destroyEditor && i.destroyEditor(), a !== null && clearInterval(a);
317
- }), (o, e) => (x(), N("div", P, [
318
- L("", !0),
319
- e[1] || (e[1] = S("div", {
329
+ let f = g(!1);
330
+ const k = (o) => {
331
+ o.data.eventType === "customEventReplay" && console.info(o, "DDD11"), o.data.eventType === "customEventCommon" && console.info(o, "DDD22");
332
+ };
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", {
320
340
  id: "editor",
321
341
  style: { flex: "1" }
322
342
  }, null, -1))
@@ -324,5 +344,5 @@ ${e.message}`, console.log("数据绑定成功,绑定信息:", e.binding);
324
344
  }
325
345
  });
326
346
  export {
327
- B as onlyoffice
347
+ j as onlyoffice
328
348
  };
@@ -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 u={class:"onlyoffice-box"},r="https://test.xuandou.vip:126",p="https://badges-1302420147.cos.ap-shanghai.myqcloud.com/test1.docx",b="asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}",$=a.defineComponent({__name:"onlyoffice",setup(S){let i=null;const s=a.ref(!1),f=r+"/web-apps/apps/api/documents/api.js",I=r+"/8.3.1-10ca0f5dd35a63800b6a3956f350bf95/sdkjs-plugins/example_extended_comments/config.json";function h(){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 y(){await h();const o=window.DocsAPI;i?.destroyEditor&&i.destroyEditor(),s.value=!1;const e={document:{fileType:"docx",title:"Demo.docx",url:p,key:"test-key",permissions:{edit:!0}},documentType:"word",editorConfig:{lang:"zh-CN",mode:"edit",user:{id:"u1",name:"Tester"},plugins:{autostart:[b],pluginsData:[{url:I+"?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),C(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),O(n.data.data)),n.data.command==="selectionBound"&&(console.log("[ONLYOFFICE] 选中内容绑定完成:",n.data.data),w(n.data.data)),n.data.command==="bindingClicked"&&(console.log("[ONLYOFFICE] 绑定控件被点击:",n.data.data),x(n.data.data)),n.data.command==="elementClicked"&&(console.log("[ONLYOFFICE] 元素被点击:",n.data.data),k(n.data.data)),n.data.command==="preciseTableCellClicked"&&(console.log("[ONLYOFFICE] 精确表格单元格被点击:",n.data.data),A(n.data.data)),n.data.command==="chartClicked"&&(console.log("[ONLYOFFICE] 图表被点击:",n.data.data),N(n.data.data)))}}};i=new o.DocEditor("editor",e),window.addEventListener("message",n=>{console.log(n,"event123"),n.data.eventType==="customEventReplay"&&console.info(n,"DDD1"),n.data.eventType==="customEventCommon"&&console.info(n,"DDD2")})}function D(){try{i.executeCommand&&i.executeCommand("focus"),console.log("123autoOpenPluginSidePanel",i),i.serviceCommand&&i.serviceCommand("sidePanel",{action:"toggle",state:!1})}catch(o){console.error("auto-open plugin failed:",o)}}function C(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(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 插入成功!
2
2
 
3
3
  文本: ${o.parameters?.text||"未知"}
4
4
  字体大小: ${o.parameters?.fontSize||"未知"}
@@ -25,7 +25,7 @@ ${o.message||""}`;confirm(e+`
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 O(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 w(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?"是":"否"}
@@ -35,7 +35,7 @@ ${o.message||""}`;confirm(e+`
35
35
  `,e.suggestedBindings.slice(0,3).forEach((t,d)=>{n+=`${d+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 w(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 k(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 k(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 A(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}
@@ -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 A(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 N(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 N(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 x(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 x(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("当前点击位置不是绑定控件")}return a.onMounted(()=>y()),a.onBeforeUnmount(()=>{i?.destroyEditor&&i.destroyEditor(),c!==null&&clearInterval(c)}),(o,e)=>(a.openBlock(),a.createElementBlock("div",u,[a.createCommentVNode("",!0),e[1]||(e[1]=a.createElementVNode("div",{id:"editor",style:{flex:"1"}},null,-1))]))}});l.onlyoffice=$,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 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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sur-onlyoffice",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "文档",
5
5
  "main": "dist/onlyoffice.umd.js",
6
6
  "module": "dist/onlyoffice.es.js",
@@ -89,6 +89,22 @@ import { onMounted, onBeforeUnmount, ref } from 'vue'
89
89
  let editor: any = null
90
90
  const pluginReady = ref(false)
91
91
 
92
+
93
+ const props = defineProps({
94
+ config: {
95
+ type: Object,
96
+ default: () => {}
97
+ },
98
+ documentServerUrl: {
99
+ type: String,
100
+ default: 'camunda'
101
+ },
102
+ onLoadComponentError: {
103
+ type: Object,
104
+ default: () => {}
105
+ },
106
+ })
107
+
92
108
  // === 按你的环境修改 ===
93
109
  // const DOCUMENT_SERVER = 'http://192.168.1.103:9998'
94
110
  const DOCUMENT_SERVER = 'https://test.xuandou.vip:126'
@@ -366,7 +382,6 @@ function insertLink() {
366
382
  json:{name:'gm'}
367
383
  });
368
384
  }
369
-
370
385
  // ---- WordArt 相关功能 ----
371
386
  function insertCustomWordArt() {
372
387
  // 自定义 WordArt 参数
@@ -386,14 +401,12 @@ function insertCustomWordArt() {
386
401
  rotation: 0
387
402
  });
388
403
  }
389
-
390
404
  function insertClassicWordArt() {
391
405
  serviceCommandSafe('insertPresetWordArt', {
392
406
  preset: 'classic',
393
407
  text: 'CLASSIC'
394
408
  });
395
409
  }
396
-
397
410
  function insertModernWordArt() {
398
411
  serviceCommandSafe('insertPresetWordArt', {
399
412
  preset: 'modern',
@@ -1127,26 +1140,26 @@ function handleBindingClicked(data: any) {
1127
1140
 
1128
1141
 
1129
1142
  // 使用标志确保监听器只注册一次
1130
- let messageListenerRegistered = false;
1143
+ let messageListenerRegistered = ref(false);
1131
1144
  const messageHandler = (event) => {
1132
1145
  // 您的业务逻辑...
1133
1146
  if (event.data.eventType === 'customEventReplay') {
1134
- console.info(event,'DDD1')
1147
+ console.info(event,'DDD11')
1135
1148
  }
1136
1149
 
1137
1150
  if (event.data.eventType === 'customEventCommon') {
1138
- console.info(event,'DDD2')
1151
+ console.info(event,'DDD22')
1139
1152
  }
1140
1153
  };
1141
1154
 
1142
1155
 
1143
- onMounted(() =>{
1156
+ onMounted(async() =>{
1144
1157
 
1145
- createEditor()
1158
+ await createEditor()
1146
1159
 
1147
- if (!messageListenerRegistered) {
1160
+ if (!messageListenerRegistered.value) {
1148
1161
  window.addEventListener('message', messageHandler);
1149
- messageListenerRegistered = true;
1162
+ messageListenerRegistered.value = true;
1150
1163
  console.log('✅ 消息监听器已注册');
1151
1164
  } else {
1152
1165
  console.warn('⚠️ 消息监听器已存在,跳过重复注册');