@univerjs/docs-hyper-link 0.2.12 → 0.2.13
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 __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DOC_HYPER_LINK_PLUGIN="DOC_HYPER_LINK_PLUGIN";var _a;let DocHyperLinkResourceController=(_a=class extends core.Disposable{constructor(_resourceManagerService,_univerInstanceService){super(),this._resourceManagerService=_resourceManagerService,this._univerInstanceService=_univerInstanceService,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:DOC_HYPER_LINK_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_DOC],onLoad:__name((unitID,resource)=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC);if(!doc)return;const customRangeMap=new Map,handleDoc=__name(model=>{var _a3,_b;return(_b=(_a3=model.getBody())==null?void 0:_a3.customRanges)==null||_b.forEach(customRange=>{customRange.rangeType===core.CustomRangeType.HYPERLINK&&customRangeMap.set(customRange.rangeId,customRange)}),customRangeMap},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc),resource.links.forEach(link=>{const customRange=customRangeMap.get(link.id);customRange&&(customRange.properties={...customRange.properties,url:link.payload})})},"onLoad"),onUnLoad:__name(unitID=>{},"onUnLoad"),toJson:__name(unitID=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC),links=[];if(doc){const handleDoc=__name(model=>{var _a3,_b;(_b=(_a3=model.getBody())==null?void 0:_a3.customRanges)==null||_b.forEach(customRange=>{var _a4;customRange.rangeType===core.CustomRangeType.HYPERLINK&&links.push({id:customRange.rangeId,payload:((_a4=customRange.properties)==null?void 0:_a4.url)||""})})},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc)}return JSON.stringify({links})},"toJson"),parseJson(bytes){return JSON.parse(bytes)}})}},__name(_a,"DocHyperLinkResourceController"),_a);DocHyperLinkResourceController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocHyperLinkResourceController),__decorateParam$1(0,core.Inject(core.IResourceManagerService)),__decorateParam$1(1,core.IUniverInstanceService)],DocHyperLinkResourceController);
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),AddHyperLinkMuatation={id:"docs.mutation.add-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},UpdateHyperLinkMuatation={id:"docs.mutation.update-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},DeleteHyperLinkMuatation={id:"docs.mutation.delete-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},PLUGIN_CONFIG_KEY="docs-hyper-link.config",defaultPluginConfig={};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DOC_HYPER_LINK_PLUGIN="DOC_HYPER_LINK_PLUGIN";var _a;let DocHyperLinkResourceController=(_a=class extends core.Disposable{constructor(_resourceManagerService,_univerInstanceService){super(),this._resourceManagerService=_resourceManagerService,this._univerInstanceService=_univerInstanceService,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:DOC_HYPER_LINK_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_DOC],onLoad:__name((unitID,resource)=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC);if(!doc)return;const customRangeMap=new Map,handleDoc=__name(model=>{var _a3,_b;return(_b=(_a3=model.getBody())==null?void 0:_a3.customRanges)==null||_b.forEach(customRange=>{customRange.rangeType===core.CustomRangeType.HYPERLINK&&customRangeMap.set(customRange.rangeId,customRange)}),customRangeMap},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc),resource.links.forEach(link=>{const customRange=customRangeMap.get(link.id);customRange&&(customRange.properties={...customRange.properties,url:link.payload})})},"onLoad"),onUnLoad:__name(unitID=>{},"onUnLoad"),toJson:__name(unitID=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC),links=[];if(doc){const handleDoc=__name(model=>{var _a3,_b;(_b=(_a3=model.getBody())==null?void 0:_a3.customRanges)==null||_b.forEach(customRange=>{var _a4;customRange.rangeType===core.CustomRangeType.HYPERLINK&&links.push({id:customRange.rangeId,payload:((_a4=customRange.properties)==null?void 0:_a4.url)||""})})},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc)}return JSON.stringify({links})},"toJson"),parseJson(bytes){return JSON.parse(bytes)}})}},__name(_a,"DocHyperLinkResourceController"),_a);DocHyperLinkResourceController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocHyperLinkResourceController),__decorateParam$1(0,core.Inject(core.IResourceManagerService)),__decorateParam$1(1,core.IUniverInstanceService)],DocHyperLinkResourceController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a2;exports.UniverDocsHyperLinkPlugin=(_a2=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService,_commandService){super(),this._config=_config,this._injector=_injector,this._configService=_configService,this._commandService=_commandService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocHyperLinkResourceController]].forEach(dep=>{this._injector.add(dep)}),[AddHyperLinkMuatation,DeleteHyperLinkMuatation,UpdateHyperLinkMuatation].forEach(mutation=>{this.disposeWithMe(this._commandService.registerCommand(mutation))})}},__name(_a2,"UniverDocsHyperLinkPlugin"),__publicField(_a2,"pluginName",DOC_HYPER_LINK_PLUGIN),__publicField(_a2,"type",core.UniverInstanceType.UNIVER_DOC),_a2);exports.UniverDocsHyperLinkPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService),__decorateParam(3,core.ICommandService)],exports.UniverDocsHyperLinkPlugin);
|
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,20 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { OnLifecycle, LifecycleStages, Inject, IResourceManagerService, Disposable, UniverInstanceType, IUniverInstanceService, CustomRangeType, Plugin, Injector, IConfigService } from "@univerjs/core";
|
|
5
|
+
import { CommandType, OnLifecycle, LifecycleStages, Inject, IResourceManagerService, Disposable, UniverInstanceType, IUniverInstanceService, CustomRangeType, Plugin, Injector, IConfigService, ICommandService } from "@univerjs/core";
|
|
6
|
+
const AddHyperLinkMuatation = {
|
|
7
|
+
id: "docs.mutation.add-hyper-link",
|
|
8
|
+
type: CommandType.MUTATION,
|
|
9
|
+
handler: /* @__PURE__ */ __name(() => !0, "handler")
|
|
10
|
+
}, UpdateHyperLinkMuatation = {
|
|
11
|
+
id: "docs.mutation.update-hyper-link",
|
|
12
|
+
type: CommandType.MUTATION,
|
|
13
|
+
handler: /* @__PURE__ */ __name(() => !0, "handler")
|
|
14
|
+
}, DeleteHyperLinkMuatation = {
|
|
15
|
+
id: "docs.mutation.delete-hyper-link",
|
|
16
|
+
type: CommandType.MUTATION,
|
|
17
|
+
handler: /* @__PURE__ */ __name(() => !0, "handler")
|
|
18
|
+
}, PLUGIN_CONFIG_KEY = "docs-hyper-link.config", defaultPluginConfig = {};
|
|
6
19
|
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7
20
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
21
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -74,15 +87,14 @@ DocHyperLinkResourceController = __decorateClass$1([
|
|
|
74
87
|
__decorateParam$1(0, Inject(IResourceManagerService)),
|
|
75
88
|
__decorateParam$1(1, IUniverInstanceService)
|
|
76
89
|
], DocHyperLinkResourceController);
|
|
77
|
-
const PLUGIN_CONFIG_KEY = "docs-hyper-link.config", defaultPluginConfig = {};
|
|
78
90
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
79
91
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
80
92
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
81
93
|
return kind && result && __defProp2(target, key, result), result;
|
|
82
94
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a2;
|
|
83
95
|
let UniverDocsHyperLinkPlugin = (_a2 = class extends Plugin {
|
|
84
|
-
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
85
|
-
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
96
|
+
constructor(_config = defaultPluginConfig, _injector, _configService, _commandService) {
|
|
97
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService, this._commandService = _commandService;
|
|
86
98
|
const { ...rest } = this._config;
|
|
87
99
|
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
88
100
|
}
|
|
@@ -91,12 +103,15 @@ let UniverDocsHyperLinkPlugin = (_a2 = class extends Plugin {
|
|
|
91
103
|
[DocHyperLinkResourceController]
|
|
92
104
|
].forEach((dep) => {
|
|
93
105
|
this._injector.add(dep);
|
|
106
|
+
}), [AddHyperLinkMuatation, DeleteHyperLinkMuatation, UpdateHyperLinkMuatation].forEach((mutation) => {
|
|
107
|
+
this.disposeWithMe(this._commandService.registerCommand(mutation));
|
|
94
108
|
});
|
|
95
109
|
}
|
|
96
110
|
}, __name(_a2, "UniverDocsHyperLinkPlugin"), __publicField(_a2, "pluginName", DOC_HYPER_LINK_PLUGIN), __publicField(_a2, "type", UniverInstanceType.UNIVER_DOC), _a2);
|
|
97
111
|
UniverDocsHyperLinkPlugin = __decorateClass([
|
|
98
112
|
__decorateParam(1, Inject(Injector)),
|
|
99
|
-
__decorateParam(2, IConfigService)
|
|
113
|
+
__decorateParam(2, IConfigService),
|
|
114
|
+
__decorateParam(3, ICommandService)
|
|
100
115
|
], UniverDocsHyperLinkPlugin);
|
|
101
116
|
export {
|
|
102
117
|
UniverDocsHyperLinkPlugin
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
1
|
+
import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { IUniverDocsHyperLinkConfig } from './controllers/config.schema';
|
|
3
3
|
export declare class UniverDocsHyperLinkPlugin extends Plugin {
|
|
4
4
|
private readonly _config;
|
|
5
5
|
protected _injector: Injector;
|
|
6
6
|
private readonly _configService;
|
|
7
|
+
private readonly _commandService;
|
|
7
8
|
static pluginName: string;
|
|
8
9
|
static type: UniverInstanceType;
|
|
9
|
-
constructor(_config: Partial<IUniverDocsHyperLinkConfig
|
|
10
|
+
constructor(_config: Partial<IUniverDocsHyperLinkConfig> | undefined, _injector: Injector, _configService: IConfigService, _commandService: ICommandService);
|
|
10
11
|
onStarting(): void;
|
|
11
12
|
}
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocsHyperLink={},global.UniverCore))})(this,function(exports2,core){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b;var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DOC_HYPER_LINK_PLUGIN="DOC_HYPER_LINK_PLUGIN";let DocHyperLinkResourceController=(_a=class extends core.Disposable{constructor(_resourceManagerService,_univerInstanceService){super(),this._resourceManagerService=_resourceManagerService,this._univerInstanceService=_univerInstanceService,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:DOC_HYPER_LINK_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_DOC],onLoad:__name((unitID,resource)=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC);if(!doc)return;const customRangeMap=new Map,handleDoc=__name(model=>{var _a2,_b2;return(_b2=(_a2=model.getBody())==null?void 0:_a2.customRanges)==null||_b2.forEach(customRange=>{customRange.rangeType===core.CustomRangeType.HYPERLINK&&customRangeMap.set(customRange.rangeId,customRange)}),customRangeMap},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc),resource.links.forEach(link=>{const customRange=customRangeMap.get(link.id);customRange&&(customRange.properties={...customRange.properties,url:link.payload})})},"onLoad"),onUnLoad:__name(unitID=>{},"onUnLoad"),toJson:__name(unitID=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC),links=[];if(doc){const handleDoc=__name(model=>{var _a2,_b2;(_b2=(_a2=model.getBody())==null?void 0:_a2.customRanges)==null||_b2.forEach(customRange=>{var _a3;customRange.rangeType===core.CustomRangeType.HYPERLINK&&links.push({id:customRange.rangeId,payload:((_a3=customRange.properties)==null?void 0:_a3.url)||""})})},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc)}return JSON.stringify({links})},"toJson"),parseJson(bytes){return JSON.parse(bytes)}})}},__name(_a,"DocHyperLinkResourceController"),_a);DocHyperLinkResourceController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocHyperLinkResourceController),__decorateParam$1(0,core.Inject(core.IResourceManagerService)),__decorateParam$1(1,core.IUniverInstanceService)],DocHyperLinkResourceController);
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocsHyperLink={},global.UniverCore))})(this,function(exports2,core){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b;const AddHyperLinkMuatation={id:"docs.mutation.add-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},UpdateHyperLinkMuatation={id:"docs.mutation.update-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},DeleteHyperLinkMuatation={id:"docs.mutation.delete-hyper-link",type:core.CommandType.MUTATION,handler:__name(()=>!0,"handler")},PLUGIN_CONFIG_KEY="docs-hyper-link.config",defaultPluginConfig={};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DOC_HYPER_LINK_PLUGIN="DOC_HYPER_LINK_PLUGIN";let DocHyperLinkResourceController=(_a=class extends core.Disposable{constructor(_resourceManagerService,_univerInstanceService){super(),this._resourceManagerService=_resourceManagerService,this._univerInstanceService=_univerInstanceService,this._init()}_init(){this._resourceManagerService.registerPluginResource({pluginName:DOC_HYPER_LINK_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_DOC],onLoad:__name((unitID,resource)=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC);if(!doc)return;const customRangeMap=new Map,handleDoc=__name(model=>{var _a2,_b2;return(_b2=(_a2=model.getBody())==null?void 0:_a2.customRanges)==null||_b2.forEach(customRange=>{customRange.rangeType===core.CustomRangeType.HYPERLINK&&customRangeMap.set(customRange.rangeId,customRange)}),customRangeMap},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc),resource.links.forEach(link=>{const customRange=customRangeMap.get(link.id);customRange&&(customRange.properties={...customRange.properties,url:link.payload})})},"onLoad"),onUnLoad:__name(unitID=>{},"onUnLoad"),toJson:__name(unitID=>{const doc=this._univerInstanceService.getUnit(unitID,core.UniverInstanceType.UNIVER_DOC),links=[];if(doc){const handleDoc=__name(model=>{var _a2,_b2;(_b2=(_a2=model.getBody())==null?void 0:_a2.customRanges)==null||_b2.forEach(customRange=>{var _a3;customRange.rangeType===core.CustomRangeType.HYPERLINK&&links.push({id:customRange.rangeId,payload:((_a3=customRange.properties)==null?void 0:_a3.url)||""})})},"handleDoc");doc.headerModelMap.forEach(headerModel=>{handleDoc(headerModel)}),doc.footerModelMap.forEach(footerModel=>{handleDoc(footerModel)}),handleDoc(doc)}return JSON.stringify({links})},"toJson"),parseJson(bytes){return JSON.parse(bytes)}})}},__name(_a,"DocHyperLinkResourceController"),_a);DocHyperLinkResourceController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocHyperLinkResourceController),__decorateParam$1(0,core.Inject(core.IResourceManagerService)),__decorateParam$1(1,core.IUniverInstanceService)],DocHyperLinkResourceController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.UniverDocsHyperLinkPlugin=(_b=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService,_commandService){super(),this._config=_config,this._injector=_injector,this._configService=_configService,this._commandService=_commandService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocHyperLinkResourceController]].forEach(dep=>{this._injector.add(dep)}),[AddHyperLinkMuatation,DeleteHyperLinkMuatation,UpdateHyperLinkMuatation].forEach(mutation=>{this.disposeWithMe(this._commandService.registerCommand(mutation))})}},__name(_b,"UniverDocsHyperLinkPlugin"),__publicField(_b,"pluginName",DOC_HYPER_LINK_PLUGIN),__publicField(_b,"type",core.UniverInstanceType.UNIVER_DOC),_b),exports2.UniverDocsHyperLinkPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService),__decorateParam(3,core.ICommandService)],exports2.UniverDocsHyperLinkPlugin),Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-hyper-link",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer thread comment plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@univerjs/core": "0.2.
|
|
47
|
+
"@univerjs/core": "0.2.13"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@univerjs/icons": "^0.1.
|
|
50
|
+
"@univerjs/icons": "^0.1.78",
|
|
51
|
+
"@univerjs/core": "0.2.13"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"rxjs": "^7.8.1",
|
|
54
|
-
"typescript": "^5.
|
|
55
|
-
"vite": "^5.4.
|
|
55
|
+
"typescript": "^5.6.2",
|
|
56
|
+
"vite": "^5.4.4",
|
|
56
57
|
"vitest": "^2.0.5",
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/docs": "0.2.12"
|
|
58
|
+
"@univerjs-infra/shared": "0.2.13"
|
|
59
59
|
},
|
|
60
60
|
"univerSpace": {
|
|
61
61
|
".": {
|