@atlaskit/editor-core 187.31.7 → 187.32.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 +40 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/cjs/plugins/analytics/plugin.js +14 -12
- package/dist/cjs/plugins/annotation/index.js +15 -13
- package/dist/cjs/plugins/avatar-group/index.js +16 -14
- package/dist/cjs/plugins/base/plugin.js +12 -10
- package/dist/cjs/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/cjs/plugins/block-type/index.js +32 -30
- package/dist/cjs/plugins/breakout/index.js +10 -8
- package/dist/cjs/plugins/caption/index.js +7 -6
- package/dist/cjs/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/code-bidi-warning/index.js +2 -4
- package/dist/cjs/plugins/code-block/index.js +14 -11
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/cjs/plugins/collab-edit/index.js +16 -14
- package/dist/cjs/plugins/collab-edit/plugin.js +5 -5
- package/dist/cjs/plugins/date/index.js +18 -17
- package/dist/cjs/plugins/emoji/index.js +35 -33
- package/dist/cjs/plugins/expand/index.js +14 -13
- package/dist/cjs/plugins/extension/index.js +16 -15
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/feedback-dialog/index.js +5 -4
- package/dist/cjs/plugins/find-replace/index.js +17 -15
- package/dist/cjs/plugins/floating-toolbar/index.js +31 -30
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +29 -24
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- package/dist/cjs/plugins/help-dialog/index.js +18 -17
- package/dist/cjs/plugins/insert-block/index.js +52 -51
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/cjs/plugins/layout/index.js +15 -14
- package/dist/cjs/plugins/max-content-size/index.js +4 -3
- package/dist/cjs/plugins/media/index.js +49 -47
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +7 -7
- package/dist/cjs/plugins/media/toolbar/index.js +29 -24
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -4
- package/dist/cjs/plugins/media/toolbar/utils.js +22 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/cjs/plugins/media/utils/media-single.js +19 -4
- package/dist/cjs/plugins/mentions/index.js +17 -15
- package/dist/cjs/plugins/panel/index.js +13 -12
- package/dist/cjs/plugins/paste/index.js +13 -10
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/cjs/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/cjs/plugins/placeholder/index.js +9 -7
- package/dist/cjs/plugins/placeholder-text/index.js +23 -16
- package/dist/cjs/plugins/quick-insert/index.js +13 -12
- package/dist/cjs/plugins/rule/index.js +8 -7
- package/dist/cjs/plugins/save-on-enter/index.js +4 -3
- package/dist/cjs/plugins/selection/index.js +5 -4
- package/dist/cjs/plugins/status/index.js +20 -14
- package/dist/cjs/plugins/submit-editor/index.js +4 -3
- package/dist/cjs/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/cjs/plugins/text-color/index.js +17 -15
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/cjs/plugins/type-ahead/index.js +21 -20
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/cjs/ui/ToolbarFeedback/index.js +1 -1
- package/dist/cjs/use-preset.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/plugins/analytics/plugin.js +11 -8
- package/dist/es2019/plugins/annotation/index.js +4 -1
- package/dist/es2019/plugins/avatar-group/index.js +8 -5
- package/dist/es2019/plugins/base/plugin.js +6 -3
- package/dist/es2019/plugins/before-primaryToolbar/index.js +4 -2
- package/dist/es2019/plugins/block-type/index.js +14 -11
- package/dist/es2019/plugins/breakout/index.js +6 -3
- package/dist/es2019/plugins/caption/index.js +3 -1
- package/dist/es2019/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/code-bidi-warning/index.js +2 -4
- package/dist/es2019/plugins/code-block/index.js +15 -9
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/es2019/plugins/collab-edit/index.js +9 -6
- package/dist/es2019/plugins/collab-edit/plugin.js +5 -5
- package/dist/es2019/plugins/date/index.js +6 -3
- package/dist/es2019/plugins/emoji/index.js +16 -13
- package/dist/es2019/plugins/expand/index.js +7 -4
- package/dist/es2019/plugins/extension/index.js +11 -8
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/feedback-dialog/index.js +4 -2
- package/dist/es2019/plugins/find-replace/index.js +8 -5
- package/dist/es2019/plugins/floating-toolbar/index.js +6 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +9 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +4 -4
- package/dist/es2019/plugins/help-dialog/index.js +9 -6
- package/dist/es2019/plugins/insert-block/index.js +12 -9
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/max-content-size/index.js +3 -1
- package/dist/es2019/plugins/media/index.js +14 -10
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
- package/dist/es2019/plugins/media/toolbar/index.js +29 -25
- package/dist/es2019/plugins/media/toolbar/linking.js +4 -4
- package/dist/es2019/plugins/media/toolbar/utils.js +18 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/es2019/plugins/media/utils/media-single.js +22 -4
- package/dist/es2019/plugins/mentions/index.js +9 -6
- package/dist/es2019/plugins/panel/index.js +5 -2
- package/dist/es2019/plugins/paste/index.js +9 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/es2019/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/es2019/plugins/placeholder/index.js +10 -7
- package/dist/es2019/plugins/placeholder-text/index.js +12 -4
- package/dist/es2019/plugins/quick-insert/index.js +3 -1
- package/dist/es2019/plugins/rule/index.js +5 -3
- package/dist/es2019/plugins/save-on-enter/index.js +3 -1
- package/dist/es2019/plugins/selection/index.js +3 -1
- package/dist/es2019/plugins/status/index.js +11 -3
- package/dist/es2019/plugins/submit-editor/index.js +3 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +6 -4
- package/dist/es2019/plugins/text-color/index.js +6 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +9 -5
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/es2019/plugins/type-ahead/index.js +3 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
- package/dist/es2019/use-preset.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/plugins/analytics/plugin.js +14 -12
- package/dist/esm/plugins/annotation/index.js +15 -13
- package/dist/esm/plugins/avatar-group/index.js +16 -14
- package/dist/esm/plugins/base/plugin.js +12 -10
- package/dist/esm/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/esm/plugins/block-type/index.js +32 -30
- package/dist/esm/plugins/breakout/index.js +10 -8
- package/dist/esm/plugins/caption/index.js +7 -6
- package/dist/esm/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/code-bidi-warning/index.js +2 -4
- package/dist/esm/plugins/code-block/index.js +14 -11
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/esm/plugins/collab-edit/index.js +16 -14
- package/dist/esm/plugins/collab-edit/plugin.js +5 -5
- package/dist/esm/plugins/date/index.js +18 -17
- package/dist/esm/plugins/emoji/index.js +35 -33
- package/dist/esm/plugins/expand/index.js +14 -13
- package/dist/esm/plugins/extension/index.js +16 -15
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/feedback-dialog/index.js +5 -4
- package/dist/esm/plugins/find-replace/index.js +17 -15
- package/dist/esm/plugins/floating-toolbar/index.js +31 -30
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +28 -23
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +4 -4
- package/dist/esm/plugins/help-dialog/index.js +18 -17
- package/dist/esm/plugins/insert-block/index.js +52 -51
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/esm/plugins/layout/index.js +15 -14
- package/dist/esm/plugins/max-content-size/index.js +4 -3
- package/dist/esm/plugins/media/index.js +49 -47
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/media/toolbar/index.js +30 -25
- package/dist/esm/plugins/media/toolbar/linking.js +4 -4
- package/dist/esm/plugins/media/toolbar/utils.js +19 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/esm/plugins/media/utils/media-single.js +19 -4
- package/dist/esm/plugins/mentions/index.js +17 -15
- package/dist/esm/plugins/panel/index.js +13 -12
- package/dist/esm/plugins/paste/index.js +13 -10
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/esm/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/esm/plugins/placeholder/index.js +9 -7
- package/dist/esm/plugins/placeholder-text/index.js +23 -16
- package/dist/esm/plugins/quick-insert/index.js +13 -12
- package/dist/esm/plugins/rule/index.js +8 -7
- package/dist/esm/plugins/save-on-enter/index.js +4 -3
- package/dist/esm/plugins/selection/index.js +5 -4
- package/dist/esm/plugins/status/index.js +20 -14
- package/dist/esm/plugins/submit-editor/index.js +4 -3
- package/dist/esm/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/esm/plugins/text-color/index.js +17 -15
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/esm/plugins/type-ahead/index.js +21 -20
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/use-preset.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +62 -618
- package/dist/types/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types/plugins/media/types.d.ts +1 -0
- package/dist/types/plugins/selection/index.d.ts +2 -2
- package/dist/types/plugins/text-color/index.d.ts +3 -2
- package/dist/types/use-preset.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +96 -716
- package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/selection/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-color/index.d.ts +3 -2
- package/dist/types-ts4.5/use-preset.d.ts +2 -2
- package/package.json +3 -3
|
@@ -22,7 +22,7 @@ import { EmojiPickerButton } from './EmojiPickerButton';
|
|
|
22
22
|
import { injectIntl } from 'react-intl-next';
|
|
23
23
|
import messages from './messages';
|
|
24
24
|
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
25
|
-
import ScrollButtons from './ScrollButtons';
|
|
25
|
+
import { ScrollButtons } from './ScrollButtons';
|
|
26
26
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
27
27
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
28
28
|
const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
@@ -49,7 +49,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
49
49
|
useSomewhatSemanticTextColorNames: false
|
|
50
50
|
};
|
|
51
51
|
return jsx(ButtonGroup, null, items.filter(item => !item.hidden).map((item, idx) => {
|
|
52
|
-
var _api$
|
|
52
|
+
var _api$contextPanel;
|
|
53
53
|
switch (item.type) {
|
|
54
54
|
case 'button':
|
|
55
55
|
const ButtonIcon = item.icon;
|
|
@@ -206,7 +206,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
206
206
|
editorView: editorView,
|
|
207
207
|
extensionProvider: extensionsProvider,
|
|
208
208
|
separator: item.separator,
|
|
209
|
-
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$
|
|
209
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange
|
|
210
210
|
});
|
|
211
211
|
case 'separator':
|
|
212
212
|
return jsx(Separator, {
|
|
@@ -373,7 +373,7 @@ class Toolbar extends Component {
|
|
|
373
373
|
if (table) {
|
|
374
374
|
return clearHoverSelection()(state, dispatch);
|
|
375
375
|
}
|
|
376
|
-
(_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.
|
|
376
|
+
(_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.decorations.actions.removeDecoration(state, dispatch);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
setDisableScroll(disabled) {
|
|
@@ -35,7 +35,10 @@ export function createPlugin(dispatch, imageEnabled) {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
const helpDialog = (
|
|
38
|
+
const helpDialog = ({
|
|
39
|
+
config: imageUploadProviderExists = false,
|
|
40
|
+
api
|
|
41
|
+
}) => ({
|
|
39
42
|
name: 'helpDialog',
|
|
40
43
|
pmPlugins() {
|
|
41
44
|
return [{
|
|
@@ -46,8 +49,8 @@ const helpDialog = (imageUploadProviderExists = false, api) => ({
|
|
|
46
49
|
}, {
|
|
47
50
|
name: 'helpDialogKeymap',
|
|
48
51
|
plugin: () => {
|
|
49
|
-
var _api$
|
|
50
|
-
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
52
|
+
var _api$analytics;
|
|
53
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
51
54
|
}
|
|
52
55
|
}];
|
|
53
56
|
},
|
|
@@ -65,10 +68,10 @@ const helpDialog = (imageUploadProviderExists = false, api) => ({
|
|
|
65
68
|
label: ""
|
|
66
69
|
}),
|
|
67
70
|
action(insert) {
|
|
68
|
-
var _api$
|
|
71
|
+
var _api$analytics2;
|
|
69
72
|
const tr = insert('');
|
|
70
73
|
openHelpCommand(tr);
|
|
71
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
74
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
72
75
|
action: ACTION.HELP_OPENED,
|
|
73
76
|
actionSubject: ACTION_SUBJECT.HELP,
|
|
74
77
|
actionSubjectId: ACTION_SUBJECT_ID.HELP_QUICK_INSERT,
|
|
@@ -93,7 +96,7 @@ const helpDialog = (imageUploadProviderExists = false, api) => ({
|
|
|
93
96
|
}) => /*#__PURE__*/React.createElement(HelpDialogLoader, {
|
|
94
97
|
editorView: editorView,
|
|
95
98
|
isVisible: helpDialog.isVisible,
|
|
96
|
-
quickInsertEnabled: !!(api !== null && api !== void 0 && api.
|
|
99
|
+
quickInsertEnabled: !!(api !== null && api !== void 0 && api.quickInsert),
|
|
97
100
|
imageEnabled: helpDialog.imageEnabled
|
|
98
101
|
})
|
|
99
102
|
});
|
|
@@ -27,9 +27,12 @@ const toolbarSizeToButtons = toolbarSize => {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const insertBlockPlugin = (
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const insertBlockPlugin = ({
|
|
31
|
+
config: options = {},
|
|
32
|
+
api
|
|
33
|
+
}) => {
|
|
34
|
+
var _api$featureFlags;
|
|
35
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
33
36
|
return {
|
|
34
37
|
name: 'insertBlock',
|
|
35
38
|
primaryToolbarComponent({
|
|
@@ -118,7 +121,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
118
121
|
layoutState,
|
|
119
122
|
featureFlags
|
|
120
123
|
}) {
|
|
121
|
-
var _pluginInjectionApi$
|
|
124
|
+
var _pluginInjectionApi$a2, _pluginInjectionApi$i;
|
|
122
125
|
const buttons = toolbarSizeToButtons(toolbarSize);
|
|
123
126
|
const {
|
|
124
127
|
dateState,
|
|
@@ -133,9 +136,9 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
133
136
|
* @param name Block name
|
|
134
137
|
*/
|
|
135
138
|
const handleInsertBlockType = React.useCallback(name => {
|
|
136
|
-
var _pluginInjectionApi$
|
|
137
|
-
return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
138
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
139
|
+
var _pluginInjectionApi$a;
|
|
140
|
+
return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
|
|
141
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions]);
|
|
139
142
|
return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
|
|
140
143
|
pluginInjectionApi: pluginInjectionApi,
|
|
141
144
|
buttons: buttons,
|
|
@@ -155,9 +158,9 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
155
158
|
mediaUploadsEnabled: mediaState && mediaState.allowsUploads,
|
|
156
159
|
onShowMediaPicker: mediaState && mediaState.showMediaPicker,
|
|
157
160
|
mediaSupported: !!mediaState,
|
|
158
|
-
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.
|
|
161
|
+
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
159
162
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
160
|
-
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
163
|
+
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
161
164
|
availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
|
|
162
165
|
linkSupported: !!hyperlinkState,
|
|
163
166
|
linkDisabled: !hyperlinkState || !hyperlinkState.canInsertLink || !!hyperlinkState.activeLinkMark,
|
|
@@ -150,14 +150,14 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
_defineProperty(this, "toggleLinkPanel", inputMethod => {
|
|
153
|
-
var _pluginInjectionApi$
|
|
153
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$h;
|
|
154
154
|
const {
|
|
155
155
|
pluginInjectionApi
|
|
156
156
|
} = this.props;
|
|
157
|
-
return (_pluginInjectionApi$
|
|
157
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
158
158
|
});
|
|
159
159
|
_defineProperty(this, "insertMention", inputMethod => {
|
|
160
|
-
var _pluginInjectionApi$
|
|
160
|
+
var _pluginInjectionApi$m;
|
|
161
161
|
const {
|
|
162
162
|
editorView,
|
|
163
163
|
pluginInjectionApi
|
|
@@ -165,7 +165,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
165
165
|
if (!editorView) {
|
|
166
166
|
return true;
|
|
167
167
|
}
|
|
168
|
-
const pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
168
|
+
const pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mention) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.sharedState.currentState();
|
|
169
169
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
170
170
|
return false;
|
|
171
171
|
}
|
|
@@ -173,7 +173,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
173
173
|
return true;
|
|
174
174
|
});
|
|
175
175
|
_defineProperty(this, "insertTable", inputMethod => {
|
|
176
|
-
var _pluginInjectionApi$
|
|
176
|
+
var _pluginInjectionApi$t, _pluginInjectionApi$t2, _pluginInjectionApi$t3, _pluginInjectionApi$t4;
|
|
177
177
|
const {
|
|
178
178
|
pluginInjectionApi,
|
|
179
179
|
editorView
|
|
@@ -182,7 +182,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
182
182
|
state,
|
|
183
183
|
dispatch
|
|
184
184
|
} = editorView;
|
|
185
|
-
return (_pluginInjectionApi$
|
|
185
|
+
return (_pluginInjectionApi$t = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t2 = pluginInjectionApi.table) === null || _pluginInjectionApi$t2 === void 0 ? void 0 : (_pluginInjectionApi$t3 = (_pluginInjectionApi$t4 = _pluginInjectionApi$t2.actions).insertTable) === null || _pluginInjectionApi$t3 === void 0 ? void 0 : _pluginInjectionApi$t3.call(_pluginInjectionApi$t4, {
|
|
186
186
|
action: ACTION.INSERTED,
|
|
187
187
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
188
188
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -190,7 +190,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
190
190
|
inputMethod
|
|
191
191
|
},
|
|
192
192
|
eventType: EVENT_TYPE.TRACK
|
|
193
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$
|
|
193
|
+
})(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
|
|
194
194
|
});
|
|
195
195
|
_defineProperty(this, "createDate", inputMethod => {
|
|
196
196
|
const {
|
|
@@ -281,21 +281,21 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
281
281
|
return true;
|
|
282
282
|
});
|
|
283
283
|
_defineProperty(this, "handleSelectedEmoji", emojiId => {
|
|
284
|
-
var _pluginInjectionApi$
|
|
284
|
+
var _pluginInjectionApi$e;
|
|
285
285
|
const {
|
|
286
286
|
pluginInjectionApi
|
|
287
287
|
} = this.props;
|
|
288
288
|
this.props.editorView.focus();
|
|
289
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
289
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute((_pluginInjectionApi$e = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
290
290
|
this.toggleEmojiPicker();
|
|
291
291
|
return true;
|
|
292
292
|
});
|
|
293
293
|
_defineProperty(this, "openElementBrowser", () => {
|
|
294
|
-
var _pluginInjectionApi$
|
|
294
|
+
var _pluginInjectionApi$q;
|
|
295
295
|
const {
|
|
296
296
|
pluginInjectionApi
|
|
297
297
|
} = this.props;
|
|
298
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
298
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
299
299
|
});
|
|
300
300
|
_defineProperty(this, "onItemActivated", ({
|
|
301
301
|
item,
|
|
@@ -8,7 +8,10 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
8
8
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
9
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
10
|
export { pluginKey };
|
|
11
|
-
const layoutPlugin = (
|
|
11
|
+
const layoutPlugin = ({
|
|
12
|
+
config: options = {},
|
|
13
|
+
api
|
|
14
|
+
}) => ({
|
|
12
15
|
name: 'layout',
|
|
13
16
|
nodes() {
|
|
14
17
|
return [{
|
|
@@ -34,8 +37,8 @@ const layoutPlugin = (options = {}, api) => ({
|
|
|
34
37
|
allowSingleColumnLayout
|
|
35
38
|
} = pluginKey.getState(state);
|
|
36
39
|
if (pos !== null) {
|
|
37
|
-
var _api$
|
|
38
|
-
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$
|
|
40
|
+
var _api$decorations$acti;
|
|
41
|
+
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$decorations$acti = api.decorations.actions) === null || _api$decorations$acti === void 0 ? void 0 : _api$decorations$acti.hoverDecoration);
|
|
39
42
|
}
|
|
40
43
|
return undefined;
|
|
41
44
|
},
|
|
@@ -49,9 +52,9 @@ const layoutPlugin = (options = {}, api) => ({
|
|
|
49
52
|
priority: 1100,
|
|
50
53
|
icon: () => /*#__PURE__*/React.createElement(IconLayout, null),
|
|
51
54
|
action(insert, state) {
|
|
52
|
-
var _api$
|
|
55
|
+
var _api$analytics, _api$analytics$action;
|
|
53
56
|
const tr = insert(createDefaultLayoutSection(state));
|
|
54
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
57
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
55
58
|
action: ACTION.INSERTED,
|
|
56
59
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
57
60
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -19,7 +19,9 @@ export function createPlugin(dispatch, maxContentSize) {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
const maxContentSizePlugin =
|
|
22
|
+
const maxContentSizePlugin = ({
|
|
23
|
+
config: maxContentSize
|
|
24
|
+
}) => ({
|
|
23
25
|
name: 'maxContentSize',
|
|
24
26
|
pmPlugins() {
|
|
25
27
|
return [{
|
|
@@ -24,9 +24,12 @@ import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
|
24
24
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
import { stateKey } from './pm-plugins/plugin-key';
|
|
26
26
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
27
|
-
const mediaPlugin = (
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const mediaPlugin = ({
|
|
28
|
+
config: options = {},
|
|
29
|
+
api
|
|
30
|
+
}) => {
|
|
31
|
+
var _api$featureFlags;
|
|
32
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
30
33
|
return {
|
|
31
34
|
name: 'media',
|
|
32
35
|
getSharedState(editorState) {
|
|
@@ -109,8 +112,8 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
109
112
|
}, {
|
|
110
113
|
name: 'mediaKeymap',
|
|
111
114
|
plugin: () => {
|
|
112
|
-
var _api$
|
|
113
|
-
return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$
|
|
115
|
+
var _api$analytics;
|
|
116
|
+
return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
114
117
|
}
|
|
115
118
|
}];
|
|
116
119
|
if (options && options.allowMediaSingle) {
|
|
@@ -131,8 +134,8 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
131
134
|
plugin: ({
|
|
132
135
|
schema
|
|
133
136
|
}) => {
|
|
134
|
-
var _api$
|
|
135
|
-
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
137
|
+
var _api$analytics2;
|
|
138
|
+
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
136
139
|
}
|
|
137
140
|
});
|
|
138
141
|
}
|
|
@@ -229,11 +232,11 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
229
232
|
keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video'],
|
|
230
233
|
icon: () => /*#__PURE__*/React.createElement(IconImages, null),
|
|
231
234
|
action(insert, state) {
|
|
232
|
-
var _api$
|
|
235
|
+
var _api$analytics3;
|
|
233
236
|
const pluginState = pluginKey.getState(state);
|
|
234
237
|
pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
|
|
235
238
|
const tr = insert('');
|
|
236
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
239
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
237
240
|
action: ACTION.OPENED,
|
|
238
241
|
actionSubject: ACTION_SUBJECT.PICKER,
|
|
239
242
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -253,7 +256,8 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
253
256
|
allowLinking: options && options.allowLinking,
|
|
254
257
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
255
258
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
256
|
-
altTextValidator: options && options.altTextValidator
|
|
259
|
+
altTextValidator: options && options.altTextValidator,
|
|
260
|
+
fullWidthEnabled: options && options.fullWidthEnabled
|
|
257
261
|
}, api)
|
|
258
262
|
}
|
|
259
263
|
};
|
|
@@ -164,7 +164,7 @@ export default class MediaSingleNode extends Component {
|
|
|
164
164
|
(_this$captionPlaceHol = this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
|
|
165
165
|
});
|
|
166
166
|
_defineProperty(this, "clickPlaceholder", () => {
|
|
167
|
-
var _pluginInjectionApi$
|
|
167
|
+
var _pluginInjectionApi$a;
|
|
168
168
|
const {
|
|
169
169
|
view,
|
|
170
170
|
getPos,
|
|
@@ -174,7 +174,7 @@ export default class MediaSingleNode extends Component {
|
|
|
174
174
|
if (typeof getPos === 'boolean') {
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
177
|
+
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(getPos(), node)(view.state, view.dispatch);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -172,16 +172,16 @@ export class MediaPluginStateImplementation {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
175
|
-
var _this$pluginInjection, _pluginInjectionApi$
|
|
175
|
+
var _this$pluginInjection, _pluginInjectionApi$a;
|
|
176
176
|
// read width state right before inserting to get up-to-date and define values
|
|
177
|
-
const widthPluginState = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.
|
|
178
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
177
|
+
const widthPluginState = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.width.sharedState.currentState();
|
|
178
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
|
|
179
179
|
} else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
|
|
180
|
-
var _pluginInjectionApi$
|
|
181
|
-
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
180
|
+
var _pluginInjectionApi$a2;
|
|
181
|
+
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
182
182
|
} else {
|
|
183
|
-
var _pluginInjectionApi$
|
|
184
|
-
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
183
|
+
var _pluginInjectionApi$a3;
|
|
184
|
+
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// do events when media state changes
|
|
@@ -18,7 +18,7 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
18
18
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { FilePreviewItem } from './filePreviewItem';
|
|
21
|
-
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement } from './utils';
|
|
21
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout } from './utils';
|
|
22
22
|
import { isVideo } from '../utils/media-single';
|
|
23
23
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
24
24
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
@@ -206,7 +206,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
206
206
|
let toolbarButtons = [];
|
|
207
207
|
const {
|
|
208
208
|
hoverDecoration
|
|
209
|
-
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
209
|
+
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
|
|
210
210
|
if (shouldShowImageBorder(state)) {
|
|
211
211
|
toolbarButtons.push({
|
|
212
212
|
type: 'custom',
|
|
@@ -222,12 +222,12 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
222
222
|
const borderMark = currentMediaNodeBorderMark(state);
|
|
223
223
|
return /*#__PURE__*/React.createElement(ImageBorderItem, {
|
|
224
224
|
toggleBorder: () => {
|
|
225
|
-
var _pluginInjectionApi$
|
|
226
|
-
toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
225
|
+
var _pluginInjectionApi$a;
|
|
226
|
+
toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
|
|
227
227
|
},
|
|
228
228
|
setBorder: attrs => {
|
|
229
|
-
var _pluginInjectionApi$
|
|
230
|
-
setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
229
|
+
var _pluginInjectionApi$a2;
|
|
230
|
+
setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
|
|
231
231
|
},
|
|
232
232
|
showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
|
|
233
233
|
borderMark: borderMark,
|
|
@@ -240,8 +240,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
if (allowAdvancedToolBarOptions) {
|
|
243
|
-
var _pluginInjectionApi$
|
|
244
|
-
const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
243
|
+
var _pluginInjectionApi$a3;
|
|
244
|
+
const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width;
|
|
245
245
|
let isChangingLayoutDisabled = false;
|
|
246
246
|
if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
|
|
247
247
|
var _widthPlugin$sharedSt;
|
|
@@ -256,7 +256,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
259
|
+
const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
|
|
260
260
|
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
261
261
|
if (layoutButtons.length) {
|
|
262
262
|
toolbarButtons.push({
|
|
@@ -285,7 +285,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
285
285
|
return null;
|
|
286
286
|
}
|
|
287
287
|
const {
|
|
288
|
-
|
|
288
|
+
width: mediaSingleWidth,
|
|
289
|
+
widthType,
|
|
290
|
+
layout
|
|
289
291
|
} = selectedMediaSingleNode.node.attrs;
|
|
290
292
|
const {
|
|
291
293
|
width: mediaWidth,
|
|
@@ -296,9 +298,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
296
298
|
const isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
|
|
297
299
|
const minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
298
300
|
const isLegacy = widthType !== 'pixel';
|
|
299
|
-
const
|
|
301
|
+
const pixelWidthFromElement = getPixelWidthOfElement(editorView, selectedMediaSingleNode.pos + 1,
|
|
300
302
|
// get pos of media node
|
|
301
303
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
304
|
+
const pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
302
305
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
303
306
|
intl: intl,
|
|
304
307
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -327,7 +330,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
327
330
|
const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
|
|
328
331
|
...selectedMediaSingleNode.node.attrs,
|
|
329
332
|
width,
|
|
330
|
-
widthType: 'pixel'
|
|
333
|
+
widthType: 'pixel',
|
|
334
|
+
layout: calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled)
|
|
331
335
|
});
|
|
332
336
|
tr.setMeta('scrollIntoView', false);
|
|
333
337
|
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
@@ -336,7 +340,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
336
340
|
onMigrate: () => {
|
|
337
341
|
const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
|
|
338
342
|
...selectedMediaSingleNode.node.attrs,
|
|
339
|
-
width:
|
|
343
|
+
width: pixelWidthFromElement,
|
|
340
344
|
widthType: 'pixel'
|
|
341
345
|
});
|
|
342
346
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -391,14 +395,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
391
395
|
};
|
|
392
396
|
const openLink = () => {
|
|
393
397
|
if (editorView) {
|
|
394
|
-
var _pluginInjectionApi$
|
|
398
|
+
var _pluginInjectionApi$a4;
|
|
395
399
|
const {
|
|
396
400
|
state: {
|
|
397
401
|
tr
|
|
398
402
|
},
|
|
399
403
|
dispatch
|
|
400
404
|
} = editorView;
|
|
401
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
405
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.attachAnalyticsEvent({
|
|
402
406
|
eventType: EVENT_TYPE.TRACK,
|
|
403
407
|
action: ACTION.VISITED,
|
|
404
408
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
@@ -424,8 +428,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
430
|
if (allowAltTextOnImages) {
|
|
427
|
-
var _pluginInjectionApi$
|
|
428
|
-
toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
431
|
+
var _pluginInjectionApi$a5;
|
|
432
|
+
toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
429
433
|
type: 'separator'
|
|
430
434
|
});
|
|
431
435
|
}
|
|
@@ -456,7 +460,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
456
460
|
return items;
|
|
457
461
|
};
|
|
458
462
|
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
459
|
-
var _pluginInjectionApi$
|
|
463
|
+
var _pluginInjectionApi$d2;
|
|
460
464
|
const {
|
|
461
465
|
media,
|
|
462
466
|
mediaInline,
|
|
@@ -475,7 +479,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
475
479
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
476
480
|
const {
|
|
477
481
|
hoverDecoration
|
|
478
|
-
} = (_pluginInjectionApi$
|
|
482
|
+
} = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {};
|
|
479
483
|
if (!mediaPluginState) {
|
|
480
484
|
return;
|
|
481
485
|
}
|
|
@@ -494,10 +498,10 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
494
498
|
if (allowAltTextOnImages) {
|
|
495
499
|
const mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
496
500
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
497
|
-
var _pluginInjectionApi$
|
|
501
|
+
var _pluginInjectionApi$f;
|
|
498
502
|
return getAltTextToolbar(baseToolbar, {
|
|
499
503
|
altTextValidator,
|
|
500
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
504
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector
|
|
501
505
|
});
|
|
502
506
|
}
|
|
503
507
|
}
|
|
@@ -508,22 +512,22 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
508
512
|
selectedNodeType = state.selection.node.type;
|
|
509
513
|
}
|
|
510
514
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
511
|
-
var _pluginInjectionApi$
|
|
515
|
+
var _pluginInjectionApi$a6;
|
|
512
516
|
const mediaOffset = state.selection.$from.parentOffset + 1;
|
|
513
517
|
baseToolbar.getDomRef = () => {
|
|
514
518
|
var _mediaPluginState$ele;
|
|
515
519
|
const selector = mediaFilmstripItemDOMSelector(mediaOffset);
|
|
516
520
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
517
521
|
};
|
|
518
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
522
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions);
|
|
519
523
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
520
|
-
var _pluginInjectionApi$
|
|
524
|
+
var _pluginInjectionApi$a7;
|
|
521
525
|
baseToolbar.getDomRef = () => {
|
|
522
526
|
var _mediaPluginState$ele2;
|
|
523
527
|
const element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(`.${MediaInlineNodeSelector}`);
|
|
524
528
|
return element || mediaPluginState.element;
|
|
525
529
|
};
|
|
526
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
530
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions);
|
|
527
531
|
} else {
|
|
528
532
|
baseToolbar.getDomRef = () => {
|
|
529
533
|
var _mediaPluginState$ele3;
|
|
@@ -56,8 +56,8 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
56
56
|
intl: intl,
|
|
57
57
|
editing: editing,
|
|
58
58
|
onUnlink: () => {
|
|
59
|
-
var _pluginInjectionApi$
|
|
60
|
-
return unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
59
|
+
var _pluginInjectionApi$a;
|
|
60
|
+
return unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch, view);
|
|
61
61
|
},
|
|
62
62
|
onBack: (href, meta) => {
|
|
63
63
|
if (href.trim() && meta.inputMethod) {
|
|
@@ -66,7 +66,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
66
66
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
67
67
|
},
|
|
68
68
|
onCancel: () => {
|
|
69
|
-
var _pluginInjectionApi$
|
|
69
|
+
var _pluginInjectionApi$f;
|
|
70
70
|
hideLinkingToolbar(view.state, view.dispatch, view, true);
|
|
71
71
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
72
72
|
* and not close the floating toolbar.
|
|
@@ -77,7 +77,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
77
77
|
},
|
|
78
78
|
dispatch
|
|
79
79
|
} = view;
|
|
80
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
80
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector(FORCE_FOCUS_SELECTOR)(tr);
|
|
81
81
|
dispatch(tr);
|
|
82
82
|
},
|
|
83
83
|
onSubmit: (href, meta) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
2
2
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { wrappedLayouts } from '@atlaskit/editor-common/media-single';
|
|
3
5
|
export const getSelectedMediaContainerNodeAttrs = mediaPluginState => {
|
|
4
6
|
const selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
5
7
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -53,4 +55,20 @@ export const getPixelWidthOfElement = (editorView, pos, mediaWidth) => {
|
|
|
53
55
|
return domNode.offsetWidth;
|
|
54
56
|
}
|
|
55
57
|
return mediaWidth;
|
|
58
|
+
};
|
|
59
|
+
export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false) => {
|
|
60
|
+
const isWrappedLayout = wrappedLayouts.indexOf(layout) > -1;
|
|
61
|
+
if (width >= akEditorFullWidthLayoutWidth) {
|
|
62
|
+
// If width is greater than or equal to full editor width
|
|
63
|
+
return 'full-width';
|
|
64
|
+
}
|
|
65
|
+
if (fullWidthMode) {
|
|
66
|
+
// If under editor full width mode
|
|
67
|
+
return isWrappedLayout ? layout : 'center';
|
|
68
|
+
}
|
|
69
|
+
if (width > contentWidth) {
|
|
70
|
+
// If width is greater than content length and not nested
|
|
71
|
+
return 'wide';
|
|
72
|
+
}
|
|
73
|
+
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
56
74
|
};
|