@atlaskit/editor-core 187.18.2 → 187.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -1
  3. package/dist/cjs/plugins/base/index.js +0 -7
  4. package/dist/cjs/plugins/code-block/index.js +1 -1
  5. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +98 -95
  6. package/dist/cjs/plugins/composition/index.js +33 -0
  7. package/dist/cjs/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +8 -14
  8. package/dist/cjs/plugins/composition/pm-plugins/plugin-key.js +9 -0
  9. package/dist/cjs/plugins/media/index.js +4 -3
  10. package/dist/cjs/plugins/media/pm-plugins/alt-text/commands.js +10 -7
  11. package/dist/cjs/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
  12. package/dist/cjs/plugins/media/pm-plugins/main.js +9 -9
  13. package/dist/cjs/plugins/media/toolbar/alt-text.js +2 -2
  14. package/dist/cjs/plugins/media/toolbar/index.js +12 -11
  15. package/dist/cjs/plugins/media/utils/media-single.js +13 -13
  16. package/dist/cjs/plugins/paste/handlers.js +2 -2
  17. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
  18. package/dist/cjs/plugins/paste/pm-plugins/main.js +4 -4
  19. package/dist/cjs/plugins/placeholder/index.js +2 -2
  20. package/dist/cjs/plugins/selection/gap-cursor/styles.js +1 -1
  21. package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +3 -3
  22. package/dist/cjs/plugins/selection/gap-cursor/utils.js +6 -3
  23. package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +3 -3
  24. package/dist/cjs/version-wrapper.js +1 -1
  25. package/dist/cjs/version.json +1 -1
  26. package/dist/es2019/labs/next/presets/default.js +2 -1
  27. package/dist/es2019/plugins/base/index.js +0 -5
  28. package/dist/es2019/plugins/code-block/index.js +1 -1
  29. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +107 -104
  30. package/dist/es2019/plugins/composition/index.js +23 -0
  31. package/dist/es2019/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  32. package/dist/es2019/plugins/composition/pm-plugins/plugin-key.js +2 -0
  33. package/dist/es2019/plugins/media/index.js +6 -3
  34. package/dist/es2019/plugins/media/pm-plugins/alt-text/commands.js +3 -2
  35. package/dist/es2019/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
  36. package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
  37. package/dist/es2019/plugins/media/toolbar/alt-text.js +2 -2
  38. package/dist/es2019/plugins/media/toolbar/index.js +12 -11
  39. package/dist/es2019/plugins/media/utils/media-single.js +7 -8
  40. package/dist/es2019/plugins/paste/handlers.js +2 -3
  41. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
  42. package/dist/es2019/plugins/paste/pm-plugins/main.js +4 -4
  43. package/dist/es2019/plugins/placeholder/index.js +2 -2
  44. package/dist/es2019/plugins/selection/gap-cursor/styles.js +2 -1
  45. package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
  46. package/dist/es2019/plugins/selection/gap-cursor/utils.js +5 -2
  47. package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
  48. package/dist/es2019/version-wrapper.js +1 -1
  49. package/dist/es2019/version.json +1 -1
  50. package/dist/esm/labs/next/presets/default.js +2 -1
  51. package/dist/esm/plugins/base/index.js +0 -7
  52. package/dist/esm/plugins/code-block/index.js +1 -1
  53. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +98 -95
  54. package/dist/esm/plugins/composition/index.js +25 -0
  55. package/dist/esm/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  56. package/dist/esm/plugins/composition/pm-plugins/plugin-key.js +2 -0
  57. package/dist/esm/plugins/media/index.js +4 -3
  58. package/dist/esm/plugins/media/pm-plugins/alt-text/commands.js +10 -7
  59. package/dist/esm/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
  60. package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
  61. package/dist/esm/plugins/media/toolbar/alt-text.js +2 -2
  62. package/dist/esm/plugins/media/toolbar/index.js +12 -11
  63. package/dist/esm/plugins/media/utils/media-single.js +7 -7
  64. package/dist/esm/plugins/paste/handlers.js +2 -3
  65. package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
  66. package/dist/esm/plugins/paste/pm-plugins/main.js +4 -4
  67. package/dist/esm/plugins/placeholder/index.js +2 -2
  68. package/dist/esm/plugins/selection/gap-cursor/styles.js +1 -1
  69. package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
  70. package/dist/esm/plugins/selection/gap-cursor/utils.js +5 -2
  71. package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
  72. package/dist/esm/version-wrapper.js +1 -1
  73. package/dist/esm/version.json +1 -1
  74. package/dist/types/labs/next/presets/default.d.ts +16 -0
  75. package/dist/types/plugins/code-block/index.d.ts +6 -4
  76. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  77. package/dist/types/plugins/composition/index.d.ts +8 -0
  78. package/dist/types/plugins/composition/pm-plugins/main.d.ts +4 -0
  79. package/dist/types/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  80. package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
  81. package/dist/types/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
  82. package/dist/types/plugins/media/toolbar/alt-text.d.ts +2 -1
  83. package/dist/types/plugins/media/utils/media-single.d.ts +3 -3
  84. package/dist/types/plugins/paste/handlers.d.ts +2 -1
  85. package/dist/types/plugins/paste/index.d.ts +3 -1
  86. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -1
  87. package/dist/types/plugins/placeholder/index.d.ts +2 -1
  88. package/dist/types/plugins/selection/gap-cursor/utils.d.ts +1 -1
  89. package/dist/types-ts4.5/labs/next/presets/default.d.ts +20 -0
  90. package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -4
  91. package/dist/types-ts4.5/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  92. package/dist/types-ts4.5/plugins/composition/index.d.ts +8 -0
  93. package/dist/types-ts4.5/plugins/composition/pm-plugins/main.d.ts +4 -0
  94. package/dist/types-ts4.5/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  95. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
  96. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
  97. package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +2 -1
  98. package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +3 -3
  99. package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -1
  100. package/dist/types-ts4.5/plugins/paste/index.d.ts +3 -1
  101. package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -1
  102. package/dist/types-ts4.5/plugins/placeholder/index.d.ts +3 -1
  103. package/dist/types-ts4.5/plugins/selection/gap-cursor/utils.d.ts +1 -1
  104. package/package.json +1 -1
  105. package/report.api.md +1 -0
  106. package/tmp/api-report-tmp.d.ts +1 -1
  107. package/dist/types/plugins/base/pm-plugins/composition.d.ts +0 -9
  108. package/dist/types-ts4.5/plugins/base/pm-plugins/composition.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f284dd4d761`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f284dd4d761) - updated withAnalytics usage to new EditorAnalyticsAPI
8
+ - [`442d9be406d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/442d9be406d) - [ux] [ED-19027] Fixed gap cursor for nodes with fixed width
9
+
10
+ ## 187.19.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`7cb6ec49e68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7cb6ec49e68) - Decouple `composition` plugin from `base` plugin
15
+
3
16
  ## 187.18.2
