@atlaskit/editor-plugin-hyperlink 8.1.8 → 8.1.9
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/CHANGELOG.md +9 -0
- package/dist/cjs/pm-plugins/fake-cursor-for-toolbar.js +9 -0
- package/dist/cjs/pm-plugins/main.js +10 -0
- package/dist/cjs/pm-plugins/toolbar-buttons.js +4 -0
- package/dist/es2019/pm-plugins/fake-cursor-for-toolbar.js +12 -0
- package/dist/es2019/pm-plugins/main.js +12 -0
- package/dist/es2019/pm-plugins/toolbar-buttons.js +4 -0
- package/dist/esm/pm-plugins/fake-cursor-for-toolbar.js +9 -0
- package/dist/esm/pm-plugins/main.js +10 -0
- package/dist/esm/pm-plugins/toolbar-buttons.js +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 8.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
8
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
9
|
+
project refs are setup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 8.1.8
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -33,9 +33,11 @@ var getInsertLinkToolbarState = function getInsertLinkToolbarState(editorState)
|
|
|
33
33
|
var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
|
|
34
34
|
key: _fakeCurorForToolbarPluginKey.fakeCursorForToolbarPluginKey,
|
|
35
35
|
state: {
|
|
36
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
36
37
|
init: function init() {
|
|
37
38
|
return _view.DecorationSet.empty;
|
|
38
39
|
},
|
|
40
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
39
41
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
40
42
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
41
43
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -43,9 +45,15 @@ var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
|
|
|
43
45
|
if (oldInsertToolbarState && insertToolbarState) {
|
|
44
46
|
var from = insertToolbarState.from,
|
|
45
47
|
to = insertToolbarState.to;
|
|
48
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
49
|
+
|
|
46
50
|
var oldFrom = tr.mapping.map(oldInsertToolbarState.from);
|
|
51
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
+
|
|
47
53
|
var oldTo = tr.mapping.map(oldInsertToolbarState.to);
|
|
48
54
|
if (oldFrom === from && oldTo === to) {
|
|
55
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
56
|
+
|
|
49
57
|
return pluginState.map(tr.mapping, tr.doc);
|
|
50
58
|
}
|
|
51
59
|
}
|
|
@@ -59,6 +67,7 @@ var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
|
|
|
59
67
|
}
|
|
60
68
|
},
|
|
61
69
|
props: {
|
|
70
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
62
71
|
decorations: function decorations(state) {
|
|
63
72
|
return _fakeCurorForToolbarPluginKey.fakeCursorForToolbarPluginKey.getState(state);
|
|
64
73
|
}
|
|
@@ -36,7 +36,11 @@ var mapTransactionToState = function mapTransactionToState(state, tr) {
|
|
|
36
36
|
return;
|
|
37
37
|
} else if (state.type === _link3.InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
38
38
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
39
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
40
|
+
|
|
39
41
|
from: tr.mapping.map(state.from),
|
|
42
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
43
|
+
|
|
40
44
|
to: tr.mapping.map(state.to)
|
|
41
45
|
});
|
|
42
46
|
}
|
|
@@ -136,6 +140,7 @@ var stateKey = exports.stateKey = new _state.PluginKey('hyperlinkPlugin');
|
|
|
136
140
|
var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) {
|
|
137
141
|
return new _safePlugin.SafePlugin({
|
|
138
142
|
state: {
|
|
143
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
139
144
|
init: function init(_, state) {
|
|
140
145
|
var canInsertLink = (0, _utils.canLinkBeCreatedInRange)(state.selection.from, state.selection.to)(state);
|
|
141
146
|
return {
|
|
@@ -146,6 +151,7 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
146
151
|
editorAppearance: editorAppearance
|
|
147
152
|
};
|
|
148
153
|
},
|
|
154
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
149
155
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
150
156
|
var state = pluginState;
|
|
151
157
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -200,8 +206,11 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
200
206
|
decorations: function decorations() {
|
|
201
207
|
return _view.DecorationSet.empty;
|
|
202
208
|
},
|
|
209
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
210
|
+
|
|
203
211
|
handleDOMEvents: {
|
|
204
212
|
// Ignored via go/ees005
|
|
213
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
205
214
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
215
|
mouseup: function mouseup(_, event) {
|
|
207
216
|
// this prevents redundant selection transaction when clicking on link
|
|
@@ -213,6 +222,7 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
213
222
|
return false;
|
|
214
223
|
},
|
|
215
224
|
// Ignored via go/ees005
|
|
225
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
216
226
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
227
|
mousedown: function mousedown(view, event) {
|
|
218
228
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
@@ -11,9 +11,13 @@ var toolbarButtonsPlugin = exports.toolbarButtonsPlugin = function toolbarButton
|
|
|
11
11
|
return new _safePlugin.SafePlugin({
|
|
12
12
|
key: toolbarKey,
|
|
13
13
|
state: {
|
|
14
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
15
|
+
|
|
14
16
|
init: function init(_, __) {
|
|
15
17
|
return initialState;
|
|
16
18
|
},
|
|
19
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
20
|
+
|
|
17
21
|
apply: function apply(tr, pluginState) {
|
|
18
22
|
var metaState = tr.getMeta(toolbarKey);
|
|
19
23
|
if (metaState) {
|
|
@@ -25,9 +25,13 @@ const getInsertLinkToolbarState = editorState => {
|
|
|
25
25
|
const fakeCursorToolbarPlugin = new SafePlugin({
|
|
26
26
|
key: fakeCursorForToolbarPluginKey,
|
|
27
27
|
state: {
|
|
28
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
29
|
+
|
|
28
30
|
init() {
|
|
29
31
|
return DecorationSet.empty;
|
|
30
32
|
},
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
34
|
+
|
|
31
35
|
apply(tr, pluginState, oldState, newState) {
|
|
32
36
|
const oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
33
37
|
const insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -37,9 +41,15 @@ const fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
37
41
|
from,
|
|
38
42
|
to
|
|
39
43
|
} = insertToolbarState;
|
|
44
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
45
|
+
|
|
40
46
|
const oldFrom = tr.mapping.map(oldInsertToolbarState.from);
|
|
47
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
+
|
|
41
49
|
const oldTo = tr.mapping.map(oldInsertToolbarState.to);
|
|
42
50
|
if (oldFrom === from && oldTo === to) {
|
|
51
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
+
|
|
43
53
|
return pluginState.map(tr.mapping, tr.doc);
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -55,6 +65,8 @@ const fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
55
65
|
}
|
|
56
66
|
},
|
|
57
67
|
props: {
|
|
68
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
69
|
+
|
|
58
70
|
decorations(state) {
|
|
59
71
|
return fakeCursorForToolbarPluginKey.getState(state);
|
|
60
72
|
}
|
|
@@ -30,7 +30,11 @@ const mapTransactionToState = (state, tr) => {
|
|
|
30
30
|
} else if (state.type === InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
31
31
|
return {
|
|
32
32
|
...state,
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
34
|
+
|
|
33
35
|
from: tr.mapping.map(state.from),
|
|
36
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
37
|
+
|
|
34
38
|
to: tr.mapping.map(state.to)
|
|
35
39
|
};
|
|
36
40
|
}
|
|
@@ -134,6 +138,8 @@ const getActiveText = selection => {
|
|
|
134
138
|
export const stateKey = new PluginKey('hyperlinkPlugin');
|
|
135
139
|
export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) => new SafePlugin({
|
|
136
140
|
state: {
|
|
141
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
142
|
+
|
|
137
143
|
init(_, state) {
|
|
138
144
|
const canInsertLink = canLinkBeCreatedInRange(state.selection.from, state.selection.to)(state);
|
|
139
145
|
return {
|
|
@@ -144,6 +150,8 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
144
150
|
editorAppearance
|
|
145
151
|
};
|
|
146
152
|
},
|
|
153
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
154
|
+
|
|
147
155
|
apply(tr, pluginState, oldState, newState) {
|
|
148
156
|
let state = pluginState;
|
|
149
157
|
const action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -199,8 +207,11 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
199
207
|
decorations: () => {
|
|
200
208
|
return DecorationSet.empty;
|
|
201
209
|
},
|
|
210
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
211
|
+
|
|
202
212
|
handleDOMEvents: {
|
|
203
213
|
// Ignored via go/ees005
|
|
214
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
204
215
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
216
|
mouseup: (_, event) => {
|
|
206
217
|
// this prevents redundant selection transaction when clicking on link
|
|
@@ -212,6 +223,7 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
212
223
|
return false;
|
|
213
224
|
},
|
|
214
225
|
// Ignored via go/ees005
|
|
226
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
215
227
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
228
|
mousedown: (view, event) => {
|
|
217
229
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
@@ -5,9 +5,13 @@ export const toolbarButtonsPlugin = initialState => {
|
|
|
5
5
|
return new SafePlugin({
|
|
6
6
|
key: toolbarKey,
|
|
7
7
|
state: {
|
|
8
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
9
|
+
|
|
8
10
|
init: (_, __) => {
|
|
9
11
|
return initialState;
|
|
10
12
|
},
|
|
13
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
14
|
+
|
|
11
15
|
apply: (tr, pluginState) => {
|
|
12
16
|
const metaState = tr.getMeta(toolbarKey);
|
|
13
17
|
if (metaState) {
|
|
@@ -27,9 +27,11 @@ var getInsertLinkToolbarState = function getInsertLinkToolbarState(editorState)
|
|
|
27
27
|
var fakeCursorToolbarPlugin = new SafePlugin({
|
|
28
28
|
key: fakeCursorForToolbarPluginKey,
|
|
29
29
|
state: {
|
|
30
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
30
31
|
init: function init() {
|
|
31
32
|
return DecorationSet.empty;
|
|
32
33
|
},
|
|
34
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
33
35
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
34
36
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
35
37
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -37,9 +39,15 @@ var fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
37
39
|
if (oldInsertToolbarState && insertToolbarState) {
|
|
38
40
|
var from = insertToolbarState.from,
|
|
39
41
|
to = insertToolbarState.to;
|
|
42
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
43
|
+
|
|
40
44
|
var oldFrom = tr.mapping.map(oldInsertToolbarState.from);
|
|
45
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
46
|
+
|
|
41
47
|
var oldTo = tr.mapping.map(oldInsertToolbarState.to);
|
|
42
48
|
if (oldFrom === from && oldTo === to) {
|
|
49
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
50
|
+
|
|
43
51
|
return pluginState.map(tr.mapping, tr.doc);
|
|
44
52
|
}
|
|
45
53
|
}
|
|
@@ -53,6 +61,7 @@ var fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
53
61
|
}
|
|
54
62
|
},
|
|
55
63
|
props: {
|
|
64
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
56
65
|
decorations: function decorations(state) {
|
|
57
66
|
return fakeCursorForToolbarPluginKey.getState(state);
|
|
58
67
|
}
|
|
@@ -30,7 +30,11 @@ var mapTransactionToState = function mapTransactionToState(state, tr) {
|
|
|
30
30
|
return;
|
|
31
31
|
} else if (state.type === InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
32
32
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
34
|
+
|
|
33
35
|
from: tr.mapping.map(state.from),
|
|
36
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
37
|
+
|
|
34
38
|
to: tr.mapping.map(state.to)
|
|
35
39
|
});
|
|
36
40
|
}
|
|
@@ -130,6 +134,7 @@ export var stateKey = new PluginKey('hyperlinkPlugin');
|
|
|
130
134
|
export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) {
|
|
131
135
|
return new SafePlugin({
|
|
132
136
|
state: {
|
|
137
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
133
138
|
init: function init(_, state) {
|
|
134
139
|
var canInsertLink = canLinkBeCreatedInRange(state.selection.from, state.selection.to)(state);
|
|
135
140
|
return {
|
|
@@ -140,6 +145,7 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
140
145
|
editorAppearance: editorAppearance
|
|
141
146
|
};
|
|
142
147
|
},
|
|
148
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
143
149
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
144
150
|
var state = pluginState;
|
|
145
151
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -194,8 +200,11 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
194
200
|
decorations: function decorations() {
|
|
195
201
|
return DecorationSet.empty;
|
|
196
202
|
},
|
|
203
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
204
|
+
|
|
197
205
|
handleDOMEvents: {
|
|
198
206
|
// Ignored via go/ees005
|
|
207
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
199
208
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
200
209
|
mouseup: function mouseup(_, event) {
|
|
201
210
|
// this prevents redundant selection transaction when clicking on link
|
|
@@ -207,6 +216,7 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
207
216
|
return false;
|
|
208
217
|
},
|
|
209
218
|
// Ignored via go/ees005
|
|
219
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
210
220
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
211
221
|
mousedown: function mousedown(view, event) {
|
|
212
222
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
@@ -5,9 +5,13 @@ export var toolbarButtonsPlugin = function toolbarButtonsPlugin(initialState) {
|
|
|
5
5
|
return new SafePlugin({
|
|
6
6
|
key: toolbarKey,
|
|
7
7
|
state: {
|
|
8
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
9
|
+
|
|
8
10
|
init: function init(_, __) {
|
|
9
11
|
return initialState;
|
|
10
12
|
},
|
|
13
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
14
|
+
|
|
11
15
|
apply: function apply(tr, pluginState) {
|
|
12
16
|
var metaState = tr.getMeta(toolbarKey);
|
|
13
17
|
if (metaState) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.9",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"@atlaskit/icon": "^29.0.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.6.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^13.42.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"uuid": "^3.1.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^110.
|
|
54
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
57
57
|
"react-intl-next": "npm:react-intl@^5.18.1"
|