@univerjs/docs-hyper-link 0.16.1 → 0.17.0

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/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var I=(n,e,r)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r;var l=(n,e,r)=>I(n,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),f={id:"docs.mutation.add-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},m={id:"docs.mutation.update-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},U={id:"docs.mutation.delete-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},P="docs-hyper-link.config",_={};var C=Object.getOwnPropertyDescriptor,D=(n,e,r,o)=>{for(var t=o>1?void 0:o?C(e,r):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(t=a(t)||t);return t},h=(n,e)=>(r,o)=>e(r,o,n);const v="DOC_HYPER_LINK_PLUGIN";let u=class extends s.Disposable{constructor(n,e){super(),this._resourceManagerService=n,this._univerInstanceService=e,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:v,businesses:[s.UniverInstanceType.UNIVER_DOC],onLoad:(n,e)=>{const r=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_DOC);if(!r)return;const o=new Map,t=i=>{var a,c;return(c=(a=i.getBody())==null?void 0:a.customRanges)==null||c.forEach(p=>{p.rangeType===s.CustomRangeType.HYPERLINK&&o.set(p.rangeId,p)}),o};r.headerModelMap.forEach(i=>{t(i)}),r.footerModelMap.forEach(i=>{t(i)}),t(r),e.links.forEach(i=>{const a=o.get(i.id);a&&(a.properties={...a.properties,url:i.payload})})},onUnLoad:n=>{},toJson:n=>{const e=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_DOC),r=[];if(e){const o=t=>{var i,a;(a=(i=t.getBody())==null?void 0:i.customRanges)==null||a.forEach(c=>{var p;c.rangeType===s.CustomRangeType.HYPERLINK&&r.push({id:c.rangeId,payload:((p=c.properties)==null?void 0:p.url)||""})})};e.headerModelMap.forEach(t=>{o(t)}),e.footerModelMap.forEach(t=>{o(t)}),o(e)}return JSON.stringify({links:r})},parseJson(n){return JSON.parse(n)}})}};u=D([h(0,s.Inject(s.IResourceManagerService)),h(1,s.IUniverInstanceService)],u);var M=Object.getOwnPropertyDescriptor,N=(n,e,r,o)=>{for(var t=o>1?void 0:o?M(e,r):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(t=a(t)||t);return t},g=(n,e)=>(r,o)=>e(r,o,n),d;exports.UniverDocsHyperLinkPlugin=(d=class extends s.Plugin{constructor(e=_,r,o,t){super(),this._config=e,this._injector=r,this._configService=o,this._commandService=t;const{...i}=s.merge({},_,this._config);this._configService.setConfig(P,i)}onStarting(){[[u]].forEach(r=>this._injector.add(r)),[f,U,m].forEach(r=>{this.disposeWithMe(this._commandService.registerCommand(r))}),this._injector.get(u)}},l(d,"pluginName",v),l(d,"type",s.UniverInstanceType.UNIVER_DOC),d);exports.UniverDocsHyperLinkPlugin=N([g(1,s.Inject(s.Injector)),g(2,s.IConfigService),g(3,s.ICommandService)],exports.UniverDocsHyperLinkPlugin);
1
+ "use strict";var I=Object.defineProperty;var f=(r,e,n)=>e in r?I(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var u=(r,e,n)=>f(r,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),m="@univerjs/docs-hyper-link",U="0.17.0",_={name:m,version:U},P={id:"docs.mutation.add-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},C={id:"docs.mutation.update-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},D={id:"docs.mutation.delete-hyper-link",type:s.CommandType.MUTATION,handler:()=>!0},M="docs-hyper-link.config",v={};var N=Object.getOwnPropertyDescriptor,O=(r,e,n,o)=>{for(var t=o>1?void 0:o?N(e,n):e,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},h=(r,e)=>(n,o)=>e(n,o,r);const y="DOC_HYPER_LINK_PLUGIN";let l=class extends s.Disposable{constructor(r,e){super(),this._resourceManagerService=r,this._univerInstanceService=e,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:y,businesses:[s.UniverInstanceType.UNIVER_DOC],onLoad:(r,e)=>{const n=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_DOC);if(!n)return;const o=new Map,t=i=>{var a,c;return(c=(a=i.getBody())==null?void 0:a.customRanges)==null||c.forEach(p=>{p.rangeType===s.CustomRangeType.HYPERLINK&&o.set(p.rangeId,p)}),o};n.headerModelMap.forEach(i=>{t(i)}),n.footerModelMap.forEach(i=>{t(i)}),t(n),e.links.forEach(i=>{const a=o.get(i.id);a&&(a.properties={...a.properties,url:i.payload})})},onUnLoad:r=>{},toJson:r=>{const e=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_DOC),n=[];if(e){const o=t=>{var i,a;(a=(i=t.getBody())==null?void 0:i.customRanges)==null||a.forEach(c=>{var p;c.rangeType===s.CustomRangeType.HYPERLINK&&n.push({id:c.rangeId,payload:((p=c.properties)==null?void 0:p.url)||""})})};e.headerModelMap.forEach(t=>{o(t)}),e.footerModelMap.forEach(t=>{o(t)}),o(e)}return JSON.stringify({links:n})},parseJson(r){return JSON.parse(r)}})}};l=O([h(0,s.Inject(s.IResourceManagerService)),h(1,s.IUniverInstanceService)],l);var E=Object.getOwnPropertyDescriptor,S=(r,e,n,o)=>{for(var t=o>1?void 0:o?E(e,n):e,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},g=(r,e)=>(n,o)=>e(n,o,r),d;exports.UniverDocsHyperLinkPlugin=(d=class extends s.Plugin{constructor(e=v,n,o,t){super(),this._config=e,this._injector=n,this._configService=o,this._commandService=t;const{...i}=s.merge({},v,this._config);this._configService.setConfig(M,i)}onStarting(){[[l]].forEach(n=>this._injector.add(n)),[P,D,C].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))}),this._injector.get(l)}},u(d,"pluginName",y),u(d,"packageName",_.name),u(d,"version",_.version),u(d,"type",s.UniverInstanceType.UNIVER_DOC),d);exports.UniverDocsHyperLinkPlugin=S([g(1,s.Inject(s.Injector)),g(2,s.IConfigService),g(3,s.ICommandService)],exports.UniverDocsHyperLinkPlugin);
package/lib/es/index.js CHANGED
@@ -1,36 +1,39 @@
1
1
  var M = Object.defineProperty;