4
17
 
5
18
  ### Patch Changes
@@ -26,6 +26,7 @@ var _plugins = require("../../../plugins");
26
26
  var _editorPluginAnalytics = require("@atlaskit/editor-plugin-analytics");
27
27
  var _placeholder = _interopRequireDefault(require("../../../plugins/placeholder"));
28
28
  var _annotation = _interopRequireDefault(require("../../../plugins/annotation"));
29
+ var _composition = _interopRequireDefault(require("../../../plugins/composition"));
29
30
  var _quickInsert = _interopRequireDefault(require("../../../plugins/quick-insert"));
30
31
  var _selection = _interopRequireDefault(require("../../../plugins/selection"));
31
32
  var _codeBlock = _interopRequireDefault(require("../../../plugins/code-block"));
@@ -61,7 +62,7 @@ function createDefaultPreset(options) {
61
62
  }]);
62
63
  }
63
64
  return builder;
64
- }).add([_paste.default, options.paste]).add(_clipboard.default).add(_editorPluginFocus.focusPlugin).add([_base.default, options.base]).add(_editorPluginDecorations.decorationsPlugin).maybeAdd(_undoRedo.default, function (p, builder) {
65
+ }).add([_paste.default, options.paste]).add(_clipboard.default).add(_editorPluginFocus.focusPlugin).add(_composition.default).add([_base.default, options.base]).add(_editorPluginDecorations.decorationsPlugin).maybeAdd(_undoRedo.default, function (p, builder) {
65
66
  var _options$featureFlags;
66
67
  // The undo redo plugin needs to be add before the blockTypePlugin
67
68
  if ((_options$featureFlags = options.featureFlags) !== null && _options$featureFlags !== void 0 && _options$featureFlags.undoRedoButtons) {
@@ -19,7 +19,6 @@ var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cu
19
19
  var _scrollGutter = _interopRequireDefault(require("./pm-plugins/scroll-gutter"));
20
20
  var _keymaps = require("@atlaskit/editor-common/keymaps");
21
21
  var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
22
- var _composition = _interopRequireDefault(require("./pm-plugins/composition"));
23
22
  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; }
24
23
  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; }
25
24
  // Chrome >= 88
@@ -112,12 +111,6 @@ var basePlugin = function basePlugin(options, api) {
112
111
  return (0, _disableSpellChecking.default)(featureFlags);
113
112
  }
114
113
  });
