@atlaskit/editor-core 150.0.3 → 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 +47 -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/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/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/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/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/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/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/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/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/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/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/utils.d.ts +0 -21
- 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 +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 +19 -16
- 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
|
@@ -41,30 +41,35 @@ const isLayoutSupported = (state, selectedExtNode) => {
|
|
|
41
41
|
return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !hasParentNodeOfType([bodiedExtension, table, expand].filter(Boolean))(selection)) && !hasParentNodeOfType([layoutSection])(selection));
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const breakoutOptions = (state, formatMessage,
|
|
45
|
-
const nodeWithPos = getSelectedExtension(state, true);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
const breakoutOptions = (state, formatMessage, breakoutEnabled) => {
|
|
45
|
+
const nodeWithPos = getSelectedExtension(state, true); // we should only return breakout options when breakouts are enabled and the node supports them
|
|
46
|
+
|
|
47
|
+
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
|
|
48
|
+
const {
|
|
49
|
+
layout
|
|
50
|
+
} = nodeWithPos.node.attrs;
|
|
51
|
+
return [{
|
|
52
|
+
type: 'button',
|
|
53
|
+
icon: CenterIcon,
|
|
54
|
+
onClick: updateExtensionLayout('default'),
|
|
55
|
+
selected: layout === 'default',
|
|
56
|
+
title: formatMessage(commonMessages.layoutFixedWidth)
|
|
57
|
+
}, {
|
|
58
|
+
type: 'button',
|
|
59
|
+
icon: WideIcon,
|
|
60
|
+
onClick: updateExtensionLayout('wide'),
|
|
61
|
+
selected: layout === 'wide',
|
|
62
|
+
title: formatMessage(commonMessages.layoutWide)
|
|
63
|
+
}, {
|
|
64
|
+
type: 'button',
|
|
65
|
+
icon: FullWidthIcon,
|
|
66
|
+
onClick: updateExtensionLayout('full-width'),
|
|
67
|
+
selected: layout === 'full-width',
|
|
68
|
+
title: formatMessage(commonMessages.layoutFullWidth)
|
|
69
|
+
}];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return [];
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
const editButton = (formatMessage, extensionState) => {
|
|
@@ -99,7 +104,7 @@ export const getToolbarConfig = (breakoutEnabled = true) => (state, intl) => {
|
|
|
99
104
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
100
105
|
const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
|
|
101
106
|
const editButtonArray = editButton(formatMessage, extensionState);
|
|
102
|
-
const breakoutButtonArray = breakoutOptions(state, formatMessage,
|
|
107
|
+
const breakoutButtonArray = breakoutOptions(state, formatMessage, breakoutEnabled);
|
|
103
108
|
return {
|
|
104
109
|
title: 'Extension floating controls',
|
|
105
110
|
getDomRef: () => extensionState.element.parentElement || undefined,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
2
|
-
|
|
2
|
+
import { browser } from '@atlaskit/editor-common';
|
|
3
3
|
/**
|
|
4
4
|
* Transforms EditorProps to an FeatureFlags object,
|
|
5
5
|
* which is used by both current and archv3 editors.
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
export function createFeatureFlagsFromProps(props) {
|
|
8
|
-
var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25;
|
|
9
|
+
var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
12
|
+
return { ...normalizedFeatureFlags,
|
|
11
13
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
12
14
|
interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
|
|
13
15
|
placeholderBracketHint: !!props.placeholderBracketHint,
|
|
@@ -32,6 +34,8 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
32
34
|
errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.useErrorBoundaryDocStructure) : false),
|
|
33
35
|
synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.synchronyErrorDocStructure) : false),
|
|
34
36
|
enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.enableViewUpdateSubscription) : false),
|
|
35
|
-
collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false)
|
|
37
|
+
collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false),
|
|
38
|
+
ufo: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.ufo) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.ufo) : false),
|
|
39
|
+
codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false)
|
|
36
40
|
};
|
|
37
41
|
}
|
|
@@ -71,12 +71,17 @@ class Find extends React.Component {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
_defineProperty(this, "handleFindChange", event =>
|
|
74
|
+
_defineProperty(this, "handleFindChange", event => {
|
|
75
75
|
this.updateFindValue(event.target.value);
|
|
76
|
-
})
|
|
76
|
+
});
|
|
77
77
|
|
|
78
78
|
_defineProperty(this, "updateFindValue", value => {
|
|
79
|
-
this.
|
|
79
|
+
this.setState({
|
|
80
|
+
localFindText: value
|
|
81
|
+
});
|
|
82
|
+
this.skipWhileComposing(() => {
|
|
83
|
+
this.props.onFind(value);
|
|
84
|
+
});
|
|
80
85
|
});
|
|
81
86
|
|
|
82
87
|
_defineProperty(this, "handleFindKeyDown", event => this.skipWhileComposing(() => {
|
|
@@ -153,7 +158,13 @@ class Find extends React.Component {
|
|
|
153
158
|
});
|
|
154
159
|
this.closeIcon = /*#__PURE__*/React.createElement(EditorCloseIcon, {
|
|
155
160
|
label: this.closeFindReplaceDialog
|
|
156
|
-
});
|
|
161
|
+
}); // We locally manage the value of the input inside this component in order to support compositions.
|
|
162
|
+
// This requires some additional work inside componentDidUpdate to ensure we support changes that
|
|
163
|
+
// occur to this value which do not originate from this component.
|
|
164
|
+
|
|
165
|
+
this.state = {
|
|
166
|
+
localFindText: this.props.findText || ''
|
|
167
|
+
};
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
componentDidMount() {
|
|
@@ -162,7 +173,17 @@ class Find extends React.Component {
|
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
componentDidUpdate() {
|
|
165
|
-
this.focusFindTextfield();
|
|
176
|
+
this.focusFindTextfield(); // If the external prop findText changes and we aren't in a composition we should update to the
|
|
177
|
+
// use the external prop value.
|
|
178
|
+
//
|
|
179
|
+
// An example of where this may happen is when a find occurs through the user selecting some text
|
|
180
|
+
// and pressing Mod-f.
|
|
181
|
+
|
|
182
|
+
if (!this.isComposing && this.props.findText !== this.state.localFindText) {
|
|
183
|
+
this.setState({
|
|
184
|
+
localFindText: this.props.findText || ''
|
|
185
|
+
});
|
|
186
|
+
}
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
render() {
|
|
@@ -183,7 +204,7 @@ class Find extends React.Component {
|
|
|
183
204
|
name: "find",
|
|
184
205
|
appearance: "none",
|
|
185
206
|
placeholder: this.find,
|
|
186
|
-
value:
|
|
207
|
+
value: this.state.localFindText,
|
|
187
208
|
ref: this.findTextfieldRef,
|
|
188
209
|
autoComplete: "off",
|
|
189
210
|
onChange: this.handleFindChange,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from 'prosemirror-keymap';
|
|
2
|
+
import { getLinkMatch } from '@atlaskit/adf-schema';
|
|
2
3
|
import * as keymaps from '../../../keymaps';
|
|
3
|
-
import { getLinkMatch } from '../utils';
|
|
4
4
|
import { stateKey } from '../pm-plugins/main';
|
|
5
5
|
import { showLinkToolbar, hideLinkToolbar } from '../commands';
|
|
6
6
|
import { queueCards } from '../../card/pm-plugins/actions';
|
|
@@ -83,7 +83,8 @@ const mapActivityProviderResultToLinkSearchItemData = ({
|
|
|
83
83
|
container,
|
|
84
84
|
iconUrl,
|
|
85
85
|
url,
|
|
86
|
-
lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined
|
|
86
|
+
lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined,
|
|
87
|
+
prefetch: true
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
const mapSearchProviderResultToLinkSearchItemData = ({
|
|
@@ -99,7 +100,8 @@ const mapSearchProviderResultToLinkSearchItemData = ({
|
|
|
99
100
|
name: title,
|
|
100
101
|
url,
|
|
101
102
|
lastUpdatedDate: updatedTimestamp ? new Date(updatedTimestamp) : undefined,
|
|
102
|
-
icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon
|
|
103
|
+
icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon,
|
|
104
|
+
prefetch: false
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
@@ -344,7 +346,7 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
if (interaction === 'click' || this.isUrlPopulatedWithSelectedItem()) {
|
|
347
|
-
var _pluginState$searchSe3;
|
|
349
|
+
var _pluginState$searchSe3, _selectedItem$prefetc;
|
|
348
350
|
|
|
349
351
|
/**
|
|
350
352
|
* When it's a mouse click even or the selectedItem.url matches displayUrl, we think
|
|
@@ -361,7 +363,8 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
|
361
363
|
trigger: interaction,
|
|
362
364
|
resultCount: items.length,
|
|
363
365
|
selectedResultId: selectedItem.objectId,
|
|
364
|
-
selectedRelativePosition: selectedIndex
|
|
366
|
+
selectedRelativePosition: selectedIndex,
|
|
367
|
+
prefetch: (_selectedItem$prefetc = selectedItem.prefetch) !== null && _selectedItem$prefetc !== void 0 ? _selectedItem$prefetc : false
|
|
365
368
|
},
|
|
366
369
|
eventType: EVENT_TYPE.UI
|
|
367
370
|
});
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
import LinkifyIt from 'linkify-it';
|
|
2
1
|
import { mapSlice } from '../../utils/slice';
|
|
3
|
-
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
4
|
-
export const LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
|
|
5
|
-
const linkify = LinkifyIt();
|
|
6
|
-
linkify.add('sourcetree:', 'http:');
|
|
7
|
-
const tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
8
|
-
const tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
|
9
|
-
tlds.push(tlds2Char);
|
|
10
|
-
linkify.tlds(tlds, false);
|
|
11
|
-
export function getLinkMatch(str) {
|
|
12
|
-
if (!str) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let match = linkifyMatch(str);
|
|
17
|
-
|
|
18
|
-
if (!match.length) {
|
|
19
|
-
match = linkify.match(str);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return match && match[0];
|
|
23
|
-
}
|
|
2
|
+
import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
|
|
24
3
|
/**
|
|
25
4
|
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
|
|
26
5
|
* Hence it has been made similar to regex with an exec method.
|
|
@@ -81,8 +60,7 @@ export function normalizeUrl(url) {
|
|
|
81
60
|
return url;
|
|
82
61
|
}
|
|
83
62
|
|
|
84
|
-
|
|
85
|
-
return match && match.url || '';
|
|
63
|
+
return normaliseLinkHref(url);
|
|
86
64
|
}
|
|
87
65
|
export function linkifyContent(schema) {
|
|
88
66
|
return slice => mapSlice(slice, (node, parent) => {
|
|
@@ -148,38 +126,4 @@ function findLinkMatches(text) {
|
|
|
148
126
|
}
|
|
149
127
|
|
|
150
128
|
return matches;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const linkifyMatch = text => {
|
|
154
|
-
const matches = [];
|
|
155
|
-
|
|
156
|
-
if (!LINK_REGEXP.test(text)) {
|
|
157
|
-
return matches;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
let startpos = 0;
|
|
161
|
-
let substr;
|
|
162
|
-
|
|
163
|
-
while (substr = text.substr(startpos)) {
|
|
164
|
-
const link = (substr.match(LINK_REGEXP) || [''])[0];
|
|
165
|
-
|
|
166
|
-
if (link) {
|
|
167
|
-
const index = substr.search(LINK_REGEXP);
|
|
168
|
-
const start = index >= 0 ? index + startpos : index;
|
|
169
|
-
const end = start + link.length;
|
|
170
|
-
matches.push({
|
|
171
|
-
index: start,
|
|
172
|
-
lastIndex: end,
|
|
173
|
-
raw: link,
|
|
174
|
-
url: link,
|
|
175
|
-
text: link,
|
|
176
|
-
schema: ''
|
|
177
|
-
});
|
|
178
|
-
startpos += end;
|
|
179
|
-
} else {
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return matches;
|
|
185
|
-
};
|
|
129
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { media, mediaGroup, mediaSingle, mediaSingleWithCaption } from '@atlaskit/adf-schema';
|
|
2
|
+
import { media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline } from '@atlaskit/adf-schema';
|
|
3
3
|
import { stateKey as pluginKey, createPlugin } from './pm-plugins/main';
|
|
4
4
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
5
5
|
import { createPlugin as createMediaEditorPlugin } from './pm-plugins/media-editor';
|
|
@@ -21,6 +21,7 @@ import MediaEditor from './ui/MediaEditor';
|
|
|
21
21
|
import { MediaPickerComponents } from './ui/MediaPicker';
|
|
22
22
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
23
23
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
24
|
+
import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
24
25
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
25
26
|
|
|
26
27
|
const mediaPlugin = options => ({
|
|
@@ -30,6 +31,7 @@ const mediaPlugin = options => ({
|
|
|
30
31
|
const {
|
|
31
32
|
allowMediaGroup = true,
|
|
32
33
|
allowMediaSingle = false,
|
|
34
|
+
allowMediaInline = false,
|
|
33
35
|
featureFlags
|
|
34
36
|
} = options || {};
|
|
35
37
|
const captions = getMediaFeatureFlag('captions', featureFlags);
|
|
@@ -43,6 +45,9 @@ const mediaPlugin = options => ({
|
|
|
43
45
|
}, {
|
|
44
46
|
name: 'media',
|
|
45
47
|
node: media
|
|
48
|
+
}, {
|
|
49
|
+
name: 'mediaInline',
|
|
50
|
+
node: mediaInline
|
|
46
51
|
}].filter(node => {
|
|
47
52
|
if (node.name === 'mediaGroup') {
|
|
48
53
|
return allowMediaGroup;
|
|
@@ -52,6 +57,10 @@ const mediaPlugin = options => ({
|
|
|
52
57
|
return allowMediaSingle;
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
if (node.name === 'mediaInline') {
|
|
61
|
+
return allowMediaInline;
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
return true;
|
|
56
65
|
});
|
|
57
66
|
},
|
|
@@ -73,7 +82,8 @@ const mediaPlugin = options => ({
|
|
|
73
82
|
nodeViews: {
|
|
74
83
|
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
75
84
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options),
|
|
76
|
-
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options)
|
|
85
|
+
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
86
|
+
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory)
|
|
77
87
|
},
|
|
78
88
|
errorReporter,
|
|
79
89
|
uploadErrorHandler: options && options.uploadErrorHandler,
|
|
@@ -197,8 +207,7 @@ const mediaPlugin = options => ({
|
|
|
197
207
|
action(insert, state) {
|
|
198
208
|
const pluginState = pluginKey.getState(state);
|
|
199
209
|
pluginState.showMediaPicker();
|
|
200
|
-
|
|
201
|
-
return addAnalytics(state, tr, {
|
|
210
|
+
return addAnalytics(state, insert(''), {
|
|
202
211
|
action: ACTION.OPENED,
|
|
203
212
|
actionSubject: ACTION_SUBJECT.PICKER,
|
|
204
213
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -111,6 +111,21 @@ export default class MediaGroup extends React.Component {
|
|
|
111
111
|
// We declared this to get a fresh position every time
|
|
112
112
|
const getNodePos = () => {
|
|
113
113
|
return getPos() + idx + 1;
|
|
114
|
+
}; // Media Inline creates a floating toolbar with the same options, excludes these options if enabled
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
const mediaInlineOptions = (allowMediaInline = false) => {
|
|
118
|
+
if (!allowMediaInline) {
|
|
119
|
+
return {
|
|
120
|
+
shouldEnableDownloadButton: mediaOptions.enableDownloadButton,
|
|
121
|
+
actions: [{
|
|
122
|
+
handler: disabled ? () => {} : this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
|
|
123
|
+
icon: /*#__PURE__*/React.createElement(EditorCloseIcon, {
|
|
124
|
+
label: "delete"
|
|
125
|
+
})
|
|
126
|
+
}]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
114
129
|
};
|
|
115
130
|
|
|
116
131
|
return {
|
|
@@ -120,13 +135,7 @@ export default class MediaGroup extends React.Component {
|
|
|
120
135
|
onClick: () => {
|
|
121
136
|
setNodeSelection(this.props.view, getNodePos());
|
|
122
137
|
},
|
|
123
|
-
|
|
124
|
-
actions: [{
|
|
125
|
-
handler: disabled ? () => {} : this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
|
|
126
|
-
icon: /*#__PURE__*/React.createElement(EditorCloseIcon, {
|
|
127
|
-
label: "delete"
|
|
128
|
-
})
|
|
129
|
-
}]
|
|
138
|
+
...mediaInlineOptions(mediaOptions.allowMediaInline)
|
|
130
139
|
};
|
|
131
140
|
});
|
|
132
141
|
return /*#__PURE__*/React.createElement(Filmstrip, {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { ReactNodeView } from '../../../nodeviews/';
|
|
3
|
+
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
4
|
+
import { WithProviders } from '@atlaskit/editor-common';
|
|
5
|
+
export const MediaInline = props => {
|
|
6
|
+
const [viewMediaClientConfig, setViewMediaClientConfig] = useState({});
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
updateViewMediaClientConfig(props);
|
|
9
|
+
}, [props]);
|
|
10
|
+
|
|
11
|
+
const updateViewMediaClientConfig = async props => {
|
|
12
|
+
const mediaProvider = await props.mediaProvider;
|
|
13
|
+
|
|
14
|
+
if (mediaProvider) {
|
|
15
|
+
const viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
16
|
+
setViewMediaClientConfig(viewMediaClientConfig);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
id,
|
|
22
|
+
collection
|
|
23
|
+
} = props.node.attrs;
|
|
24
|
+
const identifier = {
|
|
25
|
+
id,
|
|
26
|
+
mediaItemType: 'file',
|
|
27
|
+
collectionName: collection
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
30
|
+
identifier: identifier,
|
|
31
|
+
mediaClientConfig: viewMediaClientConfig
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export class MediaInlineNodeView extends ReactNodeView {
|
|
35
|
+
createDomRef() {
|
|
36
|
+
const domRef = document.createElement('span');
|
|
37
|
+
domRef.contentEditable = 'false';
|
|
38
|
+
return domRef;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getContentDOM() {
|
|
42
|
+
const dom = document.createElement('span');
|
|
43
|
+
return {
|
|
44
|
+
dom
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ignoreMutation() {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
viewShouldUpdate(nextNode) {
|
|
53
|
+
if (this.node.attrs !== nextNode.attrs) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render(props) {
|
|
61
|
+
const {
|
|
62
|
+
providerFactory
|
|
63
|
+
} = props;
|
|
64
|
+
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
65
|
+
providers: ['mediaProvider'],
|
|
66
|
+
providerFactory: providerFactory,
|
|
67
|
+
renderNode: ({
|
|
68
|
+
mediaProvider
|
|
69
|
+
}) => {
|
|
70
|
+
if (!mediaProvider) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/React.createElement(MediaInline, {
|
|
75
|
+
identifier: this.node.attrs.id,
|
|
76
|
+
mediaProvider: mediaProvider,
|
|
77
|
+
node: this.node
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory) => (node, view, getPos) => {
|
|
85
|
+
return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
86
|
+
providerFactory
|
|
87
|
+
}).init();
|
|
88
|
+
};
|
|
@@ -9,14 +9,15 @@ import assert from 'assert';
|
|
|
9
9
|
import { findDomRefAtPos, isNodeSelection } from 'prosemirror-utils';
|
|
10
10
|
import { insertMediaSingleNode, isMediaSingle } from '../utils/media-single';
|
|
11
11
|
import DropPlaceholder from '../ui/Media/DropPlaceholder';
|
|
12
|
-
import { insertMediaGroupNode } from '../utils/media-files';
|
|
13
|
-
import { removeMediaNode, splitMediaGroup } from '../utils/media-common';
|
|
12
|
+
import { insertMediaGroupNode, insertMediaInlineNode, canInsertMediaInline } from '../utils/media-files';
|
|
13
|
+
import { isInsidePotentialEmptyParagraph, removeMediaNode, splitMediaGroup } from '../utils/media-common';
|
|
14
14
|
import * as helpers from '../commands/helpers';
|
|
15
15
|
import { updateMediaNodeAttrs } from '../commands/helpers';
|
|
16
16
|
import { stateKey } from './plugin-key';
|
|
17
17
|
import PickerFacade from '../picker-facade';
|
|
18
18
|
import { INPUT_METHOD } from '../../analytics/types';
|
|
19
19
|
import { isImage } from '../utils/is-image';
|
|
20
|
+
import { isInEmptyLine } from '../../../utils/document';
|
|
20
21
|
export { stateKey } from './plugin-key';
|
|
21
22
|
|
|
22
23
|
const createDropPlaceholder = allowDropLine => {
|
|
@@ -60,7 +61,7 @@ export class MediaPluginStateImplementation {
|
|
|
60
61
|
|
|
61
62
|
_defineProperty(this, "removeOnCloseListener", () => {});
|
|
62
63
|
|
|
63
|
-
_defineProperty(this, "
|
|
64
|
+
_defineProperty(this, "onPopupToggleCallback", () => {});
|
|
64
65
|
|
|
65
66
|
_defineProperty(this, "pickers", []);
|
|
66
67
|
|
|
@@ -151,12 +152,13 @@ export class MediaPluginStateImplementation {
|
|
|
151
152
|
var _this$mediaOptions;
|
|
152
153
|
|
|
153
154
|
const {
|
|
155
|
+
mediaInline,
|
|
154
156
|
mediaSingle,
|
|
155
157
|
media
|
|
156
158
|
} = this.view.state.schema.nodes;
|
|
157
159
|
|
|
158
160
|
if ((_this$mediaOptions = this.mediaOptions) !== null && _this$mediaOptions !== void 0 && _this$mediaOptions.allowMediaInline) {
|
|
159
|
-
return type === mediaSingle || type === media;
|
|
161
|
+
return type === mediaSingle || type === media || type === mediaInline;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
return type === mediaSingle;
|
|
@@ -165,6 +167,11 @@ export class MediaPluginStateImplementation {
|
|
|
165
167
|
_defineProperty(this, "hasUserAuthProvider", () => !!this.uploadMediaClientConfig && !!this.uploadMediaClientConfig.userAuthProvider);
|
|
166
168
|
|
|
167
169
|
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType) => {
|
|
170
|
+
var _this$mediaOptions2;
|
|
171
|
+
|
|
172
|
+
const {
|
|
173
|
+
state
|
|
174
|
+
} = this.view;
|
|
168
175
|
const mediaStateWithContext = { ...mediaState,
|
|
169
176
|
contextId: this.contextIdentifierProvider ? this.contextIdentifierProvider.objectId : undefined
|
|
170
177
|
};
|
|
@@ -185,8 +192,10 @@ export class MediaPluginStateImplementation {
|
|
|
185
192
|
});
|
|
186
193
|
}
|
|
187
194
|
|
|
188
|
-
if (isMediaSingle(
|
|
195
|
+
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
189
196
|
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert);
|
|
197
|
+
} else if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInline && !isInEmptyLine(state) && !isInsidePotentialEmptyParagraph(state) && canInsertMediaInline(state)) {
|
|
198
|
+
insertMediaInlineNode(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
190
199
|
} else {
|
|
191
200
|
insertMediaGroupNode(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
192
201
|
} // do events when media state changes
|
|
@@ -234,7 +243,7 @@ export class MediaPluginStateImplementation {
|
|
|
234
243
|
_defineProperty(this, "splitMediaGroup", () => splitMediaGroup(this.view));
|
|
235
244
|
|
|
236
245
|
_defineProperty(this, "onPopupPickerClose", () => {
|
|
237
|
-
this.
|
|
246
|
+
this.onPopupToggleCallback(false);
|
|
238
247
|
});
|
|
239
248
|
|
|
240
249
|
_defineProperty(this, "shouldUseMediaPickerPopup", () => {
|
|
@@ -255,15 +264,15 @@ export class MediaPluginStateImplementation {
|
|
|
255
264
|
}
|
|
256
265
|
|
|
257
266
|
this.popupPicker.show();
|
|
258
|
-
this.
|
|
267
|
+
this.onPopupToggleCallback(true);
|
|
259
268
|
});
|
|
260
269
|
|
|
261
270
|
_defineProperty(this, "setBrowseFn", browseFn => {
|
|
262
271
|
this.openMediaPickerBrowser = browseFn;
|
|
263
272
|
});
|
|
264
273
|
|
|
265
|
-
_defineProperty(this, "onPopupToggle",
|
|
266
|
-
this.
|
|
274
|
+
_defineProperty(this, "onPopupToggle", onPopupToggleCallback => {
|
|
275
|
+
this.onPopupToggleCallback = onPopupToggleCallback;
|
|
267
276
|
});
|
|
268
277
|
|
|
269
278
|
_defineProperty(this, "waitForPendingTasks", (timeout, lastTask) => {
|
|
@@ -482,7 +491,7 @@ export class MediaPluginStateImplementation {
|
|
|
482
491
|
}
|
|
483
492
|
|
|
484
493
|
getDomElement(domAtPos) {
|
|
485
|
-
var _this$
|
|
494
|
+
var _this$mediaOptions3;
|
|
486
495
|
|
|
487
496
|
const {
|
|
488
497
|
selection
|
|
@@ -496,7 +505,7 @@ export class MediaPluginStateImplementation {
|
|
|
496
505
|
return;
|
|
497
506
|
}
|
|
498
507
|
|
|
499
|
-
const position = (_this$
|
|
508
|
+
const position = (_this$mediaOptions3 = this.mediaOptions) !== null && _this$mediaOptions3 !== void 0 && _this$mediaOptions3.allowMediaInline ? selection.from + 1 : selection.from;
|
|
500
509
|
const node = findDomRefAtPos(position, domAtPos);
|
|
501
510
|
|
|
502
511
|
if (node) {
|