prosemirror-link-plugin 1.2.0 → 1.3.1
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 +161 -161
- package/dist/decorationsUpdateInRange.d.ts +9 -20
- package/dist/decorationsUpdateInRange.d.ts.map +1 -0
- package/dist/defaultAliasDecoration.d.ts +5 -7
- package/dist/defaultAliasDecoration.d.ts.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +1 -15
- package/dist/index.js +1 -1
- package/dist/plugin.d.ts +7 -8
- package/dist/plugin.d.ts.map +1 -0
- package/dist/prosemirror-utils.d.ts +9 -0
- package/dist/prosemirror-utils.d.ts.map +1 -0
- package/dist/types.d.ts +21 -22
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +9 -8
- package/dist/utils.d.ts.map +1 -0
- package/package.json +69 -90
package/README.md
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
# prosemirror-link-plugin
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
By [Viktor Váczi](https://emergence-engineering.com/cv/viktor) at [Emergence Engineering](https://emergence-engineering.com/)
|
|
6
|
-
|
|
7
|
-
Try it out at <https://emergence-engineering.com/blog/prosemirror-link-plugin>
|
|
8
|
-
|
|
9
|
-
# Features
|
|
10
|
-
|
|
11
|
-
- Add decoration around words in a given list of aliases
|
|
12
|
-
- Update the aliases on the fly and see your decorations update
|
|
13
|
-
- Get notified when the user types or removes an alias from the document
|
|
14
|
-
- Do something with the decorations ( for example links that lead to a page about the alias )
|
|
15
|
-
|
|
16
|
-
# How to use
|
|
17
|
-
|
|
18
|
-
Install with `npm install --save prosemirror-link-plugin`, then:
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import { schema } from "prosemirror-schema-basic";
|
|
22
|
-
import { exampleSetup } from "prosemirror-example-setup";
|
|
23
|
-
import { Decoration } from "prosemirror-view";
|
|
24
|
-
import { EditorState } from "prosemirror-state";
|
|
25
|
-
import { EditorView } from "prosemirror-view";
|
|
26
|
-
import {
|
|
27
|
-
autoLinkingPlugin,
|
|
28
|
-
LinksKeyState,
|
|
29
|
-
} from "prosemirror-link-plugin";
|
|
30
|
-
|
|
31
|
-
export interface LinkSpec {
|
|
32
|
-
id: number;
|
|
33
|
-
alias: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const aliasDecoration = (
|
|
37
|
-
start: number,
|
|
38
|
-
end: number,
|
|
39
|
-
alias: string,
|
|
40
|
-
matchPos: number,
|
|
41
|
-
pluginState: LinksKeyState<LinkSpec>,
|
|
42
|
-
) => {
|
|
43
|
-
const spec = pluginState.aliasToSpec[alias];
|
|
44
|
-
return Decoration.inline(
|
|
45
|
-
start,
|
|
46
|
-
end,
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
class: "autoLink",
|
|
50
|
-
onclick: `alert('You clicked on "${alias}"')`,
|
|
51
|
-
},
|
|
52
|
-
{ id: spec?.id, alias },
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
let aliases = { alias: "typing", id: 1 };
|
|
57
|
-
|
|
58
|
-
const initialDoc = {
|
|
59
|
-
content: [
|
|
60
|
-
{
|
|
61
|
-
content: [
|
|
62
|
-
{
|
|
63
|
-
text: "Start typing!",
|
|
64
|
-
type: "text",
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
type: "paragraph",
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
type: "doc",
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const state = EditorState.create<typeof schema>({
|
|
74
|
-
doc: schema.nodeFromJSON(initialDoc),
|
|
75
|
-
plugins: [
|
|
76
|
-
...exampleSetup({
|
|
77
|
-
schema,
|
|
78
|
-
}),
|
|
79
|
-
autoLinkingPlugin(
|
|
80
|
-
aliases,
|
|
81
|
-
aliasDecoration,
|
|
82
|
-
),
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const view: EditorView = new EditorView(document.getElementById("editor"), {
|
|
87
|
-
state,
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## How to update the alias list
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
const meta: LinksMeta<LinkSpec> = {
|
|
95
|
-
type: LinksMetaType.linkUpdate,
|
|
96
|
-
// aliases is the new list of alises
|
|
97
|
-
specs: aliases,
|
|
98
|
-
};
|
|
99
|
-
view.dispatch(pmView.state.tr.setMeta(linksKey, meta));
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
# Configuration
|
|
103
|
-
|
|
104
|
-
### AutoLinkingPlugin
|
|
105
|
-
| name | type | description |
|
|
106
|
-
| --------------------- | ---------------------------------------------------- | -------------------------------------------------------------- |
|
|
107
|
-
| aliasesWithSpec | Array<SpecWithAlias<T>> | Initial list of aliases ( with additional properties ) |
|
|
108
|
-
| createAliasDecoration | CreateAliasDecoration ( explained below ) | Used to create ProseMirror `Decoration` when an alias is found |
|
|
109
|
-
| onLinkAdd | ( addedLinks: Array<SpecWithAlias<T>> ) => void | Called when links are added |
|
|
110
|
-
| onLinkRemove | ( removedLinks: Array<SpecWithAlias<T>> ) => void | Called when links are removed |
|
|
111
|
-
| regexGenerator | regexGenerator: ( aliases: string[] ) => RegExp | Creates the regex used internally to find matches |
|
|
112
|
-
|
|
113
|
-
### createAliasDecoration
|
|
114
|
-
|
|
115
|
-
| name | type | description |
|
|
116
|
-
| --------------------- | ---------------- | --------------------------------- |
|
|
117
|
-
| start | number | Start position of the alias |
|
|
118
|
-
| end | number | End position of the alias |
|
|
119
|
-
| alias | string | Matched alias |
|
|
120
|
-
| matchPos | number | Distance from the non-text parent |
|
|
121
|
-
| pluginState | LinksKeyState<T> | Current state of the plugin |
|
|
122
|
-
| doc | Node | ProseMirror doc Node |
|
|
123
|
-
|
|
124
|
-
### Example CSS
|
|
125
|
-
|
|
126
|
-
```css
|
|
127
|
-
.autoLink {
|
|
128
|
-
display: inline-flex;
|
|
129
|
-
justify-content: center;
|
|
130
|
-
align-items: center;
|
|
131
|
-
background-color: lightblue;
|
|
132
|
-
color: black;
|
|
133
|
-
border: 1px solid blueviolet;
|
|
134
|
-
width: fit-content;
|
|
135
|
-
height: 1.4rem;
|
|
136
|
-
padding: 3px 5px 3px 5px;
|
|
137
|
-
border-radius: 5px;
|
|
138
|
-
margin-left: 3px;
|
|
139
|
-
margin-right: 3px;
|
|
140
|
-
cursor: pointer;
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Development
|
|
145
|
-
|
|
146
|
-
### Running & linking locally
|
|
147
|
-
1. install plugin dependencies: `npm install`
|
|
148
|
-
2. install peer dependencies: `npm run install-peers`
|
|
149
|
-
3. link local lib: `npm run link`
|
|
150
|
-
4. link the package from the project you want to use it: `npm run link prosemirror-link-plugin`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### About us
|
|
154
|
-
|
|
155
|
-
Emergence Engineering is dev shop from the EU:
|
|
156
|
-
<https://emergence-engineering.com/>
|
|
157
|
-
|
|
158
|
-
We're looking for work, especially with ProseMirror ;)
|
|
159
|
-
|
|
160
|
-
Feel free to contact me at
|
|
161
|
-
<viktor.vaczi@emergence-engineering.com>
|
|
1
|
+
# prosemirror-link-plugin
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
By [Viktor Váczi](https://emergence-engineering.com/cv/viktor) at [Emergence Engineering](https://emergence-engineering.com/)
|
|
6
|
+
|
|
7
|
+
Try it out at <https://emergence-engineering.com/blog/prosemirror-link-plugin>
|
|
8
|
+
|
|
9
|
+
# Features
|
|
10
|
+
|
|
11
|
+
- Add decoration around words in a given list of aliases
|
|
12
|
+
- Update the aliases on the fly and see your decorations update
|
|
13
|
+
- Get notified when the user types or removes an alias from the document
|
|
14
|
+
- Do something with the decorations ( for example links that lead to a page about the alias )
|
|
15
|
+
|
|
16
|
+
# How to use
|
|
17
|
+
|
|
18
|
+
Install with `npm install --save prosemirror-link-plugin`, then:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { schema } from "prosemirror-schema-basic";
|
|
22
|
+
import { exampleSetup } from "prosemirror-example-setup";
|
|
23
|
+
import { Decoration } from "prosemirror-view";
|
|
24
|
+
import { EditorState } from "prosemirror-state";
|
|
25
|
+
import { EditorView } from "prosemirror-view";
|
|
26
|
+
import {
|
|
27
|
+
autoLinkingPlugin,
|
|
28
|
+
LinksKeyState,
|
|
29
|
+
} from "prosemirror-link-plugin";
|
|
30
|
+
|
|
31
|
+
export interface LinkSpec {
|
|
32
|
+
id: number;
|
|
33
|
+
alias: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const aliasDecoration = (
|
|
37
|
+
start: number,
|
|
38
|
+
end: number,
|
|
39
|
+
alias: string,
|
|
40
|
+
matchPos: number,
|
|
41
|
+
pluginState: LinksKeyState<LinkSpec>,
|
|
42
|
+
) => {
|
|
43
|
+
const spec = pluginState.aliasToSpec[alias];
|
|
44
|
+
return Decoration.inline(
|
|
45
|
+
start,
|
|
46
|
+
end,
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
class: "autoLink",
|
|
50
|
+
onclick: `alert('You clicked on "${alias}"')`,
|
|
51
|
+
},
|
|
52
|
+
{ id: spec?.id, alias },
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
let aliases = { alias: "typing", id: 1 };
|
|
57
|
+
|
|
58
|
+
const initialDoc = {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
text: "Start typing!",
|
|
64
|
+
type: "text",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
type: "paragraph",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
type: "doc",
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const state = EditorState.create<typeof schema>({
|
|
74
|
+
doc: schema.nodeFromJSON(initialDoc),
|
|
75
|
+
plugins: [
|
|
76
|
+
...exampleSetup({
|
|
77
|
+
schema,
|
|
78
|
+
}),
|
|
79
|
+
autoLinkingPlugin(
|
|
80
|
+
aliases,
|
|
81
|
+
aliasDecoration,
|
|
82
|
+
),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const view: EditorView = new EditorView(document.getElementById("editor"), {
|
|
87
|
+
state,
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## How to update the alias list
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const meta: LinksMeta<LinkSpec> = {
|
|
95
|
+
type: LinksMetaType.linkUpdate,
|
|
96
|
+
// aliases is the new list of alises
|
|
97
|
+
specs: aliases,
|
|
98
|
+
};
|
|
99
|
+
view.dispatch(pmView.state.tr.setMeta(linksKey, meta));
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
# Configuration
|
|
103
|
+
|
|
104
|
+
### AutoLinkingPlugin
|
|
105
|
+
| name | type | description |
|
|
106
|
+
| --------------------- | ---------------------------------------------------- | -------------------------------------------------------------- |
|
|
107
|
+
| aliasesWithSpec | Array<SpecWithAlias<T>> | Initial list of aliases ( with additional properties ) |
|
|
108
|
+
| createAliasDecoration | CreateAliasDecoration ( explained below ) | Used to create ProseMirror `Decoration` when an alias is found |
|
|
109
|
+
| onLinkAdd | ( addedLinks: Array<SpecWithAlias<T>> ) => void | Called when links are added |
|
|
110
|
+
| onLinkRemove | ( removedLinks: Array<SpecWithAlias<T>> ) => void | Called when links are removed |
|
|
111
|
+
| regexGenerator | regexGenerator: ( aliases: string[] ) => RegExp | Creates the regex used internally to find matches |
|
|
112
|
+
|
|
113
|
+
### createAliasDecoration
|
|
114
|
+
|
|
115
|
+
| name | type | description |
|
|
116
|
+
| --------------------- | ---------------- | --------------------------------- |
|
|
117
|
+
| start | number | Start position of the alias |
|
|
118
|
+
| end | number | End position of the alias |
|
|
119
|
+
| alias | string | Matched alias |
|
|
120
|
+
| matchPos | number | Distance from the non-text parent |
|
|
121
|
+
| pluginState | LinksKeyState<T> | Current state of the plugin |
|
|
122
|
+
| doc | Node | ProseMirror doc Node |
|
|
123
|
+
|
|
124
|
+
### Example CSS
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
.autoLink {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: center;
|
|
131
|
+
background-color: lightblue;
|
|
132
|
+
color: black;
|
|
133
|
+
border: 1px solid blueviolet;
|
|
134
|
+
width: fit-content;
|
|
135
|
+
height: 1.4rem;
|
|
136
|
+
padding: 3px 5px 3px 5px;
|
|
137
|
+
border-radius: 5px;
|
|
138
|
+
margin-left: 3px;
|
|
139
|
+
margin-right: 3px;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
### Running & linking locally
|
|
147
|
+
1. install plugin dependencies: `npm install`
|
|
148
|
+
2. install peer dependencies: `npm run install-peers`
|
|
149
|
+
3. link local lib: `npm run link`
|
|
150
|
+
4. link the package from the project you want to use it: `npm run link prosemirror-link-plugin`
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### About us
|
|
154
|
+
|
|
155
|
+
Emergence Engineering is dev shop from the EU:
|
|
156
|
+
<https://emergence-engineering.com/>
|
|
157
|
+
|
|
158
|
+
We're looking for work, especially with ProseMirror ;)
|
|
159
|
+
|
|
160
|
+
Feel free to contact me at
|
|
161
|
+
<viktor.vaczi@emergence-engineering.com>
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { Decoration } from "prosemirror-view";
|
|
2
|
-
import { Node
|
|
3
|
-
import { LinksKeyState, SpecObject
|
|
4
|
-
declare const decorationsUpdateInRange: <T extends SpecObject
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
alias: string;
|
|
11
|
-
} & {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}>[];
|
|
14
|
-
decorationsToRemove: Decoration<T & {
|
|
15
|
-
alias: string;
|
|
16
|
-
} & {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}>[];
|
|
19
|
-
};
|
|
20
|
-
export default decorationsUpdateInRange;
|
|
1
|
+
import { Decoration } from "prosemirror-view";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
|
+
import { LinksKeyState, SpecObject } from "./types";
|
|
4
|
+
declare const decorationsUpdateInRange: <T extends SpecObject>(from: number, to: number, doc: Node, pluginState: LinksKeyState<T>, createAliasDecoration: (decorationStart: number, decorationEnd: number, alias: string, matchPos: number, linkPluginState: LinksKeyState<T>, docNode: Node) => Decoration) => {
|
|
5
|
+
decorationsToAdd: Decoration[];
|
|
6
|
+
decorationsToRemove: Decoration[];
|
|
7
|
+
};
|
|
8
|
+
export default decorationsUpdateInRange;
|
|
9
|
+
//# sourceMappingURL=decorationsUpdateInRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorationsUpdateInRange.d.ts","sourceRoot":"","sources":["../src/decorationsUpdateInRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGpD,QAAA,MAAM,wBAAwB,GAAI,CAAC,SAAS,UAAU,EACpD,MAAM,MAAM,EACZ,IAAI,MAAM,EACV,KAAK,IAAI,EACT,aAAa,aAAa,CAAC,CAAC,CAAC,EAC7B,uBAAuB,CACrB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC,EACjC,OAAO,EAAE,IAAI,KACV,UAAU,KACd;IACD,gBAAgB,EAAE,UAAU,EAAE,CAAC;IAC/B,mBAAmB,EAAE,UAAU,EAAE,CAAC;CA8EnC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Decoration } from "prosemirror-view";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} & import("prosemirror-view").InlineDecorationSpec>;
|
|
7
|
-
export default defaultAliasDecoration;
|
|
1
|
+
import { Decoration } from "prosemirror-view";
|
|
2
|
+
import { LinksKeyState } from "./types";
|
|
3
|
+
declare const defaultAliasDecoration: <Spec extends Record<string, any>>(start: number, end: number, alias: string, matchPos: number, pluginState: LinksKeyState<Spec>) => Decoration;
|
|
4
|
+
export default defaultAliasDecoration;
|
|
5
|
+
//# sourceMappingURL=defaultAliasDecoration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultAliasDecoration.d.ts","sourceRoot":"","sources":["../src/defaultAliasDecoration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,QAAA,MAAM,sBAAsB,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9D,OAAO,MAAM,EACb,KAAK,MAAM,EACX,OAAO,MAAM,EACb,UAAU,MAAM,EAChB,aAAa,aAAa,CAAC,IAAI,CAAC,eAWjC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
export { autoLinkingPlugin, linksKey } from "./plugin";
|
|
2
|
+
export { LinksMetaType } from "./types";
|
|
3
|
+
export type { SpecWithAlias, LinksKeyState, LinksMeta, LinksUpdateMeta, } from "./types";
|
|
4
|
+
export { default as defaultAliasDecoration } from "./defaultAliasDecoration";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import{PluginKey as
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var a,i=function(){return(i=Object.assign||function(n){for(var e,r=1,o=arguments.length;r<o;r++)for(var t in e=arguments[r])Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}).apply(this,arguments)};function c(n,e){for(var r=0,o=e.length,t=n.length;r<o;r++,t++)n[t]=e[r];return n}!function(n){n.linkUpdate="linkUpdate"}(a||(a={}));var d=function(n){var e=n.length?n.map((function(n){return"\\b"+n.trim()+"\\b"})).sort((function(n,e){return e.length-n.length})).join("|"):"a^";return new RegExp(e,"g")},u=function(n,e,r,o,a){var i=n,d=[],u=[],s=[],p=[],l=function(){var n=r.resolve(i),e=n.parent,d=i-n.parentOffset,s=d+e.nodeSize,l=o.decorations.find(d,s).filter((function(n){return n.from>=d&&n.to<=s}));p=c(c([],p),l),t(e).map((function(n){var e,t;return Array.from((null===(t=null===(e=n.node)||void 0===e?void 0:e.text)||void 0===t?void 0:t.matchAll(o.regex))||[]).map((function(e){if(!e)throw new Error("wrong match");var t=e.index||0,i=e[0],s=n.pos+t+d,p=n.pos+t+i.length+d,l=n.pos+t,f=a(s,p,i,l,o,r);u=c(c([],u),[f])}))})),i+=e.nodeSize};do{l()}while(i<e);return p.map((function(n){var e=u.find((function(e){return e.from===n.from&&e.to===n.to&&(r=e.spec,o=n.spec,t=Object.keys(r),a=Object.keys(o),t.length===a.length&&t.reduce((function(n,e){return n&&o[e]===r[e]}),!0));var r,o,t,a}));return e?d.push(e):s.push(n),null})),{decorationsToAdd:u=u.filter((function(n){return!d.includes(n)})),decorationsToRemove:s}},s=new n("links"),p=function(n,o,t,p,l){void 0===l&&(l=d);var f=function(n){return n.map((function(n){return n.spec}))};return new e({key:s,state:{init:function(e,t){var a=l(n.map((function(n){return n.alias}))),c={decorations:new r,regex:a,aliasToSpec:n.reduce((function(n,e){var r;return i(i({},n),((r={})[e.alias]=e,r))}),{})},d=u(0,t.doc.nodeSize,t.doc,c,o),s=c.decorations.add(t.doc,d.decorationsToAdd);return i(i({},c),{decorations:s})},apply:function(n,e){var r=n.getMeta(s),d=e.regex,m=e.aliasToSpec;if((null==r?void 0:r.type)===a.linkUpdate){m=r.specs.reduce((function(n,e){var r;return i(i({},n),((r={})[e.alias]=e,r))}),{}),d=l(r.specs.map((function(n){return n.alias})));var v=u(0,n.doc.nodeSize,n.doc,i(i({},e),{regex:d,aliasToSpec:m}),o),g=v.decorationsToAdd,h=v.decorationsToRemove;return h.length&&p&&p(f(h)),g.length&&t&&t(f(g)),{decorations:e.decorations.remove(h).add(n.doc,g),regex:d,aliasToSpec:m}}if(!n.mapping.maps.length)return e;var T=[],S=e.decorations.map(n.mapping,n.doc,{onRemove:function(n){T.push(n)}}),x=function(n){for(var e=n.doc.nodeSize,r=0,o=0;o<n.mapping.maps.length;o+=1){var t=n.mapping.maps[o].ranges[0],a=t+n.mapping.maps[o].ranges[2];e=Math.min(e,t,a),r=Math.max(r,t,a)}return{start:e,end:r}}(n),w=x.start,y=x.end,k=u(w,y,n.doc,i(i({},e),{decorations:S}),o),b=k.decorationsToRemove,A=k.decorationsToAdd,O=c(c([],T),f(b));return O.length&&p&&p(O),A.length&&t&&t(f(A)),{decorations:S.remove(b).add(n.doc,A),regex:d,aliasToSpec:m}}},props:{decorations:function(n){var e;return r.create(n.doc,(null===(e=s.getState(n))||void 0===e?void 0:e.decorations.find())||[])}}})},l=function(n,e,r,t,a,i){var c=a.aliasToSpec[r];return o.inline(n,e,{class:"autoLink"},c)};export{a as LinksMetaType,p as autoLinkingPlugin,l as defaultAliasDecoration,s as linksKey};
|
|
1
|
+
import{PluginKey as e,Plugin as o}from"prosemirror-state";import{DecorationSet as t,Decoration as r}from"prosemirror-view";var n;!function(e){e.linkUpdate="linkUpdate"}(n||(n={}));const a=e=>{const o=e.length?e.map(e=>`\\b${e.trim()}\\b`).sort((e,o)=>o.length-e.length).join("|"):"a^";return new RegExp(o,"g")},s=(e,o,t)=>{if(!e)throw new Error('Invalid "node" parameter');if(!o)throw new Error('Invalid "predicate" parameter');return((e,o=!0)=>{if(!e)throw new Error('Invalid "node" parameter');const t=[];return e.descendants((e,r)=>{if(t.push({node:e,pos:r}),!o)return!1}),t})(e,t).filter(e=>o(e.node))},i=(e,o=!0)=>s(e,e=>e.isText,o),d=(e,o,t,r,n)=>{let a=e;const s=[];let d=[];const c=[];let p=[];do{const e=t.resolve(a),o=e.parent,s=a-e.parentOffset,c=s+o.nodeSize,l=r.decorations.find(s,c).filter(e=>e.from>=s&&e.to<=c);p=[...p,...l];i(o).map(e=>Array.from(e.node?.text?.matchAll(r.regex)||[]).map(o=>{if(!o)throw new Error("wrong match");const a=o.index||0,i=o[0],c=e.pos+a+s,p=e.pos+a+i.length+s,l=e.pos+a,m=n(c,p,i,l,r,t);d=[...d,m]})),a+=o.nodeSize}while(a<o);return p.map(e=>{const o=d.find(o=>o.from===e.from&&o.to===e.to&&((e,o)=>{const t=Object.keys(e),r=Object.keys(o);return t.length===r.length&&t.reduce((t,r)=>t&&o[r]===e[r],!0)})(o.spec,e.spec));return o?s.push(o):c.push(e),null}),d=d.filter(e=>!s.includes(e)),{decorationsToAdd:d,decorationsToRemove:c}},c=new e("links"),p=(e,r,s,i,p=a)=>{const l=e=>e.map(e=>e.spec);return new o({key:c,state:{init(o,n){const a=p(e.map(e=>e.alias)),s={decorations:t.empty,regex:a,aliasToSpec:e.reduce((e,o)=>({...e,[o.alias]:o}),{})},i=d(0,n.doc.nodeSize,n.doc,s,r),c=s.decorations.add(n.doc,i.decorationsToAdd);return{...s,decorations:c}},apply(e,o){const t=e.getMeta(c);let{regex:a,aliasToSpec:m}=o;if(t?.type===n.linkUpdate){m=t.specs.reduce((e,o)=>({...e,[o.alias]:o}),{}),a=p(t.specs.map(e=>e.alias));const{decorationsToAdd:n,decorationsToRemove:c}=d(0,e.doc.nodeSize,e.doc,{...o,regex:a,aliasToSpec:m},r);c.length&&i&&i(l(c)),n.length&&s&&s(l(n));return{decorations:o.decorations.remove(c).add(e.doc,n),regex:a,aliasToSpec:m}}if(!e.mapping.maps.length)return o;const g=[],h=o.decorations.map(e.mapping,e.doc,{onRemove:e=>{g.push(e)}}),{start:u,end:f}=(e=>{let o=e.doc.nodeSize,t=0;for(let r=0;r<e.mapping.maps.length;r+=1){const n=e.mapping.maps[r].ranges[0],a=n+e.mapping.maps[r].ranges[2];o=Math.min(o,n,a),t=Math.max(t,n,a)}return{start:o,end:t}})(e),{decorationsToRemove:w,decorationsToAdd:T}=d(u,f,e.doc,{...o,decorations:h},r),v=[...g,...l(w)];v.length&&i&&i(v),T.length&&s&&s(l(T));return{decorations:h.remove(w).add(e.doc,T),regex:a,aliasToSpec:m}}},props:{decorations:e=>t.create(e.doc,c.getState(e)?.decorations.find()||[])}})},l=(e,o,t,n,a)=>{const s=a.aliasToSpec[t];return r.inline(e,o,{class:"autoLink"},s)};export{n as LinksMetaType,p as autoLinkingPlugin,l as defaultAliasDecoration,c as linksKey};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var e=require("prosemirror-state"),o=require("prosemirror-view");exports.LinksMetaType=void 0,(exports.LinksMetaType||(exports.LinksMetaType={})).linkUpdate="linkUpdate";const t=e=>{const o=e.length?e.map(e=>`\\b${e.trim()}\\b`).sort((e,o)=>o.length-e.length).join("|"):"a^";return new RegExp(o,"g")},r=(e,o,t)=>{if(!e)throw new Error('Invalid "node" parameter');if(!o)throw new Error('Invalid "predicate" parameter');return((e,o=!0)=>{if(!e)throw new Error('Invalid "node" parameter');const t=[];return e.descendants((e,r)=>{if(t.push({node:e,pos:r}),!o)return!1}),t})(e,t).filter(e=>o(e.node))},n=(e,o=!0)=>r(e,e=>e.isText,o),a=(e,o,t,r,a)=>{let s=e;const i=[];let d=[];const c=[];let p=[];do{const e=t.resolve(s),o=e.parent,i=s-e.parentOffset,c=i+o.nodeSize,l=r.decorations.find(i,c).filter(e=>e.from>=i&&e.to<=c);p=[...p,...l];n(o).map(e=>Array.from(e.node?.text?.matchAll(r.regex)||[]).map(o=>{if(!o)throw new Error("wrong match");const n=o.index||0,s=o[0],c=e.pos+n+i,p=e.pos+n+s.length+i,l=e.pos+n,m=a(c,p,s,l,r,t);d=[...d,m]})),s+=o.nodeSize}while(s<o);return p.map(e=>{const o=d.find(o=>o.from===e.from&&o.to===e.to&&((e,o)=>{const t=Object.keys(e),r=Object.keys(o);return t.length===r.length&&t.reduce((t,r)=>t&&o[r]===e[r],!0)})(o.spec,e.spec));return o?i.push(o):c.push(e),null}),d=d.filter(e=>!i.includes(e)),{decorationsToAdd:d,decorationsToRemove:c}},s=new e.PluginKey("links");exports.autoLinkingPlugin=(r,n,i,d,c=t)=>{const p=e=>e.map(e=>e.spec);return new e.Plugin({key:s,state:{init(e,t){const s=c(r.map(e=>e.alias)),i={decorations:o.DecorationSet.empty,regex:s,aliasToSpec:r.reduce((e,o)=>({...e,[o.alias]:o}),{})},d=a(0,t.doc.nodeSize,t.doc,i,n),p=i.decorations.add(t.doc,d.decorationsToAdd);return{...i,decorations:p}},apply(e,o){const t=e.getMeta(s);let{regex:r,aliasToSpec:l}=o;if(t?.type===exports.LinksMetaType.linkUpdate){l=t.specs.reduce((e,o)=>({...e,[o.alias]:o}),{}),r=c(t.specs.map(e=>e.alias));const{decorationsToAdd:s,decorationsToRemove:m}=a(0,e.doc.nodeSize,e.doc,{...o,regex:r,aliasToSpec:l},n);m.length&&d&&d(p(m)),s.length&&i&&i(p(s));return{decorations:o.decorations.remove(m).add(e.doc,s),regex:r,aliasToSpec:l}}if(!e.mapping.maps.length)return o;const m=[],g=o.decorations.map(e.mapping,e.doc,{onRemove:e=>{m.push(e)}}),{start:u,end:h}=(e=>{let o=e.doc.nodeSize,t=0;for(let r=0;r<e.mapping.maps.length;r+=1){const n=e.mapping.maps[r].ranges[0],a=n+e.mapping.maps[r].ranges[2];o=Math.min(o,n,a),t=Math.max(t,n,a)}return{start:o,end:t}})(e),{decorationsToRemove:f,decorationsToAdd:x}=a(u,h,e.doc,{...o,decorations:g},n),T=[...m,...p(f)];T.length&&d&&d(T),x.length&&i&&i(p(x));return{decorations:g.remove(f).add(e.doc,x),regex:r,aliasToSpec:l}}},props:{decorations:e=>o.DecorationSet.create(e.doc,s.getState(e)?.decorations.find()||[])}})},exports.defaultAliasDecoration=(e,t,r,n,a)=>{const s=a.aliasToSpec[r];return o.Decoration.inline(e,t,{class:"autoLink"},s)},exports.linksKey=s;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
-
import { Decoration } from "prosemirror-view";
|
|
3
|
-
import { Node } from "prosemirror-model";
|
|
4
|
-
import { LinksKeyState, SpecObject, SpecWithAlias } from "./types";
|
|
5
|
-
export declare const linksKey: PluginKey<LinksKeyState<any
|
|
6
|
-
export declare const autoLinkingPlugin: <T extends SpecObject>(aliasesWithSpec: SpecWithAlias<T
|
|
7
|
-
|
|
8
|
-
} & SpecObject>, onLinkAdd?: ((addedLinks: SpecWithAlias<T>[]) => void) | undefined, onLinkRemove?: ((removedLinks: SpecWithAlias<T>[]) => void) | undefined, regexGenerator?: (aliases: string[]) => RegExp) => Plugin<LinksKeyState<T>, any>;
|
|
1
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
+
import { Decoration } from "prosemirror-view";
|
|
3
|
+
import { Node } from "prosemirror-model";
|
|
4
|
+
import { LinksKeyState, SpecObject, SpecWithAlias } from "./types";
|
|
5
|
+
export declare const linksKey: PluginKey<LinksKeyState<any>>;
|
|
6
|
+
export declare const autoLinkingPlugin: <T extends SpecObject>(aliasesWithSpec: Array<SpecWithAlias<T>>, createAliasDecoration: (start: number, end: number, alias: string, matchPos: number, pluginState: LinksKeyState<T>, doc: Node) => Decoration, onLinkAdd?: (addedLinks: Array<SpecWithAlias<T>>) => void, onLinkRemove?: (removedLinks: Array<SpecWithAlias<T>>) => void, regexGenerator?: (aliases: string[]) => RegExp) => Plugin<LinksKeyState<T>>;
|
|
7
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,aAAa,EAGb,UAAU,EACV,aAAa,EACd,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,QAAQ,+BAA6C,CAAC;AAEnE,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,UAAU,EACpD,iBAAiB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EACxC,uBAAuB,CACrB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAC7B,GAAG,EAAE,IAAI,KACN,UAAU,EACf,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EACzD,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9D,iBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,MAAsB,6BA2H9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
export interface NodeWithPos {
|
|
3
|
+
node: Node;
|
|
4
|
+
pos: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const flatten: (node: Node, descend?: boolean) => NodeWithPos[];
|
|
7
|
+
export declare const findChildren: (node: Node, predicate: (child: Node) => boolean, descend: boolean) => NodeWithPos[];
|
|
8
|
+
export declare const findTextNodes: (node: Node, descend?: boolean) => NodeWithPos[];
|
|
9
|
+
//# sourceMappingURL=prosemirror-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prosemirror-utils.d.ts","sourceRoot":"","sources":["../src/prosemirror-utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AACD,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,EAAE,iBAAc,kBAajD,CAAC;AAQF,eAAO,MAAM,YAAY,GACvB,MAAM,IAAI,EACV,WAAW,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,EACnC,SAAS,OAAO,kBAQjB,CAAC;AAQF,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,EAAE,iBAAc,kBAEvD,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { DecorationSet } from "prosemirror-view";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare type LinksMeta<Spec extends SpecObject> = LinksUpdateMeta<Spec>;
|
|
1
|
+
import { DecorationSet } from "prosemirror-view";
|
|
2
|
+
export type SpecObject = Record<string, any>;
|
|
3
|
+
export type SpecWithAlias<Spec extends SpecObject> = Spec & {
|
|
4
|
+
alias: string;
|
|
5
|
+
};
|
|
6
|
+
export interface LinksKeyState<Spec extends SpecObject = {
|
|
7
|
+
alias: string;
|
|
8
|
+
}> {
|
|
9
|
+
decorations: DecorationSet;
|
|
10
|
+
regex: RegExp;
|
|
11
|
+
aliasToSpec: Record<string, SpecWithAlias<Spec>>;
|
|
12
|
+
}
|
|
13
|
+
export declare enum LinksMetaType {
|
|
14
|
+
linkUpdate = "linkUpdate"
|
|
15
|
+
}
|
|
16
|
+
export interface LinksUpdateMeta<Spec extends SpecObject> {
|
|
17
|
+
type: LinksMetaType.linkUpdate;
|
|
18
|
+
specs: Array<SpecWithAlias<Spec>>;
|
|
19
|
+
}
|
|
20
|
+
export type LinksMeta<Spec extends SpecObject> = LinksUpdateMeta<Spec>;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,UAAU,IAAI,IAAI,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,WAAW,aAAa,CAAC,IAAI,SAAS,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;IAExE,WAAW,EAAE,aAAa,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;CAClD;AAED,oBAAY,aAAa;IACvB,UAAU,eAAe;CAC1B;AAED,MAAM,WAAW,eAAe,CAAC,IAAI,SAAS,UAAU;IACtD,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,UAAU,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Transaction } from "prosemirror-state";
|
|
2
|
-
import { SpecObject } from "./types";
|
|
3
|
-
export declare const generateRegex: (aliases: string[]) => RegExp;
|
|
4
|
-
export declare const getTransactionRange: (tr: Transaction) => {
|
|
5
|
-
start: number;
|
|
6
|
-
end: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const specEquals: (specA: SpecObject, specB: SpecObject) => boolean;
|
|
1
|
+
import { Transaction } from "prosemirror-state";
|
|
2
|
+
import { SpecObject } from "./types";
|
|
3
|
+
export declare const generateRegex: (aliases: string[]) => RegExp;
|
|
4
|
+
export declare const getTransactionRange: (tr: Transaction) => {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const specEquals: (specA: SpecObject, specB: SpecObject) => boolean;
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,KAAG,MASjD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,IAAI,WAAW;;;CAclD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,UAAU,EAAE,OAAO,UAAU,YAO9D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,90 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prosemirror-link-plugin",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "ProseMirror plugin for automatic links",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.es.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"url": "
|
|
25
|
-
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"prosemirror-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"prosemirror-schema-list": "^1.1.4",
|
|
71
|
-
"prosemirror-test-builder": "^1.0.4",
|
|
72
|
-
"rollup": "^2.50.3",
|
|
73
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
74
|
-
"rollup-plugin-typescript2": "^0.30.0",
|
|
75
|
-
"ts-jest": "^27.0.1",
|
|
76
|
-
"tslib": "^2.2.0",
|
|
77
|
-
"typescript": "^4.3.2"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"npm-install-peers": "^1.2.2",
|
|
81
|
-
"orderedmap": "^1.1.1",
|
|
82
|
-
"prosemirror-commands": "^1.1.8",
|
|
83
|
-
"prosemirror-model": "^1.14.1",
|
|
84
|
-
"prosemirror-state": "^1.3.4",
|
|
85
|
-
"prosemirror-tables": "^1.1.1",
|
|
86
|
-
"prosemirror-transform": "^1.3.2",
|
|
87
|
-
"prosemirror-utils": "^0.9.6",
|
|
88
|
-
"prosemirror-view": "^1.18.7"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "prosemirror-link-plugin",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "ProseMirror plugin for automatic links",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/emergence-engineering/emergence-tools.git",
|
|
11
|
+
"directory": "packages/prosemirror-link-plugin"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/**/*"
|
|
15
|
+
],
|
|
16
|
+
"author": "Emergence Engineering",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ProseMirror",
|
|
19
|
+
"link",
|
|
20
|
+
"automatic"
|
|
21
|
+
],
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/emergence-engineering/emergence-tools/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/emergence-engineering/emergence-tools/tree/main/packages/prosemirror-link-plugin#readme",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"orderedmap": "^2.1.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"prosemirror-commands": "^1.1.4",
|
|
35
|
+
"prosemirror-model": "^1.11.0",
|
|
36
|
+
"prosemirror-state": "^1.3.3",
|
|
37
|
+
"prosemirror-tables": "^1.3.0",
|
|
38
|
+
"prosemirror-transform": "^1.7.0",
|
|
39
|
+
"prosemirror-view": "^1.15.5"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/jest": "^29.2.4",
|
|
43
|
+
"jest": "^29.3.1",
|
|
44
|
+
"prosemirror-commands": "^1.1.4",
|
|
45
|
+
"prosemirror-model": "^1.11.0",
|
|
46
|
+
"prosemirror-schema-basic": "^1.2.0",
|
|
47
|
+
"prosemirror-schema-list": "^1.2.2",
|
|
48
|
+
"prosemirror-state": "^1.3.3",
|
|
49
|
+
"prosemirror-tables": "^1.3.0",
|
|
50
|
+
"prosemirror-test-builder": "^1.1.0",
|
|
51
|
+
"prosemirror-transform": "^1.7.0",
|
|
52
|
+
"prosemirror-view": "^1.15.5",
|
|
53
|
+
"rimraf": "^5.0.0",
|
|
54
|
+
"rollup": "^3.7.4",
|
|
55
|
+
"rollup-plugin-minification": "^0.2.0",
|
|
56
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
57
|
+
"ts-jest": "^29.0.3",
|
|
58
|
+
"tslib": "^2.4.1",
|
|
59
|
+
"typescript": "^5.2.2"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"prebuild": "rimraf dist",
|
|
63
|
+
"build": "rollup -c --bundleConfigAsCjs",
|
|
64
|
+
"dev": "rollup -c -w --bundleConfigAsCjs",
|
|
65
|
+
"format": "echo 'no formatter configured'",
|
|
66
|
+
"lint": "tsc --noEmit",
|
|
67
|
+
"test": "jest"
|
|
68
|
+
}
|
|
69
|
+
}
|