115
- plugins.push({
116
- name: 'compositionPlugin',
117
- plugin: function plugin() {
118
- return (0, _composition.default)();
119
- }
120
- });
121
114
  return plugins;
122
115
  },
123
116
  nodes: function nodes() {
@@ -44,7 +44,7 @@ var codeBlockPlugin = function codeBlockPlugin(options, api) {
44
44
  }, {
45
45
  name: 'codeBlockIDEKeyBindings',
46
46
  plugin: function plugin() {
47
- return _ideUx.default;
47
+ return (0, _ideUx.default)(api);
48
48
  }
49
49
  }, {
50
50
  name: 'codeBlockKeyMap',
@@ -15,113 +15,116 @@ var _bracketHandling = require("../ide-ux/bracket-handling");
15
15
  var _quoteHandling = require("../ide-ux/quote-handling");
16
16
  var _lineHandling = require("../ide-ux/line-handling");
17
17
  var _commands = require("../ide-ux/commands");
18
- var _composition = require("../../base/pm-plugins/composition");
19
- var _default = new _safePlugin.SafePlugin({
20
- props: {
21
- handleTextInput: function handleTextInput(view, from, to, text) {
22
- var state = view.state,
23
- dispatch = view.dispatch;
24
- if ((0, _lineHandling.isCursorInsideCodeBlock)(state) && !(0, _composition.isComposing)(state)) {
25
- var beforeText = (0, _lineHandling.getStartOfCurrentLine)(state).text;
26
- var afterText = (0, _lineHandling.getEndOfCurrentLine)(state).text;
27
-
28
- // If text is a closing bracket/quote and we've already inserted it, move the selection after
29
- if ((0, _pairedCharacterHandling.isCursorBeforeClosingCharacter)(afterText) && (0, _pairedCharacterHandling.isClosingCharacter)(text) && afterText.startsWith(text)) {
30
- dispatch((0, _utils.setTextSelection)(to + text.length)(state.tr));
31
- return true;
32
- }
33
-
34
- // Automatically add right-hand side bracket when user types the left bracket
35
- if ((0, _bracketHandling.shouldAutoCloseBracket)(beforeText, afterText)) {
36
- var _getAutoClosingBracke = (0, _bracketHandling.getAutoClosingBracketInfo)(beforeText + text, afterText),
37
- left = _getAutoClosingBracke.left,
38
- right = _getAutoClosingBracke.right;
39
- if (left && right) {
40
- var bracketPair = state.schema.text(text + right);
41
- var tr = state.tr.replaceWith(from, to, bracketPair);
42
- dispatch((0, _utils.setTextSelection)(from + text.length)(tr));
43
- return true;
44
- }
45
- }
46
-
47
- // Automatically add closing quote when user types a starting quote
48
- if ((0, _quoteHandling.shouldAutoCloseQuote)(beforeText, afterText)) {
49
- var _getAutoClosingQuoteI = (0, _quoteHandling.getAutoClosingQuoteInfo)(beforeText + text, afterText),
50
- leftQuote = _getAutoClosingQuoteI.left,
51
- rightQuote = _getAutoClosingQuoteI.right;
52
- if (leftQuote && rightQuote) {
53
- var quotePair = state.schema.text(text + rightQuote);
54
- var _tr = state.tr.replaceWith(from, to, quotePair);
55
- dispatch((0, _utils.setTextSelection)(from + text.length)(_tr));
56
- return true;
57
- }
58
- }
59
- }
60
- return false;
61
- },
62
- handleKeyDown: (0, _keymap.keydownHandler)({
63
- Backspace: function Backspace(state, dispatch) {
64
- if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
65
- var $cursor = (0, _utils2.getCursor)(state.selection);
18
+ var ideUX = function ideUX(pluginInjectionApi) {
19
+ return new _safePlugin.SafePlugin({
20
+ props: {
21
+ handleTextInput: function handleTextInput(view, from, to, text) {
22
+ var state = view.state,
23
+ dispatch = view.dispatch;
24
+ var compositionPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.composition.sharedState.currentState();
25
+ if ((0, _lineHandling.isCursorInsideCodeBlock)(state) && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
66
26
  var beforeText = (0, _lineHandling.getStartOfCurrentLine)(state).text;
67
27
  var afterText = (0, _lineHandling.getEndOfCurrentLine)(state).text;
68
- var _getAutoClosingBracke2 = (0, _bracketHandling.getAutoClosingBracketInfo)(beforeText, afterText),
69
- leftBracket = _getAutoClosingBracke2.left,
70
- rightBracket = _getAutoClosingBracke2.right,
71
- hasTrailingMatchingBracket = _getAutoClosingBracke2.hasTrailingMatchingBracket;
72
- if (leftBracket && rightBracket && hasTrailingMatchingBracket && dispatch) {
73
- dispatch(state.tr.delete($cursor.pos - leftBracket.length, $cursor.pos + rightBracket.length));
28
+
29
+ // If text is a closing bracket/quote and we've already inserted it, move the selection after
30
+ if ((0, _pairedCharacterHandling.isCursorBeforeClosingCharacter)(afterText) && (0, _pairedCharacterHandling.isClosingCharacter)(text) && afterText.startsWith(text)) {
31
+ dispatch((0, _utils.setTextSelection)(to + text.length)(state.tr));
74
32
  return true;
75
33
  }
76
- var _getAutoClosingQuoteI2 = (0, _quoteHandling.getAutoClosingQuoteInfo)(beforeText, afterText),
77
- leftQuote = _getAutoClosingQuoteI2.left,
78
- rightQuote = _getAutoClosingQuoteI2.right,
79
- hasTrailingMatchingQuote = _getAutoClosingQuoteI2.hasTrailingMatchingQuote;
80
- if (leftQuote && rightQuote && hasTrailingMatchingQuote && dispatch) {
81
- dispatch(state.tr.delete($cursor.pos - leftQuote.length, $cursor.pos + rightQuote.length));
82
- return true;
34
+
35
+ // Automatically add right-hand side bracket when user types the left bracket
36
+ if ((0, _bracketHandling.shouldAutoCloseBracket)(beforeText, afterText)) {
37
+ var _getAutoClosingBracke = (0, _bracketHandling.getAutoClosingBracketInfo)(beforeText + text, afterText),
38
+ left = _getAutoClosingBracke.left,
39
+ right = _getAutoClosingBracke.right;
40
+ if (left && right) {
41
+ var bracketPair = state.schema.text(text + right);
42
+ var tr = state.tr.replaceWith(from, to, bracketPair);
43
+ dispatch((0, _utils.setTextSelection)(from + text.length)(tr));
44
+ return true;
45
+ }
83
46
  }
84
- var _getLineInfo = (0, _lineHandling.getLineInfo)(beforeText),
85
- _getLineInfo$indentTo = _getLineInfo.indentToken,
86
- size = _getLineInfo$indentTo.size,
87
- token = _getLineInfo$indentTo.token,
88
- indentText = _getLineInfo.indentText;
89
- if (beforeText === indentText) {
90
- if (indentText.endsWith(token.repeat(size)) && dispatch) {
91
- dispatch(state.tr.delete($cursor.pos - (size - indentText.length % size || size), $cursor.pos));
47
+
48
+ // Automatically add closing quote when user types a starting quote
49
+ if ((0, _quoteHandling.shouldAutoCloseQuote)(beforeText, afterText)) {
50
+ var _getAutoClosingQuoteI = (0, _quoteHandling.getAutoClosingQuoteInfo)(beforeText + text, afterText),
51
+ leftQuote = _getAutoClosingQuoteI.left,
52
+ rightQuote = _getAutoClosingQuoteI.right;
53
+ if (leftQuote && rightQuote) {
54
+ var quotePair = state.schema.text(text + rightQuote);
55
+ var _tr = state.tr.replaceWith(from, to, quotePair);
56
+ dispatch((0, _utils.setTextSelection)(from + text.length)(_tr));
92
57
  return true;
93
58
  }
94
59
  }
95
60
  }
96
61
  return false;
97
62
  },
98
- Enter: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.insertNewlineWithIndent),
99
- 'Mod-]': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.indent),
100
- 'Mod-[': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
101
- Tab: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, function (state, dispatch) {
102
- if (!dispatch) {
63
+ handleKeyDown: (0, _keymap.keydownHandler)({
64
+ Backspace: function Backspace(state, dispatch) {
65
+ if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
66
+ var $cursor = (0, _utils2.getCursor)(state.selection);
67
+ var beforeText = (0, _lineHandling.getStartOfCurrentLine)(state).text;
68
+ var afterText = (0, _lineHandling.getEndOfCurrentLine)(state).text;
69
+ var _getAutoClosingBracke2 = (0, _bracketHandling.getAutoClosingBracketInfo)(beforeText, afterText),
70
+ leftBracket = _getAutoClosingBracke2.left,
71
+ rightBracket = _getAutoClosingBracke2.right,
72
+ hasTrailingMatchingBracket = _getAutoClosingBracke2.hasTrailingMatchingBracket;
73
+ if (leftBracket && rightBracket && hasTrailingMatchingBracket && dispatch) {
74
+ dispatch(state.tr.delete($cursor.pos - leftBracket.length, $cursor.pos + rightBracket.length));
75
+ return true;
76
+ }
77
+ var _getAutoClosingQuoteI2 = (0, _quoteHandling.getAutoClosingQuoteInfo)(beforeText, afterText),
78
+ leftQuote = _getAutoClosingQuoteI2.left,
79
+ rightQuote = _getAutoClosingQuoteI2.right,
80
+ hasTrailingMatchingQuote = _getAutoClosingQuoteI2.hasTrailingMatchingQuote;
81
+ if (leftQuote && rightQuote && hasTrailingMatchingQuote && dispatch) {
82
+ dispatch(state.tr.delete($cursor.pos - leftQuote.length, $cursor.pos + rightQuote.length));
83
+ return true;
84
+ }
85
+ var _getLineInfo = (0, _lineHandling.getLineInfo)(beforeText),
86
+ _getLineInfo$indentTo = _getLineInfo.indentToken,
87
+ size = _getLineInfo$indentTo.size,
88
+ token = _getLineInfo$indentTo.token,
89
+ indentText = _getLineInfo.indentText;
90
+ if (beforeText === indentText) {
91
+ if (indentText.endsWith(token.repeat(size)) && dispatch) {
92
+ dispatch(state.tr.delete($cursor.pos - (size - indentText.length % size || size), $cursor.pos));
93
+ return true;
94
+ }
95
+ }
96
+ }
103
97
  return false;
104
- }
105
- if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
106
- return (0, _commands.insertIndent)(state, dispatch);
107
- }
108
- return (0, _commands.indent)(state, dispatch);
109
- }),
110
- 'Shift-Tab': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
111
- 'Mod-a': function ModA(state, dispatch) {
112
- if ((0, _lineHandling.isSelectionEntirelyInsideCodeBlock)(state)) {
113
- var _state$selection = state.selection,
114
- $from = _state$selection.$from,
115
- $to = _state$selection.$to;
116
- var isFullCodeBlockSelection = $from.parentOffset === 0 && $to.parentOffset === $to.parent.nodeSize - 2;
117
- if (!isFullCodeBlockSelection && dispatch) {
118
- dispatch(state.tr.setSelection(_state.TextSelection.create(state.doc, $from.start(), $to.end())));
119
- return true;
98
+ },
99
+ Enter: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.insertNewlineWithIndent),
100
+ 'Mod-]': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.indent),
101
+ 'Mod-[': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
102
+ Tab: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, function (state, dispatch) {
103
+ if (!dispatch) {
104
+ return false;
105
+ }
106
+ if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
107
+ return (0, _commands.insertIndent)(state, dispatch);
108
+ }
109
+ return (0, _commands.indent)(state, dispatch);
110
+ }),
111
+ 'Shift-Tab': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
112
+ 'Mod-a': function ModA(state, dispatch) {
113
+ if ((0, _lineHandling.isSelectionEntirelyInsideCodeBlock)(state)) {
114
+ var _state$selection = state.selection,
115
+ $from = _state$selection.$from,
116
+ $to = _state$selection.$to;
117
+ var isFullCodeBlockSelection = $from.parentOffset === 0 && $to.parentOffset === $to.parent.nodeSize - 2;
118
+ if (!isFullCodeBlockSelection && dispatch) {
119
+ dispatch(state.tr.setSelection(_state.TextSelection.create(state.doc, $from.start(), $to.end())));
120
+ return true;
121
+ }
120
122
  }
123
+ return false;
121
124
  }
122
- return false;
123
- }
124
- })
125
- }
126
- });
125
+ })
126
+ }
127
+ });
128
+ };
129
+ var _default = ideUX;
127
130
  exports.default = _default;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _main = _interopRequireDefault(require("./pm-plugins/main"));