2
- var N = (r, e, t) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var _ = (r, e, t) => N(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as l, Inject as y, IResourceManagerService as E, IUniverInstanceService as O, Disposable as C, UniverInstanceType as d, CustomRangeType as g, Plugin as D, merge as P, Injector as S, IConfigService as U, ICommandService as L } from "@univerjs/core";
5
- const R = {
2
+ var E = (r, e, t) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var d = (r, e, t) => E(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommandType as l, Inject as m, IResourceManagerService as O, IUniverInstanceService as C, Disposable as D, UniverInstanceType as u, CustomRangeType as g, Plugin as P, merge as S, Injector as U, IConfigService as L, ICommandService as R } from "@univerjs/core";
5
+ const k = "@univerjs/docs-hyper-link", T = "0.17.0", v = {
6
+ name: k,
7
+ version: T
8
+ }, H = {
6
9
  id: "docs.mutation.add-hyper-link",
7
10
  type: l.MUTATION,
8
11
  handler: () => !0
9
- }, T = {
12
+ }, j = {
10
13
  id: "docs.mutation.update-hyper-link",
11
14
  type: l.MUTATION,
12
15
  handler: () => !0
13
- }, H = {
16
+ }, K = {
14
17
  id: "docs.mutation.delete-hyper-link",
15
18
  type: l.MUTATION,
16
19
  handler: () => !0
17
- }, k = "docs-hyper-link.config", f = {};
18
- var j = Object.getOwnPropertyDescriptor, K = (r, e, t, o) => {
19
- for (var n = o > 1 ? void 0 : o ? j(e, t) : e, i = r.length - 1, s; i >= 0; i--)
20
+ }, Y = "docs-hyper-link.config", f = {};
21
+ var w = Object.getOwnPropertyDescriptor, b = (r, e, t, o) => {
22
+ for (var n = o > 1 ? void 0 : o ? w(e, t) : e, i = r.length - 1, s; i >= 0; i--)
20
23
  (s = r[i]) && (n = s(n) || n);
21
24
  return n;
22
- }, v = (r, e) => (t, o) => e(t, o, r);
23
- const m = "DOC_HYPER_LINK_PLUGIN";
24
- let u = class extends C {
25
+ }, I = (r, e) => (t, o) => e(t, o, r);
26
+ const N = "DOC_HYPER_LINK_PLUGIN";
27
+ let _ = class extends D {
25
28
  constructor(r, e) {
26
29
  super(), this._resourceManagerService = r, this._univerInstanceService = e, this._init();
27
30
  }
28
31
  _init() {
29
32
  this._resourceManagerService.registerPluginResource({
30
- pluginName: m,
31
- businesses: [d.UNIVER_DOC],
33
+ pluginName: N,
34
+ businesses: [u.UNIVER_DOC],
32
35
  onLoad: (r, e) => {
33
- const t = this._univerInstanceService.getUnit(r, d.UNIVER_DOC);
36
+ const t = this._univerInstanceService.getUnit(r, u.UNIVER_DOC);
34
37
  if (!t)
35
38
  return;
36
39
  const o = /* @__PURE__ */ new Map(), n = (i) => {
@@ -54,7 +57,7 @@ let u = class extends C {
54
57
  onUnLoad: (r) => {
55
58
  },
56
59
  toJson: (r) => {
57
- const e = this._univerInstanceService.getUnit(r, d.UNIVER_DOC), t = [];
60
+ const e = this._univerInstanceService.getUnit(r, u.UNIVER_DOC), t = [];
58
61
  if (e) {
59
62
  const o = (n) => {
60
63
  var i, s;
@@ -80,36 +83,36 @@ let u = class extends C {
80
83
  });
81
84
  }
82
85
  };
83
- u = K([
84
- v(0, y(E)),
85
- v(1, O)
86
- ], u);
87
- var Y = Object.getOwnPropertyDescriptor, w = (r, e, t, o) => {
88
- for (var n = o > 1 ? void 0 : o ? Y(e, t) : e, i = r.length - 1, s; i >= 0; i--)
86
+ _ = b([
87
+ I(0, m(O)),
88
+ I(1, C)
89
+ ], _);
90
+ var A = Object.getOwnPropertyDescriptor, G = (r, e, t, o) => {
91
+ for (var n = o > 1 ? void 0 : o ? A(e, t) : e, i = r.length - 1, s; i >= 0; i--)
89
92
  (s = r[i]) && (n = s(n) || n);
90
93
  return n;
91
94
  }, h = (r, e) => (t, o) => e(t, o, r), p;
92
- let I = (p = class extends D {
95
+ let y = (p = class extends P {
93
96
  constructor(r = f, e, t, o) {
94
97
  super(), this._config = r, this._injector = e, this._configService = t, this._commandService = o;
95
- const { ...n } = P(
98
+ const { ...n } = S(
96
99
  {},
97
100
  f,
98
101
  this._config
99
102
  );
100
- this._configService.setConfig(k, n);
103
+ this._configService.setConfig(Y, n);
101
104
  }
102
105
  onStarting() {
103
- [[u]].forEach((e) => this._injector.add(e)), [R, H, T].forEach((e) => {
106
+ [[_]].forEach((e) => this._injector.add(e)), [H, K, j].forEach((e) => {
104
107
  this.disposeWithMe(this._commandService.registerCommand(e));
105
- }), this._injector.get(u);
108
+ }), this._injector.get(_);
106
109
  }
107
- }, _(p, "pluginName", m), _(p, "type", d.UNIVER_DOC), p);
108
- I = w([
109
- h(1, y(S)),
110
- h(2, U),
111
- h(3, L)
112
- ], I);
110
+ }, d(p, "pluginName", N), d(p, "packageName", v.name), d(p, "version", v.version), d(p, "type", u.UNIVER_DOC), p);
111
+ y = G([
112
+ h(1, m(U)),
113
+ h(2, L),
114
+ h(3, R)
115
+ ], y);
113
116
  export {
114
- I as UniverDocsHyperLinkPlugin
117
+ y as UniverDocsHyperLinkPlugin
115
118
  };
package/lib/index.js CHANGED
@@ -1,36 +1,39 @@
1
1
  var M = Object.defineProperty;
2
- var N = (r, e, t) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var _ = (r, e, t) => N(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as l, Inject as y, IResourceManagerService as E, IUniverInstanceService as O, Disposable as C, UniverInstanceType as d, CustomRangeType as g, Plugin as D, merge as P, Injector as S, IConfigService as U, ICommandService as L } from "@univerjs/core";
5
- const R = {
2
+ var E = (r, e, t) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var d = (r, e, t) => E(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommandType as l, Inject as m, IResourceManagerService as O, IUniverInstanceService as C, Disposable as D, UniverInstanceType as u, CustomRangeType as g, Plugin as P, merge as S, Injector as U, IConfigService as L, ICommandService as R } from "@univerjs/core";
5
+ const k = "@univerjs/docs-hyper-link", T = "0.17.0", v = {
6
+ name: k,
7
+ version: T
8
+ }, H = {
6
9
  id: "docs.mutation.add-hyper-link",
7
10
  type: l.MUTATION,
8
11
  handler: () => !0
9
- }, T = {
12
+ }, j = {
10
13
  id: "docs.mutation.update-hyper-link",
11
14
  type: l.MUTATION,
12
15
  handler: () => !0
13
- }, H = {
16
+ }, K = {
14
17
  id: "docs.mutation.delete-hyper-link",
15
18
  type: l.MUTATION,
16
19
  handler: () => !0
17
- }, k = "docs-hyper-link.config", f = {};
18
- var j = Object.getOwnPropertyDescriptor, K = (r, e, t, o) => {
19
- for (var n = o > 1 ? void 0 : o ? j(e, t) : e, i = r.length - 1, s; i >= 0; i--)
20
+ }, Y = "docs-hyper-link.config", f = {};
21
+ var w = Object.getOwnPropertyDescriptor, b = (r, e, t, o) => {
22
+ for (var n = o > 1 ? void 0 : o ? w(e, t) : e, i = r.length - 1, s; i >= 0; i--)
20
23
  (s = r[i]) && (n = s(n) || n);
21
24
  return n;
22
- }, v = (r, e) => (t, o) => e(t, o, r);
23
- const m = "DOC_HYPER_LINK_PLUGIN";
24
- let u = class extends C {
25
+ }, I = (r, e) => (t, o) => e(t, o, r);
26
+ const N = "DOC_HYPER_LINK_PLUGIN";
27
+ let _ = class extends D {
25
28
  constructor(r, e) {
26
29
  super(), this._resourceManagerService = r, this._univerInstanceService = e, this._init();
27
30
  }
28
31
  _init() {
29
32
  this._resourceManagerService.registerPluginResource({
30
- pluginName: m,
31
- businesses: [d.UNIVER_DOC],
33
+ pluginName: N,
34
+ businesses: [u.UNIVER_DOC],
32
35
  onLoad: (r, e) => {
33
- const t = this._univerInstanceService.getUnit(r, d.UNIVER_DOC);
36
+ const t = this._univerInstanceService.getUnit(r, u.UNIVER_DOC);
34
37
  if (!t)
35
38
  return;
36
39
  const o = /* @__PURE__ */ new Map(), n = (i) => {
@@ -54,7 +57,7 @@ let u = class extends C {
54
57
  onUnLoad: (r) => {
55
58
  },
56
59
  toJson: (r) => {
57
- const e = this._univerInstanceService.getUnit(r, d.UNIVER_DOC), t = [];
60
+ const e = this._univerInstanceService.getUnit(r, u.UNIVER_DOC), t = [];
58
61
  if (e) {
59
62
  const o = (n) => {
60
63
  var i, s;
@@ -80,36 +83,36 @@ let u = class extends C {
80
83
  });
81
84
  }
82
85
  };
83
- u = K([
84
- v(0, y(E)),
85
- v(1, O)
86
- ], u);
87
- var Y = Object.getOwnPropertyDescriptor, w = (r, e, t, o) => {
88
- for (var n = o > 1 ? void 0 : o ? Y(e, t) : e, i = r.length - 1, s; i >= 0; i--)
86
+ _ = b([
87
+ I(0, m(O)),
88
+ I(1, C)
89
+ ], _);
90
+ var A = Object.getOwnPropertyDescriptor, G = (r, e, t, o) => {
91
+ for (var n = o > 1 ? void 0 : o ? A(e, t) : e, i = r.length - 1, s; i >= 0; i--)
89
92
  (s = r[i]) && (n = s(n) || n);
90
93
  return n;
91
94
  }, h = (r, e) => (t, o) => e(t, o, r), p;
92
- let I = (p = class extends D {
95
+ let y = (p = class extends P {
93
96
  constructor(r = f, e, t, o) {
94
97
  super(), this._config = r, this._injector = e, this._configService = t, this._commandService = o;
95
- const { ...n } = P(
98
+ const { ...n } = S(
96
99
  {},
97
100
  f,
98
101
  this._config
99
102
  );
100
- this._configService.setConfig(k, n);
103
+ this._configService.setConfig(Y, n);
101
104
  }
102
105
  onStarting() {
103
- [[u]].forEach((e) => this._injector.add(e)), [R, H, T].forEach((e) => {
106
+ [[_]].forEach((e) => this._injector.add(e)), [H, K, j].forEach((e) => {
104
107
  this.disposeWithMe(this._commandService.registerCommand(e));
105
- }), this._injector.get(u);
108
+ }), this._injector.get(_);
106
109
  }
107
- }, _(p, "pluginName", m), _(p, "type", d.UNIVER_DOC), p);
108
- I = w([
109
- h(1, y(S)),
110
- h(2, U),
111
- h(3, L)
112
- ], I);
110
+ }, d(p, "pluginName", N), d(p, "packageName", v.name), d(p, "version", v.version), d(p, "type", u.UNIVER_DOC), p);
111
+ y = G([
112
+ h(1, m(U)),
113
+ h(2, L),
114
+ h(3, R)
115
+ ], y);
113
116
  export {
114
- I as UniverDocsHyperLinkPlugin
117
+ y as UniverDocsHyperLinkPlugin
115
118
  };
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export type { IUniverDocsHyperLinkConfig } from './controllers/config.schema';
16
+ export type { IUniverDocsHyperLinkConfig } from './config/config';
17
17
  export { UniverDocsHyperLinkPlugin } from './plugin';
@@ -1,4 +1,4 @@
1
- import { IUniverDocsHyperLinkConfig } from './controllers/config.schema';
1
+ import { IUniverDocsHyperLinkConfig } from './config/config';
2
2
  import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
3
  export declare class UniverDocsHyperLinkPlugin extends Plugin {
4
4
  private readonly _config;
@@ -6,6 +6,8 @@ export declare class UniverDocsHyperLinkPlugin extends Plugin {
6
6
  private readonly _configService;
7
7
  private readonly _commandService;
8
8
  static pluginName: string;
9
+ static packageName: string;
10
+ static version: string;
9
11
  static type: UniverInstanceType;
10
12
  constructor(_config: Partial<IUniverDocsHyperLinkConfig> | undefined, _injector: Injector, _configService: IConfigService, _commandService: ICommandService);
11
13
  onStarting(): void;
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.UniverDocsHyperLink={},a.UniverCore))})(this,(function(a,e){"use strict";var N=Object.defineProperty;var O=(a,e,p)=>e in a?N(a,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):a[e]=p;var f=(a,e,p)=>O(a,typeof e!="symbol"?e+"":e,p);var h;const p={id:"docs.mutation.add-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},I={id:"docs.mutation.update-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},m={id:"docs.mutation.delete-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},U="docs-hyper-link.config",g={};var C=Object.getOwnPropertyDescriptor,D=(s,n,t,o)=>{for(var r=o>1?void 0:o?C(n,t):n,i=s.length-1,c;i>=0;i--)(c=s[i])&&(r=c(r)||r);return r},v=(s,n)=>(t,o)=>n(t,o,s);const y="DOC_HYPER_LINK_PLUGIN";let l=class extends e.Disposable{constructor(s,n){super(),this._resourceManagerService=s,this._univerInstanceService=n,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:y,businesses:[e.UniverInstanceType.UNIVER_DOC],onLoad:(s,n)=>{const t=this._univerInstanceService.getUnit(s,e.UniverInstanceType.UNIVER_DOC);if(!t)return;const o=new Map,r=i=>{var c,d;return(d=(c=i.getBody())==null?void 0:c.customRanges)==null||d.forEach(u=>{u.rangeType===e.CustomRangeType.HYPERLINK&&o.set(u.rangeId,u)}),o};t.headerModelMap.forEach(i=>{r(i)}),t.footerModelMap.forEach(i=>{r(i)}),r(t),n.links.forEach(i=>{const c=o.get(i.id);c&&(c.properties={...c.properties,url:i.payload})})},onUnLoad:s=>{},toJson:s=>{const n=this._univerInstanceService.getUnit(s,e.UniverInstanceType.UNIVER_DOC),t=[];if(n){const o=r=>{var i,c;(c=(i=r.getBody())==null?void 0:i.customRanges)==null||c.forEach(d=>{var u;d.rangeType===e.CustomRangeType.HYPERLINK&&t.push({id:d.rangeId,payload:((u=d.properties)==null?void 0:u.url)||""})})};n.headerModelMap.forEach(r=>{o(r)}),n.footerModelMap.forEach(r=>{o(r)}),o(n)}return JSON.stringify({links:t})},parseJson(s){return JSON.parse(s)}})}};l=D([v(0,e.Inject(e.IResourceManagerService)),v(1,e.IUniverInstanceService)],l);var P=Object.getOwnPropertyDescriptor,M=(s,n,t,o)=>{for(var r=o>1?void 0:o?P(n,t):n,i=s.length-1,c;i>=0;i--)(c=s[i])&&(r=c(r)||r);return r},_=(s,n)=>(t,o)=>n(t,o,s);a.UniverDocsHyperLinkPlugin=(h=class extends e.Plugin{constructor(n=g,t,o,r){super(),this._config=n,this._injector=t,this._configService=o,this._commandService=r;const{...i}=e.merge({},g,this._config);this._configService.setConfig(U,i)}onStarting(){[[l]].forEach(t=>this._injector.add(t)),[p,m,I].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))}),this._injector.get(l)}},f(h,"pluginName",y),f(h,"type",e.UniverInstanceType.UNIVER_DOC),h),a.UniverDocsHyperLinkPlugin=M([_(1,e.Inject(e.Injector)),_(2,e.IConfigService),_(3,e.ICommandService)],a.UniverDocsHyperLinkPlugin),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.UniverDocsHyperLink={},a.UniverCore))})(this,(function(a,e){"use strict";var T=Object.defineProperty;var E=(a,e,v)=>e in a?T(a,e,{enumerable:!0,configurable:!0,writable:!0,value:v}):a[e]=v;var l=(a,e,v)=>E(a,typeof e!="symbol"?e+"":e,v);var p;const _={name:"@univerjs/docs-hyper-link",version:"0.17.0"},m={id:"docs.mutation.add-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},U={id:"docs.mutation.update-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},C={id:"docs.mutation.delete-hyper-link",type:e.CommandType.MUTATION,handler:()=>!0},D="docs-hyper-link.config",f={};var P=Object.getOwnPropertyDescriptor,M=(s,n,t,o)=>{for(var i=o>1?void 0:o?P(n,t):n,r=s.length-1,c;r>=0;r--)(c=s[r])&&(i=c(i)||i);return i},y=(s,n)=>(t,o)=>n(t,o,s);const I="DOC_HYPER_LINK_PLUGIN";let g=class extends e.Disposable{constructor(s,n){super(),this._resourceManagerService=s,this._univerInstanceService=n,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:I,businesses:[e.UniverInstanceType.UNIVER_DOC],onLoad:(s,n)=>{const t=this._univerInstanceService.getUnit(s,e.UniverInstanceType.UNIVER_DOC);if(!t)return;const o=new Map,i=r=>{var c,d;return(d=(c=r.getBody())==null?void 0:c.customRanges)==null||d.forEach(u=>{u.rangeType===e.CustomRangeType.HYPERLINK&&o.set(u.rangeId,u)}),o};t.headerModelMap.forEach(r=>{i(r)}),t.footerModelMap.forEach(r=>{i(r)}),i(t),n.links.forEach(r=>{const c=o.get(r.id);c&&(c.properties={...c.properties,url:r.payload})})},onUnLoad:s=>{},toJson:s=>{const n=this._univerInstanceService.getUnit(s,e.UniverInstanceType.UNIVER_DOC),t=[];if(n){const o=i=>{var r,c;(c=(r=i.getBody())==null?void 0:r.customRanges)==null||c.forEach(d=>{var u;d.rangeType===e.CustomRangeType.HYPERLINK&&t.push({id:d.rangeId,payload:((u=d.properties)==null?void 0:u.url)||""})})};n.headerModelMap.forEach(i=>{o(i)}),n.footerModelMap.forEach(i=>{o(i)}),o(n)}return JSON.stringify({links:t})},parseJson(s){return JSON.parse(s)}})}};g=M([y(0,e.Inject(e.IResourceManagerService)),y(1,e.IUniverInstanceService)],g);var N=Object.getOwnPropertyDescriptor,O=(s,n,t,o)=>{for(var i=o>1?void 0:o?N(n,t):n,r=s.length-1,c;r>=0;r--)(c=s[r])&&(i=c(i)||i);return i},h=(s,n)=>(t,o)=>n(t,o,s);a.UniverDocsHyperLinkPlugin=(p=class extends e.Plugin{constructor(n=f,t,o,i){super(),this._config=n,this._injector=t,this._configService=o,this._commandService=i;const{...r}=e.merge({},f,this._config);this._configService.setConfig(D,r)}onStarting(){[[g]].forEach(t=>this._injector.add(t)),[m,C,U].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))}),this._injector.get(g)}},l(p,"pluginName",I),l(p,"packageName",_.name),l(p,"version",_.version),l(p,"type",e.UniverInstanceType.UNIVER_DOC),p),a.UniverDocsHyperLinkPlugin=O([h(1,e.Inject(e.Injector)),h(2,e.IConfigService),h(3,e.ICommandService)],a.UniverDocsHyperLinkPlugin),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-hyper-link",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -43,13 +43,13 @@
43
43
  "lib"
44
44
  ],
45
45
  "dependencies": {
46
- "@univerjs/core": "0.16.1"
46
+ "@univerjs/core": "0.17.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "typescript": "^5.9.3",
50
50
  "vite": "^7.3.1",
51
51
  "vitest": "^4.0.18",
52
- "@univerjs-infra/shared": "0.16.1"
52
+ "@univerjs-infra/shared": "0.17.0"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "vitest run",