@univerjs/docs-hyper-link 0.5.1 → 0.5.2

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