@atlaskit/editor-core 187.18.1 → 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 (113) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -1
  3. package/dist/cjs/labs/next/presets/universal.js +2 -1
  4. package/dist/cjs/plugins/base/index.js +0 -7
  5. package/dist/cjs/plugins/code-block/index.js +1 -1
  6. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +98 -95
  7. package/dist/cjs/plugins/composition/index.js +33 -0
  8. package/dist/cjs/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +8 -14
  9. package/dist/cjs/plugins/{image-upload → composition}/pm-plugins/plugin-key.js +3 -3
  10. package/dist/cjs/plugins/index.js +0 -7
  11. package/dist/cjs/plugins/paste/pm-plugins/main.js +2 -6
  12. package/dist/cjs/plugins/placeholder/index.js +2 -2
  13. package/dist/cjs/utils/clipboard.js +5 -27
  14. package/dist/cjs/version-wrapper.js +1 -1
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/labs/next/presets/default.js +2 -1
  17. package/dist/es2019/labs/next/presets/universal.js +2 -1
  18. package/dist/es2019/plugins/base/index.js +0 -5
  19. package/dist/es2019/plugins/code-block/index.js +1 -1
  20. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +107 -104
  21. package/dist/es2019/plugins/composition/index.js +23 -0
  22. package/dist/es2019/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  23. package/dist/es2019/plugins/{image-upload → composition}/pm-plugins/plugin-key.js +1 -1
  24. package/dist/es2019/plugins/index.js +0 -1
  25. package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -2
  26. package/dist/es2019/plugins/placeholder/index.js +2 -2
  27. package/dist/es2019/utils/clipboard.js +0 -16
  28. package/dist/es2019/version-wrapper.js +1 -1
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/labs/next/presets/default.js +2 -1
  31. package/dist/esm/labs/next/presets/universal.js +2 -1
  32. package/dist/esm/plugins/base/index.js +0 -7
  33. package/dist/esm/plugins/code-block/index.js +1 -1
  34. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +98 -95
  35. package/dist/esm/plugins/composition/index.js +25 -0
  36. package/dist/esm/plugins/{base/pm-plugins/composition.js → composition/pm-plugins/main.js} +7 -12
  37. package/dist/esm/plugins/{image-upload → composition}/pm-plugins/plugin-key.js +1 -1
  38. package/dist/esm/plugins/index.js +0 -1
  39. package/dist/esm/plugins/paste/pm-plugins/main.js +2 -2
  40. package/dist/esm/plugins/placeholder/index.js +2 -2
  41. package/dist/esm/utils/clipboard.js +4 -23
  42. package/dist/esm/version-wrapper.js +1 -1
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/labs/next/presets/default.d.ts +16 -0
  45. package/dist/types/plugins/code-block/index.d.ts +6 -4
  46. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  47. package/dist/types/plugins/composition/index.d.ts +8 -0
  48. package/dist/types/plugins/composition/pm-plugins/main.d.ts +4 -0
  49. package/dist/types/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  50. package/dist/types/plugins/index.d.ts +0 -1
  51. package/dist/types/plugins/insert-block/index.d.ts +1 -1
  52. package/dist/types/plugins/placeholder/index.d.ts +2 -1
  53. package/dist/types/utils/clipboard.d.ts +0 -3
  54. package/dist/types-ts4.5/labs/next/presets/default.d.ts +20 -0
  55. package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -4
  56. package/dist/types-ts4.5/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -2
  57. package/dist/types-ts4.5/plugins/composition/index.d.ts +8 -0
  58. package/dist/types-ts4.5/plugins/composition/pm-plugins/main.d.ts +4 -0
  59. package/dist/types-ts4.5/plugins/composition/pm-plugins/plugin-key.d.ts +6 -0
  60. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  61. package/dist/types-ts4.5/plugins/insert-block/index.d.ts +1 -1
  62. package/dist/types-ts4.5/plugins/placeholder/index.d.ts +3 -1
  63. package/dist/types-ts4.5/utils/clipboard.d.ts +0 -3
  64. package/package.json +4 -3
  65. package/dist/cjs/plugins/image-upload/index.js +0 -45
  66. package/dist/cjs/plugins/image-upload/pm-plugins/actions.js +0 -19
  67. package/dist/cjs/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -19
  68. package/dist/cjs/plugins/image-upload/pm-plugins/commands.js +0 -40
  69. package/dist/cjs/plugins/image-upload/pm-plugins/input-rule.js +0 -31
  70. package/dist/cjs/plugins/image-upload/pm-plugins/main.js +0 -194
  71. package/dist/cjs/plugins/image-upload/types.js +0 -5
  72. package/dist/cjs/plugins/image-upload/utils.js +0 -40
  73. package/dist/cjs/utils/drag-drop.js +0 -19
  74. package/dist/es2019/plugins/image-upload/index.js +0 -34
  75. package/dist/es2019/plugins/image-upload/pm-plugins/actions.js +0 -8
  76. package/dist/es2019/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -12
  77. package/dist/es2019/plugins/image-upload/pm-plugins/commands.js +0 -28
  78. package/dist/es2019/plugins/image-upload/pm-plugins/input-rule.js +0 -25
  79. package/dist/es2019/plugins/image-upload/pm-plugins/main.js +0 -159
  80. package/dist/es2019/plugins/image-upload/types.js +0 -1
  81. package/dist/es2019/plugins/image-upload/utils.js +0 -38
  82. package/dist/es2019/utils/drag-drop.js +0 -9
  83. package/dist/esm/plugins/image-upload/index.js +0 -37
  84. package/dist/esm/plugins/image-upload/pm-plugins/actions.js +0 -12
  85. package/dist/esm/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -12
  86. package/dist/esm/plugins/image-upload/pm-plugins/commands.js +0 -32
  87. package/dist/esm/plugins/image-upload/pm-plugins/input-rule.js +0 -23
  88. package/dist/esm/plugins/image-upload/pm-plugins/main.js +0 -186
  89. package/dist/esm/plugins/image-upload/types.js +0 -1
  90. package/dist/esm/plugins/image-upload/utils.js +0 -31
  91. package/dist/esm/utils/drag-drop.js +0 -11
  92. package/dist/types/plugins/base/pm-plugins/composition.d.ts +0 -9
  93. package/dist/types/plugins/image-upload/index.d.ts +0 -16
  94. package/dist/types/plugins/image-upload/pm-plugins/actions.d.ts +0 -3
  95. package/dist/types/plugins/image-upload/pm-plugins/commands-toolbar.d.ts +0 -3
  96. package/dist/types/plugins/image-upload/pm-plugins/commands.d.ts +0 -5
  97. package/dist/types/plugins/image-upload/pm-plugins/input-rule.d.ts +0 -5
  98. package/dist/types/plugins/image-upload/pm-plugins/main.d.ts +0 -4
  99. package/dist/types/plugins/image-upload/pm-plugins/plugin-key.d.ts +0 -3
  100. package/dist/types/plugins/image-upload/types.d.ts +0 -18
  101. package/dist/types/plugins/image-upload/utils.d.ts +0 -5
  102. package/dist/types/utils/drag-drop.d.ts +0 -2
  103. package/dist/types-ts4.5/plugins/base/pm-plugins/composition.d.ts +0 -9
  104. package/dist/types-ts4.5/plugins/image-upload/index.d.ts +0 -16
  105. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/actions.d.ts +0 -3
  106. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/commands-toolbar.d.ts +0 -3
  107. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/commands.d.ts +0 -5
  108. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/input-rule.d.ts +0 -5
  109. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/main.d.ts +0 -4
  110. package/dist/types-ts4.5/plugins/image-upload/pm-plugins/plugin-key.d.ts +0 -3
  111. package/dist/types-ts4.5/plugins/image-upload/types.d.ts +0 -18
  112. package/dist/types-ts4.5/plugins/image-upload/utils.d.ts +0 -5
  113. package/dist/types-ts4.5/utils/drag-drop.d.ts +0 -2
