@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
|
@@ -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) {
|
|
@@ -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
|
|
|
@@ -15,8 +15,25 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
var selection = tr.selection;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
if (!(selection instanceof TextSelection)) {
|
|
20
|
+
return tr;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!selection.$cursor) {
|
|
24
|
+
tr.deleteSelection();
|
|
25
|
+
return tr;
|
|
26
|
+
} // Search & Destroy placeholder
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var cursorPos = selection.$cursor.pos;
|
|
30
|
+
var nodeAtCursor = tr.doc.nodeAt(cursorPos);
|
|
31
|
+
var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
|
|
32
|
+
|
|
33
|
+
if (nodeAtCursor && isPlaceholderAtCursorPosition) {
|
|
34
|
+
tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return tr;
|
|
21
38
|
};
|
|
22
39
|
};
|
|
@@ -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;
|
|
@@ -3,8 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { EditorState } from 'prosemirror-state';
|
|
5
5
|
import { DirectEditorProps, EditorView } from 'prosemirror-view';
|
|
6
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
6
7
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
8
|
import { ErrorReporter, ProviderFactory, Transformer } from '@atlaskit/editor-common';
|
|
9
|
+
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
8
10
|
import { Dispatch, EventDispatcher } from '../event-dispatcher';
|
|
9
11
|
import { AnalyticsEventPayload, DispatchAnalyticsEvent, FULL_WIDTH_MODE } from '../plugins/analytics';
|
|
10
12
|
import { EditorAppearance, EditorConfig, EditorReactContext, EditorPlugin, EditorProps } from '../types';
|
|
@@ -19,6 +21,7 @@ export interface EditorViewProps {
|
|
|
19
21
|
portalProviderAPI: PortalProviderAPI;
|
|
20
22
|
allowAnalyticsGASV3?: boolean;
|
|
21
23
|
disabled?: boolean;
|
|
24
|
+
experienceStore?: ExperienceStore;
|
|
22
25
|
render?: (props: {
|
|
23
26
|
editor: JSX.Element;
|
|
24
27
|
view?: EditorView;
|
|
@@ -52,12 +55,14 @@ export default class ReactEditorView<T = {}> extends React.Component<EditorViewP
|
|
|
52
55
|
proseMirrorRenderedSeverity?: SEVERITY;
|
|
53
56
|
transactionTracker: TransactionTracker;
|
|
54
57
|
validTransactionCount: number;
|
|
58
|
+
experienceStore?: ExperienceStore;
|
|
55
59
|
static contextTypes: {
|
|
56
60
|
getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<any>;
|
|
57
61
|
intl: ReactIntl.IntlShape;
|
|
58
62
|
};
|
|
59
63
|
private canDispatchTransactions;
|
|
60
|
-
private focusTimeoutId
|
|
64
|
+
private focusTimeoutId?;
|
|
65
|
+
private reliabilityInterval?;
|
|
61
66
|
private pluginPerformanceObserver;
|
|
62
67
|
private featureFlags;
|
|
63
68
|
private onPluginObservation;
|
|
@@ -67,6 +72,11 @@ export default class ReactEditorView<T = {}> extends React.Component<EditorViewP
|
|
|
67
72
|
constructor(props: EditorViewProps & T, context: EditorReactContext);
|
|
68
73
|
UNSAFE_componentWillReceiveProps(nextProps: EditorViewProps): void;
|
|
69
74
|
formatFullWidthAppearance: (appearance: EditorAppearance | undefined) => FULL_WIDTH_MODE;
|
|
75
|
+
resetEditorState: ({ doc, shouldScrollToBottom, }: {
|
|
76
|
+
doc: string;
|
|
77
|
+
shouldScrollToBottom: boolean;
|
|
78
|
+
}) => void;
|
|
79
|
+
blur: () => void;
|
|
70
80
|
reconfigureState: (props: EditorViewProps) => void;
|
|
71
81
|
handleAnalyticsEvent: FireAnalyticsCallback;
|
|
72
82
|
componentDidMount(): void;
|
|
@@ -78,13 +88,15 @@ export default class ReactEditorView<T = {}> extends React.Component<EditorViewP
|
|
|
78
88
|
createEditorState: (options: {
|
|
79
89
|
props: EditorViewProps;
|
|
80
90
|
context: EditorReactContext;
|
|
81
|
-
|
|
91
|
+
doc?: string | Object | PMNode<any> | undefined;
|
|
92
|
+
resetting?: boolean | undefined;
|
|
93
|
+
selectionAtStart?: boolean | undefined;
|
|
82
94
|
}) => EditorState<any>;
|
|
83
95
|
private onEditorViewStateUpdated;
|
|
84
96
|
private trackValidTransactions;
|
|
85
97
|
private dispatchTransaction;
|
|
86
98
|
getDirectEditorProps: (state?: EditorState<any> | undefined) => DirectEditorProps;
|
|
87
|
-
createEditorView
|
|
99
|
+
private createEditorView;
|
|
88
100
|
handleEditorViewRef: (node: HTMLDivElement) => void;
|
|
89
101
|
dispatchAnalyticsEvent: (payload: AnalyticsEventPayload) => void;
|
|
90
102
|
private editor;
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export default class Editor extends React.Component<EditorProps, State> {
|
|
|
27
27
|
private editorActions;
|
|
28
28
|
private createAnalyticsEvent?;
|
|
29
29
|
private editorSessionId;
|
|
30
|
+
private experienceStore?;
|
|
31
|
+
private startTime?;
|
|
30
32
|
constructor(props: EditorProps, context: Context);
|
|
31
33
|
componentDidMount(): void;
|
|
32
34
|
componentDidUpdate(prevProps: EditorProps): void;
|
|
@@ -48,7 +50,7 @@ export default class Editor extends React.Component<EditorProps, State> {
|
|
|
48
50
|
};
|
|
49
51
|
} | undefined;
|
|
50
52
|
};
|
|
51
|
-
prepareExtensionProvider: (extensionProviders?: (ExtensionProvider<any> | Promise<ExtensionProvider<any>>)[] | ((editorActions?: EditorActions<any> | undefined) => (ExtensionProvider<any> | Promise<ExtensionProvider<any>>)[]) | undefined) => ExtensionProvider<any> | undefined
|
|
53
|
+
prepareExtensionProvider: import("memoize-one").MemoizedFn<(extensionProviders?: (ExtensionProvider<any> | Promise<ExtensionProvider<any>>)[] | ((editorActions?: EditorActions<any> | undefined) => (ExtensionProvider<any> | Promise<ExtensionProvider<any>>)[]) | undefined) => ExtensionProvider<any> | undefined>;
|
|
52
54
|
prepareQuickInsertProvider: (extensionProvider?: ExtensionProvider<any> | undefined, quickInsert?: boolean | {
|
|
53
55
|
provider: Promise<QuickInsertProvider>;
|
|
54
56
|
} | undefined) => Promise<QuickInsertProvider> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import analyticsPlugin from './plugin';
|
|
2
2
|
export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, LIST_TEXT_SCENARIOS, } from './types';
|
|
3
|
-
export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadWithChannel, CommonListAnalyticsAttributes, CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, ErrorEventPayload, FormatEventPayload, GeneralEventPayload, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, SubstituteEventPayload, TableEventPayload, } from './types';
|
|
3
|
+
export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadWithChannel, CommonListAnalyticsAttributes, CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, ErrorEventPayload, ErrorEventAttributes, FormatEventPayload, GeneralEventPayload, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, SubstituteEventPayload, TableEventPayload, } from './types';
|
|
4
4
|
export { withAnalytics, addAnalytics, findInsertLocation, getAnalyticsEventsFromTransaction, getSelectionType, getStateContext, mapActionSubjectIdToAttributes, } from './utils';
|
|
5
5
|
export declare const analyticsPluginKey: import("prosemirror-state").PluginKey<any, any>;
|
|
6
6
|
export default analyticsPlugin;
|
|
@@ -88,7 +88,8 @@ export declare enum ACTION {
|
|
|
88
88
|
RENDERED = "rendered",
|
|
89
89
|
ON_EDITOR_READY_CALLBACK = "onEditorReadyCallback",
|
|
90
90
|
ON_CHANGE_CALLBACK = "onChangeCalled",
|
|
91
|
-
REMOVE_ICON = "removedIcon"
|
|
91
|
+
REMOVE_ICON = "removedIcon",
|
|
92
|
+
UFO_SESSION_COMPLETE = "ufoSessionComplete"
|
|
92
93
|
}
|
|
93
94
|
export declare enum INPUT_METHOD {
|
|
94
95
|
ASCII = "ascii",
|
|
@@ -217,8 +218,9 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
217
218
|
LINK = "link",
|
|
218
219
|
LINK_PREVIEW = "linkPreview",
|
|
219
220
|
MEDIA = "media",
|
|
220
|
-
MEDIA_SINGLE = "mediaSingle",
|
|
221
221
|
MEDIA_GROUP = "mediaGroup",
|
|
222
|
+
MEDIA_INLINE = "mediaInline",
|
|
223
|
+
MEDIA_SINGLE = "mediaSingle",
|
|
222
224
|
MEDIA_LINK = "mediaLink",
|
|
223
225
|
MENTION = "mention",
|
|
224
226
|
NESTED_EXPAND = "nestedExpand",
|