@atlaskit/editor-core 150.0.0 → 151.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.
- package/CHANGELOG.md +65 -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 +4 -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-block/toolbar.js +1 -1
- package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
- 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 +8 -3
- package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
- 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/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/status/styles.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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 +4 -2
- 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-block/toolbar.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
- 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 +8 -4
- package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
- 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/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/status/styles.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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 +4 -2
- 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-block/toolbar.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
- 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 +8 -4
- package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
- 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/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/status/styles.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- 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 +3 -1
- package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
- 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/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/extension/types.d.ts +0 -2
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -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/utils.d.ts +0 -21
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- 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/plugins/quick-insert/index.d.ts +1 -1
- package/dist/types/profiler/render-count.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +8 -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 +20 -17
- 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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.RenderCountProfiler = exports.ProfiledComponentIds = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
|
+
|
|
16
|
+
var _useComponentRendererTracking = require("../utils/react-hooks/use-component-renderer-tracking");
|
|
17
|
+
|
|
18
|
+
var _editorCommon = require("@atlaskit/editor-common");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
var ProfiledComponentIds;
|
|
25
|
+
exports.ProfiledComponentIds = ProfiledComponentIds;
|
|
26
|
+
|
|
27
|
+
(function (ProfiledComponentIds) {
|
|
28
|
+
ProfiledComponentIds["editor"] = "Editor";
|
|
29
|
+
ProfiledComponentIds["appearance"] = "FullPageEditor";
|
|
30
|
+
ProfiledComponentIds["reactEditorView"] = "ReactEditorView";
|
|
31
|
+
ProfiledComponentIds["contentArea"] = "FullPageContentArea";
|
|
32
|
+
ProfiledComponentIds["toolbar"] = "FullPageToolbar";
|
|
33
|
+
ProfiledComponentIds["mention"] = "MentionNodeView";
|
|
34
|
+
})(ProfiledComponentIds || (exports.ProfiledComponentIds = ProfiledComponentIds = {}));
|
|
35
|
+
|
|
36
|
+
var CoreRenderCountProfiler = function CoreRenderCountProfiler(_ref) {
|
|
37
|
+
var componentId = _ref.componentId;
|
|
38
|
+
|
|
39
|
+
var _useRef = (0, _react.useRef)((0, _uuid.default)()),
|
|
40
|
+
instanceId = _useRef.current;
|
|
41
|
+
|
|
42
|
+
var onRender = function onRender(_ref2) {
|
|
43
|
+
var renderCount = _ref2.renderCount;
|
|
44
|
+
|
|
45
|
+
var profiler = _editorCommon.RenderCountProfiler.getInstance({
|
|
46
|
+
store: window
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
profiler.setRenderCount({
|
|
50
|
+
componentId: componentId,
|
|
51
|
+
instanceId: instanceId,
|
|
52
|
+
renderCount: renderCount
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
(0, _useComponentRendererTracking.useComponentRenderTracking)({
|
|
57
|
+
onRender: onRender,
|
|
58
|
+
propsDiffingOptions: {
|
|
59
|
+
enabled: false
|
|
60
|
+
},
|
|
61
|
+
zeroBasedCount: false
|
|
62
|
+
});
|
|
63
|
+
return null;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var RenderCountProfiler = function RenderCountProfiler(_ref3) {
|
|
67
|
+
var componentId = _ref3.componentId;
|
|
68
|
+
|
|
69
|
+
var profiler = _editorCommon.RenderCountProfiler.getInstance({
|
|
70
|
+
store: window
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (profiler.isEnabled()) {
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(CoreRenderCountProfiler, {
|
|
75
|
+
componentId: componentId
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.RenderCountProfiler = RenderCountProfiler;
|
|
@@ -78,12 +78,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
78
78
|
var CommentEditorMargin = 14;
|
|
79
79
|
var CommentEditorSmallerMargin = 8;
|
|
80
80
|
|
|
81
|
-
var CommentEditor = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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
|
|
82
|
-
return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
|
|
83
|
-
}, _colors.N40, (0, _constants.borderRadius)());
|
|
81
|
+
var CommentEditor = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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, _colors.N40, (0, _constants.borderRadius)());
|
|
84
82
|
|
|
85
83
|
CommentEditor.displayName = 'CommentEditor';
|
|
86
|
-
var ContentArea = (0, _styledComponents.default)(_ContentStyles.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\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"])),
|
|
84
|
+
var ContentArea = (0, _styledComponents.default)(_ContentStyles.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\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) {
|
|
85
|
+
return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
|
|
86
|
+
}, CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles);
|
|
87
87
|
ContentArea.displayName = 'ContentArea';
|
|
88
88
|
|
|
89
89
|
var SecondaryToolbar = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: 12px 1px;\n"])));
|
|
@@ -173,7 +173,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
173
173
|
},
|
|
174
174
|
className: (0, _classnames.default)('ak-editor-content-area', {
|
|
175
175
|
'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
|
|
176
|
-
})
|
|
176
|
+
}),
|
|
177
|
+
maxHeight: maxHeight
|
|
177
178
|
}, customContentComponents, /*#__PURE__*/_react.default.createElement(_PluginSlot.default, {
|
|
178
179
|
editorView: editorView,
|
|
179
180
|
editorActions: editorActions,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -8,40 +10,74 @@ exports.RenderTracking = RenderTracking;
|
|
|
8
10
|
|
|
9
11
|
var _react = require("react");
|
|
10
12
|
|
|
13
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
14
|
+
|
|
11
15
|
var _compare = require("../../compare");
|
|
12
16
|
|
|
13
17
|
var _analytics = require("../../../plugins/analytics");
|
|
14
18
|
|
|
15
|
-
function useComponentRenderTracking(
|
|
16
|
-
var
|
|
17
|
-
|
|
19
|
+
function useComponentRenderTracking(_ref) {
|
|
20
|
+
var onRender = _ref.onRender,
|
|
21
|
+
propsDiffingOptions = _ref.propsDiffingOptions,
|
|
22
|
+
_ref$zeroBasedCount = _ref.zeroBasedCount,
|
|
23
|
+
zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
|
|
18
24
|
var propsRef = (0, _react.useRef)();
|
|
19
|
-
var renderCountRef = (0, _react.useRef)(0);
|
|
25
|
+
var renderCountRef = (0, _react.useRef)(zeroBasedCount ? 0 : 1);
|
|
20
26
|
(0, _react.useEffect)(function () {
|
|
21
27
|
var lastProps = propsRef.current;
|
|
22
28
|
var renderCount = renderCountRef.current;
|
|
29
|
+
var propsDifference;
|
|
23
30
|
|
|
24
|
-
if (lastProps) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
31
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
|
|
32
|
+
propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? (0, _compare.getShallowPropsDifference)(lastProps, propsDiffingOptions.props) : (0, _compare.getPropsDifference)(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var result = {
|
|
36
|
+
renderCount: renderCount,
|
|
37
|
+
propsDifference: propsDifference
|
|
38
|
+
};
|
|
39
|
+
onRender(result);
|
|
40
|
+
|
|
41
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
|
|
42
|
+
propsRef.current = propsDiffingOptions.props;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
propsRef.current = props;
|
|
40
45
|
renderCountRef.current = renderCountRef.current + 1;
|
|
41
46
|
}); // No dependencies run on each render
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
function RenderTracking(props) {
|
|
45
|
-
|
|
50
|
+
var debouncedHandleAnalyticsEvent = (0, _react.useMemo)(function () {
|
|
51
|
+
return (0, _debounce.default)(props.handleAnalyticsEvent, 500);
|
|
52
|
+
}, [props.handleAnalyticsEvent]);
|
|
53
|
+
useComponentRenderTracking({
|
|
54
|
+
onRender: function onRender(_ref2) {
|
|
55
|
+
var renderCount = _ref2.renderCount,
|
|
56
|
+
propsDifference = _ref2.propsDifference;
|
|
57
|
+
|
|
58
|
+
if (!renderCount) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
debouncedHandleAnalyticsEvent({
|
|
63
|
+
payload: {
|
|
64
|
+
action: props.action,
|
|
65
|
+
actionSubject: props.actionSubject,
|
|
66
|
+
attributes: {
|
|
67
|
+
count: renderCount,
|
|
68
|
+
propsDifference: propsDifference
|
|
69
|
+
},
|
|
70
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
propsDiffingOptions: {
|
|
75
|
+
enabled: true,
|
|
76
|
+
props: props.componentProps,
|
|
77
|
+
propsToIgnore: props.propsToIgnore,
|
|
78
|
+
useShallow: props.useShallow
|
|
79
|
+
},
|
|
80
|
+
zeroBasedCount: true
|
|
81
|
+
});
|
|
46
82
|
return null;
|
|
47
83
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.nextMajorVersion = exports.version = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "151.0.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
|
|
12
12
|
var nextMajorVersion = function nextMajorVersion() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Node } from 'prosemirror-model';
|
|
3
|
-
import { TextSelection
|
|
3
|
+
import { TextSelection } from 'prosemirror-state';
|
|
4
4
|
import { toJSON } from '../utils';
|
|
5
5
|
import { processRawValue, isEmptyDocument } from '../utils/document';
|
|
6
6
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel } from '../utils/action';
|
|
@@ -171,35 +171,13 @@ export default class EditorActions {
|
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} = state;
|
|
180
|
-
const content = processRawValue(schema, rawValue, undefined, undefined, this.contentTransformer, this.dispatchAnalyticsEvent);
|
|
181
|
-
|
|
182
|
-
if (!content) {
|
|
183
|
-
return false;
|
|
184
|
-
} // In case of replacing a whole document, we only need a content of a top level node e.g. document.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
let tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content.content);
|
|
188
|
-
|
|
189
|
-
if (!shouldScrollToBottom && !tr.selectionSet) {
|
|
190
|
-
// Restore selection at start of document instead of the end.
|
|
191
|
-
tr.setSelection(Selection.atStart(tr.doc));
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (shouldScrollToBottom) {
|
|
195
|
-
tr = tr.scrollIntoView();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (!shouldAddToHistory) {
|
|
199
|
-
tr.setMeta('addToHistory', false);
|
|
174
|
+
if (this.eventDispatcher) {
|
|
175
|
+
this.eventDispatcher.emit('resetEditorState', {
|
|
176
|
+
doc: rawValue,
|
|
177
|
+
shouldScrollToBottom
|
|
178
|
+
});
|
|
200
179
|
}
|
|
201
180
|
|
|
202
|
-
this.editorView.dispatch(tr);
|
|
203
181
|
return true;
|
|
204
182
|
}
|
|
205
183
|
|
|
@@ -3,14 +3,20 @@ import React from 'react';
|
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import memoizeOne from 'memoize-one';
|
|
5
5
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common';
|
|
6
|
+
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
6
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics';
|
|
7
8
|
import { editorAnalyticsChannel } from '../plugins/analytics/consts';
|
|
8
9
|
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
9
10
|
import { getDocStructure } from '../utils/document-logger';
|
|
10
11
|
import { WithEditorView } from './WithEditorView';
|
|
11
12
|
export class ErrorBoundaryWithEditorView extends React.Component {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
// Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
|
|
14
|
+
get featureFlags() {
|
|
15
|
+
return this.getFeatureFlags(this.props.editorView);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
14
20
|
|
|
15
21
|
_defineProperty(this, "browserExtensions", undefined);
|
|
16
22
|
|
|
@@ -26,60 +32,48 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
26
32
|
return getFeatureFlags(editorView.state);
|
|
27
33
|
}));
|
|
28
34
|
|
|
29
|
-
_defineProperty(this, "
|
|
35
|
+
_defineProperty(this, "sendErrorData", async analyticsErrorPayload => {
|
|
36
|
+
const product = await this.getProductName();
|
|
30
37
|
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
createAnalyticsEvent(event).fire(editorAnalyticsChannel);
|
|
62
|
-
createAnalyticsEvent({
|
|
63
|
-
action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
|
|
64
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
65
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
66
|
-
attributes: {
|
|
67
|
-
errorStack,
|
|
68
|
-
errorId: sharedId
|
|
69
|
-
}
|
|
70
|
-
}).fire(editorAnalyticsChannel);
|
|
71
|
-
} else {
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
console.error('Editor Error Boundary: Missing `createAnalyticsEvent` prop.', {
|
|
74
|
-
channel: editorAnalyticsChannel,
|
|
75
|
-
product,
|
|
76
|
-
error: analyticsErrorPayload
|
|
77
|
-
});
|
|
38
|
+
error,
|
|
39
|
+
errorInfo,
|
|
40
|
+
errorStack
|
|
41
|
+
} = analyticsErrorPayload;
|
|
42
|
+
const sharedId = uuid();
|
|
43
|
+
const attributes = {
|
|
44
|
+
product,
|
|
45
|
+
browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
|
|
46
|
+
error: error,
|
|
47
|
+
errorInfo,
|
|
48
|
+
errorId: sharedId,
|
|
49
|
+
browserExtensions: this.browserExtensions,
|
|
50
|
+
docStructure: this.featureFlags.errorBoundaryDocStructure && this.props.editorView ? getDocStructure(this.props.editorView.state.doc, {
|
|
51
|
+
compact: true
|
|
52
|
+
}) : undefined
|
|
53
|
+
};
|
|
54
|
+
this.fireAnalyticsEvent({
|
|
55
|
+
action: ACTION.EDITOR_CRASHED,
|
|
56
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
57
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
58
|
+
attributes
|
|
59
|
+
});
|
|
60
|
+
this.fireAnalyticsEvent({
|
|
61
|
+
action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
|
|
62
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
63
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
64
|
+
attributes: {
|
|
65
|
+
errorStack,
|
|
66
|
+
errorId: sharedId
|
|
78
67
|
}
|
|
79
|
-
}).catch(e => {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
console.error('Failed to resolve product name from contextIdentifierProvider.', e);
|
|
82
68
|
});
|
|
69
|
+
|
|
70
|
+
if (this.featureFlags.ufo && this.props.editorView) {
|
|
71
|
+
var _this$experienceStore;
|
|
72
|
+
|
|
73
|
+
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll({ ...this.getExperienceMetadata(attributes),
|
|
74
|
+
errorStack
|
|
75
|
+
});
|
|
76
|
+
}
|
|
83
77
|
});
|
|
84
78
|
|
|
85
79
|
_defineProperty(this, "getProductName", async () => {
|
|
@@ -97,20 +91,39 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
97
91
|
|
|
98
92
|
return 'atlaskit';
|
|
99
93
|
});
|
|
100
|
-
}
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
_defineProperty(this, "fireAnalyticsEvent", event => {
|
|
96
|
+
var _this$props$createAna, _this$props;
|
|
97
|
+
|
|
98
|
+
(_this$props$createAna = (_this$props = this.props).createAnalyticsEvent) === null || _this$props$createAna === void 0 ? void 0 : _this$props$createAna.call(_this$props, event).fire(editorAnalyticsChannel);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
_defineProperty(this, "getExperienceMetadata", attributes => {
|
|
102
|
+
var _attributes$browserEx;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
browserInfo: attributes.browserInfo,
|
|
106
|
+
error: attributes.error.toString(),
|
|
107
|
+
errorInfo: {
|
|
108
|
+
componentStack: attributes.errorInfo.componentStack
|
|
109
|
+
},
|
|
110
|
+
errorId: attributes.errorId,
|
|
111
|
+
browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
|
|
112
|
+
docStructure: attributes.docStructure
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (props.editorView) {
|
|
117
|
+
this.experienceStore = ExperienceStore.getInstance(props.editorView);
|
|
118
|
+
}
|
|
104
119
|
}
|
|
105
120
|
|
|
106
121
|
componentDidCatch(error, errorInfo) {
|
|
107
|
-
|
|
108
|
-
this.fireAnalytics({
|
|
122
|
+
this.sendErrorData({
|
|
109
123
|
error: error.toString(),
|
|
110
124
|
errorInfo,
|
|
111
125
|
errorStack: error.stack
|
|
112
|
-
}); //
|
|
113
|
-
// // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
126
|
+
}); // // Update state to allow a re-render to attempt graceful recovery (in the event that
|
|
114
127
|
// // the error was caused by a race condition or is intermittent)
|
|
115
128
|
|
|
116
129
|
this.setState({
|