@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,4 +1,3 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
1
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
3
2
|
import InfoIcon from '@atlaskit/icon/glyph/editor/info';
|
|
4
3
|
import NoteIcon from '@atlaskit/icon/glyph/editor/note';
|
|
@@ -16,44 +15,16 @@ import { findDomRefAtPos } from 'prosemirror-utils';
|
|
|
16
15
|
import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
|
|
17
16
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
18
17
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, providerFactory, activePanelType, activePanelColor, activePanelIcon) => {
|
|
18
|
+
import { messages } from './message';
|
|
19
|
+
export const panelIconMap = {
|
|
20
|
+
[PanelType.INFO]: ':info:',
|
|
21
|
+
[PanelType.NOTE]: ':note:',
|
|
22
|
+
[PanelType.WARNING]: ':warning:',
|
|
23
|
+
[PanelType.ERROR]: ':error:',
|
|
24
|
+
[PanelType.SUCCESS]: ':success:',
|
|
25
|
+
[PanelType.TIP]: ':tip:'
|
|
26
|
+
};
|
|
27
|
+
export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) => {
|
|
57
28
|
const items = [{
|
|
58
29
|
id: 'editor.panel.info',
|
|
59
30
|
type: 'button',
|
|
@@ -100,10 +71,16 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
100
71
|
}
|
|
101
72
|
|
|
102
73
|
let previousColor = panelNode.node.attrs.panelColor || getPanelTypeBackground(panelNode.node.attrs.panelType);
|
|
74
|
+
const emojiInfo = panelNode.node.attrs.panelType;
|
|
75
|
+
const panelInfo = panelIconMap[emojiInfo];
|
|
76
|
+
const previousEmoji = panelInfo ? {
|
|
77
|
+
emoji: panelInfo
|
|
78
|
+
} : {};
|
|
103
79
|
|
|
104
80
|
if (previousColor === color) {
|
|
105
81
|
changePanelType(PanelType.CUSTOM, {
|
|
106
|
-
color
|
|
82
|
+
color,
|
|
83
|
+
...previousEmoji
|
|
107
84
|
}, isCustomPanelEnabled)(state, dispatch);
|
|
108
85
|
return false;
|
|
109
86
|
}
|
|
@@ -119,7 +96,8 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
119
96
|
eventType: EVENT_TYPE.TRACK
|
|
120
97
|
};
|
|
121
98
|
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
122
|
-
color
|
|
99
|
+
color,
|
|
100
|
+
...previousEmoji
|
|
123
101
|
}, isCustomPanelEnabled))(state, dispatch);
|
|
124
102
|
return false;
|
|
125
103
|
};
|
|
@@ -188,35 +166,38 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
188
166
|
value: panelColor,
|
|
189
167
|
border: DEFAULT_BORDER_COLOR
|
|
190
168
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
169
|
+
|
|
170
|
+
if (isCustomPanelEditable) {
|
|
171
|
+
const colorPicker = {
|
|
172
|
+
id: 'editor.panel.colorPicker',
|
|
173
|
+
title: formatMessage(messages.backgroundColor),
|
|
174
|
+
type: 'select',
|
|
175
|
+
selectType: 'color',
|
|
176
|
+
defaultValue: defaultPalette,
|
|
177
|
+
options: panelBackgroundPalette,
|
|
178
|
+
onChange: option => changeColor(option.value)
|
|
179
|
+
};
|
|
180
|
+
const emojiPicker = {
|
|
181
|
+
id: 'editor.panel.emojiPicker',
|
|
182
|
+
title: formatMessage(messages.emoji),
|
|
183
|
+
type: 'select',
|
|
184
|
+
selectType: 'emoji',
|
|
185
|
+
options: [],
|
|
186
|
+
selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
|
|
187
|
+
onChange: emojiShortName => changeEmoji(emojiShortName)
|
|
188
|
+
};
|
|
189
|
+
const removeEmojiButton = {
|
|
190
|
+
id: 'editor.panel.removeEmoji',
|
|
191
|
+
type: 'button',
|
|
192
|
+
icon: RemoveEmojiIcon,
|
|
193
|
+
onClick: removeEmoji(),
|
|
194
|
+
title: formatMessage(commonMessages.removeEmoji),
|
|
195
|
+
disabled: activePanelIcon ? false : true
|
|
196
|
+
};
|
|
197
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
198
|
+
type: 'separator'
|
|
199
|
+
}, colorPicker);
|
|
200
|
+
}
|
|
220
201
|
}
|
|
221
202
|
|
|
222
203
|
items.push({
|
|
@@ -249,7 +230,7 @@ export const getToolbarConfig = (state, intl, options = {}, providerFactory) =>
|
|
|
249
230
|
panelIcon
|
|
250
231
|
} = panelObject.node.attrs; // force toolbar to be turned on
|
|
251
232
|
|
|
252
|
-
const items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
|
|
233
|
+
const 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);
|
|
253
234
|
|
|
254
235
|
const getDomRef = editorView => {
|
|
255
236
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -21,7 +21,7 @@ export const panelAttrsToDom = (attrs, allowCustomPanel) => {
|
|
|
21
21
|
'data-panel-type': panelType || PanelType.INFO,
|
|
22
22
|
style
|
|
23
23
|
};
|
|
24
|
-
const
|
|
24
|
+
const iconDiv = ['div', {
|
|
25
25
|
class: PanelSharedCssClassName.icon
|
|
26
26
|
}];
|
|
27
27
|
const contentDiv = ['div', {
|
|
@@ -29,7 +29,7 @@ export const panelAttrsToDom = (attrs, allowCustomPanel) => {
|
|
|
29
29
|
}, 0];
|
|
30
30
|
|
|
31
31
|
if (hasIcon) {
|
|
32
|
-
return ['div', panelAttrs,
|
|
32
|
+
return ['div', panelAttrs, iconDiv, contentDiv];
|
|
33
33
|
} else {
|
|
34
34
|
return ['div', panelAttrs, contentDiv];
|
|
35
35
|
}
|
|
@@ -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
|
const arrayReplaceAt = (src, pos, newElements) => {
|
|
@@ -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
|
|
@@ -3,6 +3,8 @@ import { StatusSharedCssClassName } from '@atlaskit/editor-common';
|
|
|
3
3
|
import { SelectionStyle, getSelectionStyles, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
export const statusStyles = css`
|
|
5
5
|
.${StatusSharedCssClassName.STATUS_CONTAINER} {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
|
|
6
8
|
> span {
|
|
7
9
|
display: inline-block;
|
|
8
10
|
cursor: pointer;
|
|
@@ -462,10 +462,26 @@ export class TableRowNodeView {
|
|
|
462
462
|
* so it should be safe to ignore mutations that we cause
|
|
463
463
|
* by updating styles and classnames on this DOM element
|
|
464
464
|
*
|
|
465
|
-
* Update: should
|
|
465
|
+
* Update: should not ignore mutations for row selection to avoid known issue with table selection highlight in firefox
|
|
466
466
|
* Related bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1289673
|
|
467
467
|
* */
|
|
468
|
-
|
|
468
|
+
const isTableSelection = mutationRecord.type === 'selection' && mutationRecord.target.nodeName === 'TR';
|
|
469
|
+
/**
|
|
470
|
+
* Update: should not ignore mutations when an node is added, as this interferes with
|
|
471
|
+
* prosemirrors handling of some language inputs in Safari (ie. Pinyin, Hiragana).
|
|
472
|
+
*
|
|
473
|
+
* In paticular, when a composition occurs at the start of the first node inside a table cell, if the resulting mutation
|
|
474
|
+
* from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
|
|
475
|
+
* selection and insertion.
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
const isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
|
|
479
|
+
|
|
480
|
+
if (isTableSelection || isNodeInsertion) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return true;
|
|
469
485
|
}
|
|
470
486
|
/* receive external events */
|
|
471
487
|
|
|
@@ -0,0 +1,60 @@
|
|
|
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 let 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
|
+
const CoreRenderCountProfiler = ({
|
|
17
|
+
componentId
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
current: instanceId
|
|
21
|
+
} = useRef(uuid());
|
|
22
|
+
|
|
23
|
+
const onRender = ({
|
|
24
|
+
renderCount
|
|
25
|
+
}) => {
|
|
26
|
+
const profiler = RenderCountProfilerClass.getInstance({
|
|
27
|
+
store: window
|
|
28
|
+
});
|
|
29
|
+
profiler.setRenderCount({
|
|
30
|
+
componentId,
|
|
31
|
+
instanceId,
|
|
32
|
+
renderCount
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
useComponentRenderTracking({
|
|
37
|
+
onRender,
|
|
38
|
+
propsDiffingOptions: {
|
|
39
|
+
enabled: false
|
|
40
|
+
},
|
|
41
|
+
zeroBasedCount: false
|
|
42
|
+
});
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const RenderCountProfiler = ({
|
|
47
|
+
componentId
|
|
48
|
+
}) => {
|
|
49
|
+
const profiler = RenderCountProfilerClass.getInstance({
|
|
50
|
+
store: window
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (profiler.isEnabled()) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(CoreRenderCountProfiler, {
|
|
55
|
+
componentId: componentId
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
@@ -37,7 +37,7 @@ const CommentEditor = styled.div`
|
|
|
37
37
|
/* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */
|
|
38
38
|
min-height: 150px;
|
|
39
39
|
height: auto;
|
|
40
|
-
|
|
40
|
+
background-color: white;
|
|
41
41
|
border: 1px solid ${N40};
|
|
42
42
|
box-sizing: border-box;
|
|
43
43
|
border-radius: ${borderRadius()}px;
|
|
@@ -51,6 +51,7 @@ const ContentArea = styled(ContentStyles)`
|
|
|
51
51
|
overflow-x: hidden;
|
|
52
52
|
overflow-y: auto;
|
|
53
53
|
line-height: 24px;
|
|
54
|
+
${props => props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : ''};
|
|
54
55
|
|
|
55
56
|
/** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/
|
|
56
57
|
/** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/
|
|
@@ -155,7 +156,8 @@ class Editor extends React.Component {
|
|
|
155
156
|
innerRef: ref => this.containerElement = ref,
|
|
156
157
|
className: classnames('ak-editor-content-area', {
|
|
157
158
|
'less-margin': width < akEditorMobileBreakoutPoint
|
|
158
|
-
})
|
|
159
|
+
}),
|
|
160
|
+
maxHeight: maxHeight
|
|
159
161
|
}, customContentComponents, /*#__PURE__*/React.createElement(PluginSlot, {
|
|
160
162
|
editorView: editorView,
|
|
161
163
|
editorActions: editorActions,
|
|
@@ -1,33 +1,66 @@
|
|
|
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
|
+
export function useComponentRenderTracking({
|
|
6
|
+
onRender,
|
|
7
|
+
propsDiffingOptions,
|
|
8
|
+
zeroBasedCount = true
|
|
9
|
+
}) {
|
|
5
10
|
const propsRef = useRef();
|
|
6
|
-
const renderCountRef = useRef(0);
|
|
11
|
+
const renderCountRef = useRef(zeroBasedCount ? 0 : 1);
|
|
7
12
|
useEffect(() => {
|
|
8
13
|
const lastProps = propsRef.current;
|
|
9
14
|
const renderCount = renderCountRef.current;
|
|
15
|
+
let propsDifference;
|
|
10
16
|
|
|
11
|
-
if (lastProps) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
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
|
+
const result = {
|
|
22
|
+
renderCount,
|
|
23
|
+
propsDifference
|
|
24
|
+
};
|
|
25
|
+
onRender(result);
|
|
26
|
+
|
|
27
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
|
|
28
|
+
propsRef.current = propsDiffingOptions.props;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
propsRef.current = props;
|
|
27
31
|
renderCountRef.current = renderCountRef.current + 1;
|
|
28
32
|
}); // No dependencies run on each render
|
|
29
33
|
}
|
|
30
34
|
export function RenderTracking(props) {
|
|
31
|
-
|
|
35
|
+
const debouncedHandleAnalyticsEvent = useMemo(() => debounce(props.handleAnalyticsEvent, 500), [props.handleAnalyticsEvent]);
|
|
36
|
+
useComponentRenderTracking({
|
|
37
|
+
onRender: ({
|
|
38
|
+
renderCount,
|
|
39
|
+
propsDifference
|
|
40
|
+
}) => {
|
|
41
|
+
if (!renderCount) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
debouncedHandleAnalyticsEvent({
|
|
46
|
+
payload: {
|
|
47
|
+
action: props.action,
|
|
48
|
+
actionSubject: props.actionSubject,
|
|
49
|
+
attributes: {
|
|
50
|
+
count: renderCount,
|
|
51
|
+
propsDifference: propsDifference
|
|
52
|
+
},
|
|
53
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
propsDiffingOptions: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
props: props.componentProps,
|
|
60
|
+
propsToIgnore: props.propsToIgnore,
|
|
61
|
+
useShallow: props.useShallow
|
|
62
|
+
},
|
|
63
|
+
zeroBasedCount: true
|
|
64
|
+
});
|
|
32
65
|
return null;
|
|
33
66
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -4,7 +4,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import { Node } from 'prosemirror-model';
|
|
7
|
-
import { TextSelection
|
|
7
|
+
import { TextSelection } from 'prosemirror-state';
|
|
8
8
|
import { toJSON } from '../utils';
|
|
9
9
|
import { processRawValue, isEmptyDocument } from '../utils/document';
|
|
10
10
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
|
|
@@ -244,31 +244,13 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
244
244
|
return false;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return false;
|
|
253
|
-
} // In case of replacing a whole document, we only need a content of a top level node e.g. document.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content.content);
|
|
257
|
-
|
|
258
|
-
if (!shouldScrollToBottom && !tr.selectionSet) {
|
|
259
|
-
// Restore selection at start of document instead of the end.
|
|
260
|
-
tr.setSelection(Selection.atStart(tr.doc));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (shouldScrollToBottom) {
|
|
264
|
-
tr = tr.scrollIntoView();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (!shouldAddToHistory) {
|
|
268
|
-
tr.setMeta('addToHistory', false);
|
|
247
|
+
if (this.eventDispatcher) {
|
|
248
|
+
this.eventDispatcher.emit('resetEditorState', {
|
|
249
|
+
doc: rawValue,
|
|
250
|
+
shouldScrollToBottom: shouldScrollToBottom
|
|
251
|
+
});
|
|
269
252
|
}
|
|
270
253
|
|
|
271
|
-
this.editorView.dispatch(tr);
|
|
272
254
|
return true;
|
|
273
255
|
}
|
|
274
256
|
}, {
|