@atlaskit/editor-plugin-hyperlink 0.2.0 → 0.2.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/commands.js +3 -3
  3. package/dist/cjs/pm-plugins/fake-curor-for-toolbar-plugin-key.js +2 -2
  4. package/dist/cjs/pm-plugins/fake-cursor-for-toolbar.js +6 -6
  5. package/dist/cjs/pm-plugins/keymap.js +2 -2
  6. package/dist/cjs/pm-plugins/main.js +4 -4
  7. package/dist/cjs/pm-plugins/toolbar-buttons.js +2 -2
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/commands.js +2 -2
  10. package/dist/es2019/pm-plugins/fake-curor-for-toolbar-plugin-key.js +1 -1
  11. package/dist/es2019/pm-plugins/fake-cursor-for-toolbar.js +1 -1
  12. package/dist/es2019/pm-plugins/keymap.js +1 -1
  13. package/dist/es2019/pm-plugins/main.js +1 -1
  14. package/dist/es2019/pm-plugins/toolbar-buttons.js +1 -1
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/commands.js +2 -2
  17. package/dist/esm/pm-plugins/fake-curor-for-toolbar-plugin-key.js +1 -1
  18. package/dist/esm/pm-plugins/fake-cursor-for-toolbar.js +1 -1
  19. package/dist/esm/pm-plugins/keymap.js +1 -1
  20. package/dist/esm/pm-plugins/main.js +1 -1
  21. package/dist/esm/pm-plugins/toolbar-buttons.js +1 -1
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/Toolbar.d.ts +1 -1
  24. package/dist/types/commands.d.ts +4 -3
  25. package/dist/types/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +1 -1
  26. package/dist/types/pm-plugins/input-rule.d.ts +3 -3
  27. package/dist/types/pm-plugins/keymap.d.ts +2 -2
  28. package/dist/types/pm-plugins/main.d.ts +4 -4
  29. package/dist/types/pm-plugins/toolbar-buttons.d.ts +4 -3
  30. package/dist/types-ts4.5/Toolbar.d.ts +1 -1
  31. package/dist/types-ts4.5/commands.d.ts +4 -3
  32. package/dist/types-ts4.5/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +1 -1
  33. package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +3 -3
  34. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
  35. package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -4
  36. package/dist/types-ts4.5/pm-plugins/toolbar-buttons.d.ts +4 -3
  37. package/package.json +5 -8
  38. package/report.api.md +5 -5
  39. package/tmp/api-report-tmp.d.ts +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d8c1bcdc71a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d8c1bcdc71a) - ED-19217 decoupled lists related util functions from editor-core
8
+ - Updated dependencies
9
+
10
+ ## 0.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
15
+
3
16
  ## 0.2.0
4
17
 
5
18
  ### Minor Changes
@@ -14,19 +14,19 @@ exports.setLinkHref = setLinkHref;
14
14
  exports.showLinkToolbar = showLinkToolbar;
15
15
  exports.updateLink = updateLink;
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
- var _prosemirrorState = require("prosemirror-state");
18
17
  var _analytics = require("@atlaskit/editor-common/analytics");
19
18
  var _card = require("@atlaskit/editor-common/card");
20
19
  var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
21
20
  var _link = require("@atlaskit/editor-common/link");
22
21
  var _utils = require("@atlaskit/editor-common/utils");
22
+ 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
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
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; }
28
28
  function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
