@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 +1 -1
- package/lib/es/index.js +1 -118
- package/lib/index.js +1 -118
- package/lib/types/commands/mutations/hyper-link.mutation.d.ts +16 -1
- package/lib/types/controllers/resource.controller.d.ts +15 -0
- package/lib/types/plugin.d.ts +16 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -6
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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 {
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
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(
|
|
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.
|
|
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.
|
|
46
|
+
"@univerjs/core": "0.18.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"typescript": "^5.9.3",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
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
|
}
|