@atlaskit/editor-plugin-hyperlink 0.3.4 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 0.3.5
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
18
+ signature of `NextEditorPlugin`.
19
+
20
+ Previously a `NextEditorPlugin` would be consumed as so:
21
+
22
+ ```ts
23
+ const plugin: NextEditorPlugin< ... > = (config, api) => {
24
+ // Can use api like so:
25
+ api.dependencies.core.actions.execute( ... )
26
+ return { ... }
27
+ }
28
+ ```
29
+
30
+ Now these have become named parameters like so and the `pluginInjectionAPI` is used
31
+ without the `dependencies` prop:
32
+
33
+ ```ts
34
+ const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
35
+ // Can use api like so:
36
+ api.core.actions.execute( ... )
37
+ return { ... }
38
+ }
39
+ ```
40
+
41
+ - Updated dependencies
42
+
3
43
  ## 0.3.4
4
44
 
5
45
  ### Patch Changes
package/README.md CHANGED
@@ -1,7 +1,30 @@
1
- # EditorPluginHyperlink
1
+ # Editor plugin hyperlink
2
2
 
3
3
  Hyperlink plugin for @atlaskit/editor-core
4
4
 
5
+ **Note:** This component is designed for internal Atlassian development.
6
+ External contributors will be able to use this component but will not be able to submit issues.
7
+
8
+ ## Install
9
+ ---
10
+ - **Install** - *yarn add @atlaskit/editor-plugin-hyperlink*
11
+ - **npm** - [@atlaskit/editor-plugin-hyperlink](https://www.npmjs.com/package/@atlaskit/editor-plugin-hyperlink)
12
+ - **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-hyperlink)
13
+ - **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/editor-plugin-hyperlink/dist/)
14
+
5
15
  ## Usage
