@atlaskit/editor-core 165.0.0 → 166.0.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 (181) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/actions/index.js +9 -0
  3. package/dist/cjs/create-editor/ReactEditorView.js +14 -6
  4. package/dist/cjs/create-editor/create-plugins-list.js +1 -2
  5. package/dist/cjs/editor.js +13 -0
  6. package/dist/cjs/event-dispatcher/index.js +9 -0
  7. package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
  8. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  9. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  10. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
  11. package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
  12. package/dist/cjs/plugins/card/styles.js +3 -1
  13. package/dist/cjs/plugins/code-block/styles.js +6 -4
  14. package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
  15. package/dist/cjs/plugins/date/styles.js +3 -1
  16. package/dist/cjs/plugins/emoji/index.js +30 -34
  17. package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
  18. package/dist/cjs/plugins/emoji/styles.js +3 -17
  19. package/dist/cjs/plugins/expand/ui/styles.js +2 -2
  20. package/dist/cjs/plugins/extension/ui/styles.js +3 -1
  21. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  22. package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
  23. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
  24. package/dist/cjs/plugins/layout/styles.js +3 -1
  25. package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
  26. package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
  27. package/dist/cjs/plugins/list/transforms.js +11 -3
  28. package/dist/cjs/plugins/media/styles.js +3 -1
  29. package/dist/cjs/plugins/mentions/index.js +10 -14
  30. package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
  31. package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
  32. package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
  33. package/dist/cjs/plugins/panel/styles.js +3 -1
  34. package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  35. package/dist/cjs/plugins/rule/styles.js +3 -1
  36. package/dist/cjs/plugins/selection/utils.js +39 -23
  37. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
  38. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  39. package/dist/cjs/plugins/table/ui/consts.js +6 -4
  40. package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
  41. package/dist/cjs/plugins/type-ahead/index.js +6 -2
  42. package/dist/cjs/plugins/unsupported-content/index.js +22 -10
  43. package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
  44. package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
  45. package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
  46. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
  47. package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
  48. package/dist/cjs/ui/ContentStyles/index.js +2 -2
  49. package/dist/cjs/version-wrapper.js +1 -1
  50. package/dist/cjs/version.json +1 -1
  51. package/dist/es2019/actions/index.js +12 -1
  52. package/dist/es2019/create-editor/ReactEditorView.js +14 -6
  53. package/dist/es2019/create-editor/create-plugins-list.js +1 -2
  54. package/dist/es2019/editor.js +14 -0
  55. package/dist/es2019/event-dispatcher/index.js +8 -0
  56. package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
  57. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
  58. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  59. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
  60. package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
  61. package/dist/es2019/plugins/card/styles.js +9 -5
  62. package/dist/es2019/plugins/code-block/styles.js +11 -8
  63. package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
  64. package/dist/es2019/plugins/date/styles.js +3 -1
  65. package/dist/es2019/plugins/emoji/index.js +16 -21
  66. package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
  67. package/dist/es2019/plugins/emoji/styles.js +1 -82
  68. package/dist/es2019/plugins/expand/ui/styles.js +2 -2
  69. package/dist/es2019/plugins/extension/ui/styles.js +4 -2
  70. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  71. package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
  72. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
  73. package/dist/es2019/plugins/layout/styles.js +3 -2
  74. package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
  75. package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
  76. package/dist/es2019/plugins/list/transforms.js +9 -4
  77. package/dist/es2019/plugins/media/styles.js +9 -7
  78. package/dist/es2019/plugins/mentions/index.js +1 -6
  79. package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
  80. package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
  81. package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
  82. package/dist/es2019/plugins/panel/styles.js +5 -4
  83. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  84. package/dist/es2019/plugins/rule/styles.js +2 -1
  85. package/dist/es2019/plugins/selection/utils.js +35 -20
  86. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
  87. package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
  88. package/dist/es2019/plugins/table/ui/consts.js +5 -4
  89. package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
  90. package/dist/es2019/plugins/type-ahead/index.js +5 -1
  91. package/dist/es2019/plugins/unsupported-content/index.js +23 -12
  92. package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
  93. package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
  94. package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
  95. package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
  96. package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
  97. package/dist/es2019/ui/ContentStyles/index.js +3 -3
  98. package/dist/es2019/version-wrapper.js +1 -1
  99. package/dist/es2019/version.json +1 -1
  100. package/dist/esm/actions/index.js +8 -0
  101. package/dist/esm/create-editor/ReactEditorView.js +14 -6
  102. package/dist/esm/create-editor/create-plugins-list.js +1 -2
  103. package/dist/esm/editor.js +14 -0
  104. package/dist/esm/event-dispatcher/index.js +9 -0
  105. package/dist/esm/nodeviews/ReactNodeView.js +1 -10
  106. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  107. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  108. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
  109. package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
  110. package/dist/esm/plugins/card/styles.js +2 -1
  111. package/dist/esm/plugins/code-block/styles.js +5 -4
  112. package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
  113. package/dist/esm/plugins/date/styles.js +2 -1
  114. package/dist/esm/plugins/emoji/index.js +26 -29
  115. package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
  116. package/dist/esm/plugins/emoji/styles.js +3 -14
  117. package/dist/esm/plugins/expand/ui/styles.js +2 -2
  118. package/dist/esm/plugins/extension/ui/styles.js +2 -1
  119. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  120. package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
  121. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
  122. package/dist/esm/plugins/layout/styles.js +2 -1
  123. package/dist/esm/plugins/list/commands/indent-list.js +4 -1
  124. package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
  125. package/dist/esm/plugins/list/transforms.js +9 -4
  126. package/dist/esm/plugins/media/styles.js +2 -1
  127. package/dist/esm/plugins/mentions/index.js +10 -14
  128. package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
  129. package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
  130. package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
  131. package/dist/esm/plugins/panel/styles.js +2 -1
  132. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  133. package/dist/esm/plugins/rule/styles.js +2 -1
  134. package/dist/esm/plugins/selection/utils.js +35 -20
  135. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
  136. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  137. package/dist/esm/plugins/table/ui/consts.js +5 -4
  138. package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
  139. package/dist/esm/plugins/type-ahead/index.js +6 -2
  140. package/dist/esm/plugins/unsupported-content/index.js +21 -11
  141. package/dist/esm/plugins/unsupported-content/styles.js +3 -2
  142. package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
  143. package/dist/esm/ui/Appearance/Chromeless.js +6 -3
  144. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
  145. package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
  146. package/dist/esm/ui/ContentStyles/index.js +3 -3
  147. package/dist/esm/version-wrapper.js +1 -1
  148. package/dist/esm/version.json +1 -1
  149. package/dist/types/actions/index.d.ts +3 -1
  150. package/dist/types/editor.d.ts +3 -0
  151. package/dist/types/event-dispatcher/index.d.ts +1 -0
  152. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
  153. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  154. package/dist/types/plugins/analytics/types/events.d.ts +2 -2
  155. package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
  156. package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
  157. package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
  158. package/dist/types/plugins/emoji/index.d.ts +2 -6
  159. package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
  160. package/dist/types/plugins/emoji/styles.d.ts +0 -1
  161. package/dist/types/plugins/emoji/types.d.ts +0 -1
  162. package/dist/types/plugins/list/transforms.d.ts +10 -1
  163. package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
  164. package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
  165. package/dist/types/plugins/selection/utils.d.ts +7 -15
  166. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
  167. package/dist/types/plugins/table/ui/consts.d.ts +2 -2
  168. package/dist/types/plugins/type-ahead/types.d.ts +1 -0
  169. package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
  170. package/dist/types/types/editor-appearance-component.d.ts +1 -0
  171. package/dist/types/types/editor-props.d.ts +1 -0
  172. package/dist/types/types/feature-flags.d.ts +0 -14
  173. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
  174. package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
  175. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +4 -4
  176. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  177. package/package.json +22 -22
  178. package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
  179. package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
  180. package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
  181. package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