9
+ var _pluginKey = require("./pm-plugins/plugin-key");
10
+ var composition = function composition() {
11
+ return {
12
+ name: 'composition',
13
+ getSharedState: function getSharedState(editorState) {
14
+ var _pluginKey$getState;
15
+ if (!editorState) {
16
+ return undefined;
17
+ }
18
+ return {
19
+ isComposing: !!((_pluginKey$getState = _pluginKey.pluginKey.getState(editorState)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.isComposing)
20
+ };
21
+ },
22
+ pmPlugins: function pmPlugins() {
23
+ return [{
24
+ name: 'composition',
25
+ plugin: function plugin() {
26
+ return (0, _main.default)();
27
+ }
28
+ }];
29
+ }
30
+ };
31
+ };
32
+ var _default = composition;
33
+ exports.default = _default;
@@ -3,22 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isComposing = exports.default = void 0;
6
+ exports.default = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _state = require("@atlaskit/editor-prosemirror/state");
9
8
  var _utils = require("@atlaskit/editor-common/utils");
10
- var compositionPluginKey = new _state.PluginKey('compositionPlugin');
11
- var isComposing = function isComposing(state) {
12
- var _compositionPluginKey;
13
- return !!((_compositionPluginKey = compositionPluginKey.getState(state)) !== null && _compositionPluginKey !== void 0 && _compositionPluginKey.isComposing);
14
- };
15
- exports.isComposing = isComposing;
9
+ var _pluginKey = require("./plugin-key");
16
10
  var isLinux = function isLinux() {
17
11
  return navigator.userAgent.indexOf('Linux') >= 0;
18
12
  };
19
13
  var _default = function _default() {
20
14
  return new _safePlugin.SafePlugin({
21
- key: compositionPluginKey,
15
+ key: _pluginKey.pluginKey,
22
16
  state: {
23
17
  init: function init() {
24
18
  return {
@@ -27,7 +21,7 @@ var _default = function _default() {
27
21
  };
28
22
  },
29
23
  apply: function apply(tr, value) {
30
- var isComposing = tr.getMeta(compositionPluginKey);
24
+ var isComposing = tr.getMeta(_pluginKey.pluginKey);
31
25
  var zeroWidthSpacePos = tr.getMeta('zeroWidthSpacePos');
32
26
  if (typeof isComposing === 'undefined') {
33
27
  return value;
@@ -42,7 +36,7 @@ var _default = function _default() {
42
36
  handleDOMEvents: {
43
37
  compositionstart: function compositionstart(view, event) {
44
38
  var tr = view.state.tr;
45
- tr.setMeta(compositionPluginKey, true);
39
+ tr.setMeta(_pluginKey.pluginKey, true);
46
40
 
47
41
  // only apply for linux and cursor is at start of line
48
42
  if (isLinux() && view.state.selection.$from.parentOffset === 0) {
@@ -56,10 +50,10 @@ var _default = function _default() {
56
50
  },
57
51
  compositionend: function compositionend(view, event) {
58
52
  var tr = view.state.tr;
59
- tr.setMeta(compositionPluginKey, false);
53
+ tr.setMeta(_pluginKey.pluginKey, false);
60
54
  if (isLinux()) {
61
- var _compositionPluginKey2;
62
- var zeroWidthSpacePos = (_compositionPluginKey2 = compositionPluginKey.getState(view.state)) === null || _compositionPluginKey2 === void 0 ? void 0 : _compositionPluginKey2.zeroWidthSpacePos;
55
+ var _pluginKey$getState;
56
+ var zeroWidthSpacePos = (_pluginKey$getState = _pluginKey.pluginKey.getState(view.state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.zeroWidthSpacePos;
63
57
  if (typeof zeroWidthSpacePos !== 'undefined') {
64
58
  tr.deleteRange(zeroWidthSpacePos, zeroWidthSpacePos + 1);
65
59
  }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = void 0;
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var pluginKey = new _state.PluginKey('compositionPlugin');
9
+ exports.pluginKey = pluginKey;
@@ -145,8 +145,9 @@ var mediaPlugin = function mediaPlugin() {
145
145
  pmPlugins.push({
146
146
  name: 'mediaAltTextKeymap',
147
147
  plugin: function plugin(_ref4) {
148
+ var _api$dependencies$ana2;
148
149
  var schema = _ref4.schema;
149
- return (0, _keymap.default)(schema);
150
+ return (0, _keymap.default)(schema, 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);
150
151
  }
151
152
  });
152
153
  }
@@ -241,11 +242,11 @@ var mediaPlugin = function mediaPlugin() {
241
242
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconImages, null);
242
243
  },
243
244
  action: function action(insert, state) {
244
- var _api$dependencies$ana2;
245
+ var _api$dependencies$ana3;
245
246
  var pluginState = _main.stateKey.getState(state);
246
247
  pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
247
248
  var tr = insert('');
248
- 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.attachAnalyticsEvent({
249
+ 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.attachAnalyticsEvent({
249
250
  action: _analytics.ACTION.OPENED,
250
251
  actionSubject: _analytics.ACTION_SUBJECT.PICKER,
251
252
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
@@ -8,16 +8,19 @@ exports.updateAltText = exports.openMediaAltTextMenu = exports.closeMediaAltText
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _ = require(".");
10
10
  var _mediaCommon = require("../../utils/media-common");
11
- var _analytics = require("../../../analytics");
11
+ var _analytics = require("@atlaskit/editor-common/analytics");
12
+ var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
12
13
  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; }
13
14
  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
15
  var createCommandWithAnalytics = function createCommandWithAnalytics(actionType, action, transform) {
15
- return (0, _analytics.withAnalytics)({
16
- action: actionType,
17
- actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
18
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.ALT_TEXT,
19
- eventType: _analytics.EVENT_TYPE.TRACK
20
- })((0, _.createCommand)(action, transform));
16
+ return function (editorAnalyticsAPI) {
17
+ return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
18
+ action: actionType,
19
+ actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
20
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.ALT_TEXT,
21
+ eventType: _analytics.EVENT_TYPE.TRACK
22
+ })((0, _.createCommand)(action, transform));
23
+ };
21
24
  };
22
25
  var closeMediaAltTextMenu = (0, _.createCommand)(function (state) {
23
26
  if ((0, _mediaCommon.isSelectionMediaSingleNode)(state)) {
@@ -10,9 +10,9 @@ var keymaps = _interopRequireWildcard(require("../../../../keymaps"));
10
10
  var _commands = require("./commands");
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- function keymapPlugin(schema) {
13
+ function keymapPlugin(schema, editorAnalyticsAPI) {
14
14
  var list = {};
15
- keymaps.bindKeymapWithCommand(keymaps.addAltText.common, _commands.openMediaAltTextMenu, list);
15
+ keymaps.bindKeymapWithCommand(keymaps.addAltText.common, (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI), list);
16
16
  keymaps.bindKeymapWithCommand(keymaps.escape.common, _commands.closeMediaAltTextMenu, list);
17
17
  return (0, _keymap.keymap)(list);
18
18
  }
@@ -33,7 +33,7 @@ var _mediaCommon = require("../utils/media-common");
33
33
  var helpers = _interopRequireWildcard(require("../commands/helpers"));
34
34
  var _pluginKey = require("./plugin-key");
35
35
  var _pickerFacade = _interopRequireDefault(require("../picker-facade"));
36
- var _types = require("../../analytics/types");
36
+ var _analytics = require("@atlaskit/editor-common/analytics");
37
37
  var _document = require("../../../utils/document");
38
38
  var _mediaCommon2 = require("@atlaskit/media-common");
39
39
  var _utils3 = require("../../../utils");
@@ -240,16 +240,16 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
240
240
  });
241
241
  }
242
242
  if ((0, _mediaSingle.isMediaSingle)(state.schema, mediaStateWithContext.fileMimeType)) {
243
- var _this$pluginInjection;
243
+ var _this$pluginInjection, _pluginInjectionApi$d, _pluginInjectionApi$d2;
244
244
  // read width state right before inserting to get up-to-date and define values
245
245
  var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.dependencies.width.sharedState.currentState();
246
- (0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState);
246
+ (0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions);
247
247
  } else if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !(0, _document.isInEmptyLine)(state) && (!(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state) || (0, _utils3.isInListItem)(state)) && (0, _mediaFiles.canInsertMediaInline)(state)) {
248
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
249
- (0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
250
- } else {
251
248
  var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
252
- (0, _mediaFiles.insertMediaGroupNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.analytics) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
249
+ (0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.analytics) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
250
+ } else {
251
+ var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
252
+ (0, _mediaFiles.insertMediaGroupNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
253
253
  }
254
254
 
255
255
  // do events when media state changes
@@ -409,9 +409,9 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
409
409
  (0, _defineProperty2.default)(this, "getInputMethod", function (pickerType) {
410
410
  switch (pickerType) {
411
411
  case 'clipboard':
412
- return _types.INPUT_METHOD.CLIPBOARD;
412
+ return _analytics.INPUT_METHOD.CLIPBOARD;
413
413
  case 'dropzone':
414
- return _types.INPUT_METHOD.DRAG_AND_DROP;
414
+ return _analytics.INPUT_METHOD.DRAG_AND_DROP;
415
415
  }
416
416
  return;
417
417
  });
@@ -19,7 +19,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
19
19
  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; }
20
20
  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; }
21
21
  var testId = 'alt-text-edit-button';
22
- var altTextButton = function altTextButton(intl, state) {
22
+ var altTextButton = function altTextButton(intl, state, editorAnalyticsAPI) {
23
23
  var mediaNode = (0, _mediaCommon.getMediaNodeFromSelection)(state);
24
24
  var message = mediaNode && mediaNode.attrs.alt ? _messages.messages.editAltText : _messages.messages.altText;
25
25
  var title = intl.formatMessage(message);
@@ -27,7 +27,7 @@ var altTextButton = function altTextButton(intl, state) {
27
27
  title: title,
28
28
  id: 'editor.media.altText',
29
29
  type: 'button',
30
- onClick: _commands.openMediaAltTextMenu,
30
+ onClick: (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI),
31
31
  showTitle: true,
32
32
  testId: testId,
33
33
  tooltipContent: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
@@ -198,7 +198,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
198
198
  return items;
199
199
  };
200
200
  var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
201
- var _pluginInjectionApi$d7;
201
+ var _pluginInjectionApi$d8;
202
202
  var mediaSingle = state.schema.nodes.mediaSingle;
203
203
  var allowResizing = options.allowResizing,
204
204
  allowLinking = options.allowLinking,
@@ -354,11 +354,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
354
354
  }
355
355
  }
356
356
  if (allowAltTextOnImages) {
357
- toolbarButtons.push((0, _altText2.altTextButton)(intl, state), {
357
+ var _pluginInjectionApi$d7;
358
+ toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions), {
358
359
  type: 'separator'
359
360
  });
360
361
  }
361
- var _ref2 = (_pluginInjectionApi$d7 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d7 !== void 0 ? _pluginInjectionApi$d7 : {},
362
+ var _ref2 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
362
363
  hoverDecoration = _ref2.hoverDecoration;
363
364
  var removeButton = {
364
365
  id: 'editor.media.delete',
@@ -387,7 +388,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
387
388
  return items;
388
389
  };
389
390
  var floatingToolbar = function floatingToolbar(state, intl) {
390
- var _pluginInjectionApi$d8;
391
+ var _pluginInjectionApi$d9;
391
392
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
392
393
  var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
393
394
  var _state$schema$nodes = state.schema.nodes,
@@ -403,7 +404,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
403
404
  getEditorFeatureFlags = options.getEditorFeatureFlags;
404
405
  var mediaPluginState = _pluginKey.stateKey.getState(state);
405
406
  var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
406
- var _ref3 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
407
+ var _ref3 = (_pluginInjectionApi$d9 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d9 !== void 0 ? _pluginInjectionApi$d9 : {},
407
408
  hoverDecoration = _ref3.hoverDecoration;
408
409
  if (!mediaPluginState || mediaPluginState.isResizing) {
409
410
  return;
@@ -425,10 +426,10 @@ var floatingToolbar = function floatingToolbar(state, intl) {
425
426
  if (allowAltTextOnImages) {
426
427
  var mediaAltTextPluginState = (0, _altText.getPluginState)(state);
427
428
  if (mediaAltTextPluginState.isAltTextEditorOpen) {
428
- var _pluginInjectionApi$d9;
429
+ var _pluginInjectionApi$d10;
429
430
  return (0, _altText2.getAltTextToolbar)(baseToolbar, {
430
431
  altTextValidator: altTextValidator,
431
- forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d9 = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d9 === void 0 ? void 0 : _pluginInjectionApi$d9.forceFocusSelector
432
+ forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d10 = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d10 === void 0 ? void 0 : _pluginInjectionApi$d10.forceFocusSelector
432
433
  });
433
434
  }
434
435
  }
@@ -439,22 +440,22 @@ var floatingToolbar = function floatingToolbar(state, intl) {
439
440
  selectedNodeType = state.selection.node.type;
440
441
  }
441
442
  if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
442
- var _pluginInjectionApi$d10, _pluginInjectionApi$d11;
443
+ var _pluginInjectionApi$d11, _pluginInjectionApi$d12;
443
444
  var mediaOffset = state.selection.$from.parentOffset + 1;
444
445
  baseToolbar.getDomRef = function () {
445
446
  var _mediaPluginState$ele;
446
447
  var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
447
448
  return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
448
449
  };
449
- items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d10 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d10 === void 0 ? void 0 : (_pluginInjectionApi$d11 = _pluginInjectionApi$d10.analytics) === null || _pluginInjectionApi$d11 === void 0 ? void 0 : _pluginInjectionApi$d11.actions);
450
+ items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d11 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d11 === void 0 ? void 0 : (_pluginInjectionApi$d12 = _pluginInjectionApi$d11.analytics) === null || _pluginInjectionApi$d12 === void 0 ? void 0 : _pluginInjectionApi$d12.actions);
450
451
  } else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
451
- var _pluginInjectionApi$d12, _pluginInjectionApi$d13;
452
+ var _pluginInjectionApi$d13, _pluginInjectionApi$d14;
452
453
  baseToolbar.getDomRef = function () {
453
454
  var _mediaPluginState$ele2;
454
455
  var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
455
456
  return element || mediaPluginState.element;
456
457
  };
457
- items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d12 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d12 === void 0 ? void 0 : (_pluginInjectionApi$d13 = _pluginInjectionApi$d12.analytics) === null || _pluginInjectionApi$d13 === void 0 ? void 0 : _pluginInjectionApi$d13.actions);
458
+ items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d13 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d13 === void 0 ? void 0 : (_pluginInjectionApi$d14 = _pluginInjectionApi$d13.analytics) === null || _pluginInjectionApi$d14 === void 0 ? void 0 : _pluginInjectionApi$d14.actions);
458
459
  } else {
459
460
  baseToolbar.getDomRef = function () {
460
461
  var _mediaPluginState$ele3;