16
+ ---
17
+ **Internal use only**
18
+
19
+ @atlaskit/editor-plugin-hyperlink is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
20
+
21
+ Direct use of this component is not supported.
22
+
23
+ Please see [Atlaskit - Editor plugin hyperlink](https://atlaskit.atlassian.com/packages/editor/editor-plugin-hyperlink) for documentation and examples for this package.
6
24
 
7
- `import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';`
25
+ ## Support
26
+ ---
27
+ For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
28
+ ## License
29
+ ---
30
+ Please see [Atlassian Frontend - License](https://developer.atlassian.com/cloud/framework/atlassian-frontend/#license) for more licensing information.
@@ -23,8 +23,8 @@ var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"))
23
23
  var _commands = require("./commands");
24
24
  var _main = require("./pm-plugins/main");
25
25
  var _toolbarButtons = require("./pm-plugins/toolbar-buttons");
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
28
  /* type guard for edit links */
29
29
  function isEditLink(linkMark) {
30
30
  return linkMark.pos !== undefined;
@@ -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$d;
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$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
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
@@ -23,8 +23,8 @@ var _state = require("@atlaskit/editor-prosemirror/state");
23
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
24
  var _main = require("./pm-plugins/main");
25
25
  var _toolbarButtons = require("./pm-plugins/toolbar-buttons");
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
28
  function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
29
29
  return (0, _utils.filterCommand)((0, _link.isTextAtPos)(pos), function (state, dispatch) {
30
30
  var $pos = state.doc.resolve(pos);
@@ -19,11 +19,16 @@ 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$dependencies, _api$dependencies$fea;
24
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
- var api = arguments.length > 1 ? arguments[1] : undefined;
26
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
22
+ /**
23
+ * Hyperlink plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
24
+ * from `@atlaskit/editor-core`.
25
+ */
26
+ var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
27
+ var _api$featureFlags;
28
+ var _ref$config = _ref.config,
29
+ options = _ref$config === void 0 ? {} : _ref$config,
30
+ api = _ref.api;
31
+ 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
32
  return {
28
33
  name: 'hyperlink',
29
34
  marks: function marks() {
@@ -34,19 +39,19 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
34
39
  },
35
40
  commands: {
36
41
  showLinkToolbar: function showLinkToolbar() {
37
- var _api$dependencies$ana;
42
+ var _api$analytics;
38
43
  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$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
44
+ 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
45
  }
41
46
  },
42
47
  actions: {
43
48
  prependToolbarButtons: _toolbarButtons.prependToolbarButtons,
44
49
  hideLinkToolbar: _commands.hideLinkToolbarSetMeta,
45
50
  insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
46
- var _api$dependencies$ana2;
51
+ var _api$analytics2;
47
52
  var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
48
53
  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$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions, title, displayText, cardsAvailable, sourceEvent);
54
+ 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
55
  },
51
56
  updateLink: _commands.updateLink
52
57
  },
@@ -63,8 +68,8 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
63
68
  var skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
64
69
  return [{
65
70
  name: 'hyperlink',
66
- plugin: function plugin(_ref) {
67
- var dispatch = _ref.dispatch;
71
+ plugin: function plugin(_ref2) {
72
+ var dispatch = _ref2.dispatch;
68
73
  return (0, _main.plugin)(dispatch, options === null || options === void 0 ? void 0 : options.editorAppearance);
69
74
  }
70
75
  }, {
@@ -74,17 +79,17 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
74
79
  }
75
80
  }, {
76
81
  name: 'hyperlinkInputRule',
77
- plugin: function plugin(_ref2) {
78
- var _api$dependencies$ana3;
79
- var schema = _ref2.schema,
80
- featureFlags = _ref2.featureFlags;
81
- return (0, _inputRule.createInputRulePlugin)(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
82
+ plugin: function plugin(_ref3) {
83
+ var _api$analytics3;
84
+ var schema = _ref3.schema,
85
+ featureFlags = _ref3.featureFlags;
86
+ 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
87
  }
83
88
  }, {
84
89
  name: 'hyperlinkKeymap',
85
90
  plugin: function plugin() {
86
- var _api$dependencies$ana4;
87
- return (0, _keymap.createKeymapPlugin)(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
91
+ var _api$analytics4;
92
+ 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
93
  }
89
94
  }, {
90
95
  name: 'hyperlinkToolbarButtons',
@@ -92,8 +97,8 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
92
97
  }];
93
98
  },
94
99
  pluginsOptions: {
95
- quickInsert: function quickInsert(_ref3) {
96
- var formatMessage = _ref3.formatMessage;
100
+ quickInsert: function quickInsert(_ref4) {
101
+ var formatMessage = _ref4.formatMessage;
97
102
  return [{
98
103
  id: 'hyperlink',
99
104
  title: formatMessage(_messages.toolbarInsertBlockMessages.link),
@@ -105,13 +110,13 @@ var hyperlinkPlugin = function hyperlinkPlugin() {
105
110
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconLink, null);
106
111
  },
107
112
  action: function action(insert, state) {
108
- var _api$dependencies2, _api$dependencies2$an, _api$dependencies2$an2, _api$dependencies2$an3;
113
+ var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
109
114
  var tr = insert(undefined);
110
115
  tr.setMeta(_main.stateKey, {
111
116
  type: _link.LinkAction.SHOW_INSERT_TOOLBAR,
112
117
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
113
118
  });
114
- var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$dependencies2 = api.dependencies) === null || _api$dependencies2 === void 0 ? void 0 : (_api$dependencies2$an = _api$dependencies2.analytics) === null || _api$dependencies2$an === void 0 ? void 0 : (_api$dependencies2$an2 = _api$dependencies2$an.actions) === null || _api$dependencies2$an2 === void 0 ? void 0 : (_api$dependencies2$an3 = _api$dependencies2$an2.attachAnalyticsEvent) === null || _api$dependencies2$an3 === void 0 ? void 0 : _api$dependencies2$an3.call(_api$dependencies2$an2, {
119
+ 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
120
  action: _analytics.ACTION.INVOKED,
116
121
  actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
117
122
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
@@ -11,8 +11,8 @@ var _link3 = require("@atlaskit/editor-common/link");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
16
  var isSelectionInsideLink = function isSelectionInsideLink(state) {
17
17
  return !!state.doc.type.schema.marks.link.isInSet(state.selection.$from.marks());
18
18
  };
@@ -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$d;
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$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
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
@@ -12,9 +12,16 @@ 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 = (options = {}, api) => {
16
- var _api$dependencies, _api$dependencies$fea;
17
- const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
15
+ /**
16
+ * Hyperlink plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
17
+ * from `@atlaskit/editor-core`.
18
+ */
19
+ export const hyperlinkPlugin = ({
20
+ config: options = {},
21
+ api
22
+ }) => {
23
+ var _api$featureFlags;
24
+ 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
25
  return {
19
26
  name: 'hyperlink',
20
27
  marks() {
@@ -25,16 +32,16 @@ export const hyperlinkPlugin = (options = {}, api) => {
25
32
  },
26
33
  commands: {
27
34
  showLinkToolbar: (inputMethod = INPUT_METHOD.TOOLBAR) => {
28
- var _api$dependencies$ana;
29
- return showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
35
+ var _api$analytics;
36
+ 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
37
  }
31
38
  },
32
39
  actions: {
33
40
  prependToolbarButtons,
34
41
  hideLinkToolbar: hideLinkToolbarSetMeta,
35
42
  insertLink: (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined) => {
36
- var _api$dependencies$ana2;
37
- return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions, title, displayText, cardsAvailable, sourceEvent);
43
+ var _api$analytics2;
44
+ 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
45
  },
39
46
  updateLink: updateLink
40
47
  },
@@ -63,14 +70,14 @@ export const hyperlinkPlugin = (options = {}, api) => {
63
70
  schema,
64
71
  featureFlags
65
72
  }) => {
66
- var _api$dependencies$ana3;
67
- return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
73
+ var _api$analytics3;
74
+ 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
75
  }
69
76
  }, {
70
77
  name: 'hyperlinkKeymap',
71
78
  plugin: () => {
72
- var _api$dependencies$ana4;
73
- return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
79
+ var _api$analytics4;
80
+ 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
81
  }
75
82
  }, {
76
83
  name: 'hyperlinkToolbarButtons',
@@ -89,13 +96,13 @@ export const hyperlinkPlugin = (options = {}, api) => {
89
96
  keyshortcut: tooltip(addLink),
90
97
  icon: () => /*#__PURE__*/React.createElement(IconLink, null),
91
98
  action(insert, state) {
92
- var _api$dependencies2, _api$dependencies2$an, _api$dependencies2$an2, _api$dependencies2$an3;
99
+ var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
93
100
  const tr = insert(undefined);
94
101
  tr.setMeta(stateKey, {
95
102
  type: LinkAction.SHOW_INSERT_TOOLBAR,
96
103
  inputMethod: INPUT_METHOD.QUICK_INSERT
97
104
  });
98
- const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$dependencies2 = api.dependencies) === null || _api$dependencies2 === void 0 ? void 0 : (_api$dependencies2$an = _api$dependencies2.analytics) === null || _api$dependencies2$an === void 0 ? void 0 : (_api$dependencies2$an2 = _api$dependencies2$an.actions) === null || _api$dependencies2$an2 === void 0 ? void 0 : (_api$dependencies2$an3 = _api$dependencies2$an2.attachAnalyticsEvent) === null || _api$dependencies2$an3 === void 0 ? void 0 : _api$dependencies2$an3.call(_api$dependencies2$an2, {
105
+ 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
106
  action: ACTION.INVOKED,
100
107
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
101
108
  actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React from 'react';
6
6
  import { isSafeUrl } from '@atlaskit/adf-schema';
7
7
  import { ACTION, ACTION_SUBJECT_ID, buildOpenedSettingsPayload, buildVisitedLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -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$d;
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$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
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
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, buildEditLinkPayload, EVENT_TYPE, INPUT_METHOD, unlinkPayload } from '@atlaskit/editor-common/analytics';
5
5
  import { addLinkMetadata, commandWithMetadata } from '@atlaskit/editor-common/card';
6
6
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
@@ -12,11 +12,16 @@ 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$dependencies, _api$dependencies$fea;
17
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
- var api = arguments.length > 1 ? arguments[1] : undefined;
19
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
15
+ /**
16
+ * Hyperlink plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
17
+ * from `@atlaskit/editor-core`.
18
+ */
19
+ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
20
+ var _api$featureFlags;
21
+ var _ref$config = _ref.config,
22
+ options = _ref$config === void 0 ? {} : _ref$config,
23
+ api = _ref.api;
24
+ 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
25
  return {
21
26
  name: 'hyperlink',
22
27
  marks: function marks() {
@@ -27,19 +32,19 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
27
32
  },
28
33
  commands: {
29
34
  showLinkToolbar: function showLinkToolbar() {
30
- var _api$dependencies$ana;
35
+ var _api$analytics;
31
36
  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$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
37
+ 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
38
  }
34
39
  },
35
40
  actions: {
36
41
  prependToolbarButtons: prependToolbarButtons,
37
42
  hideLinkToolbar: hideLinkToolbarSetMeta,
38
43
  insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
39
- var _api$dependencies$ana2;
44
+ var _api$analytics2;
40
45
  var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
41
46
  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$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions, title, displayText, cardsAvailable, sourceEvent);
47
+ 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
48
  },
44
49
  updateLink: updateLink
45
50
  },
@@ -56,8 +61,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
56
61
  var skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
57
62
  return [{
58
63
  name: 'hyperlink',
59
- plugin: function plugin(_ref) {
60
- var dispatch = _ref.dispatch;
64
+ plugin: function plugin(_ref2) {
65
+ var dispatch = _ref2.dispatch;
61
66
  return _plugin(dispatch, options === null || options === void 0 ? void 0 : options.editorAppearance);
62
67
  }
63
68
  }, {
@@ -67,17 +72,17 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
67
72
  }
68
73
  }, {
69
74
  name: 'hyperlinkInputRule',
70
- plugin: function plugin(_ref2) {
71
- var _api$dependencies$ana3;
72
- var schema = _ref2.schema,
73
- featureFlags = _ref2.featureFlags;
74
- return createInputRulePlugin(schema, skipAnalytics, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
75
+ plugin: function plugin(_ref3) {
76
+ var _api$analytics3;
77
+ var schema = _ref3.schema,
78
+ featureFlags = _ref3.featureFlags;
79
+ 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
80
  }
76
81
  }, {
77
82
  name: 'hyperlinkKeymap',
78
83
  plugin: function plugin() {
79
- var _api$dependencies$ana4;
80
- return createKeymapPlugin(skipAnalytics, api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
84
+ var _api$analytics4;
85
+ 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
86
  }
82
87
  }, {
83
88
  name: 'hyperlinkToolbarButtons',
@@ -85,8 +90,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
85
90
  }];
86
91
  },
87
92
  pluginsOptions: {
88
- quickInsert: function quickInsert(_ref3) {
89
- var formatMessage = _ref3.formatMessage;
93
+ quickInsert: function quickInsert(_ref4) {
94
+ var formatMessage = _ref4.formatMessage;
90
95
  return [{
91
96
  id: 'hyperlink',
92
97
  title: formatMessage(messages.link),
@@ -98,13 +103,13 @@ export var hyperlinkPlugin = function hyperlinkPlugin() {
98
103
  return /*#__PURE__*/React.createElement(IconLink, null);
99
104
  },
100
105
  action: function action(insert, state) {
101
- var _api$dependencies2, _api$dependencies2$an, _api$dependencies2$an2, _api$dependencies2$an3;
106
+ var _api$analytics5, _api$analytics5$actio, _api$analytics5$actio2;
102
107
  var tr = insert(undefined);
103
108
  tr.setMeta(stateKey, {
104
109
  type: LinkAction.SHOW_INSERT_TOOLBAR,
105
110
  inputMethod: INPUT_METHOD.QUICK_INSERT
106
111
  });
107
- var analyticsAttached = api === null || api === void 0 ? void 0 : (_api$dependencies2 = api.dependencies) === null || _api$dependencies2 === void 0 ? void 0 : (_api$dependencies2$an = _api$dependencies2.analytics) === null || _api$dependencies2$an === void 0 ? void 0 : (_api$dependencies2$an2 = _api$dependencies2$an.actions) === null || _api$dependencies2$an2 === void 0 ? void 0 : (_api$dependencies2$an3 = _api$dependencies2$an2.attachAnalyticsEvent) === null || _api$dependencies2$an3 === void 0 ? void 0 : _api$dependencies2$an3.call(_api$dependencies2$an2, {
112
+ 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
113
  action: ACTION.INVOKED,
109
114
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
110
115
  actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import uuid from 'uuid';
5
5
  import { InsertStatus, LinkAction } from '@atlaskit/editor-common/link';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -28,7 +28,7 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
28
28
  * Example:
29
29
  *
30
30
  * ```
31
- * const newTr = pluginInjectionApi?.dependencies.hyperlink.commands.showLinkToolbar(
31
+ * const newTr = pluginInjectionApi?.hyperlink.commands.showLinkToolbar(
32
32
  * inputMethod
33
33
  * )({ tr })
34
34
  * ```
@@ -37,4 +37,8 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
37
37
  };
38
38
  sharedState: HyperlinkState | undefined;
39
39
  }>;
40
+ /**
41
+ * Hyperlink plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
42
+ * from `@atlaskit/editor-core`.
43
+ */
40
44
  export declare const hyperlinkPlugin: HyperlinkPlugin;
@@ -31,7 +31,7 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
31
31
  * Example:
32
32
  *
33
33
  * ```
34
- * const newTr = pluginInjectionApi?.dependencies.hyperlink.commands.showLinkToolbar(
34
+ * const newTr = pluginInjectionApi?.hyperlink.commands.showLinkToolbar(
35
35
  * inputMethod
36
36
  * )({ tr })
37
37
  * ```
@@ -40,4 +40,8 @@ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
40
40
  };
41
41
  sharedState: HyperlinkState | undefined;
42
42
  }>;
43
+ /**
44
+ * Hyperlink plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
45
+ * from `@atlaskit/editor-core`.
46
+ */
43
47
  export declare const hyperlinkPlugin: HyperlinkPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Editor",
11
+ "team": "Editor: Media Experience Porygon",
12
12
  "singleton": true,
13
13
  "releaseModel": "continuous"
14
14
  },
@@ -33,9 +33,9 @@
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "28.1.2",
35
35
  "@atlaskit/analytics-next": "^9.1.0",
36
- "@atlaskit/editor-common": "^74.52.0",
37
- "@atlaskit/editor-plugin-analytics": "^0.1.0",
38
- "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
36
+ "@atlaskit/editor-common": "^74.55.0",
37
+ "@atlaskit/editor-plugin-analytics": "^0.2.0",
38
+ "@atlaskit/editor-plugin-feature-flags": "^0.2.0",
39
39
  "@atlaskit/editor-prosemirror": "1.1.0",
40
40
  "@atlaskit/icon": "^21.12.0",
41
41
  "@atlaskit/platform-feature-flags": "^0.2.0",
package/report.api.md CHANGED
@@ -64,7 +64,7 @@ export type HyperlinkPlugin = NextEditorPlugin<
64
64
  }
65
65
  >;
66
66
 
67
- // @public (undocumented)
67
+ // @public
68
68
  export const hyperlinkPlugin: HyperlinkPlugin;
69
69
 
70
70
  // @public (undocumented)
@@ -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
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
+ ```