@univerjs/docs-hyper-link 0.17.0 → 0.18.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 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);
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@univerjs/core`);var t=`@univerjs/docs-hyper-link`,n=`0.18.0`;const r={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},a={id:`docs.mutation.delete-hyper-link`,type:e.CommandType.MUTATION,handler:()=>!0},o=`docs-hyper-link.config`;Symbol(o);const s={};function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const u=`DOC_HYPER_LINK_PLUGIN`;let d=class extends e.Disposable{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:u,businesses:[e.UniverInstanceType.UNIVER_DOC],onLoad:(t,n)=>{let r=this._univerInstanceService.getUnit(t,e.UniverInstanceType.UNIVER_DOC);if(!r)return;let i=new Map,a=t=>{var n;return(n=t.getBody())==null||(n=n.customRanges)==null||n.forEach(t=>{t.rangeType===e.CustomRangeType.HYPERLINK&&i.set(t.rangeId,t)}),i};r.headerModelMap.forEach(e=>{a(e)}),r.footerModelMap.forEach(e=>{a(e)}),a(r),n.links.forEach(e=>{let t=i.get(e.id);t&&(t.properties={...t.properties,url:e.payload})})},onUnLoad:e=>{},toJson:t=>{let n=this._univerInstanceService.getUnit(t,e.UniverInstanceType.UNIVER_DOC),r=[];if(n){let t=t=>{var n;(n=t.getBody())==null||(n=n.customRanges)==null||n.forEach(t=>{if(t.rangeType===e.CustomRangeType.HYPERLINK){var n;r.push({id:t.rangeId,payload:((n=t.properties)==null?void 0:n.url)||``})}})};n.headerModelMap.forEach(e=>{t(e)}),n.footerModelMap.forEach(e=>{t(e)}),t(n)}return JSON.stringify({links:r})},parseJson(e){return JSON.parse(e)}})}};d=l([c(0,(0,e.Inject)(e.IResourceManagerService)),c(1,e.IUniverInstanceService)],d);function f(e){"@babel/helpers - typeof";return f=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},f(e)}function p(e,t){if(f(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(f(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return f(t)==`symbol`?t:t+``}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let g=class extends e.Plugin{constructor(t=s,n,r,i){super(),this._config=t,this._injector=n,this._configService=r,this._commandService=i;let{...a}=(0,e.merge)({},s,this._config);this._configService.setConfig(o,a)}onStarting(){[[d]].forEach(e=>this._injector.add(e)),[r,a,i].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))}),this._injector.get(d)}};h(g,`pluginName`,u),h(g,`packageName`,t),h(g,`version`,n),h(g,`type`,e.UniverInstanceType.UNIVER_DOC),g=l([c(1,(0,e.Inject)(e.Injector)),c(2,e.IConfigService),c(3,e.ICommandService)],g),Object.defineProperty(exports,`UniverDocsHyperLinkPlugin`,{enumerable:!0,get:function(){return g}});
package/lib/es/index.js CHANGED
@@ -1,118 +1 @@
1
- var M = Object.defineProperty;
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 = {
9
- id: "docs.mutation.add-hyper-link",
10
- type: l.MUTATION,
11
- handler: () => !0
12
- }, j = {
13
- id: "docs.mutation.update-hyper-link",
14
- type: l.MUTATION,
15
- handler: () => !0
16
- }, K = {
17
- id: "docs.mutation.delete-hyper-link",
18
- type: l.MUTATION,
19
- handler: () => !0
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--)
23
- (s = r[i]) && (n = s(n) || n);
24
- return n;
25
- }, I = (r, e) => (t, o) => e(t, o, r);
26
- const N = "DOC_HYPER_LINK_PLUGIN";
27
- let _ = class extends D {
28
- constructor(r, e) {
29
- super(), this._resourceManagerService = r, this._univerInstanceService = e, this._init();
30
- }
31
- _init() {
32
- this._resourceManagerService.registerPluginResource({
33
- pluginName: N,
34
- businesses: [u.UNIVER_DOC],
35
- onLoad: (r, e) => {
36
- const t = this._univerInstanceService.getUnit(r, u.UNIVER_DOC);
37
- if (!t)
38
- return;
39
- const o = /* @__PURE__ */ new Map(), n = (i) => {
40
- var s, a;
41
- return (a = (s = i.getBody()) == null ? void 0 : s.customRanges) == null || a.forEach((c) => {
42
- c.rangeType === g.HYPERLINK && o.set(c.rangeId, c);
43
- }), o;
44
- };
45
- t.headerModelMap.forEach((i) => {
46
- n(i);
47
- }), t.footerModelMap.forEach((i) => {
48
- n(i);
49
- }), n(t), e.links.forEach((i) => {
50
- const s = o.get(i.id);
51
- s && (s.properties = {
52
- ...s.properties,
53
- url: i.payload
54
- });
55
- });
56
- },
57
- onUnLoad: (r) => {
58
- },
59
- toJson: (r) => {
60
- const e = this._univerInstanceService.getUnit(r, u.UNIVER_DOC), t = [];
61
- if (e) {
62
- const o = (n) => {
63
- var i, s;
64
- (s = (i = n.getBody()) == null ? void 0 : i.customRanges) == null || s.forEach((a) => {
65
- var c;
66
- a.rangeType === g.HYPERLINK && t.push({
67
- id: a.rangeId,
68
- payload: ((c = a.properties) == null ? void 0 : c.url) || ""
69
- });
70
- });
71
- };
72
- e.headerModelMap.forEach((n) => {
73
- o(n);
74
- }), e.footerModelMap.forEach((n) => {
75
- o(n);
76
- }), o(e);
77
- }
78
- return JSON.stringify({ links: t });
79
- },
80
- parseJson(r) {
81
- return JSON.parse(r);
82
- }
83
- });
84
- }
85
- };
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--)
92
- (s = r[i]) && (n = s(n) || n);
93
- return n;
94
- }, h = (r, e) => (t, o) => e(t, o, r), p;
95
- let y = (p = class extends P {
96
- constructor(r = f, e, t, o) {
97
- super(), this._config = r, this._injector = e, this._configService = t, this._commandService = o;
98
- const { ...n } = S(
99
- {},
100
- f,
101
- this._config
102
- );
103
- this._configService.setConfig(Y, n);
104
- }
105
- onStarting() {
106
- [[_]].forEach((e) => this._injector.add(e)), [H, K, j].forEach((e) => {
107
- this.disposeWithMe(this._commandService.registerCommand(e));
108
- }), this._injector.get(_);
109
- }
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);
116
- export {
117
- y as UniverDocsHyperLinkPlugin
118
- };
1
+ import{CommandType as e,CustomRangeType as t,Disposable as n,ICommandService as r,IConfigService as i,IResourceManagerService as a,IUniverInstanceService as o,Inject as s,Injector as c,Plugin as l,UniverInstanceType as u,merge as d}from"@univerjs/core";var f=`@univerjs/docs-hyper-link`,p=`0.18.0`;const m={id:`docs.mutation.add-hyper-link`,type:e.MUTATION,handler:()=>!0},h={id:`docs.mutation.update-hyper-link`,type:e.MUTATION,handler:()=>!0},g={id:`docs.mutation.delete-hyper-link`,type:e.MUTATION,handler:()=>!0},_=`docs-hyper-link.config`;Symbol(_);const v={};function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const x=`DOC_HYPER_LINK_PLUGIN`;let S=class extends n{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:x,businesses:[u.UNIVER_DOC],onLoad:(e,n)=>{let r=this._univerInstanceService.getUnit(e,u.UNIVER_DOC);if(!r)return;let i=new Map,a=e=>{var n;return(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{e.rangeType===t.HYPERLINK&&i.set(e.rangeId,e)}),i};r.headerModelMap.forEach(e=>{a(e)}),r.footerModelMap.forEach(e=>{a(e)}),a(r),n.links.forEach(e=>{let t=i.get(e.id);t&&(t.properties={...t.properties,url:e.payload})})},onUnLoad:e=>{},toJson:e=>{let n=this._univerInstanceService.getUnit(e,u.UNIVER_DOC),r=[];if(n){let e=e=>{var n;(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{if(e.rangeType===t.HYPERLINK){var n;r.push({id:e.rangeId,payload:((n=e.properties)==null?void 0:n.url)||``})}})};n.headerModelMap.forEach(t=>{e(t)}),n.footerModelMap.forEach(t=>{e(t)}),e(n)}return JSON.stringify({links:r})},parseJson(e){return JSON.parse(e)}})}};S=b([y(0,s(a)),y(1,o)],S);function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function E(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let D=class extends l{constructor(e=v,t,n,r){super(),this._config=e,this._injector=t,this._configService=n,this._commandService=r;let{...i}=d({},v,this._config);this._configService.setConfig(_,i)}onStarting(){[[S]].forEach(e=>this._injector.add(e)),[m,g,h].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))}),this._injector.get(S)}};E(D,`pluginName`,x),E(D,`packageName`,f),E(D,`version`,p),E(D,`type`,u.UNIVER_DOC),D=b([y(1,s(c)),y(2,i),y(3,r)],D);export{D as UniverDocsHyperLinkPlugin};
package/lib/index.js CHANGED
@@ -1,118 +1 @@
1
- var M = Object.defineProperty;
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 = {
9
- id: "docs.mutation.add-hyper-link",
10
- type: l.MUTATION,
11
- handler: () => !0
12
- }, j = {
13
- id: "docs.mutation.update-hyper-link",
14
- type: l.MUTATION,
15
- handler: () => !0
16
- }, K = {
17
- id: "docs.mutation.delete-hyper-link",
18
- type: l.MUTATION,
19
- handler: () => !0
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--)
23
- (s = r[i]) && (n = s(n) || n);
24
- return n;
25
- }, I = (r, e) => (t, o) => e(t, o, r);
26
- const N = "DOC_HYPER_LINK_PLUGIN";
27
- let _ = class extends D {
28
- constructor(r, e) {
29
- super(), this._resourceManagerService = r, this._univerInstanceService = e, this._init();
30
- }
31
- _init() {
32
- this._resourceManagerService.registerPluginResource({
33
- pluginName: N,
34
- businesses: [u.UNIVER_DOC],
35
- onLoad: (r, e) => {
36
- const t = this._univerInstanceService.getUnit(r, u.UNIVER_DOC);
37
- if (!t)
38
- return;
39
- const o = /* @__PURE__ */ new Map(), n = (i) => {
40
- var s, a;
41
- return (a = (s = i.getBody()) == null ? void 0 : s.customRanges) == null || a.forEach((c) => {
42
- c.rangeType === g.HYPERLINK && o.set(c.rangeId, c);
43
- }), o;
44
- };
45
- t.headerModelMap.forEach((i) => {
46
- n(i);
47
- }), t.footerModelMap.forEach((i) => {
48
- n(i);
49
- }), n(t), e.links.forEach((i) => {
50
- const s = o.get(i.id);
51
- s && (s.properties = {
52
- ...s.properties,
53
- url: i.payload
54
- });
55
- });
56
- },
57
- onUnLoad: (r) => {
58
- },
59
- toJson: (r) => {
60
- const e = this._univerInstanceService.getUnit(r, u.UNIVER_DOC), t = [];
61
- if (e) {
62
- const o = (n) => {
63
- var i, s;
64
- (s = (i = n.getBody()) == null ? void 0 : i.customRanges) == null || s.forEach((a) => {
65
- var c;
66
- a.rangeType === g.HYPERLINK && t.push({
67
- id: a.rangeId,
68
- payload: ((c = a.properties) == null ? void 0 : c.url) || ""
69
- });
70
- });
71
- };
72
- e.headerModelMap.forEach((n) => {
73
- o(n);
74
- }), e.footerModelMap.forEach((n) => {
75
- o(n);
76
- }), o(e);
77
- }
78
- return JSON.stringify({ links: t });
79
- },
80
- parseJson(r) {
81
- return JSON.parse(r);
82
- }
83
- });
84
- }
85
- };
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--)
92
- (s = r[i]) && (n = s(n) || n);
93
- return n;
94
- }, h = (r, e) => (t, o) => e(t, o, r), p;
95
- let y = (p = class extends P {
96
- constructor(r = f, e, t, o) {
97
- super(), this._config = r, this._injector = e, this._configService = t, this._commandService = o;
98
- const { ...n } = S(
99
- {},
100
- f,
101
- this._config
102
- );
103
- this._configService.setConfig(Y, n);
104
- }
105
- onStarting() {
106
- [[_]].forEach((e) => this._injector.add(e)), [H, K, j].forEach((e) => {
107
- this.disposeWithMe(this._commandService.registerCommand(e));
108
- }), this._injector.get(_);
109
- }
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);
116
- export {
117
- y as UniverDocsHyperLinkPlugin
118
- };
1
+ import{CommandType as e,CustomRangeType as t,Disposable as n,ICommandService as r,IConfigService as i,IResourceManagerService as a,IUniverInstanceService as o,Inject as s,Injector as c,Plugin as l,UniverInstanceType as u,merge as d}from"@univerjs/core";var f=`@univerjs/docs-hyper-link`,p=`0.18.0`;const m={id:`docs.mutation.add-hyper-link`,type:e.MUTATION,handler:()=>!0},h={id:`docs.mutation.update-hyper-link`,type:e.MUTATION,handler:()=>!0},g={id:`docs.mutation.delete-hyper-link`,type:e.MUTATION,handler:()=>!0},_=`docs-hyper-link.config`;Symbol(_);const v={};function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const x=`DOC_HYPER_LINK_PLUGIN`;let S=class extends n{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:x,businesses:[u.UNIVER_DOC],onLoad:(e,n)=>{let r=this._univerInstanceService.getUnit(e,u.UNIVER_DOC);if(!r)return;let i=new Map,a=e=>{var n;return(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{e.rangeType===t.HYPERLINK&&i.set(e.rangeId,e)}),i};r.headerModelMap.forEach(e=>{a(e)}),r.footerModelMap.forEach(e=>{a(e)}),a(r),n.links.forEach(e=>{let t=i.get(e.id);t&&(t.properties={...t.properties,url:e.payload})})},onUnLoad:e=>{},toJson:e=>{let n=this._univerInstanceService.getUnit(e,u.UNIVER_DOC),r=[];if(n){let e=e=>{var n;(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{if(e.rangeType===t.HYPERLINK){var n;r.push({id:e.rangeId,payload:((n=e.properties)==null?void 0:n.url)||``})}})};n.headerModelMap.forEach(t=>{e(t)}),n.footerModelMap.forEach(t=>{e(t)}),e(n)}return JSON.stringify({links:r})},parseJson(e){return JSON.parse(e)}})}};S=b([y(0,s(a)),y(1,o)],S);function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function E(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let D=class extends l{constructor(e=v,t,n,r){super(),this._config=e,this._injector=t,this._configService=n,this._commandService=r;let{...i}=d({},v,this._config);this._configService.setConfig(_,i)}onStarting(){[[S]].forEach(e=>this._injector.add(e)),[m,g,h].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))}),this._injector.get(S)}};E(D,`pluginName`,x),E(D,`packageName`,f),E(D,`version`,p),E(D,`type`,u.UNIVER_DOC),D=b([y(1,s(c)),y(2,i),y(3,r)],D);export{D as UniverDocsHyperLinkPlugin};
@@ -1,4 +1,19 @@
1
- import { ICommand } from '@univerjs/core';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ICommand } from '@univerjs/core';
2
17
  export declare const AddHyperLinkMuatation: ICommand;
3
18
  export declare const UpdateHyperLinkMuatation: ICommand;
4
19
  export declare const DeleteHyperLinkMuatation: ICommand;
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
  import { Disposable, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
2
17
  export declare const DOC_HYPER_LINK_PLUGIN = "DOC_HYPER_LINK_PLUGIN";
3
18
  export declare class DocHyperLinkResourceController extends Disposable {
@@ -1,4 +1,19 @@
1
- import { IUniverDocsHyperLinkConfig } from './config/config';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IUniverDocsHyperLinkConfig } from './config/config';
2
17
  import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
18
  export declare class UniverDocsHyperLinkPlugin extends Plugin {
4
19
  private readonly _config;
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 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"})}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsHyperLink={},e.UniverCore))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=`@univerjs/docs-hyper-link`,r=`0.18.0`;let i={id:`docs.mutation.add-hyper-link`,type:t.CommandType.MUTATION,handler:()=>!0},a={id:`docs.mutation.update-hyper-link`,type:t.CommandType.MUTATION,handler:()=>!0},o={id:`docs.mutation.delete-hyper-link`,type:t.CommandType.MUTATION,handler:()=>!0},s=`docs-hyper-link.config`;Symbol(s);let c={};function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=`DOC_HYPER_LINK_PLUGIN`,f=class extends t.Disposable{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:d,businesses:[t.UniverInstanceType.UNIVER_DOC],onLoad:(e,n)=>{let r=this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_DOC);if(!r)return;let i=new Map,a=e=>{var n;return(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{e.rangeType===t.CustomRangeType.HYPERLINK&&i.set(e.rangeId,e)}),i};r.headerModelMap.forEach(e=>{a(e)}),r.footerModelMap.forEach(e=>{a(e)}),a(r),n.links.forEach(e=>{let t=i.get(e.id);t&&(t.properties={...t.properties,url:e.payload})})},onUnLoad:e=>{},toJson:e=>{let n=this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_DOC),r=[];if(n){let e=e=>{var n;(n=e.getBody())==null||(n=n.customRanges)==null||n.forEach(e=>{if(e.rangeType===t.CustomRangeType.HYPERLINK){var n;r.push({id:e.rangeId,payload:((n=e.properties)==null?void 0:n.url)||``})}})};n.headerModelMap.forEach(t=>{e(t)}),n.footerModelMap.forEach(t=>{e(t)}),e(n)}return JSON.stringify({links:r})},parseJson(e){return JSON.parse(e)}})}};f=u([l(0,(0,t.Inject)(t.IResourceManagerService)),l(1,t.IUniverInstanceService)],f);function p(e){"@babel/helpers - typeof";return p=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p(e)}function m(e,t){if(p(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(p(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e){var t=m(e,`string`);return p(t)==`symbol`?t:t+``}function g(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let _=class extends t.Plugin{constructor(e=c,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._commandService=i;let{...a}=(0,t.merge)({},c,this._config);this._configService.setConfig(s,a)}onStarting(){[[f]].forEach(e=>this._injector.add(e)),[i,o,a].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))}),this._injector.get(f)}};g(_,`pluginName`,d),g(_,`packageName`,n),g(_,`version`,r),g(_,`type`,t.UniverInstanceType.UNIVER_DOC),_=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.IConfigService),l(3,t.ICommandService)],_),Object.defineProperty(e,`UniverDocsHyperLinkPlugin`,{enumerable:!0,get:function(){return _}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-hyper-link",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -43,20 +43,21 @@
43
43
  "lib"
44
44
  ],
45
45
  "dependencies": {
46
- "@univerjs/core": "0.17.0"
46
+ "@univerjs/core": "0.18.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "typescript": "^5.9.3",
50
- "vite": "^7.3.1",
51
- "vitest": "^4.0.18",
52
- "@univerjs-infra/shared": "0.17.0"
50
+ "vitest": "^4.1.0",
51
+ "@univerjs-infra/shared": "0.18.0"
53
52
  },
54
53
  "scripts": {
55
54
  "test": "vitest run",
56
55
  "test:watch": "vitest",
57
56
  "coverage": "vitest run --coverage",
58
57
  "typecheck": "tsc --noEmit",
59
- "build": "univer-cli build"
58
+ "build:bundle": "univer-cli build",
59
+ "build:types": "tsc -p tsconfig.node.json",
60
+ "build": "pnpm run build:bundle && pnpm run build:types"
60
61
  },
61
62
  "module": "./lib/es/index.js"
62
63
  }