@atlaskit/editor-core 150.0.2 → 151.1.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.
- package/CHANGELOG.md +69 -0
- package/dist/cjs/actions/index.js +5 -23
- package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
- package/dist/cjs/create-editor/ReactEditorView.js +145 -31
- package/dist/cjs/create-editor/create-plugins-list.js +8 -2
- package/dist/cjs/editor.js +101 -40
- package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
- package/dist/cjs/plugins/analytics/types/enums.js +3 -1
- package/dist/cjs/plugins/base/index.js +4 -3
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/cjs/plugins/card/index.js +13 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
- package/dist/cjs/plugins/code-bidi-warning/index.js +25 -0
- package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
- package/dist/cjs/plugins/code-block/index.js +10 -6
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- package/dist/cjs/plugins/emoji/styles.js +1 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/cjs/plugins/extension/toolbar.js +28 -23
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/cjs/plugins/hyperlink/utils.js +6 -69
- package/dist/cjs/plugins/index.js +8 -0
- package/dist/cjs/plugins/media/index.js +14 -3
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
- package/dist/cjs/plugins/media/toolbar/index.js +49 -17
- package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
- package/dist/cjs/plugins/media/utils/media-files.js +67 -1
- package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/cjs/plugins/panel/index.js +2 -3
- package/dist/cjs/plugins/panel/message.js +47 -0
- package/dist/cjs/plugins/panel/toolbar.js +64 -84
- package/dist/cjs/plugins/panel/utils.js +2 -2
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/profiler/render-count.js +82 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +6 -28
- package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
- package/dist/es2019/create-editor/ReactEditorView.js +130 -23
- package/dist/es2019/create-editor/create-plugins-list.js +9 -3
- package/dist/es2019/editor.js +74 -35
- package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
- package/dist/es2019/plugins/analytics/types/enums.js +3 -1
- package/dist/es2019/plugins/base/index.js +4 -3
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
- package/dist/es2019/plugins/card/index.js +7 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
- package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/es2019/plugins/code-block/index.js +6 -1
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
- package/dist/es2019/plugins/code-block/toolbar.js +1 -1
- package/dist/es2019/plugins/emoji/styles.js +2 -0
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/es2019/plugins/extension/toolbar.js +30 -25
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/es2019/plugins/hyperlink/utils.js +3 -59
- package/dist/es2019/plugins/index.js +2 -1
- package/dist/es2019/plugins/media/index.js +13 -4
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
- package/dist/es2019/plugins/media/toolbar/index.js +44 -15
- package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
- package/dist/es2019/plugins/media/utils/media-files.js +68 -2
- package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
- package/dist/es2019/plugins/panel/index.js +3 -4
- package/dist/es2019/plugins/panel/message.js +38 -0
- package/dist/es2019/plugins/panel/toolbar.js +52 -71
- package/dist/es2019/plugins/panel/utils.js +2 -2
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/profiler/render-count.js +60 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +6 -24
- package/dist/esm/create-editor/ErrorBoundary.js +113 -78
- package/dist/esm/create-editor/ReactEditorView.js +146 -31
- package/dist/esm/create-editor/create-plugins-list.js +9 -3
- package/dist/esm/editor.js +100 -40
- package/dist/esm/labs/next/presets/cxhtml.js +2 -1
- package/dist/esm/plugins/analytics/types/enums.js +3 -1
- package/dist/esm/plugins/base/index.js +4 -3
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
- package/dist/esm/plugins/card/index.js +13 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
- package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
- package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
- package/dist/esm/plugins/code-block/index.js +10 -6
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
- package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
- package/dist/esm/plugins/code-block/toolbar.js +1 -1
- package/dist/esm/plugins/emoji/styles.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
- package/dist/esm/plugins/extension/toolbar.js +28 -23
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
- package/dist/esm/plugins/hyperlink/utils.js +3 -59
- package/dist/esm/plugins/index.js +2 -1
- package/dist/esm/plugins/media/index.js +14 -4
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
- package/dist/esm/plugins/media/toolbar/index.js +47 -19
- package/dist/esm/plugins/media/toolbar/utils.js +15 -1
- package/dist/esm/plugins/media/utils/media-files.js +60 -2
- package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
- package/dist/esm/plugins/panel/index.js +3 -4
- package/dist/esm/plugins/panel/message.js +38 -0
- package/dist/esm/plugins/panel/toolbar.js +57 -77
- package/dist/esm/plugins/panel/utils.js +2 -2
- package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/profiler/render-count.js +57 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
- package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
- package/dist/types/editor.d.ts +2 -0
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
- package/dist/types/plugins/analytics/types/events.d.ts +7 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
- package/dist/types/plugins/analytics/types/index.d.ts +1 -1
- package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -0
- package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
- package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/types.d.ts +6 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
- package/dist/types/plugins/extension/types.d.ts +0 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +1 -1
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
- package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
- package/dist/types/plugins/panel/message.d.ts +37 -0
- package/dist/types/plugins/panel/toolbar.d.ts +4 -37
- package/dist/types/plugins/panel/types.d.ts +1 -0
- package/dist/types/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +17 -0
- package/dist/types/ui/LinkSearch/types.d.ts +1 -0
- package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
- package/package.json +21 -18
- package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
- package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
- package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
- package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
- package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
- package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
- package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
- package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
- package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
- package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
- package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
- package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
- package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
- package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
- package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
- package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
- package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
- package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
- package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
- package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
- package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
- package/dist/esm/plugins/code-block/language-list.test.js +0 -71
- package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
- package/dist/esm/plugins/media/commands/captions.test.js +0 -135
- package/dist/esm/plugins/media/commands/linking.test.js +0 -268
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
- package/dist/esm/plugins/panel/toolbar.test.js +0 -230
- package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
- package/dist/esm/ui/PortalProvider/index.test.js +0 -129
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
+
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
9
|
+
|
|
4
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5
11
|
|
|
6
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -201,6 +207,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
201
207
|
HighlightComponent = _ref6.HighlightComponent;
|
|
202
208
|
var sessionId = uuid();
|
|
203
209
|
var firstQueryWithoutResults = null;
|
|
210
|
+
var subscriptionKeys = new Set();
|
|
204
211
|
var typeAhead = {
|
|
205
212
|
id: TypeAheadAvailableNodes.MENTION,
|
|
206
213
|
trigger: '@',
|
|
@@ -247,9 +254,15 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
247
254
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
248
255
|
|
|
249
256
|
var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
|
|
250
|
-
var
|
|
257
|
+
var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
251
258
|
var stats = arguments.length > 2 ? arguments[2] : undefined;
|
|
259
|
+
|
|
260
|
+
if (query !== resultQuery) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
252
264
|
mentionProvider.unsubscribe(key);
|
|
265
|
+
subscriptionKeys.delete(key);
|
|
253
266
|
var mentionItems = mentions.map(function (mention) {
|
|
254
267
|
return memoizedToItem.call(mention);
|
|
255
268
|
});
|
|
@@ -285,13 +298,14 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
285
298
|
}
|
|
286
299
|
};
|
|
287
300
|
|
|
301
|
+
subscriptionKeys.add(key);
|
|
288
302
|
mentionProvider.subscribe(key, mentionsSubscribeCallback);
|
|
289
303
|
mentionProvider.filter(query || '', _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
290
304
|
sessionId: sessionId
|
|
291
305
|
}));
|
|
292
306
|
});
|
|
293
307
|
},
|
|
294
|
-
onOpen: function onOpen(
|
|
308
|
+
onOpen: function onOpen() {
|
|
295
309
|
firstQueryWithoutResults = null;
|
|
296
310
|
},
|
|
297
311
|
selectItem: function selectItem(state, item, insert, _ref8) {
|
|
@@ -362,11 +376,33 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
362
376
|
return insert(Fragment.from([mentionNode, space]));
|
|
363
377
|
},
|
|
364
378
|
dismiss: function dismiss(_ref9) {
|
|
365
|
-
var
|
|
379
|
+
var editorState = _ref9.editorState,
|
|
380
|
+
query = _ref9.query,
|
|
366
381
|
stats = _ref9.stats;
|
|
367
382
|
firstQueryWithoutResults = null;
|
|
368
383
|
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
369
384
|
fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
|
|
385
|
+
var pluginState = getMentionPluginState(editorState);
|
|
386
|
+
|
|
387
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
388
|
+
var mentionProvider = pluginState.mentionProvider;
|
|
389
|
+
|
|
390
|
+
var _iterator = _createForOfIteratorHelper(subscriptionKeys),
|
|
391
|
+
_step;
|
|
392
|
+
|
|
393
|
+
try {
|
|
394
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
395
|
+
var key = _step.value;
|
|
396
|
+
mentionProvider.unsubscribe(key);
|
|
397
|
+
}
|
|
398
|
+
} catch (err) {
|
|
399
|
+
_iterator.e(err);
|
|
400
|
+
} finally {
|
|
401
|
+
_iterator.f();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
subscriptionKeys.clear();
|
|
370
406
|
sessionId = uuid();
|
|
371
407
|
}
|
|
372
408
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { customPanel, PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { createPlugin } from './pm-plugins/main';
|
|
4
4
|
import { getToolbarConfig } from './toolbar';
|
|
5
5
|
import keymap from './pm-plugins/keymaps';
|
|
@@ -37,8 +37,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
37
37
|
return {
|
|
38
38
|
name: 'panel',
|
|
39
39
|
nodes: function nodes() {
|
|
40
|
-
|
|
41
|
-
var panelNode = options.UNSAFE_allowCustomPanel ? customPanel : panel;
|
|
40
|
+
var panelNode = customPanel(!!options.UNSAFE_allowCustomPanel);
|
|
42
41
|
return [{
|
|
43
42
|
name: 'panel',
|
|
44
43
|
node: panelNode
|
|
@@ -131,7 +130,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
131
130
|
}
|
|
132
131
|
}];
|
|
133
132
|
|
|
134
|
-
if (options.UNSAFE_allowCustomPanel) {
|
|
133
|
+
if (options.UNSAFE_allowCustomPanelEdit && options.UNSAFE_allowCustomPanel) {
|
|
135
134
|
quickInsertOptions.push({
|
|
136
135
|
id: 'custompanel',
|
|
137
136
|
title: formatMessage(messages.customPanel),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export var messages = defineMessages({
|
|
3
|
+
info: {
|
|
4
|
+
id: 'fabric.editor.info',
|
|
5
|
+
defaultMessage: 'Info',
|
|
6
|
+
description: 'Panels provide a way to highlight text. The info panel has a blue background.'
|
|
7
|
+
},
|
|
8
|
+
note: {
|
|
9
|
+
id: 'fabric.editor.note',
|
|
10
|
+
defaultMessage: 'Note',
|
|
11
|
+
description: 'Panels provide a way to highlight text. The note panel has a purple background.'
|
|
12
|
+
},
|
|
13
|
+
success: {
|
|
14
|
+
id: 'fabric.editor.success',
|
|
15
|
+
defaultMessage: 'Success',
|
|
16
|
+
description: 'Panels provide a way to highlight text. The success panel has a green background.'
|
|
17
|
+
},
|
|
18
|
+
warning: {
|
|
19
|
+
id: 'fabric.editor.warning',
|
|
20
|
+
defaultMessage: 'Warning',
|
|
21
|
+
description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
|
|
22
|
+
},
|
|
23
|
+
error: {
|
|
24
|
+
id: 'fabric.editor.error',
|
|
25
|
+
defaultMessage: 'Error',
|
|
26
|
+
description: 'Panels provide a way to highlight text. The error panel has a red background.'
|
|
27
|
+
},
|
|
28
|
+
emoji: {
|
|
29
|
+
id: 'fabric.editor.panel.emoji',
|
|
30
|
+
defaultMessage: 'Add emoji',
|
|
31
|
+
description: 'Select the panel icon'
|
|
32
|
+
},
|
|
33
|
+
backgroundColor: {
|
|
34
|
+
id: 'fabric.editor.panel.backgroundColor',
|
|
35
|
+
defaultMessage: 'Background color',
|
|
36
|
+
description: 'Select the panel background color.'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
var _panelIconMap;
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
2
9
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
3
10
|
import InfoIcon from '@atlaskit/icon/glyph/editor/info';
|
|
4
11
|
import NoteIcon from '@atlaskit/icon/glyph/editor/note';
|
|
@@ -16,44 +23,9 @@ import { findDomRefAtPos } from 'prosemirror-utils';
|
|
|
16
23
|
import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
|
|
17
24
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
18
25
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
defaultMessage: 'Info',
|
|
23
|
-
description: 'Panels provide a way to highlight text. The info panel has a blue background.'
|
|
24
|
-
},
|
|
25
|
-
note: {
|
|
26
|
-
id: 'fabric.editor.note',
|
|
27
|
-
defaultMessage: 'Note',
|
|
28
|
-
description: 'Panels provide a way to highlight text. The note panel has a purple background.'
|
|
29
|
-
},
|
|
30
|
-
success: {
|
|
31
|
-
id: 'fabric.editor.success',
|
|
32
|
-
defaultMessage: 'Success',
|
|
33
|
-
description: 'Panels provide a way to highlight text. The success panel has a green background.'
|
|
34
|
-
},
|
|
35
|
-
warning: {
|
|
36
|
-
id: 'fabric.editor.warning',
|
|
37
|
-
defaultMessage: 'Warning',
|
|
38
|
-
description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
|
|
39
|
-
},
|
|
40
|
-
error: {
|
|
41
|
-
id: 'fabric.editor.error',
|
|
42
|
-
defaultMessage: 'Error',
|
|
43
|
-
description: 'Panels provide a way to highlight text. The error panel has a red background.'
|
|
44
|
-
},
|
|
45
|
-
emoji: {
|
|
46
|
-
id: 'fabric.editor.panel.emoji',
|
|
47
|
-
defaultMessage: 'Add emoji',
|
|
48
|
-
description: 'Select the panel icon'
|
|
49
|
-
},
|
|
50
|
-
backgroundColor: {
|
|
51
|
-
id: 'fabric.editor.panel.backgroundColor',
|
|
52
|
-
defaultMessage: 'Background color',
|
|
53
|
-
description: 'Select the panel background color.'
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
|
|
26
|
+
import { messages } from './message';
|
|
27
|
+
export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, PanelType.INFO, ':info:'), _defineProperty(_panelIconMap, PanelType.NOTE, ':note:'), _defineProperty(_panelIconMap, PanelType.WARNING, ':warning:'), _defineProperty(_panelIconMap, PanelType.ERROR, ':error:'), _defineProperty(_panelIconMap, PanelType.SUCCESS, ':success:'), _defineProperty(_panelIconMap, PanelType.TIP, ':tip:'), _panelIconMap);
|
|
28
|
+
export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
|
|
57
29
|
var items = [{
|
|
58
30
|
id: 'editor.panel.info',
|
|
59
31
|
type: 'button',
|
|
@@ -101,11 +73,16 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
101
73
|
}
|
|
102
74
|
|
|
103
75
|
var previousColor = panelNode.node.attrs.panelColor || getPanelTypeBackground(panelNode.node.attrs.panelType);
|
|
76
|
+
var emojiInfo = panelNode.node.attrs.panelType;
|
|
77
|
+
var panelInfo = panelIconMap[emojiInfo];
|
|
78
|
+
var previousEmoji = panelInfo ? {
|
|
79
|
+
emoji: panelInfo
|
|
80
|
+
} : {};
|
|
104
81
|
|
|
105
82
|
if (previousColor === color) {
|
|
106
|
-
changePanelType(PanelType.CUSTOM, {
|
|
83
|
+
changePanelType(PanelType.CUSTOM, _objectSpread({
|
|
107
84
|
color: color
|
|
108
|
-
}, isCustomPanelEnabled)(state, dispatch);
|
|
85
|
+
}, previousEmoji), isCustomPanelEnabled)(state, dispatch);
|
|
109
86
|
return false;
|
|
110
87
|
}
|
|
111
88
|
|
|
@@ -119,9 +96,9 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
119
96
|
},
|
|
120
97
|
eventType: EVENT_TYPE.TRACK
|
|
121
98
|
};
|
|
122
|
-
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
99
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, _objectSpread({
|
|
123
100
|
color: color
|
|
124
|
-
}, isCustomPanelEnabled))(state, dispatch);
|
|
101
|
+
}, previousEmoji), isCustomPanelEnabled))(state, dispatch);
|
|
125
102
|
return false;
|
|
126
103
|
};
|
|
127
104
|
};
|
|
@@ -196,39 +173,42 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
196
173
|
value: panelColor,
|
|
197
174
|
border: DEFAULT_BORDER_COLOR
|
|
198
175
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
176
|
+
|
|
177
|
+
if (isCustomPanelEditable) {
|
|
178
|
+
var colorPicker = {
|
|
179
|
+
id: 'editor.panel.colorPicker',
|
|
180
|
+
title: formatMessage(messages.backgroundColor),
|
|
181
|
+
type: 'select',
|
|
182
|
+
selectType: 'color',
|
|
183
|
+
defaultValue: defaultPalette,
|
|
184
|
+
options: panelBackgroundPalette,
|
|
185
|
+
onChange: function onChange(option) {
|
|
186
|
+
return changeColor(option.value);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var emojiPicker = {
|
|
190
|
+
id: 'editor.panel.emojiPicker',
|
|
191
|
+
title: formatMessage(messages.emoji),
|
|
192
|
+
type: 'select',
|
|
193
|
+
selectType: 'emoji',
|
|
194
|
+
options: [],
|
|
195
|
+
selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
|
|
196
|
+
onChange: function onChange(emojiShortName) {
|
|
197
|
+
return changeEmoji(emojiShortName);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
var removeEmojiButton = {
|
|
201
|
+
id: 'editor.panel.removeEmoji',
|
|
202
|
+
type: 'button',
|
|
203
|
+
icon: RemoveEmojiIcon,
|
|
204
|
+
onClick: removeEmoji(),
|
|
205
|
+
title: formatMessage(commonMessages.removeEmoji),
|
|
206
|
+
disabled: activePanelIcon ? false : true
|
|
207
|
+
};
|
|
208
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
209
|
+
type: 'separator'
|
|
210
|
+
}, colorPicker);
|
|
211
|
+
}
|
|
232
212
|
}
|
|
233
213
|
|
|
234
214
|
items.push({
|
|
@@ -260,7 +240,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
260
240
|
panelColor = _panelObject$node$att.panelColor,
|
|
261
241
|
panelIcon = _panelObject$node$att.panelIcon; // force toolbar to be turned on
|
|
262
242
|
|
|
263
|
-
var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
|
|
243
|
+
var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, options.UNSAFE_allowCustomPanel && options.UNSAFE_allowCustomPanelEdit || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
|
|
264
244
|
|
|
265
245
|
var getDomRef = function getDomRef(editorView) {
|
|
266
246
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -17,7 +17,7 @@ export var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
17
17
|
'data-panel-type': panelType || PanelType.INFO,
|
|
18
18
|
style: style
|
|
19
19
|
};
|
|
20
|
-
var
|
|
20
|
+
var iconDiv = ['div', {
|
|
21
21
|
class: PanelSharedCssClassName.icon
|
|
22
22
|
}];
|
|
23
23
|
var contentDiv = ['div', {
|
|
@@ -25,7 +25,7 @@ export var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
25
25
|
}, 0];
|
|
26
26
|
|
|
27
27
|
if (hasIcon) {
|
|
28
|
-
return ['div', panelAttrs,
|
|
28
|
+
return ['div', panelAttrs, iconDiv, contentDiv];
|
|
29
29
|
} else {
|
|
30
30
|
return ['div', panelAttrs, contentDiv];
|
|
31
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { linkifyMatch } from '@atlaskit/adf-schema';
|
|
2
|
+
import LinkifyIt from 'linkify-it'; // modified version of the original Linkify plugin
|
|
3
3
|
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js
|
|
4
4
|
|
|
5
5
|
var arrayReplaceAt = function arrayReplaceAt(src, pos, newElements) {
|
package/dist/esm/plugins/rank.js
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
|
|
7
7
|
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', // selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
8
8
|
// left/right arrows
|
|
9
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription'],
|
|
9
|
+
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'inlineCode'],
|
|
10
10
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
11
11
|
marks: [// Inline marks
|
|
12
12
|
'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery', // Block marks
|
|
@@ -5,4 +5,4 @@ var _templateObject;
|
|
|
5
5
|
import { css } from 'styled-components';
|
|
6
6
|
import { StatusSharedCssClassName } from '@atlaskit/editor-common';
|
|
7
7
|
import { SelectionStyle, getSelectionStyles, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
-
export var statusStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, getSelectionStyles([SelectionStyle.BoxShadow]), StatusSharedCssClassName.STATUS_LOZENGE, akEditorDeleteBackgroundWithOpacity, StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, akEditorSelectedBorderSize, akEditorDeleteBorder);
|
|
8
|
+
export var statusStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, getSelectionStyles([SelectionStyle.BoxShadow]), StatusSharedCssClassName.STATUS_LOZENGE, akEditorDeleteBackgroundWithOpacity, StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, akEditorSelectedBorderSize, akEditorDeleteBorder);
|
|
@@ -497,10 +497,26 @@ export var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
497
497
|
* so it should be safe to ignore mutations that we cause
|
|
498
498
|
* by updating styles and classnames on this DOM element
|
|
499
499
|
*
|
|
500
|
-
* Update: should
|
|
500
|
+
* Update: should not ignore mutations for row selection to avoid known issue with table selection highlight in firefox
|
|
501
501
|
* Related bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1289673
|
|
502
502
|
* */
|
|
503
|
-
|
|
503
|
+
var isTableSelection = mutationRecord.type === 'selection' && mutationRecord.target.nodeName === 'TR';
|
|
504
|
+
/**
|
|
505
|
+
* Update: should not ignore mutations when an node is added, as this interferes with
|
|
506
|
+
* prosemirrors handling of some language inputs in Safari (ie. Pinyin, Hiragana).
|
|
507
|
+
*
|
|
508
|
+
* In paticular, when a composition occurs at the start of the first node inside a table cell, if the resulting mutation
|
|
509
|
+
* from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
|
|
510
|
+
* selection and insertion.
|
|
511
|
+
*/
|
|
512
|
+
|
|
513
|
+
var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
|
|
514
|
+
|
|
515
|
+
if (isTableSelection || isNodeInsertion) {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return true;
|
|
504
520
|
}
|
|
505
521
|
/* receive external events */
|
|
506
522
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import uuid from 'uuid';
|
|
3
|
+
import { useComponentRenderTracking } from '../utils/react-hooks/use-component-renderer-tracking';
|
|
4
|
+
import { RenderCountProfiler as RenderCountProfilerClass } from '@atlaskit/editor-common';
|
|
5
|
+
export var ProfiledComponentIds;
|
|
6
|
+
|
|
7
|
+
(function (ProfiledComponentIds) {
|
|
8
|
+
ProfiledComponentIds["editor"] = "Editor";
|
|
9
|
+
ProfiledComponentIds["appearance"] = "FullPageEditor";
|
|
10
|
+
ProfiledComponentIds["reactEditorView"] = "ReactEditorView";
|
|
11
|
+
ProfiledComponentIds["contentArea"] = "FullPageContentArea";
|
|
12
|
+
ProfiledComponentIds["toolbar"] = "FullPageToolbar";
|
|
13
|
+
ProfiledComponentIds["mention"] = "MentionNodeView";
|
|
14
|
+
})(ProfiledComponentIds || (ProfiledComponentIds = {}));
|
|
15
|
+
|
|
16
|
+
var CoreRenderCountProfiler = function CoreRenderCountProfiler(_ref) {
|
|
17
|
+
var componentId = _ref.componentId;
|
|
18
|
+
|
|
19
|
+
var _useRef = useRef(uuid()),
|
|
20
|
+
instanceId = _useRef.current;
|
|
21
|
+
|
|
22
|
+
var onRender = function onRender(_ref2) {
|
|
23
|
+
var renderCount = _ref2.renderCount;
|
|
24
|
+
var profiler = RenderCountProfilerClass.getInstance({
|
|
25
|
+
store: window
|
|
26
|
+
});
|
|
27
|
+
profiler.setRenderCount({
|
|
28
|
+
componentId: componentId,
|
|
29
|
+
instanceId: instanceId,
|
|
30
|
+
renderCount: renderCount
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
useComponentRenderTracking({
|
|
35
|
+
onRender: onRender,
|
|
36
|
+
propsDiffingOptions: {
|
|
37
|
+
enabled: false
|
|
38
|
+
},
|
|
39
|
+
zeroBasedCount: false
|
|
40
|
+
});
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export var RenderCountProfiler = function RenderCountProfiler(_ref3) {
|
|
45
|
+
var componentId = _ref3.componentId;
|
|
46
|
+
var profiler = RenderCountProfilerClass.getInstance({
|
|
47
|
+
store: window
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (profiler.isEnabled()) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(CoreRenderCountProfiler, {
|
|
52
|
+
componentId: componentId
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
@@ -38,11 +38,11 @@ import messages from '../../../messages';
|
|
|
38
38
|
import { TableControlsPadding, MainToolbar, MainToolbarCustomComponentsSlot } from './Toolbar';
|
|
39
39
|
var CommentEditorMargin = 14;
|
|
40
40
|
var CommentEditorSmallerMargin = 8;
|
|
41
|
-
var CommentEditor = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n min-height: 150px;\n height: auto;\n
|
|
42
|
-
return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
|
|
43
|
-
}, N40, borderRadius());
|
|
41
|
+
var CommentEditor = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n min-height: 150px;\n height: auto;\n background-color: white;\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), CommentEditorSmallerMargin, CommentEditorSmallerMargin, N40, borderRadius());
|
|
44
42
|
CommentEditor.displayName = 'CommentEditor';
|
|
45
|
-
var ContentArea = styled(ContentStyles)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])),
|
|
43
|
+
var ContentArea = styled(ContentStyles)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n ", ";\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), function (props) {
|
|
44
|
+
return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
|
|
45
|
+
}, CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - GRID_GUTTER, CommentEditorMargin - GRID_GUTTER, CommentEditorMargin - GRID_GUTTER, TableControlsPadding, tableCommentEditorStyles);
|
|
46
46
|
ContentArea.displayName = 'ContentArea';
|
|
47
47
|
var SecondaryToolbar = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: 12px 1px;\n"])));
|
|
48
48
|
SecondaryToolbar.displayName = 'SecondaryToolbar';
|
|
@@ -135,7 +135,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
135
135
|
},
|
|
136
136
|
className: classnames('ak-editor-content-area', {
|
|
137
137
|
'less-margin': width < akEditorMobileBreakoutPoint
|
|
138
|
-
})
|
|
138
|
+
}),
|
|
139
|
+
maxHeight: maxHeight
|
|
139
140
|
}, customContentComponents, /*#__PURE__*/React.createElement(PluginSlot, {
|
|
140
141
|
editorView: editorView,
|
|
141
142
|
editorActions: editorActions,
|
|
@@ -1,35 +1,68 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
1
|
+
import { useMemo, useEffect, useRef } from 'react';
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
2
3
|
import { getShallowPropsDifference, getPropsDifference } from '../../compare';
|
|
3
4
|
import { EVENT_TYPE } from '../../../plugins/analytics';
|
|
4
|
-
export function useComponentRenderTracking(
|
|
5
|
-
var
|
|
6
|
-
|
|
5
|
+
export function useComponentRenderTracking(_ref) {
|
|
6
|
+
var onRender = _ref.onRender,
|
|
7
|
+
propsDiffingOptions = _ref.propsDiffingOptions,
|
|
8
|
+
_ref$zeroBasedCount = _ref.zeroBasedCount,
|
|
9
|
+
zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
|
|
7
10
|
var propsRef = useRef();
|
|
8
|
-
var renderCountRef = useRef(0);
|
|
11
|
+
var renderCountRef = useRef(zeroBasedCount ? 0 : 1);
|
|
9
12
|
useEffect(function () {
|
|
10
13
|
var lastProps = propsRef.current;
|
|
11
14
|
var renderCount = renderCountRef.current;
|
|
15
|
+
var propsDifference;
|
|
12
16
|
|
|
13
|
-
if (lastProps) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
17
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
|
|
18
|
+
propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? getShallowPropsDifference(lastProps, propsDiffingOptions.props) : getPropsDifference(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var result = {
|
|
22
|
+
renderCount: renderCount,
|
|
23
|
+
propsDifference: propsDifference
|
|
24
|
+
};
|
|
25
|
+
onRender(result);
|
|
26
|
+
|
|
27
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
|
|
28
|
+
propsRef.current = propsDiffingOptions.props;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
propsRef.current = props;
|
|
29
31
|
renderCountRef.current = renderCountRef.current + 1;
|
|
30
32
|
}); // No dependencies run on each render
|
|
31
33
|
}
|
|
32
34
|
export function RenderTracking(props) {
|
|
33
|
-
|
|
35
|
+
var debouncedHandleAnalyticsEvent = useMemo(function () {
|
|
36
|
+
return debounce(props.handleAnalyticsEvent, 500);
|
|
37
|
+
}, [props.handleAnalyticsEvent]);
|
|
38
|
+
useComponentRenderTracking({
|
|
39
|
+
onRender: function onRender(_ref2) {
|
|
40
|
+
var renderCount = _ref2.renderCount,
|
|
41
|
+
propsDifference = _ref2.propsDifference;
|
|
42
|
+
|
|
43
|
+
if (!renderCount) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
debouncedHandleAnalyticsEvent({
|
|
48
|
+
payload: {
|
|
49
|
+
action: props.action,
|
|
50
|
+
actionSubject: props.actionSubject,
|
|
51
|
+
attributes: {
|
|
52
|
+
count: renderCount,
|
|
53
|
+
propsDifference: propsDifference
|
|
54
|
+
},
|
|
55
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
propsDiffingOptions: {
|
|
60
|
+
enabled: true,
|
|
61
|
+
props: props.componentProps,
|
|
62
|
+
propsToIgnore: props.propsToIgnore,
|
|
63
|
+
useShallow: props.useShallow
|
|
64
|
+
},
|
|
65
|
+
zeroBasedCount: true
|
|
66
|
+
});
|
|
34
67
|
return null;
|
|
35
68
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { ContextIdentifierProvider, UserBrowserExtensionResults } from '@atlaskit/editor-common';
|
|
4
|
+
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
4
5
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
6
|
import { FeatureFlags } from '../types/feature-flags';
|
|
6
7
|
export declare type ErrorBoundaryProps = {
|
|
@@ -16,13 +17,9 @@ export declare type ErrorBoundaryState = {
|
|
|
16
17
|
declare type AnalyticsErrorBoundaryErrorInfo = {
|
|
17
18
|
componentStack: string;
|
|
18
19
|
};
|
|
19
|
-
declare type AnalyticsErrorBoundaryAttributes = {
|
|
20
|
-
error: string;
|
|
21
|
-
info?: AnalyticsErrorBoundaryErrorInfo;
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
};
|
|
24
20
|
export declare class ErrorBoundaryWithEditorView extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
25
21
|
browserExtensions?: UserBrowserExtensionResults;
|
|
22
|
+
experienceStore?: ExperienceStore;
|
|
26
23
|
static defaultProps: {
|
|
27
24
|
rethrow: boolean;
|
|
28
25
|
};
|
|
@@ -31,8 +28,11 @@ export declare class ErrorBoundaryWithEditorView extends React.Component<ErrorBo
|
|
|
31
28
|
};
|
|
32
29
|
private getFeatureFlags;
|
|
33
30
|
get featureFlags(): FeatureFlags;
|
|
34
|
-
|
|
31
|
+
constructor(props: ErrorBoundaryProps);
|
|
32
|
+
private sendErrorData;
|
|
35
33
|
private getProductName;
|
|
34
|
+
private fireAnalyticsEvent;
|
|
35
|
+
private getExperienceMetadata;
|
|
36
36
|
componentDidCatch(error: Error, errorInfo: AnalyticsErrorBoundaryErrorInfo): void;
|
|
37
37
|
componentDidMount(): Promise<void>;
|
|
38
38
|
render(): React.ReactNode;
|