@@ -1,234 +0,0 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- import { DOMSerializer } from 'prosemirror-model';
7
- import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
8
- export var EmojiNodeView = /*#__PURE__*/function () {
9
- function EmojiNodeView(node, _, context) {
10
- var _this = this,
11
- _this$options;
12
-
13
- _classCallCheck(this, EmojiNodeView);
14
-
15
- _defineProperty(this, "hasProvider", false);
16
-
17
- _defineProperty(this, "subscribe", function (_, provider) {
18
- _this.hasProvider = false;
19
- _this.emojiProvider = provider;
20
- provider === null || provider === void 0 ? void 0 : provider.then(function () {
21
- return _this.hasProvider = true;
22
- }).then(function () {
23
- return _this.findEmoji();
24
- }).then(function (emoji) {
25
- return _this.update(_this.node, null, emoji);
26
- });
27
- });
28
-
29
- this.node = node;
30
- this.providers = context.providerFactory;
31
- this.options = context.options;
32
- this.dom = EmojiNodeView.toDom(node);
33
- this.el = this.dom;
34
- this.providers.subscribe('emojiProvider', this.subscribe);
35
-
36
- if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.allowZeroWidthSpaceAfter) {
37
- this.el.after(document.createTextNode(ZERO_WIDTH_SPACE));
38
- }
39
-
40
- this.update(this.node, null);
41
- }
42
-
43
- _createClass(EmojiNodeView, [{
44
- key: "findEmoji",
45
- value: function () {
46
- var _findEmoji = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47
- var node,
48
- emojiProvider,
49
- _args = arguments;
50
- return _regeneratorRuntime.wrap(function _callee$(_context) {
51
- while (1) {
52
- switch (_context.prev = _context.next) {
53
- case 0:
54
- node = _args.length > 0 && _args[0] !== undefined ? _args[0] : this.node;
55
- _context.next = 3;
56
- return this.emojiProvider;
57
-
58
- case 3:
59
- emojiProvider = _context.sent;
60
-
61
- if (!emojiProvider) {
62
- _context.next = 6;
63
- break;
64
- }
65
-
66
- return _context.abrupt("return", emojiProvider.findByEmojiId({
67
- id: node.attrs.id,
68
- shortName: node.attrs.shortName,
69
- fallback: node.attrs.text
70
- }));
71
-
72
- case 6:
73
- case "end":
74
- return _context.stop();
75
- }
76
- }
77
- }, _callee, this);
78
- }));
79
-
80
- function findEmoji() {
81
- return _findEmoji.apply(this, arguments);
82
- }
83
-
84
- return findEmoji;
85
- }()
86
- }, {
87
- key: "destroy",
88
- value: function destroy() {
89
- this.providers.unsubscribe('emojiProvider', this.subscribe);
90
- }
91
- }, {
92
- key: "update",
93
- value: function update(node, _) {
94
- var _this2 = this;
95
-
96
- var emoji = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.emoji;
97
-
98
- if (this.node.type !== node.type) {
99
- this.node = node;
100
- return false;
101
- }
102
-
103
- var prev = this.node.attrs;
104
- var next = node.attrs;
105
- var changed = false;
106
-
107
- if (prev.id !== next.id) {
108
- changed = true;
109
- this.el.dataset.emojiId = next.id;
110
- }
111
-
112
- if (prev.shortName !== next.shortName) {
113
- changed = true;
114
- this.el.dataset.emojiShortname = next.shortName;
115
- }
116
-
117
- if (changed) {
118
- this.emoji = undefined;
119
- this.node = node;
120
- this.findEmoji().then(function (emoji) {
121
- return _this2.update(_this2.node, _, emoji);
122
- });
123
- return true;
124
- }
125
-
126
- if (!this.hasProvider) {
127
- this.el.classList.add('editor-emoji-loading');
128
- this.el.style.backgroundSize = '';
129
- this.el.style.backgroundPosition = '';
130
- this.el.style.backgroundImage = '';
131
- this.node = node;
132
- this.emoji = emoji;
133
- return true;
134
- } else {
135
- this.el.classList.remove('editor-emoji-loading');
136
- }
137
-
138
- if (!emoji) {
139
- this.el.classList.add('editor-emoji-fallback');
140
- this.el.style.backgroundSize = '';
141
- this.el.style.backgroundPosition = '';
142
- this.el.style.backgroundImage = '';
143
- this.node = node;
144
- this.emoji = emoji;
145
- return true;
146
- } else {
147
- this.el.classList.remove('editor-emoji-fallback');
148
- }
149
-
150
- if (this.emoji === emoji) {
151
- return true;
152
- }
153
-
154
- var representation = emoji === null || emoji === void 0 ? void 0 : emoji.representation;
155
-
156
- if (EmojiNodeView.isSprite(representation)) {
157
- var sprite = representation.sprite,
158
- xIndex = representation.xIndex,
159
- yIndex = representation.yIndex;
160
- var row = sprite.row,
161
- column = sprite.column,
162
- url = sprite.url;
163
- var xPosition = 100 / (column - 1) * (xIndex - 0);
164
- var yPosition = 100 / (row - 1) * (yIndex - 0);
165
- this.el.style.backgroundSize = "".concat(column * 100, "% ").concat(row * 100, "%");
166
- this.el.style.backgroundPosition = "".concat(xPosition, "% ").concat(yPosition, "%");
167
- this.el.style.backgroundImage = "url(".concat(url, ")");
168
- }
169
-
170
- if (EmojiNodeView.isImage(representation) || EmojiNodeView.isMedia(representation)) {
171
- var path = EmojiNodeView.isImage(representation) ? representation.imagePath : representation.mediaPath;
172
- var rawWidth = representation.width,
173
- rawHeight = representation.height;
174
- var width = rawWidth / (rawHeight / 20);
175
- this.el.style.width = "".concat(width, "px");
176
- this.el.style.backgroundImage = "url(".concat(path, ")");
177
- }
178
-
179
- this.emoji = emoji;
180
- return true;
181
- }
182
- }, {
183
- key: "ignoreMutation",
184
- value: function ignoreMutation(_) {
185
- return true;
186
- }
187
- }], [{
188
- key: "toDomSpec",
189
- value: function toDomSpec(node) {
190
- return ['span', {
191
- 'aria-label': node.attrs.shortName,
192
- 'data-emoji-id': node.attrs.id,
193
- 'data-emoji-shortname': node.attrs.shortName,
194
- class: 'editor-emoji'
195
- }, node.attrs.shortName];
196
- }
197
- }, {
198
- key: "toDom",
199
- value: function toDom(node) {
200
- return DOMSerializer.renderSpec(document, EmojiNodeView.toDomSpec(node)).dom;
201
- }
202
- }, {
203
- key: "isSprite",
204
- value: function isSprite(representation) {
205
- var _representation$hasOw;
206
-
207
- return (_representation$hasOw = representation === null || representation === void 0 ? void 0 : representation.hasOwnProperty('sprite')) !== null && _representation$hasOw !== void 0 ? _representation$hasOw : false;
208
- }
209
- }, {
210
- key: "isImage",
211
- value: function isImage(representation) {
212
- var _representation$hasOw2;
213
-
214
- return (_representation$hasOw2 = representation === null || representation === void 0 ? void 0 : representation.hasOwnProperty('imagePath')) !== null && _representation$hasOw2 !== void 0 ? _representation$hasOw2 : false;
215
- }
216
- }, {
217
- key: "isMedia",
218
- value: function isMedia(representation) {
219
- var _representation$hasOw3;
220
-
221
- return (_representation$hasOw3 = representation === null || representation === void 0 ? void 0 : representation.hasOwnProperty('mediaPath')) !== null && _representation$hasOw3 !== void 0 ? _representation$hasOw3 : false;
222
- }
223
- }]);
224
-
225
- return EmojiNodeView;
226
- }();
227
- export default function emojiNodeView(providerFactory, options) {
228
- return function (node, view) {
229
- return new EmojiNodeView(node, view, {
230
- providerFactory: providerFactory,
231
- options: options
232
- });
233
- };
234
- }
@@ -1,31 +0,0 @@
1
- import { Node as PMNode } from 'prosemirror-model';
2
- import { EditorView, NodeView } from 'prosemirror-view';
3
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import type { EmojiDescription } from '@atlaskit/emoji';
5
- import { EmojiPluginOptions } from '../types';
6
- export interface Props {
7
- providerFactory: ProviderFactory;
8
- options?: EmojiPluginOptions;
9
- }
10
- export declare class EmojiNodeView implements NodeView {
11
- private node;
12
- private options?;
13
- private providers;
14
- private emojiProvider;
15
- private hasProvider;
16
- private emoji;
17
- private el;
18
- dom: HTMLElement;
19
- constructor(node: PMNode, _: EditorView, context: Props);
20
- private static toDomSpec;
21
- private static toDom;
22
- private static isSprite;
23
- private static isImage;
24
- private static isMedia;
25
- private subscribe;
26
- private findEmoji;
27
- destroy(): void;
28
- update(node: PMNode, _: unknown, emoji?: EmojiDescription | undefined): boolean;
29
- ignoreMutation(_: unknown): boolean;
30
- }
31
- export default function emojiNodeView(providerFactory: ProviderFactory, options?: EmojiPluginOptions): (node: PMNode, view: EditorView) => NodeView;