@univerjs/docs-hyper-link 0.21.1 → 0.22.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/README.md +28 -17
- package/lib/cjs/index.js +7 -7
- package/lib/es/index.js +7 -7
- package/lib/index.js +7 -7
- package/lib/umd/index.js +1 -1
- package/package.json +14 -8
package/README.md
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
# @univerjs/docs-hyper-link
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://npmjs.com/package/@univerjs/docs-hyper-link)
|
|
4
|
+
[](https://npmjs.com/package/@univerjs/docs-hyper-link)
|
|
5
|
+
[](https://npmjs.com/package/@univerjs/docs-hyper-link)
|
|
4
6
|
|
|
5
|
-
`@univerjs/docs-hyper-link` provides the
|
|
7
|
+
`@univerjs/docs-hyper-link` provides the core hyperlink model and commands for Univer Docs.
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Package Overview
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
|
+
| --- | --- | :---: | :---: | :---: |
|
|
13
|
+
| `@univerjs/docs-hyper-link` | `UniverDocsHyperLink` | No | No | No |
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
# Using npm
|
|
13
|
-
npm install @univerjs/docs-hyper-link
|
|
15
|
+
## Installation
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
```sh
|
|
16
18
|
pnpm add @univerjs/docs-hyper-link
|
|
19
|
+
# or
|
|
20
|
+
npm install @univerjs/docs-hyper-link
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
Keep all `@univerjs/*` packages on the same version.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
20
26
|
|
|
21
|
-
```
|
|
22
|
-
import {
|
|
27
|
+
```ts
|
|
28
|
+
import { UniverDocsHyperLinkPlugin } from '@univerjs/docs-hyper-link';
|
|
23
29
|
|
|
24
|
-
univer.registerPlugin(
|
|
30
|
+
univer.registerPlugin(UniverDocsHyperLinkPlugin);
|
|
25
31
|
```
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
## Integration Notes
|
|
34
|
+
|
|
35
|
+
Use this package with `@univerjs/docs-hyper-link-ui` when users need hyperlink editing UI.
|
|
36
|
+
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
- [Documentation](https://docs.univer.ai)
|
|
40
|
+
- [NPM package](https://npmjs.com/package/@univerjs/docs-hyper-link)
|
|
41
|
+
- [GitHub repository](https://github.com/dream-num/univer)
|
|
42
|
+
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ let _univerjs_core = require("@univerjs/core");
|
|
|
3
3
|
|
|
4
4
|
//#region package.json
|
|
5
5
|
var name = "@univerjs/docs-hyper-link";
|
|
6
|
-
var version = "0.
|
|
6
|
+
var version = "0.22.0";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/commands/mutations/hyper-link.mutation.ts
|
|
@@ -51,7 +51,7 @@ const configSymbol = Symbol(DOCS_HYPER_LINK_PLUGIN_CONFIG_KEY);
|
|
|
51
51
|
const defaultPluginConfig = {};
|
|
52
52
|
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region \0@oxc-project+runtime@0.
|
|
54
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
55
55
|
function __decorateParam(paramIndex, decorator) {
|
|
56
56
|
return function(target, key) {
|
|
57
57
|
decorator(target, key, paramIndex);
|
|
@@ -59,7 +59,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region \0@oxc-project+runtime@0.
|
|
62
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
63
63
|
function __decorate(decorators, target, key, desc) {
|
|
64
64
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
65
65
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -143,7 +143,7 @@ let DocHyperLinkResourceController = class DocHyperLinkResourceController extend
|
|
|
143
143
|
DocHyperLinkResourceController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.IResourceManagerService)), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DocHyperLinkResourceController);
|
|
144
144
|
|
|
145
145
|
//#endregion
|
|
146
|
-
//#region \0@oxc-project+runtime@0.
|
|
146
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
147
147
|
function _typeof(o) {
|
|
148
148
|
"@babel/helpers - typeof";
|
|
149
149
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -154,7 +154,7 @@ function _typeof(o) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
|
-
//#region \0@oxc-project+runtime@0.
|
|
157
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
158
158
|
function toPrimitive(t, r) {
|
|
159
159
|
if ("object" != _typeof(t) || !t) return t;
|
|
160
160
|
var e = t[Symbol.toPrimitive];
|
|
@@ -167,14 +167,14 @@ function toPrimitive(t, r) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
//#endregion
|
|
170
|
-
//#region \0@oxc-project+runtime@0.
|
|
170
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
171
171
|
function toPropertyKey(t) {
|
|
172
172
|
var i = toPrimitive(t, "string");
|
|
173
173
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
//#endregion
|
|
177
|
-
//#region \0@oxc-project+runtime@0.
|
|
177
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
178
178
|
function _defineProperty(e, r, t) {
|
|
179
179
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
180
180
|
value: t,
|
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { CommandType, CustomRangeType, Disposable, ICommandService, IConfigServi
|
|
|
2
2
|
|
|
3
3
|
//#region package.json
|
|
4
4
|
var name = "@univerjs/docs-hyper-link";
|
|
5
|
-
var version = "0.
|
|
5
|
+
var version = "0.22.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/commands/mutations/hyper-link.mutation.ts
|
|
@@ -50,7 +50,7 @@ const configSymbol = Symbol(DOCS_HYPER_LINK_PLUGIN_CONFIG_KEY);
|
|
|
50
50
|
const defaultPluginConfig = {};
|
|
51
51
|
|
|
52
52
|
//#endregion
|
|
53
|
-
//#region \0@oxc-project+runtime@0.
|
|
53
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
54
54
|
function __decorateParam(paramIndex, decorator) {
|
|
55
55
|
return function(target, key) {
|
|
56
56
|
decorator(target, key, paramIndex);
|
|
@@ -58,7 +58,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region \0@oxc-project+runtime@0.
|
|
61
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
62
62
|
function __decorate(decorators, target, key, desc) {
|
|
63
63
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
64
64
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -142,7 +142,7 @@ let DocHyperLinkResourceController = class DocHyperLinkResourceController extend
|
|
|
142
142
|
DocHyperLinkResourceController = __decorate([__decorateParam(0, Inject(IResourceManagerService)), __decorateParam(1, IUniverInstanceService)], DocHyperLinkResourceController);
|
|
143
143
|
|
|
144
144
|
//#endregion
|
|
145
|
-
//#region \0@oxc-project+runtime@0.
|
|
145
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
146
146
|
function _typeof(o) {
|
|
147
147
|
"@babel/helpers - typeof";
|
|
148
148
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -153,7 +153,7 @@ function _typeof(o) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
//#endregion
|
|
156
|
-
//#region \0@oxc-project+runtime@0.
|
|
156
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
157
157
|
function toPrimitive(t, r) {
|
|
158
158
|
if ("object" != _typeof(t) || !t) return t;
|
|
159
159
|
var e = t[Symbol.toPrimitive];
|
|
@@ -166,14 +166,14 @@ function toPrimitive(t, r) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
//#endregion
|
|
169
|
-
//#region \0@oxc-project+runtime@0.
|
|
169
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
170
170
|
function toPropertyKey(t) {
|
|
171
171
|
var i = toPrimitive(t, "string");
|
|
172
172
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
//#endregion
|
|
176
|
-
//#region \0@oxc-project+runtime@0.
|
|
176
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
177
177
|
function _defineProperty(e, r, t) {
|
|
178
178
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
179
179
|
value: t,
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { CommandType, CustomRangeType, Disposable, ICommandService, IConfigServi
|
|
|
2
2
|
|
|
3
3
|
//#region package.json
|
|
4
4
|
var name = "@univerjs/docs-hyper-link";
|
|
5
|
-
var version = "0.
|
|
5
|
+
var version = "0.22.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/commands/mutations/hyper-link.mutation.ts
|
|
@@ -50,7 +50,7 @@ const configSymbol = Symbol(DOCS_HYPER_LINK_PLUGIN_CONFIG_KEY);
|
|
|
50
50
|
const defaultPluginConfig = {};
|
|
51
51
|
|
|
52
52
|
//#endregion
|
|
53
|
-
//#region \0@oxc-project+runtime@0.
|
|
53
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
54
54
|
function __decorateParam(paramIndex, decorator) {
|
|
55
55
|
return function(target, key) {
|
|
56
56
|
decorator(target, key, paramIndex);
|
|
@@ -58,7 +58,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region \0@oxc-project+runtime@0.
|
|
61
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
62
62
|
function __decorate(decorators, target, key, desc) {
|
|
63
63
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
64
64
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -142,7 +142,7 @@ let DocHyperLinkResourceController = class DocHyperLinkResourceController extend
|
|
|
142
142
|
DocHyperLinkResourceController = __decorate([__decorateParam(0, Inject(IResourceManagerService)), __decorateParam(1, IUniverInstanceService)], DocHyperLinkResourceController);
|
|
143
143
|
|
|
144
144
|
//#endregion
|
|
145
|
-
//#region \0@oxc-project+runtime@0.
|
|
145
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
146
146
|
function _typeof(o) {
|
|
147
147
|
"@babel/helpers - typeof";
|
|
148
148
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -153,7 +153,7 @@ function _typeof(o) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
//#endregion
|
|
156
|
-
//#region \0@oxc-project+runtime@0.
|
|
156
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
157
157
|
function toPrimitive(t, r) {
|
|
158
158
|
if ("object" != _typeof(t) || !t) return t;
|
|
159
159
|
var e = t[Symbol.toPrimitive];
|
|
@@ -166,14 +166,14 @@ function toPrimitive(t, r) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
//#endregion
|
|
169
|
-
//#region \0@oxc-project+runtime@0.
|
|
169
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
170
170
|
function toPropertyKey(t) {
|
|
171
171
|
var i = toPrimitive(t, "string");
|
|
172
172
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
//#endregion
|
|
176
|
-
//#region \0@oxc-project+runtime@0.
|
|
176
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
177
177
|
function _defineProperty(e, r, t) {
|
|
178
178
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
179
179
|
value: t,
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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.
|
|
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.22.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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-hyper-link",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
6
|
-
"author": "DreamNum <developer@univer.ai>",
|
|
5
|
+
"description": "Hyperlink model and commands for Univer Docs.",
|
|
6
|
+
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"funding": {
|
|
9
9
|
"type": "opencollective",
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/dream-num/univer/issues"
|
|
19
19
|
},
|
|
20
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"univer",
|
|
22
|
+
"docs",
|
|
23
|
+
"hyperlink",
|
|
24
|
+
"link",
|
|
25
|
+
"plugin"
|
|
26
|
+
],
|
|
21
27
|
"exports": {
|
|
22
28
|
".": {
|
|
23
29
|
"import": "./lib/es/index.js",
|
|
@@ -43,12 +49,12 @@
|
|
|
43
49
|
"lib"
|
|
44
50
|
],
|
|
45
51
|
"dependencies": {
|
|
46
|
-
"@univerjs/core": "0.
|
|
52
|
+
"@univerjs/core": "0.22.0"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
|
-
"typescript": "^6.0.
|
|
50
|
-
"vitest": "^4.1.
|
|
51
|
-
"@univerjs-infra/shared": "0.
|
|
55
|
+
"typescript": "^6.0.3",
|
|
56
|
+
"vitest": "^4.1.5",
|
|
57
|
+
"@univerjs-infra/shared": "0.22.0"
|
|
52
58
|
},
|
|
53
59
|
"scripts": {
|
|
54
60
|
"test": "vitest run",
|