29
- return (0, _utils.filterCommands)((0, _link.isTextAtPos)(pos), function (state, dispatch) {
29
+ return (0, _utils.filterCommand)((0, _link.isTextAtPos)(pos), function (state, dispatch) {
30
30
  var $pos = state.doc.resolve(pos);
31
31
  var node = state.doc.nodeAt(pos);
32
32
  var linkMark = state.schema.marks.link;
@@ -112,7 +112,7 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
112
112
  tr.addMark(from, markEnd, link.create({
113
113
  href: normalizedUrl
114
114
  }));
115
- tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(markEnd)));
115
+ tr.setSelection(_state.Selection.near(tr.doc.resolve(markEnd)));
116
116
  if (!displayText || displayText === incomingHref) {
117
117
  var _toolbarKey$getState;
118
118
  var queueCardsFromChangedTr = (_toolbarKey$getState = _toolbarButtons.toolbarKey.getState(state)) === null || _toolbarKey$getState === void 0 ? void 0 : _toolbarKey$getState.onInsertLinkCallback;
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.fakeCursorForToolbarPluginKey = void 0;
7
- var _prosemirrorState = require("prosemirror-state");
8
- var fakeCursorForToolbarPluginKey = new _prosemirrorState.PluginKey('fakeCursorToolbarPlugin');
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var fakeCursorForToolbarPluginKey = new _state.PluginKey('fakeCursorToolbarPlugin');
9
9
  exports.fakeCursorForToolbarPluginKey = fakeCursorForToolbarPluginKey;
@@ -4,20 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _prosemirrorView = require("prosemirror-view");
8
7
  var _link = require("@atlaskit/editor-common/link");
9
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
+ var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _fakeCurorForToolbarPluginKey = require("./fake-curor-for-toolbar-plugin-key");
11
11
  var _main = require("./main");
12
12
  var createTextCursor = function createTextCursor(pos) {
13
13
  var node = document.createElement('div');
14
14
  node.className = 'ProseMirror-fake-text-cursor';
15
- return _prosemirrorView.Decoration.widget(pos, node, {
15
+ return _view.Decoration.widget(pos, node, {
16
16
  key: 'hyperlink-text-cursor'
17
17
  });
18
18
  };
19
19
  var createTextSelection = function createTextSelection(from, to) {
20
- return _prosemirrorView.Decoration.inline(from, to, {
20
+ return _view.Decoration.inline(from, to, {
21
21
  class: 'ProseMirror-fake-text-selection'
22
22
  });
23
23
  };
@@ -34,7 +34,7 @@ var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
34
34
  key: _fakeCurorForToolbarPluginKey.fakeCursorForToolbarPluginKey,
35
35
  state: {
36
36
  init: function init() {
37
- return _prosemirrorView.DecorationSet.empty;
37
+ return _view.DecorationSet.empty;
38
38
  },
39
39
  apply: function apply(tr, pluginState, oldState, newState) {
40
40
  var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
@@ -53,9 +53,9 @@ var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
53
53
  if (insertToolbarState) {
54
54
  var _from = insertToolbarState.from,
55
55
  _to = insertToolbarState.to;
56
- return _prosemirrorView.DecorationSet.create(tr.doc, [_from === _to ? createTextCursor(_from) : createTextSelection(_from, _to)]);
56
+ return _view.DecorationSet.create(tr.doc, [_from === _to ? createTextCursor(_from) : createTextSelection(_from, _to)]);
57
57
  }
58
- return _prosemirrorView.DecorationSet.empty;
58
+ return _view.DecorationSet.empty;
59
59
  }
60
60
  },
61
61
  props: {
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createKeymapPlugin = createKeymapPlugin;
7
7
  exports.default = void 0;
8
- var _prosemirrorKeymap = require("prosemirror-keymap");
9
8
  var _adfSchema = require("@atlaskit/adf-schema");
10
9
  var _analytics = require("@atlaskit/editor-common/analytics");
11
10
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
11
  var _utils = require("@atlaskit/editor-common/utils");
12
+ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
13
13
  var _commands = require("../commands");
14
14
  var _main = require("../pm-plugins/main");
15
15
  function createKeymapPlugin() {
@@ -30,7 +30,7 @@ function createKeymapPlugin() {
30
30
  }
31
31
  return false;
32
32
  }, list);
33
- return (0, _prosemirrorKeymap.keymap)(list);
33
+ return (0, _keymap.keymap)(list);
34
34
  }
35
35
  var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi) {
36
36
  return function (state, dispatch) {
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.stateKey = exports.plugin = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _prosemirrorState = require("prosemirror-state");
10
9
  var _uuid = _interopRequireDefault(require("uuid"));
11
10
  var _link3 = require("@atlaskit/editor-common/link");
12
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
12
  var _utils = require("@atlaskit/editor-common/utils");
13
+ var _state = require("@atlaskit/editor-prosemirror/state");
14
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
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; }
16
16
  var isSelectionInsideLink = function isSelectionInsideLink(state) {
@@ -148,12 +148,12 @@ var getActiveText = function getActiveText(selection) {
148
148
  if (currentSlice.size === 0) {
149
149
  return;
150
150
  }
151
- if (currentSlice.content.childCount === 1 && currentSlice.content.firstChild && selection instanceof _prosemirrorState.TextSelection) {
151
+ if (currentSlice.content.childCount === 1 && currentSlice.content.firstChild && selection instanceof _state.TextSelection) {
152
152
  return currentSlice.content.firstChild.textContent;
153
153
  }
154
154
  return;
155
155
  };
156
- var stateKey = new _prosemirrorState.PluginKey('hyperlinkPlugin');
156
+ var stateKey = new _state.PluginKey('hyperlinkPlugin');
157
157
  exports.stateKey = stateKey;
158
158
  var plugin = function plugin(dispatch, editorAppearance) {
159
159
  return new _safePlugin.SafePlugin({
@@ -241,7 +241,7 @@ var plugin = function plugin(dispatch, editorAppearance) {
241
241
  top: event.clientY
242
242
  });
243
243
  if ((newPosition === null || newPosition === void 0 ? void 0 : newPosition.pos) != null && newPosition.pos !== $anchor.pos) {
244
- var tr = state.tr.setSelection(_prosemirrorState.TextSelection.create(state.doc, $anchor.pos, newPosition.pos));
244
+ var tr = state.tr.setSelection(_state.TextSelection.create(state.doc, $anchor.pos, newPosition.pos));
245
245
  view.dispatch(tr);
246
246
  return true;
247
247
  }
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toolbarKey = exports.toolbarButtonsPlugin = exports.prependToolbarButtons = void 0;
7
- var _prosemirrorState = require("prosemirror-state");
8
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
- var toolbarKey = new _prosemirrorState.PluginKey('hyperlinkToolbarItems');
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var toolbarKey = new _state.PluginKey('hyperlinkToolbarItems');
10
10
  exports.toolbarKey = toolbarKey;
11
11
  var prependToolbarButtons = function prependToolbarButtons(_ref) {
12
12
  var items = _ref.items,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,9 +1,9 @@
1
- import { Selection } from 'prosemirror-state';
2
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, buildEditLinkPayload, EVENT_TYPE, INPUT_METHOD, unlinkPayload } from '@atlaskit/editor-common/analytics';
3
2
  import { addLinkMetadata, commandWithMetadata } from '@atlaskit/editor-common/card';
4
3
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
5
4
  import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
6
- import { filterCommands as filter, getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
5
+ import { filterCommand as filter, getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
6
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
8
  import { stateKey } from './pm-plugins/main';
9
9
  import { toolbarKey } from './pm-plugins/toolbar-buttons';
@@ -1,2 +1,2 @@
1
- import { PluginKey } from 'prosemirror-state';
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export const fakeCursorForToolbarPluginKey = new PluginKey('fakeCursorToolbarPlugin');
@@ -1,6 +1,6 @@
1
- import { Decoration, DecorationSet } from 'prosemirror-view';
2
1
  import { InsertStatus } from '@atlaskit/editor-common/link';
3
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { fakeCursorForToolbarPluginKey } from './fake-curor-for-toolbar-plugin-key';
5
5
  import { stateKey as hyperlinkStateKey } from './main';
6
6
  const createTextCursor = pos => {
@@ -1,8 +1,8 @@
1
- import { keymap } from 'prosemirror-keymap';
2
1
  import { getLinkMatch } from '@atlaskit/adf-schema';
3
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
3
  import { addLink, bindKeymapWithCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
5
4
  import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches } from '@atlaskit/editor-common/utils';
5
+ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { hideLinkToolbar, showLinkToolbar } from '../commands';
7
7
  import { stateKey } from '../pm-plugins/main';
8
8
  export function createKeymapPlugin(skipAnalytics = false, editorAnalyticsApi) {
@@ -1,8 +1,8 @@
1
- import { PluginKey, TextSelection } from 'prosemirror-state';
2
1
  import uuid from 'uuid';
3
2
  import { InsertStatus, LinkAction } from '@atlaskit/editor-common/link';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
4
  import { canLinkBeCreatedInRange, shallowEqual } from '@atlaskit/editor-common/utils';
5
+ import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  const isSelectionInsideLink = state => !!state.doc.type.schema.marks.link.isInSet(state.selection.$from.marks());
7
7
  const isSelectionAroundLink = state => {
8
8
  const {
@@ -1,5 +1,5 @@
1
- import { PluginKey } from 'prosemirror-state';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  export const toolbarKey = new PluginKey('hyperlinkToolbarItems');
4
4
  export const prependToolbarButtons = ({
5
5
  items,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,12 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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; }
4
- import { Selection } from 'prosemirror-state';
5
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, buildEditLinkPayload, EVENT_TYPE, INPUT_METHOD, unlinkPayload } from '@atlaskit/editor-common/analytics';
6
5
  import { addLinkMetadata, commandWithMetadata } from '@atlaskit/editor-common/card';
7
6
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
8
7
  import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
9
- import { filterCommands as filter, getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
8
+ import { filterCommand as filter, getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
9
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
11
  import { stateKey } from './pm-plugins/main';
12
12
  import { toolbarKey } from './pm-plugins/toolbar-buttons';
@@ -1,2 +1,2 @@
1
- import { PluginKey } from 'prosemirror-state';
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export var fakeCursorForToolbarPluginKey = new PluginKey('fakeCursorToolbarPlugin');
@@ -1,6 +1,6 @@
1
- import { Decoration, DecorationSet } from 'prosemirror-view';
2
1
  import { InsertStatus } from '@atlaskit/editor-common/link';
3
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { fakeCursorForToolbarPluginKey } from './fake-curor-for-toolbar-plugin-key';
5
5
  import { stateKey as hyperlinkStateKey } from './main';
6
6
  var createTextCursor = function createTextCursor(pos) {
@@ -1,8 +1,8 @@
1
- import { keymap } from 'prosemirror-keymap';
2
1
  import { getLinkMatch } from '@atlaskit/adf-schema';
3
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
3
  import { addLink, bindKeymapWithCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
5
4
  import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches } from '@atlaskit/editor-common/utils';
5
+ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { hideLinkToolbar, showLinkToolbar } from '../commands';
7
7
  import { stateKey } from '../pm-plugins/main';
8
8
  export function createKeymapPlugin() {
@@ -1,11 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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; }
4
- import { PluginKey, TextSelection } from 'prosemirror-state';
5
4
  import uuid from 'uuid';
6
5
  import { InsertStatus, LinkAction } from '@atlaskit/editor-common/link';
7
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
7
  import { canLinkBeCreatedInRange, shallowEqual } from '@atlaskit/editor-common/utils';
8
+ import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  var isSelectionInsideLink = function isSelectionInsideLink(state) {
10
10
  return !!state.doc.type.schema.marks.link.isInSet(state.selection.$from.marks());
11
11
  };
@@ -1,5 +1,5 @@
1
- import { PluginKey } from 'prosemirror-state';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  export var toolbarKey = new PluginKey('hyperlinkToolbarItems');
4
4
  export var prependToolbarButtons = function prependToolbarButtons(_ref) {
5
5
  var items = _ref.items,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
2
+ import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
3
3
  import type { ExtractInjectionAPI, FeatureFlags, FloatingToolbarHandler, HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
4
4
  import type { hyperlinkPlugin } from './index';
5
5
  export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, featureFlags, onClose, onEscapeCallback, onClickAwayCallback, pluginInjectionApi, }: HyperlinkAddToolbarProps & {
@@ -1,7 +1,8 @@
1
- import { Transaction } from 'prosemirror-state';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command, LinkInputType } from '@atlaskit/editor-common/types';
5
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
6
  export declare function setLinkHref(href: string, pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined, to?: number, isTabPressed?: boolean): Command;
6
7
  export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
7
8
  export declare function updateLink(href: string, text: string, pos: number, to?: number): Command;
@@ -1,2 +1,2 @@
1
- import { PluginKey } from 'prosemirror-state';
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const fakeCursorForToolbarPluginKey: PluginKey<any>;
@@ -1,7 +1,7 @@
1
- import { Schema } from 'prosemirror-model';
2
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
6
6
  export declare function createLinkInputRule(regexp: RegExp, skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
7
7
  export declare function createInputRulePlugin(schema: Schema, skipAnalytics: boolean | undefined, featureFlags: FeatureFlags, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
@@ -1,4 +1,4 @@
1
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  export declare function createKeymapPlugin(skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
4
4
  export default createKeymapPlugin;
@@ -1,7 +1,7 @@
1
- import { PluginKey } from 'prosemirror-state';
2
- import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
- import { HyperlinkState } from '@atlaskit/editor-common/link';
1
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
+ import type { HyperlinkState } from '@atlaskit/editor-common/link';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { EditorAppearance } from '@atlaskit/editor-common/types';
4
+ import type { EditorAppearance } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  export declare const stateKey: PluginKey<HyperlinkState>;
7
7
  export declare const plugin: (dispatch: Dispatch, editorAppearance?: EditorAppearance) => SafePlugin<HyperlinkState>;
@@ -1,10 +1,11 @@
1
- import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
2
- import { EditorView } from 'prosemirror-view';
3
1
  import type { IntlShape } from 'react-intl-next';
4
2
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
5
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
- import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
5
+ import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
6
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
8
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
9
  type HyperlinkToolbarItemsState = {
9
10
  items: GetToolbarItems;
10
11
  onEscapeCallback: ((tr: Transaction) => Transaction) | undefined;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
2
+ import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
3
3
  import type { ExtractInjectionAPI, FeatureFlags, FloatingToolbarHandler, HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
4
4
  import type { hyperlinkPlugin } from './index';
5
5
  export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, featureFlags, onClose, onEscapeCallback, onClickAwayCallback, pluginInjectionApi, }: HyperlinkAddToolbarProps & {
@@ -1,7 +1,8 @@
1
- import { Transaction } from 'prosemirror-state';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command, LinkInputType } from '@atlaskit/editor-common/types';
5
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
6
  export declare function setLinkHref(href: string, pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined, to?: number, isTabPressed?: boolean): Command;
6
7
  export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
7
8
  export declare function updateLink(href: string, text: string, pos: number, to?: number): Command;
@@ -1,2 +1,2 @@
1
- import { PluginKey } from 'prosemirror-state';
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const fakeCursorForToolbarPluginKey: PluginKey<any>;
@@ -1,7 +1,7 @@
1
- import { Schema } from 'prosemirror-model';
2
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
6
6
  export declare function createLinkInputRule(regexp: RegExp, skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
7
7
  export declare function createInputRulePlugin(schema: Schema, skipAnalytics: boolean | undefined, featureFlags: FeatureFlags, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
@@ -1,4 +1,4 @@
1
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  export declare function createKeymapPlugin(skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
4
4
  export default createKeymapPlugin;
@@ -1,7 +1,7 @@
1
- import { PluginKey } from 'prosemirror-state';
2
- import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
- import { HyperlinkState } from '@atlaskit/editor-common/link';
1
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
+ import type { HyperlinkState } from '@atlaskit/editor-common/link';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { EditorAppearance } from '@atlaskit/editor-common/types';
4
+ import type { EditorAppearance } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  export declare const stateKey: PluginKey<HyperlinkState>;
7
7
  export declare const plugin: (dispatch: Dispatch, editorAppearance?: EditorAppearance) => SafePlugin<HyperlinkState>;
@@ -1,10 +1,11 @@
1
- import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
2
- import { EditorView } from 'prosemirror-view';
3
1
  import type { IntlShape } from 'react-intl-next';
4
2
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
5
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
- import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
5
+ import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
6
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
8
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
9
  type HyperlinkToolbarItemsState = {
9
10
  items: GetToolbarItems;
10
11
  onEscapeCallback: ((tr: Transaction) => Transaction) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,19 +31,16 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^26.1.0",
34
+ "@atlaskit/adf-schema": "^26.4.0",
35
35
  "@atlaskit/analytics-next": "^9.1.0",
36
- "@atlaskit/editor-common": "^74.22.0",
36
+ "@atlaskit/editor-common": "^74.31.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
39
+ "@atlaskit/editor-prosemirror": "1.0.2",
39
40
  "@atlaskit/icon": "^21.12.0",
40
41
  "@atlaskit/platform-feature-flags": "^0.2.0",
41
42
  "@atlaskit/prosemirror-input-rules": "^2.3.0",
42
43
  "@babel/runtime": "^7.0.0",
43
- "prosemirror-keymap": "1.1.4",
44
- "prosemirror-model": "1.16.0",
45
- "prosemirror-state": "1.3.4",
46
- "prosemirror-view": "1.23.7",
47
44
  "uuid": "^3.1.0"
48
45
  },
49
46
  "peerDependencies": {
@@ -53,7 +50,7 @@
53
50
  "devDependencies": {
54
51
  "@atlaskit/activity-provider": "^2.4.0",
55
52
  "@atlaskit/editor-test-helpers": "^18.9.0",
56
- "@atlaskit/link-test-helpers": "^4.1.0",
53
+ "@atlaskit/link-test-helpers": "^6.0.0",
57
54
  "@atlaskit/media-test-helpers": "^33.0.0",
58
55
  "@atlaskit/ssr": "*",
59
56
  "@atlaskit/util-data-test": "^17.8.0",
package/report.api.md CHANGED
@@ -17,10 +17,10 @@
17
17
  ```ts
18
18
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
19
  import type { Command } from '@atlaskit/editor-common/types';
20
- import { EditorState } from 'prosemirror-state';
21
- import { EditorView } from 'prosemirror-view';
20
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
21
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
22
22
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
23
- import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
23
+ import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
24
24
  import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
25
25
  import type { HyperlinkState } from '@atlaskit/editor-common/link';
26
26
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -30,8 +30,8 @@ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
30
30
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
31
31
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
32
32
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
33
- import { Transaction } from 'prosemirror-state';
34
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
33
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
34
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
35
35
 
36
36
  // @public (undocumented)
37
37
  type GetToolbarItems = (
@@ -6,10 +6,10 @@
6
6
 
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  import type { Command } from '@atlaskit/editor-common/types';
9
- import { EditorState } from 'prosemirror-state';
10
- import { EditorView } from 'prosemirror-view';
9
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
12
- import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
12
+ import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
13
13
  import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
14
14
  import type { HyperlinkState } from '@atlaskit/editor-common/link';
15
15
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -19,8 +19,8 @@ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
19
19
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
20
20
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
21
21
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
22
- import { Transaction } from 'prosemirror-state';
23
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
22
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
23
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
24
24
 
25
25
  // @public (undocumented)
26
26
  type GetToolbarItems = (state: EditorState, intl: IntlShape, providerFactory: ProviderFactory, link: string) => FloatingToolbarItem<any>[];