@@ -9,112 +9,115 @@ import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bra
9
9
  import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
10
10
  import { getEndOfCurrentLine, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock, getLineInfo } from '../ide-ux/line-handling';
11
11
  import { insertIndent, outdent, indent, insertNewlineWithIndent } from '../ide-ux/commands';
12
- import { isComposing } from '../../base/pm-plugins/composition';
13
- export default new SafePlugin({
14
- props: {
15
- handleTextInput: function handleTextInput(view, from, to, text) {
16
- var state = view.state,
17
- dispatch = view.dispatch;
18
- if (isCursorInsideCodeBlock(state) && !isComposing(state)) {
19
- var beforeText = getStartOfCurrentLine(state).text;
20
- var afterText = getEndOfCurrentLine(state).text;
21
-
22
- // If text is a closing bracket/quote and we've already inserted it, move the selection after
23
- if (isCursorBeforeClosingCharacter(afterText) && isClosingCharacter(text) && afterText.startsWith(text)) {
24
- dispatch(setTextSelection(to + text.length)(state.tr));
25
- return true;
26
- }
27
-
28
- // Automatically add right-hand side bracket when user types the left bracket
29
- if (shouldAutoCloseBracket(beforeText, afterText)) {
30
- var _getAutoClosingBracke = getAutoClosingBracketInfo(beforeText + text, afterText),
31
- left = _getAutoClosingBracke.left,
32
- right = _getAutoClosingBracke.right;
33
- if (left && right) {
34
- var bracketPair = state.schema.text(text + right);
35
- var tr = state.tr.replaceWith(from, to, bracketPair);
36
- dispatch(setTextSelection(from + text.length)(tr));
37
- return true;
38
- }
39
- }
40
-
41
- // Automatically add closing quote when user types a starting quote
42
- if (shouldAutoCloseQuote(beforeText, afterText)) {
43
- var _getAutoClosingQuoteI = getAutoClosingQuoteInfo(beforeText + text, afterText),
44
- leftQuote = _getAutoClosingQuoteI.left,
45
- rightQuote = _getAutoClosingQuoteI.right;
46
- if (leftQuote && rightQuote) {
47
- var quotePair = state.schema.text(text + rightQuote);
48
- var _tr = state.tr.replaceWith(from, to, quotePair);
49
- dispatch(setTextSelection(from + text.length)(_tr));
50
- return true;
51
- }
52
- }
53
- }
54
- return false;
55
- },
56
- handleKeyDown: keydownHandler({
57
- Backspace: function Backspace(state, dispatch) {
58
- if (isCursorInsideCodeBlock(state)) {
59
- var $cursor = getCursor(state.selection);
12
+ var ideUX = function ideUX(pluginInjectionApi) {
13
+ return new SafePlugin({
14
+ props: {
15
+ handleTextInput: function handleTextInput(view, from, to, text) {
16
+ var state = view.state,
17
+ dispatch = view.dispatch;
18
+ var compositionPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.composition.sharedState.currentState();
19
+ if (isCursorInsideCodeBlock(state) && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
60
20
  var beforeText = getStartOfCurrentLine(state).text;
61
21
  var afterText = getEndOfCurrentLine(state).text;
62
- var _getAutoClosingBracke2 = getAutoClosingBracketInfo(beforeText, afterText),
63
- leftBracket = _getAutoClosingBracke2.left,
64
- rightBracket = _getAutoClosingBracke2.right,
65
- hasTrailingMatchingBracket = _getAutoClosingBracke2.hasTrailingMatchingBracket;
66
- if (leftBracket && rightBracket && hasTrailingMatchingBracket && dispatch) {
67
- dispatch(state.tr.delete($cursor.pos - leftBracket.length, $cursor.pos + rightBracket.length));
22
+
23
+ // If text is a closing bracket/quote and we've already inserted it, move the selection after
24
+ if (isCursorBeforeClosingCharacter(afterText) && isClosingCharacter(text) && afterText.startsWith(text)) {
25
+ dispatch(setTextSelection(to + text.length)(state.tr));
68
26
  return true;
69
27
  }
70
- var _getAutoClosingQuoteI2 = getAutoClosingQuoteInfo(beforeText, afterText),
71
- leftQuote = _getAutoClosingQuoteI2.left,
72
- rightQuote = _getAutoClosingQuoteI2.right,
73
- hasTrailingMatchingQuote = _getAutoClosingQuoteI2.hasTrailingMatchingQuote;
74
- if (leftQuote && rightQuote && hasTrailingMatchingQuote && dispatch) {
75
- dispatch(state.tr.delete($cursor.pos - leftQuote.length, $cursor.pos + rightQuote.length));
76
- return true;
28
+
29
+ // Automatically add right-hand side bracket when user types the left bracket
30
+ if (shouldAutoCloseBracket(beforeText, afterText)) {
31
+ var _getAutoClosingBracke = getAutoClosingBracketInfo(beforeText + text, afterText),
32
+ left = _getAutoClosingBracke.left,
33
+ right = _getAutoClosingBracke.right;
34
+ if (left && right) {
35
+ var bracketPair = state.schema.text(text + right);
36
+ var tr = state.tr.replaceWith(from, to, bracketPair);
37
+ dispatch(setTextSelection(from + text.length)(tr));
38
+ return true;
39
+ }
77
40
  }
78
- var _getLineInfo = getLineInfo(beforeText),
79
- _getLineInfo$indentTo = _getLineInfo.indentToken,
80
- size = _getLineInfo$indentTo.size,
81
- token = _getLineInfo$indentTo.token,
82
- indentText = _getLineInfo.indentText;
83
- if (beforeText === indentText) {
84
- if (indentText.endsWith(token.repeat(size)) && dispatch) {
85
- dispatch(state.tr.delete($cursor.pos - (size - indentText.length % size || size), $cursor.pos));
41
+
42
+ // Automatically add closing quote when user types a starting quote
43
+ if (shouldAutoCloseQuote(beforeText, afterText)) {
44
+ var _getAutoClosingQuoteI = getAutoClosingQuoteInfo(beforeText + text, afterText),
45
+ leftQuote = _getAutoClosingQuoteI.left,
46
+ rightQuote = _getAutoClosingQuoteI.right;
47
+ if (leftQuote && rightQuote) {
48
+ var quotePair = state.schema.text(text + rightQuote);
49
+ var _tr = state.tr.replaceWith(from, to, quotePair);
50
+ dispatch(setTextSelection(from + text.length)(_tr));
86
51
  return true;
87
52
  }
88
53
  }
89
54
  }
90
55
  return false;
91
56
  },
92
- Enter: filter(isSelectionEntirelyInsideCodeBlock, insertNewlineWithIndent),
93
- 'Mod-]': filter(isSelectionEntirelyInsideCodeBlock, indent),
94
- 'Mod-[': filter(isSelectionEntirelyInsideCodeBlock, outdent),
95
- Tab: filter(isSelectionEntirelyInsideCodeBlock, function (state, dispatch) {
96
- if (!dispatch) {
57
+ handleKeyDown: keydownHandler({
58
+ Backspace: function Backspace(state, dispatch) {
59
+ if (isCursorInsideCodeBlock(state)) {
60
+ var $cursor = getCursor(state.selection);
61
+ var beforeText = getStartOfCurrentLine(state).text;
62
+ var afterText = getEndOfCurrentLine(state).text;
63
+ var _getAutoClosingBracke2 = getAutoClosingBracketInfo(beforeText, afterText),
64
+ leftBracket = _getAutoClosingBracke2.left,
65
+ rightBracket = _getAutoClosingBracke2.right,
66
+ hasTrailingMatchingBracket = _getAutoClosingBracke2.hasTrailingMatchingBracket;
67
+ if (leftBracket && rightBracket && hasTrailingMatchingBracket && dispatch) {
68
+ dispatch(state.tr.delete($cursor.pos - leftBracket.length, $cursor.pos + rightBracket.length));
69
+ return true;
70
+ }
71
+ var _getAutoClosingQuoteI2 = getAutoClosingQuoteInfo(beforeText, afterText),
72
+ leftQuote = _getAutoClosingQuoteI2.left,
73
+ rightQuote = _getAutoClosingQuoteI2.right,
74
+ hasTrailingMatchingQuote = _getAutoClosingQuoteI2.hasTrailingMatchingQuote;
75
+ if (leftQuote && rightQuote && hasTrailingMatchingQuote && dispatch) {
76
+ dispatch(state.tr.delete($cursor.pos - leftQuote.length, $cursor.pos + rightQuote.length));
77
+ return true;
78
+ }
79
+ var _getLineInfo = getLineInfo(beforeText),
80
+ _getLineInfo$indentTo = _getLineInfo.indentToken,
81
+ size = _getLineInfo$indentTo.size,
82
+ token = _getLineInfo$indentTo.token,
83
+ indentText = _getLineInfo.indentText;
84
+ if (beforeText === indentText) {
85
+ if (indentText.endsWith(token.repeat(size)) && dispatch) {
86
+ dispatch(state.tr.delete($cursor.pos - (size - indentText.length % size || size), $cursor.pos));
87
+ return true;
88
+ }
89
+ }
90
+ }
97
91
  return false;
98
- }
99
- if (isCursorInsideCodeBlock(state)) {
100
- return insertIndent(state, dispatch);
101
- }
102
- return indent(state, dispatch);
103
- }),
104
- 'Shift-Tab': filter(isSelectionEntirelyInsideCodeBlock, outdent),
105
- 'Mod-a': function ModA(state, dispatch) {
106
- if (isSelectionEntirelyInsideCodeBlock(state)) {
107
- var _state$selection = state.selection,
108
- $from = _state$selection.$from,
109
- $to = _state$selection.$to;
110
- var isFullCodeBlockSelection = $from.parentOffset === 0 && $to.parentOffset === $to.parent.nodeSize - 2;
111
- if (!isFullCodeBlockSelection && dispatch) {
112
- dispatch(state.tr.setSelection(TextSelection.create(state.doc, $from.start(), $to.end())));
113
- return true;
92
+ },
93
+ Enter: filter(isSelectionEntirelyInsideCodeBlock, insertNewlineWithIndent),
94
+ 'Mod-]': filter(isSelectionEntirelyInsideCodeBlock, indent),
95
+ 'Mod-[': filter(isSelectionEntirelyInsideCodeBlock, outdent),
96
+ Tab: filter(isSelectionEntirelyInsideCodeBlock, function (state, dispatch) {
97
+ if (!dispatch) {
98
+ return false;
99
+ }
100
+ if (isCursorInsideCodeBlock(state)) {
101
+ return insertIndent(state, dispatch);
114
102
  }
103
+ return indent(state, dispatch);
104
+ }),
105
+ 'Shift-Tab': filter(isSelectionEntirelyInsideCodeBlock, outdent),
106
+ 'Mod-a': function ModA(state, dispatch) {
107
+ if (isSelectionEntirelyInsideCodeBlock(state)) {
108
+ var _state$selection = state.selection,
109
+ $from = _state$selection.$from,
110
+ $to = _state$selection.$to;
111
+ var isFullCodeBlockSelection = $from.parentOffset === 0 && $to.parentOffset === $to.parent.nodeSize - 2;
112
+ if (!isFullCodeBlockSelection && dispatch) {
113
+ dispatch(state.tr.setSelection(TextSelection.create(state.doc, $from.start(), $to.end())));
114
+ return true;
115
+ }
116
+ }
117
+ return false;
115
118
  }
116
- return false;
117
- }
118
- })
119
- }
120
- });
119
+ })
120
+ }
121
+ });
122
+ };
123
+ export default ideUX;
@@ -0,0 +1,25 @@
1
+ import createPlugin from './pm-plugins/main';
2
+ import { pluginKey } from './pm-plugins/plugin-key';
3
+ var composition = function composition() {
4
+ return {
5
+ name: 'composition',
6
+ getSharedState: function getSharedState(editorState) {
7
+ var _pluginKey$getState;
8
+ if (!editorState) {
9
+ return undefined;
10
+ }
11
+ return {
12
+ isComposing: !!((_pluginKey$getState = pluginKey.getState(editorState)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.isComposing)
13
+ };
14
+ },
15
+ pmPlugins: function pmPlugins() {
16
+ return [{
17
+ name: 'composition',
18
+ plugin: function plugin() {
19
+ return createPlugin();
20
+ }
21
+ }];
22
+ }
23
+ };
24
+ };
25
+ export default composition;
@@ -1,17 +1,12 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
2
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
4
- var compositionPluginKey = new PluginKey('compositionPlugin');
5
- export var isComposing = function isComposing(state) {
6
- var _compositionPluginKey;
7
- return !!((_compositionPluginKey = compositionPluginKey.getState(state)) !== null && _compositionPluginKey !== void 0 && _compositionPluginKey.isComposing);
8
- };
3
+ import { pluginKey } from './plugin-key';
9
4
  var isLinux = function isLinux() {
10
5
  return navigator.userAgent.indexOf('Linux') >= 0;
11
6
  };
12
7
  export default (function () {
13
8
  return new SafePlugin({
14
- key: compositionPluginKey,
9
+ key: pluginKey,
15
10
  state: {
16
11
  init: function init() {
17
12
  return {
@@ -20,7 +15,7 @@ export default (function () {
20
15
  };
21
16
  },
22
17
  apply: function apply(tr, value) {
23
- var isComposing = tr.getMeta(compositionPluginKey);
18
+ var isComposing = tr.getMeta(pluginKey);
24
19
  var zeroWidthSpacePos = tr.getMeta('zeroWidthSpacePos');
25
20
  if (typeof isComposing === 'undefined') {
26
21
  return value;
@@ -35,7 +30,7 @@ export default (function () {
35
30
  handleDOMEvents: {
36
31
  compositionstart: function compositionstart(view, event) {
37
32
  var tr = view.state.tr;
38
- tr.setMeta(compositionPluginKey, true);
33
+ tr.setMeta(pluginKey, true);
39
34
 
40
35
  // only apply for linux and cursor is at start of line
41
36
  if (isLinux() && view.state.selection.$from.parentOffset === 0) {
@@ -49,10 +44,10 @@ export default (function () {
49
44
  },
50
45
  compositionend: function compositionend(view, event) {
51
46
  var tr = view.state.tr;
52
- tr.setMeta(compositionPluginKey, false);
47
+ tr.setMeta(pluginKey, false);
53
48
  if (isLinux()) {
54
- var _compositionPluginKey2;
55
- var zeroWidthSpacePos = (_compositionPluginKey2 = compositionPluginKey.getState(view.state)) === null || _compositionPluginKey2 === void 0 ? void 0 : _compositionPluginKey2.zeroWidthSpacePos;
49
+ var _pluginKey$getState;
50
+ var zeroWidthSpacePos = (_pluginKey$getState = pluginKey.getState(view.state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.zeroWidthSpacePos;
56
51
  if (typeof zeroWidthSpacePos !== 'undefined') {
57
52
  tr.deleteRange(zeroWidthSpacePos, zeroWidthSpacePos + 1);
58
53
  }
@@ -1,2 +1,2 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export var stateKey = new PluginKey('imageUploadPlugin');
2
+ export var pluginKey = new PluginKey('compositionPlugin');
@@ -10,7 +10,6 @@ export { default as emojiPlugin } from './emoji';
10
10
  export { default as extensionPlugin } from './extension';
11
11
  export { default as fakeTextCursorPlugin } from './fake-text-cursor';
12
12
  export { default as helpDialogPlugin } from './help-dialog';
13
- export { default as imageUploadPlugin } from './image-upload';
14
13
  export { default as insertBlockPlugin } from './insert-block';
15
14
  export { default as jiraIssuePlugin } from './jira-issue';
16
15
  export { default as layoutPlugin } from './layout';
@@ -7,7 +7,7 @@ import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
7
7
  import { addLinkMetadata } from '@atlaskit/editor-common/card';
8
8
  import { mapChildren } from '../../../utils/slice';
9
9
  import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
10
- import * as clipboard from '../../../utils/clipboard';
10
+ import { isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
11
11
  import { transformSliceForMedia } from '../../media/utils/media-single';
12
12
  import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
13
13
  import { linkifyContent } from '@atlaskit/editor-common/utils';
@@ -120,7 +120,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
120
120
  if ((_text = text) !== null && _text !== void 0 && _text.includes('\r')) {
121
121
  text = text.replace(/\r/g, '');
122
122
  }
123
- var isPastedFile = clipboard.isPastedFile(event);
123
+ var isPastedFile = isPastedFileFromEvent(event);
124
124
  var isPlainText = text && !html;
125
125
  var isRichText = !!html;
126
126
 
@@ -4,7 +4,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
4
  import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
5
5
  export var pluginKey = new PluginKey('placeholderPlugin');
6
6
  import { isTypeAheadOpen } from '../type-ahead/utils';
7
- import { isComposing } from '../base/pm-plugins/composition';
8
7
  function getPlaceholderState(editorState) {
9
8
  return pluginKey.getState(editorState);
10
9
  }
@@ -98,7 +97,8 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
98
97
  hasPlaceholder = _getPlaceholderState.hasPlaceholder,
99
98
  placeholderText = _getPlaceholderState.placeholderText,
100
99
  pos = _getPlaceholderState.pos;
101
- if (hasPlaceholder && placeholderText && pos !== undefined && !isComposing(editorState)) {
100
+ var compositionPluginState = api === null || api === void 0 ? void 0 : api.dependencies.composition.sharedState.currentState();
101
+ if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
102
102
  return createPlaceholderDecoration(editorState, placeholderText, pos);
103
103
  }
104
104
  return;
@@ -2,25 +2,6 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import * as clipboard from 'clipboard-polyfill';
5
- export function checkClipboardTypes(type, item) {
6
- var isDOMStringList = function isDOMStringList(t) {
7
- return !t.indexOf && !!t.contains;
8
- };
9
- return isDOMStringList(type) ? type.contains(item) : type.indexOf(item) > -1;
10
- }
11
-
12
- // Typeguard Function
13
- export var isClipboardEvent = function isClipboardEvent(event) {
14
- return 'clipboardData' in event;
15
- };
16
- export function isPastedFile(rawEvent) {
17
- var _ref = rawEvent,
18
- clipboardData = _ref.clipboardData;
19
- if (!clipboardData) {
20
- return false;
21
- }
22
- return checkClipboardTypes(clipboardData.types, 'Files');
23
- }
24
5
  var isClipboardApiSupported = function isClipboardApiSupported() {
25
6
  return !!navigator.clipboard && typeof navigator.clipboard.writeText === 'function';
26
7
  };
@@ -28,7 +9,7 @@ var isIEClipboardApiSupported = function isIEClipboardApiSupported() {
28
9
  return window.clipboardData && typeof window.clipboardData.setData === 'function';
29
10
  };
30
11
  export var copyToClipboard = /*#__PURE__*/function () {
31
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(textToCopy) {
12
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(textToCopy) {
32
13
  return _regeneratorRuntime.wrap(function _callee$(_context) {
33
14
  while (1) switch (_context.prev = _context.next) {
34
15
  case 0:
@@ -76,11 +57,11 @@ export var copyToClipboard = /*#__PURE__*/function () {
76
57
  }, _callee, null, [[1, 6], [12, 17]]);
77
58
  }));
78
59
  return function copyToClipboard(_x) {
79
- return _ref2.apply(this, arguments);
60
+ return _ref.apply(this, arguments);
80
61
  };
81
62
  }();
82
63
  export var copyHTMLToClipboard = /*#__PURE__*/function () {
83
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(elementToCopy, plainTextToCopy) {
64
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(elementToCopy, plainTextToCopy) {
84
65
  var data;
85
66
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
67
  while (1) switch (_context2.prev = _context2.next) {
@@ -123,7 +104,7 @@ export var copyHTMLToClipboard = /*#__PURE__*/function () {
123
104
  }, _callee2, null, [[1, 7]]);
124
105
  }));
125
106
  return function copyHTMLToClipboard(_x2, _x3) {
126
- return _ref3.apply(this, arguments);
107
+ return _ref2.apply(this, arguments);
127
108
  };
128
109
  }();
129
110
 
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.18.1";
2
+ export var version = "187.19.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.18.1",
3
+ "version": "187.19.0",
4
4
  "sideEffects": false
5
5
  }
@@ -49,6 +49,10 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
49
49
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
50
50
  removeDecoration: import("@atlaskit/editor-common/types").Command;
51
51
  };
52
+ }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
53
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
54
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
55
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
52
56
  }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
53
57
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
54
58
  sharedState: {
@@ -92,6 +96,10 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
92
96
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
93
97
  removeDecoration: import("@atlaskit/editor-common/types").Command;
94
98
  };
99
+ }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
100
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
101
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
102
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
95
103
  }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
96
104
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
97
105
  sharedState: {
@@ -412,6 +420,10 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
412
420
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
413
421
  removeDecoration: import("@atlaskit/editor-common/types").Command;
414
422
  };
423
+ }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
424
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
425
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
426
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
415
427
  }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
416
428
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
417
429
  sharedState: {
@@ -455,6 +467,10 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
455
467
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
456
468
  removeDecoration: import("@atlaskit/editor-common/types").Command;
457
469
  };
470
+ }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
471
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
472
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
473
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
458
474
  }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
459
475
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
460
476
  sharedState: {
@@ -1,11 +1,13 @@
1
- import { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { CodeBlockOptions } from './types';
3
- import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
- import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { CodeBlockOptions } from './types';
3
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type compositionPlugin from '../composition';
5
6
  declare const codeBlockPlugin: NextEditorPlugin<'codeBlock', {
6
7
  pluginConfiguration: CodeBlockOptions;
7
8
  dependencies: [
8
9
  typeof decorationsPlugin,
10
+ typeof compositionPlugin,
9
11
  OptionalPlugin<typeof analyticsPlugin>
10
12
  ];
11
13
  }>;
@@ -1,3 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- declare const _default: SafePlugin<any>;
3
- export default _default;
2
+ import type codeBlockPlugin from '../';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ declare const ideUX: (pluginInjectionApi: ExtractInjectionAPI<typeof codeBlockPlugin> | undefined) => SafePlugin<any>;
5
+ export default ideUX;
@@ -0,0 +1,8 @@
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ export type CompositionState = {
3
+ isComposing: boolean;
4
+ };
5
+ declare const composition: NextEditorPlugin<'composition', {
6
+ sharedState: CompositionState | undefined;
7
+ }>;
8
+ export default composition;
@@ -0,0 +1,4 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { CompositionPluginState } from './plugin-key';
3
+ declare const _default: () => SafePlugin<CompositionPluginState>;
4
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export interface CompositionPluginState {
3
+ isComposing: boolean;
4
+ zeroWidthSpacePos?: number;
5
+ }
6
+ export declare const pluginKey: PluginKey<CompositionPluginState>;
@@ -11,7 +11,6 @@ export { default as emojiPlugin } from './emoji';
11
11
  export { default as extensionPlugin } from './extension';
12
12
  export { default as fakeTextCursorPlugin } from './fake-text-cursor';
13
13
  export { default as helpDialogPlugin } from './help-dialog';
14
- export { default as imageUploadPlugin } from './image-upload';
15
14
  export { default as insertBlockPlugin } from './insert-block';
16
15
  export { default as jiraIssuePlugin } from './jira-issue';
17
16
  export { default as layoutPlugin } from './layout';
@@ -1,5 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { ImageUploadPlugin } from '../image-upload';
2
+ import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
3
3
  import type datePlugin from '../date';
4
4
  import type { tablesPlugin } from '@atlaskit/editor-plugin-table';
5
5
  import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
@@ -5,6 +5,7 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { NextEditorPlugin, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
6
6
  import type { focusPlugin } from '@atlaskit/editor-plugin-focus';
7
7
  export declare const pluginKey: PluginKey<any>;
8
+ import type compositionPlugin from '../composition';
8
9
  export declare const placeholderTestId = "placeholder-test-id";
9
10
  export declare function createPlaceholderDecoration(editorState: EditorState, placeholderText: string, pos?: number): DecorationSet;
10
11
  export declare function createPlugin(defaultPlaceholderText?: string, bracketPlaceholderText?: string, api?: ExtractInjectionAPI<typeof placeholderPlugin>): SafePlugin | undefined;
@@ -14,6 +15,6 @@ export interface PlaceholderPluginOptions {
14
15
  }
15
16
  declare const placeholderPlugin: NextEditorPlugin<'placeholder', {
16
17
  pluginConfiguration: PlaceholderPluginOptions | undefined;
17
- dependencies: [typeof focusPlugin];
18
+ dependencies: [typeof focusPlugin, typeof compositionPlugin];
18
19
  }>;
19
20
  export default placeholderPlugin;
@@ -1,6 +1,3 @@
1
- export declare function checkClipboardTypes(type: DOMStringList | ReadonlyArray<string>, item: string): boolean;
2
- export declare const isClipboardEvent: (event: Event) => event is ClipboardEvent;
3
- export declare function isPastedFile(rawEvent: Event): boolean;
4
1
  export declare const copyToClipboard: (textToCopy: string) => Promise<void>;
5
2
  export declare const copyHTMLToClipboard: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
6
3
  export declare const copyHTMLToClipboardPolyfill: (elementToCopy: HTMLElement, plainTextToCopy?: string) => void;
@@ -66,6 +66,11 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
66
66
  removeDecoration: import("@atlaskit/editor-common/types").Command;
67
67
  };
68
68
  }>,
69
+ (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
70
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
71
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
72
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
73
+ }>,
69
74
  import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
70
75
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
71
76
  sharedState: {
@@ -116,6 +121,11 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
116
121
  removeDecoration: import("@atlaskit/editor-common/types").Command;
117
122
  };
118
123
  }>,
124
+ (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
125
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
126
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
127
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
128
+ }>,
119
129
  import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
120
130
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
121
131
  sharedState: {
@@ -507,6 +517,11 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
507
517
  removeDecoration: import("@atlaskit/editor-common/types").Command;
508
518
  };
509
519
  }>,
520
+ (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
521
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
522
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
523
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
524
+ }>,
510
525
  import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
511
526
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
512
527
  sharedState: {
@@ -557,6 +572,11 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
557
572
  removeDecoration: import("@atlaskit/editor-common/types").Command;
558
573
  };
559
574
  }>,
575
+ (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"composition", {
576
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
577
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"composition", {
578
+ sharedState: import("../../../plugins/composition").CompositionState | undefined;
579
+ }>,
560
580
  import("@atlaskit/editor-common/types").OptionalPlugin<(config: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"analytics", {
561
581
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
562
582
  sharedState: {
@@ -1,11 +1,13 @@
1
- import { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { CodeBlockOptions } from './types';
3
- import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
- import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { CodeBlockOptions } from './types';
3
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type compositionPlugin from '../composition';
5
6
  declare const codeBlockPlugin: NextEditorPlugin<'codeBlock', {
6
7
  pluginConfiguration: CodeBlockOptions;
7
8
  dependencies: [
8
9
  typeof decorationsPlugin,
10
+ typeof compositionPlugin,
9
11
  OptionalPlugin<typeof analyticsPlugin>
10
12
  ];
11
13
  }>;