@atlaskit/editor-plugin-hyperlink 0.3.4 → 0.3.5
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 +30 -0
- package/dist/cjs/Toolbar.js +2 -2
- package/dist/cjs/plugin.js +23 -22
- package/dist/es2019/Toolbar.js +2 -2
- package/dist/es2019/plugin.js +16 -13
- package/dist/esm/Toolbar.js +2 -2
- package/dist/esm/plugin.js +23 -22
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugin.d.ts +1 -1
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +81 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 0.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
8
|
+
signature of `NextEditorPlugin`.
|
|
9
|
+
|
|
10
|
+
Previously a `NextEditorPlugin` would be consumed as so:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const plugin: NextEditorPlugin< ... > = (config, api) => {
|
|
14
|
+
// Can use api like so:
|
|
15
|
+
api.dependencies.core.actions.execute( ... )
|
|
16
|
+
return { ... }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Now these have become named parameters like so and the `pluginInjectionAPI` is used
|
|
21
|
+
without the `dependencies` prop:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
|
|
25
|
+
// Can use api like so:
|
|
26
|
+
api.core.actions.execute( ... )
|
|
27
|
+
return { ... }
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 0.3.4
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/cjs/Toolbar.js
CHANGED
|
@@ -111,10 +111,10 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, intl, featur
|
|
|
111
111
|
};
|
|
112
112
|
var getToolbarConfig = function getToolbarConfig(options, featureFlags, pluginInjectionApi) {
|
|
113
113
|
return function (state, intl, providerFactory) {
|
|
114
|
-
var _pluginInjectionApi$
|
|
114
|
+
var _pluginInjectionApi$a;
|
|
115
115
|
var formatMessage = intl.formatMessage;
|
|
116
116
|
var linkState = _main.stateKey.getState(state);
|
|
117
|
-
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
117
|
+
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Enable focus trap only if feature flag is enabled AND for the new version of the picker
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -19,11 +19,12 @@ var _keymap = require("./pm-plugins/keymap");
|
|
|
19
19
|
var _main = require("./pm-plugins/main");
|
|
20
20
|
var _toolbarButtons = require("./pm-plugins/toolbar-buttons");
|
|
21
21
|
var _Toolbar = require("./Toolbar");
|
|
22
|
-
var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
23
|
-
var _api$
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
23
|
+
var _api$featureFlags;
|
|
24
|
+
var _ref$config = _ref.config,
|
|
25
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
26
|
+
api = _ref.api;
|
|
27
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
27
28
|
return {
|
|
28
29
|
name: 'hyperlink',
|
|
29
30
|
marks: function marks() {
|
|
@@ -34,19 +35,19 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
34
35
|
},
|
|
35
36
|
commands: {
|
|
36
37
|
showLinkToolbar: function showLinkToolbar() {
|
|
37
|
-
var _api$
|
|
38
|
+
var _api$analytics;
|
|
38
39
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
39
|
-
return (0, _commands.showLinkToolbar)(inputMethod, api === null || api === void 0 ? void 0 : (_api$
|
|
40
|
+
return (0, _commands.showLinkToolbar)(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
40
41
|
}
|
|
41
42
|
},
|
|
42
43
|
actions: {
|
|
43
44
|
prependToolbarButtons: _toolbarButtons.prependToolbarButtons,
|
|
44
45
|
hideLinkToolbar: _commands.hideLinkToolbarSetMeta,
|
|
45
46
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
46
|
-
var _api$
|
|
47
|
+
var _api$analytics2;
|
|
47
48
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
48
49
|
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
49
|
-
return (0, _commands.insertLinkWithAnalytics)(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$
|
|
50
|
+
return (0, _commands.insertLinkWithAnalytics)(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, title, displayText, cardsAvailable, sourceEvent);
|
|
50
51
|
},
|
|
51
52
|
updateLink: _commands.updateLink
|
|
52
53
|
},
|
|
@@ -63,8 +64,8 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
63
64
|
var skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
|
|
64
65
|
return [{
|
|
65
66
|
name: 'hyperlink',
|
|
66
|
-
plugin: function plugin(
|
|
67
|
-
var dispatch =
|
|
67
|
+
plugin: function plugin(_ref2) {
|
|
68
|
+
var dispatch = _ref2.dispatch;
|
|
68
69
|
return (0, _main.plugin)(dispatch, options === null || options === void 0 ? void 0 : options.editorAppearance);
|
|
69
70
|
}
|
|
70
71
|
}, {
|
|
@@ -74,17 +75,17 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
74
75
|
}
|
|
75
76
|
}, {
|
|
76
77
|
name: 'hyperlinkInputRule',
|
|
77
|
-
plugin: function plugin(
|
|
78
|
-
var _api$
|
|
79
|
-
var schema =
|
|
80
|
-
featureFlags =
|
|
81
|
-
return (0, _inputRule.createInputRulePlugin)(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
78
|
+
plugin: function plugin(_ref3) {
|
|
79
|
+
var _api$analytics3;
|
|
80
|
+
var schema = _ref3.schema,
|
|
81
|
+
featureFlags = _ref3.featureFlags;
|
|
82
|
+
return (0, _inputRule.createInputRulePlugin)(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
82
83
|
}
|
|
83
84
|
}, {
|
|
84
85
|
name: 'hyperlinkKeymap',
|
|
85
86
|
plugin: function plugin() {
|
|
86
|
-
var _api$
|
|
87
|
-
return (0, _keymap.createKeymapPlugin)(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$
|
|
87
|
+
var _api$analytics4;
|
|
88
|
+
return (0, _keymap.createKeymapPlugin)(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
88
89
|
}
|
|
89
90
|
}, {
|
|
90
91
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -92,8 +93,8 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
92
93
|
}];
|
|
93
94
|
},
|
|
94
95
|
pluginsOptions: {
|
|
95
|
-
quickInsert: function quickInsert(
|
|
96
|
-
var formatMessage =
|
|
96
|
+
quickInsert: function quickInsert(_ref4) {
|
|
97
|
+
var formatMessage = _ref4.formatMessage;
|
|
97
98
|
return [{
|
|
98
99
|
id: 'hyperlink',
|
|
99
100
|
title: formatMessage(_messages.toolbarInsertBlockMessages.link),
|
|
@@ -105,13 +106,13 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
105
106
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconLink, null);
|
|
106
107
|
},
|
|
107
108
|
action: function action(insert, state) {
|
|
108
|
-
var _api$
|
|
109
|
+
var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
|
|
109
110
|
var tr = insert(undefined);
|
|
110
111
|
tr.setMeta(_main.stateKey, {
|
|
111
112
|
type: _link.LinkAction.SHOW_INSERT_TOOLBAR,
|
|
112
113
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
113
114
|
});
|
|
114
|
-
var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$
|
|
115
|
+
var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : (_api$analytics5$actio = _api$analytics5.actions) === null || _api$analytics5$actio === void 0 ? void 0 : (_api$analytics5$actio2 = _api$analytics5$actio.attachAnalyticsEvent) === null || _api$analytics5$actio2 === void 0 ? void 0 : _api$analytics5$actio2.call(_api$analytics5$actio, {
|
|
115
116
|
action: _analytics.ACTION.INVOKED,
|
|
116
117
|
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
117
118
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
package/dist/es2019/Toolbar.js
CHANGED
|
@@ -97,12 +97,12 @@ const getSettingsButtonGroup = (state, intl, featureFlags, editorAnalyticsApi) =
|
|
|
97
97
|
}] : [];
|
|
98
98
|
};
|
|
99
99
|
export const getToolbarConfig = (options, featureFlags, pluginInjectionApi) => (state, intl, providerFactory) => {
|
|
100
|
-
var _pluginInjectionApi$
|
|
100
|
+
var _pluginInjectionApi$a;
|
|
101
101
|
const {
|
|
102
102
|
formatMessage
|
|
103
103
|
} = intl;
|
|
104
104
|
const linkState = stateKey.getState(state);
|
|
105
|
-
const editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
105
|
+
const editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Enable focus trap only if feature flag is enabled AND for the new version of the picker
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -12,9 +12,12 @@ import { createKeymapPlugin } from './pm-plugins/keymap';
|
|
|
12
12
|
import { plugin, stateKey } from './pm-plugins/main';
|
|
13
13
|
import { prependToolbarButtons, toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
|
|
14
14
|
import { getToolbarConfig } from './Toolbar';
|
|
15
|
-
export const hyperlinkPlugin = (
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export const hyperlinkPlugin = ({
|
|
16
|
+
config: options = {},
|
|
17
|
+
api
|
|
18
|
+
}) => {
|
|
19
|
+
var _api$featureFlags;
|
|
20
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
18
21
|
return {
|
|
19
22
|
name: 'hyperlink',
|
|
20
23
|
marks() {
|
|
@@ -25,16 +28,16 @@ export const hyperlinkPlugin = (options = {}, api) => {
|
|
|
25
28
|
},
|
|
26
29
|
commands: {
|
|
27
30
|
showLinkToolbar: (inputMethod = INPUT_METHOD.TOOLBAR) => {
|
|
28
|
-
var _api$
|
|
29
|
-
return showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$
|
|
31
|
+
var _api$analytics;
|
|
32
|
+
return showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
30
33
|
}
|
|
31
34
|
},
|
|
32
35
|
actions: {
|
|
33
36
|
prependToolbarButtons,
|
|
34
37
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
35
38
|
insertLink: (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined) => {
|
|
36
|
-
var _api$
|
|
37
|
-
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$
|
|
39
|
+
var _api$analytics2;
|
|
40
|
+
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, title, displayText, cardsAvailable, sourceEvent);
|
|
38
41
|
},
|
|
39
42
|
updateLink: updateLink
|
|
40
43
|
},
|
|
@@ -63,14 +66,14 @@ export const hyperlinkPlugin = (options = {}, api) => {
|
|
|
63
66
|
schema,
|
|
64
67
|
featureFlags
|
|
65
68
|
}) => {
|
|
66
|
-
var _api$
|
|
67
|
-
return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
69
|
+
var _api$analytics3;
|
|
70
|
+
return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
68
71
|
}
|
|
69
72
|
}, {
|
|
70
73
|
name: 'hyperlinkKeymap',
|
|
71
74
|
plugin: () => {
|
|
72
|
-
var _api$
|
|
73
|
-
return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$
|
|
75
|
+
var _api$analytics4;
|
|
76
|
+
return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
74
77
|
}
|
|
75
78
|
}, {
|
|
76
79
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -89,13 +92,13 @@ export const hyperlinkPlugin = (options = {}, api) => {
|
|
|
89
92
|
keyshortcut: tooltip(addLink),
|
|
90
93
|
icon: () => /*#__PURE__*/React.createElement(IconLink, null),
|
|
91
94
|
action(insert, state) {
|
|
92
|
-
var _api$
|
|
95
|
+
var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
|
|
93
96
|
const tr = insert(undefined);
|
|
94
97
|
tr.setMeta(stateKey, {
|
|
95
98
|
type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
96
99
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
97
100
|
});
|
|
98
|
-
const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$
|
|
101
|
+
const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : (_api$analytics5$actio = _api$analytics5.actions) === null || _api$analytics5$actio === void 0 ? void 0 : (_api$analytics5$actio2 = _api$analytics5$actio.attachAnalyticsEvent) === null || _api$analytics5$actio2 === void 0 ? void 0 : _api$analytics5$actio2.call(_api$analytics5$actio, {
|
|
99
102
|
action: ACTION.INVOKED,
|
|
100
103
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
101
104
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
package/dist/esm/Toolbar.js
CHANGED
|
@@ -103,10 +103,10 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, intl, featur
|
|
|
103
103
|
};
|
|
104
104
|
export var getToolbarConfig = function getToolbarConfig(options, featureFlags, pluginInjectionApi) {
|
|
105
105
|
return function (state, intl, providerFactory) {
|
|
106
|
-
var _pluginInjectionApi$
|
|
106
|
+
var _pluginInjectionApi$a;
|
|
107
107
|
var formatMessage = intl.formatMessage;
|
|
108
108
|
var linkState = stateKey.getState(state);
|
|
109
|
-
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
109
|
+
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Enable focus trap only if feature flag is enabled AND for the new version of the picker
|
package/dist/esm/plugin.js
CHANGED
|
@@ -12,11 +12,12 @@ import { createKeymapPlugin } from './pm-plugins/keymap';
|
|
|
12
12
|
import { plugin as _plugin, stateKey } from './pm-plugins/main';
|
|
13
13
|
import { prependToolbarButtons, toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
|
|
14
14
|
import { getToolbarConfig } from './Toolbar';
|
|
15
|
-
export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
16
|
-
var _api$
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
16
|
+
var _api$featureFlags;
|
|
17
|
+
var _ref$config = _ref.config,
|
|
18
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
19
|
+
api = _ref.api;
|
|
20
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
20
21
|
return {
|
|
21
22
|
name: 'hyperlink',
|
|
22
23
|
marks: function marks() {
|
|
@@ -27,19 +28,19 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
27
28
|
},
|
|
28
29
|
commands: {
|
|
29
30
|
showLinkToolbar: function showLinkToolbar() {
|
|
30
|
-
var _api$
|
|
31
|
+
var _api$analytics;
|
|
31
32
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.TOOLBAR;
|
|
32
|
-
return _showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$
|
|
33
|
+
return _showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
actions: {
|
|
36
37
|
prependToolbarButtons: prependToolbarButtons,
|
|
37
38
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
38
39
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
39
|
-
var _api$
|
|
40
|
+
var _api$analytics2;
|
|
40
41
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
41
42
|
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
42
|
-
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$
|
|
43
|
+
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, title, displayText, cardsAvailable, sourceEvent);
|
|
43
44
|
},
|
|
44
45
|
updateLink: updateLink
|
|
45
46
|
},
|
|
@@ -56,8 +57,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
56
57
|
var skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
|
|
57
58
|
return [{
|
|
58
59
|
name: 'hyperlink',
|
|
59
|
-
plugin: function plugin(
|
|
60
|
-
var dispatch =
|
|
60
|
+
plugin: function plugin(_ref2) {
|
|
61
|
+
var dispatch = _ref2.dispatch;
|
|
61
62
|
return _plugin(dispatch, options === null || options === void 0 ? void 0 : options.editorAppearance);
|
|
62
63
|
}
|
|
63
64
|
}, {
|
|
@@ -67,17 +68,17 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
67
68
|
}
|
|
68
69
|
}, {
|
|
69
70
|
name: 'hyperlinkInputRule',
|
|
70
|
-
plugin: function plugin(
|
|
71
|
-
var _api$
|
|
72
|
-
var schema =
|
|
73
|
-
featureFlags =
|
|
74
|
-
return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
71
|
+
plugin: function plugin(_ref3) {
|
|
72
|
+
var _api$analytics3;
|
|
73
|
+
var schema = _ref3.schema,
|
|
74
|
+
featureFlags = _ref3.featureFlags;
|
|
75
|
+
return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
75
76
|
}
|
|
76
77
|
}, {
|
|
77
78
|
name: 'hyperlinkKeymap',
|
|
78
79
|
plugin: function plugin() {
|
|
79
|
-
var _api$
|
|
80
|
-
return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$
|
|
80
|
+
var _api$analytics4;
|
|
81
|
+
return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
81
82
|
}
|
|
82
83
|
}, {
|
|
83
84
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -85,8 +86,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
85
86
|
}];
|
|
86
87
|
},
|
|
87
88
|
pluginsOptions: {
|
|
88
|
-
quickInsert: function quickInsert(
|
|
89
|
-
var formatMessage =
|
|
89
|
+
quickInsert: function quickInsert(_ref4) {
|
|
90
|
+
var formatMessage = _ref4.formatMessage;
|
|
90
91
|
return [{
|
|
91
92
|
id: 'hyperlink',
|
|
92
93
|
title: formatMessage(messages.link),
|
|
@@ -98,13 +99,13 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
|
|
|
98
99
|
return /*#__PURE__*/React.createElement(IconLink, null);
|
|
99
100
|
},
|
|
100
101
|
action: function action(insert, state) {
|
|
101
|
-
var _api$
|
|
102
|
+
var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
|
|
102
103
|
var tr = insert(undefined);
|
|
103
104
|
tr.setMeta(stateKey, {
|
|
104
105
|
type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
105
106
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
106
107
|
});
|
|
107
|
-
var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$
|
|
108
|
+
var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : (_api$analytics5$actio = _api$analytics5.actions) === null || _api$analytics5$actio === void 0 ? void 0 : (_api$analytics5$actio2 = _api$analytics5$actio.attachAnalyticsEvent) === null || _api$analytics5$actio2 === void 0 ? void 0 : _api$analytics5$actio2.call(_api$analytics5$actio, {
|
|
108
109
|
action: ACTION.INVOKED,
|
|
109
110
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
110
111
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
|
|
|
28
28
|
* Example:
|
|
29
29
|
*
|
|
30
30
|
* ```
|
|
31
|
-
* const newTr = pluginInjectionApi?.
|
|
31
|
+
* const newTr = pluginInjectionApi?.hyperlink.commands.showLinkToolbar(
|
|
32
32
|
* inputMethod
|
|
33
33
|
* )({ tr })
|
|
34
34
|
* ```
|
|
@@ -31,7 +31,7 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
|
|
|
31
31
|
* Example:
|
|
32
32
|
*
|
|
33
33
|
* ```
|
|
34
|
-
* const newTr = pluginInjectionApi?.
|
|
34
|
+
* const newTr = pluginInjectionApi?.hyperlink.commands.showLinkToolbar(
|
|
35
35
|
* inputMethod
|
|
36
36
|
* )({ tr })
|
|
37
37
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "28.1.2",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^74.
|
|
36
|
+
"@atlaskit/editor-common": "^74.53.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-hyperlink"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
12
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
13
|
+
import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
|
|
15
|
+
import type { HyperlinkState } from '@atlaskit/editor-common/link';
|
|
16
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
17
|
+
import type { IntlShape } from 'react-intl-next';
|
|
18
|
+
import type { LinkInputType } from '@atlaskit/editor-common/types';
|
|
19
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
20
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
21
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
22
|
+
import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
|
|
23
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
24
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
25
|
+
|
|
26
|
+
// @public (undocumented)
|
|
27
|
+
type GetToolbarItems = (state: EditorState, intl: IntlShape, providerFactory: ProviderFactory, link: string) => FloatingToolbarItem<any>[];
|
|
28
|
+
|
|
29
|
+
// @public (undocumented)
|
|
30
|
+
export type HideLinkToolbar = (tr: Transaction) => Transaction;
|
|
31
|
+
|
|
32
|
+
// @public (undocumented)
|
|
33
|
+
export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
|
|
34
|
+
pluginConfiguration: HyperlinkPluginOptions | undefined;
|
|
35
|
+
dependencies: [FeatureFlagsPlugin, OptionalPlugin<AnalyticsPlugin>];
|
|
36
|
+
actions: {
|
|
37
|
+
prependToolbarButtons: PrependToolbarButtons;
|
|
38
|
+
hideLinkToolbar: HideLinkToolbar;
|
|
39
|
+
insertLink: InsertLink;
|
|
40
|
+
updateLink: UpdateLink;
|
|
41
|
+
};
|
|
42
|
+
commands: {
|
|
43
|
+
showLinkToolbar: ShowLinkToolbar;
|
|
44
|
+
};
|
|
45
|
+
sharedState: HyperlinkState | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
export const hyperlinkPlugin: HyperlinkPlugin;
|
|
50
|
+
|
|
51
|
+
// @public (undocumented)
|
|
52
|
+
type HyperlinkToolbarItemsState = {
|
|
53
|
+
items: GetToolbarItems;
|
|
54
|
+
onEscapeCallback: ((tr: Transaction) => Transaction) | undefined;
|
|
55
|
+
onInsertLinkCallback: QueueCardsFromTransactionAction | undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
type InputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR;
|
|
60
|
+
|
|
61
|
+
// @public (undocumented)
|
|
62
|
+
export type InsertLink = (inputMethod: LinkInputType, from: number, to: number, href: string, title?: string, displayText?: string, cardsAvailable?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
63
|
+
|
|
64
|
+
// @public (undocumented)
|
|
65
|
+
export type PrependToolbarButtons = (props: PrependToolbarButtonsProps) => void;
|
|
66
|
+
|
|
67
|
+
// @public (undocumented)
|
|
68
|
+
interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
|
|
69
|
+
// (undocumented)
|
|
70
|
+
view: EditorView;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// @public (undocumented)
|
|
74
|
+
export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
|
|
75
|
+
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
|
|
78
|
+
|
|
79
|
+
// (No @packageDocumentation comment for this package)
|
|
80
|
+
|
|
81
|
+
```
|