@atlaskit/editor-core 187.18.2 → 187.19.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +6 -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/placeholder/index.js +2 -2
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/labs/next/presets/default.js +2 -1
  13. package/dist/es2019/plugins/base/index.js +0 -5
  14. package/dist/es2019/plugins/code-block/index.js +1 -1
  15. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +107 -104
  16. package/dist/es2019/plugins/composition/index.js +23 -0
  17. package/dist/es2019/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  18. package/dist/es2019/plugins/composition/pm-plugins/plugin-key.js +2 -0
  19. package/dist/es2019/plugins/placeholder/index.js +2 -2
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/labs/next/presets/default.js +2 -1
  23. package/dist/esm/plugins/base/index.js +0 -7
  24. package/dist/esm/plugins/code-block/index.js +1 -1
  25. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +98 -95
  26. package/dist/esm/plugins/composition/index.js +25 -0
  27. package/dist/esm/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  28. package/dist/esm/plugins/composition/pm-plugins/plugin-key.js +2 -0
  29. package/dist/esm/plugins/placeholder/index.js +2 -2
  30. package/dist/esm/version-wrapper.js +1 -1
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/labs/next/presets/default.d.ts +16 -0
  33. package/dist/types/plugins/code-block/index.d.ts +6 -4
  34. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  35. package/dist/types/plugins/composition/index.d.ts +8 -0
  36. package/dist/types/plugins/composition/pm-plugins/main.d.ts +4 -0
  37. package/dist/types/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  38. package/dist/types/plugins/placeholder/index.d.ts +2 -1
  39. package/dist/types-ts4.5/labs/next/presets/default.d.ts +20 -0
  40. package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -4
  41. package/dist/types-ts4.5/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  42. package/dist/types-ts4.5/plugins/composition/index.d.ts +8 -0
  43. package/dist/types-ts4.5/plugins/composition/pm-plugins/main.d.ts +4 -0
  44. package/dist/types-ts4.5/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  45. package/dist/types-ts4.5/plugins/placeholder/index.d.ts +3 -1
  46. package/package.json +1 -1
  47. package/dist/types/plugins/base/pm-plugins/composition.d.ts +0 -9
  48. package/dist/types-ts4.5/plugins/base/pm-plugins/composition.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7cb6ec49e68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7cb6ec49e68) - Decouple `composition` plugin from `base` plugin
8
+
3
9
  ## 187.18.2
4
10
 
5
11
  ### 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;
@@ -11,7 +11,6 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _view = require("@atlaskit/editor-prosemirror/view");
13
13
  var _utils2 = require("../type-ahead/utils");
14
- var _composition = require("../base/pm-plugins/composition");
15
14
  var pluginKey = new _state.PluginKey('placeholderPlugin');
16
15
  exports.pluginKey = pluginKey;
17
16
  function getPlaceholderState(editorState) {
@@ -108,7 +107,8 @@ function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
108
107
  hasPlaceholder = _getPlaceholderState.hasPlaceholder,
109
108
  placeholderText = _getPlaceholderState.placeholderText,
110
109
  pos = _getPlaceholderState.pos;
111
- if (hasPlaceholder && placeholderText && pos !== undefined && !(0, _composition.isComposing)(editorState)) {
110
+ var compositionPluginState = api === null || api === void 0 ? void 0 : api.dependencies.composition.sharedState.currentState();
111
+ if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
112
112
  return createPlaceholderDecoration(editorState, placeholderText, pos);
113
113
  }
114
114
  return;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.18.2";
9
+ var version = "187.19.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.18.2",
3
+ "version": "187.19.0",
4
4
  "sideEffects": false
5
5
  }
@@ -20,6 +20,7 @@ import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../../../plugins';
20
20
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
21
21
  import placeholderPlugin from '../../../plugins/placeholder';
22
22
  import annotationPlugin from '../../../plugins/annotation';
23
+ import compositionPlugin from '../../../plugins/composition';
23
24
  import quickInsertPlugin from '../../../plugins/quick-insert';
24
25
  import selectionPlugin from '../../../plugins/selection';
25
26
  import codeBlockPlugin from '../../../plugins/code-block';
@@ -57,7 +58,7 @@ export function createDefaultPreset(options) {
57
58
  }]);
58
59
  }
59
60
  return builder;
60
- }).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add([basePlugin, options.base]).add(decorationsPlugin).maybeAdd(undoRedoPlugin, (p, builder) => {
61
+ }).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([basePlugin, options.base]).add(decorationsPlugin).maybeAdd(undoRedoPlugin, (p, builder) => {
61
62
  var _options$featureFlags;
62
63
  // The undo redo plugin needs to be add before the blockTypePlugin
63
64
  if ((_options$featureFlags = options.featureFlags) !== null && _options$featureFlags !== void 0 && _options$featureFlags.undoRedoButtons) {
@@ -11,7 +11,6 @@ import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
11
11
  import scrollGutter from './pm-plugins/scroll-gutter';
12
12
  import { keymap } from '@atlaskit/editor-common/keymaps';
13
13
  import frozenEditor from './pm-plugins/frozen-editor';
14
- import compositionPlugin from './pm-plugins/composition';
15
14
  // Chrome >= 88
16
15
  export const isChromeWithSelectionBug = browser.chrome && browser.chrome_version >= 88;
17
16
  const basePlugin = (options, api) => {
@@ -85,10 +84,6 @@ const basePlugin = (options, api) => {
85
84
  name: 'disableSpellcheckingPlugin',
86
85
  plugin: () => disableSpellcheckingPlugin(featureFlags)
87
86
  });
88
- plugins.push({
89
- name: 'compositionPlugin',
90
- plugin: () => compositionPlugin()
91
- });
92
87
  return plugins;
93
88
  },
94
89
  nodes() {
@@ -33,7 +33,7 @@ const codeBlockPlugin = (options, api) => ({
33
33
  })
34
34
  }, {
35
35
  name: 'codeBlockIDEKeyBindings',
36
- plugin: () => ideUX
36
+ plugin: () => ideUX(api)
37
37
  }, {
38
38
  name: 'codeBlockKeyMap',
39
39
  plugin: ({