@atlaskit/editor-core 183.1.6 → 184.0.4
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/.eslintrc.js +7 -3
- package/CHANGELOG.md +29 -0
- package/dist/cjs/labs/next/full-page.js +2 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +2 -1
- package/dist/cjs/plugins/breakout/index.js +54 -35
- package/dist/cjs/plugins/card/toolbar.js +4 -3
- package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -3
- package/dist/cjs/plugins/copy-button/commands.js +8 -1
- package/dist/cjs/plugins/extension/index.js +1 -1
- package/dist/cjs/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/cjs/plugins/extension/pm-plugins/main.js +6 -6
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +34 -4
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/cjs/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/cjs/plugins/help-dialog/index.js +12 -8
- package/dist/cjs/plugins/index.js +0 -14
- package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/cjs/plugins/media/index.js +15 -5
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +53 -34
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/toolbar/index.js +4 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/cjs/test-utils.js +6 -1
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +1 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
- package/dist/cjs/ui/ContentStyles/index.js +9 -10
- package/dist/cjs/ui/ContextPanel/index.js +67 -56
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +10 -11
- package/dist/cjs/ui/Resizer/index.js +8 -8
- package/dist/cjs/ui/WidthEmitter/index.js +10 -4
- package/dist/cjs/ui/styles.js +6 -0
- package/dist/cjs/utils/clipboard.js +18 -11
- package/dist/cjs/utils/performance/instrumented-plugin.js +14 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/full-page.js +2 -5
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/breakout/index.js +48 -31
- package/dist/es2019/plugins/card/toolbar.js +4 -3
- package/dist/es2019/plugins/collab-edit/plugin-state.js +2 -4
- package/dist/es2019/plugins/copy-button/commands.js +9 -2
- package/dist/es2019/plugins/extension/index.js +1 -1
- package/dist/es2019/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +38 -2
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/es2019/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/es2019/plugins/help-dialog/index.js +14 -9
- package/dist/es2019/plugins/index.js +0 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/es2019/plugins/media/index.js +15 -5
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +21 -10
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +53 -33
- package/dist/es2019/plugins/media/styles.js +1 -7
- package/dist/es2019/plugins/media/toolbar/index.js +4 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/es2019/test-utils.js +6 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/es2019/ui/ContentStyles/index.js +1 -2
- package/dist/es2019/ui/ContextPanel/index.js +66 -43
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +8 -9
- package/dist/es2019/ui/Resizer/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +10 -4
- package/dist/es2019/ui/styles.js +6 -0
- package/dist/es2019/utils/clipboard.js +12 -7
- package/dist/es2019/utils/performance/instrumented-plugin.js +15 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/full-page.js +2 -5
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/breakout/index.js +54 -35
- package/dist/esm/plugins/card/toolbar.js +4 -3
- package/dist/esm/plugins/collab-edit/plugin-state.js +2 -3
- package/dist/esm/plugins/copy-button/commands.js +9 -2
- package/dist/esm/plugins/extension/index.js +1 -1
- package/dist/esm/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/esm/plugins/extension/pm-plugins/main.js +6 -6
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +33 -2
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/esm/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/esm/plugins/help-dialog/index.js +12 -8
- package/dist/esm/plugins/index.js +0 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/esm/plugins/media/index.js +15 -5
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +54 -35
- package/dist/esm/plugins/media/styles.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +4 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/esm/test-utils.js +6 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
- package/dist/esm/ui/ColorPickerButton/index.js +2 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/esm/ui/ContentStyles/index.js +1 -2
- package/dist/esm/ui/ContextPanel/index.js +64 -53
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +10 -11
- package/dist/esm/ui/Resizer/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +10 -4
- package/dist/esm/ui/styles.js +6 -0
- package/dist/esm/utils/clipboard.js +16 -10
- package/dist/esm/utils/performance/instrumented-plugin.js +14 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +1 -1
- package/dist/types/create-editor/get-plugins.d.ts +2 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/breakout/index.d.ts +4 -0
- package/dist/types/plugins/breakout/ui/LayoutButton.d.ts +1 -1
- package/dist/types/plugins/card/index.d.ts +2 -2
- package/dist/types/plugins/collab-edit/actions.d.ts +3 -2
- package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -3
- package/dist/types/plugins/collab-edit/events/initialize.d.ts +1 -1
- package/dist/types/plugins/collab-edit/events/send-transaction.d.ts +1 -1
- package/dist/types/plugins/collab-edit/index.d.ts +0 -1
- package/dist/types/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
- package/dist/types/plugins/collab-edit/participants.d.ts +1 -1
- package/dist/types/plugins/collab-edit/plugin.d.ts +0 -2
- package/dist/types/plugins/collab-edit/types.d.ts +1 -3
- package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +2 -1
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +4 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +3 -0
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/index.d.ts +0 -3
- package/dist/types/plugins/media/index.d.ts +12 -2
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/types.d.ts +2 -1
- package/dist/types/plugins/media/toolbar/index.d.ts +3 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
- package/dist/types/test-utils.d.ts +3 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +3 -3
- package/dist/types/ui/ContextPanel/index.d.ts +3 -4
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
- package/dist/types/ui/PluginSlot/index.d.ts +1 -1
- package/dist/types/ui/Resizer/types.d.ts +2 -2
- package/dist/types/utils/clipboard.d.ts +1 -0
- package/dist/types-ts4.5/actions/index.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/breakout/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/breakout/ui/LayoutButton.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/collab-edit/actions.d.ts +3 -2
- package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/events/send-transaction.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +1 -3
- package/dist/types-ts4.5/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +4 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/media/index.d.ts +9 -2
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
- package/dist/types-ts4.5/test-utils.d.ts +3 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +3 -4
- package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +2 -2
- package/dist/types-ts4.5/utils/clipboard.d.ts +1 -0
- package/package.json +25 -23
- package/report.api.md +15 -63
- package/dist/cjs/plugins/collab-edit/provider/index.js +0 -5
- package/dist/cjs/plugins/collab-edit/provider/types.js +0 -5
- package/dist/cjs/plugins/grid/index.js +0 -207
- package/dist/cjs/plugins/grid/styles.js +0 -16
- package/dist/cjs/plugins/grid/types.js +0 -5
- package/dist/cjs/plugins/width/index.js +0 -88
- package/dist/cjs/ui/ContextPanel/context.js +0 -89
- package/dist/es2019/plugins/collab-edit/provider/index.js +0 -1
- package/dist/es2019/plugins/collab-edit/provider/types.js +0 -1
- package/dist/es2019/plugins/grid/index.js +0 -168
- package/dist/es2019/plugins/grid/styles.js +0 -36
- package/dist/es2019/plugins/grid/types.js +0 -1
- package/dist/es2019/plugins/width/index.js +0 -72
- package/dist/es2019/ui/ContextPanel/context.js +0 -65
- package/dist/esm/plugins/collab-edit/provider/index.js +0 -1
- package/dist/esm/plugins/collab-edit/provider/types.js +0 -1
- package/dist/esm/plugins/grid/index.js +0 -191
- package/dist/esm/plugins/grid/styles.js +0 -7
- package/dist/esm/plugins/grid/types.js +0 -1
- package/dist/esm/plugins/width/index.js +0 -78
- package/dist/esm/ui/ContextPanel/context.js +0 -79
- package/dist/types/plugins/collab-edit/provider/index.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/types.d.ts +0 -1
- package/dist/types/plugins/grid/index.d.ts +0 -25
- package/dist/types/plugins/grid/styles.d.ts +0 -2
- package/dist/types/plugins/grid/types.d.ts +0 -7
- package/dist/types/plugins/width/index.d.ts +0 -18
- package/dist/types/ui/ContextPanel/context.d.ts +0 -24
- package/dist/types-ts4.5/plugins/collab-edit/provider/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/collab-edit/provider/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/grid/index.d.ts +0 -27
- package/dist/types-ts4.5/plugins/grid/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/grid/types.d.ts +0 -7
- package/dist/types-ts4.5/plugins/width/index.d.ts +0 -18
- package/dist/types-ts4.5/ui/ContextPanel/context.d.ts +0 -24
|
@@ -14,13 +14,14 @@ import ToolbarMedia from './ui/ToolbarMedia';
|
|
|
14
14
|
import { ReactMediaGroupNode } from './nodeviews/mediaGroup';
|
|
15
15
|
import { ReactMediaSingleNode } from './nodeviews/mediaSingle';
|
|
16
16
|
import { floatingToolbar as _floatingToolbar } from './toolbar';
|
|
17
|
-
import {
|
|
17
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
18
18
|
import { IconImages } from '../quick-insert/assets';
|
|
19
19
|
import WithPluginState from '../../ui/WithPluginState';
|
|
20
20
|
import { MediaPickerComponents } from './ui/MediaPicker';
|
|
21
21
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
22
22
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
23
23
|
import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
24
|
+
import { stateKey } from './pm-plugins/plugin-key';
|
|
24
25
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
25
26
|
var mediaPlugin = function mediaPlugin() {
|
|
26
27
|
var _api$dependencies, _api$dependencies$fea;
|
|
@@ -29,6 +30,12 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
29
30
|
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
30
31
|
return {
|
|
31
32
|
name: 'media',
|
|
33
|
+
getSharedState: function getSharedState(editorState) {
|
|
34
|
+
if (!editorState) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return stateKey.getState(editorState);
|
|
38
|
+
},
|
|
32
39
|
nodes: function nodes() {
|
|
33
40
|
var _ref = options || {},
|
|
34
41
|
_ref$allowMediaGroup = _ref.allowMediaGroup,
|
|
@@ -82,7 +89,7 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
82
89
|
nodeViews: {
|
|
83
90
|
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
84
91
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options, api),
|
|
85
|
-
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
92
|
+
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
86
93
|
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory)
|
|
87
94
|
},
|
|
88
95
|
errorReporter: errorReporter,
|
|
@@ -211,9 +218,11 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
211
218
|
return /*#__PURE__*/React.createElement(IconImages, null);
|
|
212
219
|
},
|
|
213
220
|
action: function action(insert, state) {
|
|
221
|
+
var _api$dependencies$ana;
|
|
214
222
|
var pluginState = pluginKey.getState(state);
|
|
215
223
|
pluginState.showMediaPicker();
|
|
216
|
-
|
|
224
|
+
var tr = insert('');
|
|
225
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions.attachAnalyticsEvent({
|
|
217
226
|
action: ACTION.OPENED,
|
|
218
227
|
actionSubject: ACTION_SUBJECT.PICKER,
|
|
219
228
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -221,7 +230,8 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
221
230
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
222
231
|
},
|
|
223
232
|
eventType: EVENT_TYPE.UI
|
|
224
|
-
});
|
|
233
|
+
})(tr);
|
|
234
|
+
return tr;
|
|
225
235
|
}
|
|
226
236
|
}];
|
|
227
237
|
},
|
|
@@ -235,7 +245,7 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
235
245
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
236
246
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
237
247
|
altTextValidator: options && options.altTextValidator
|
|
238
|
-
});
|
|
248
|
+
}, api);
|
|
239
249
|
}
|
|
240
250
|
}
|
|
241
251
|
};
|
|
@@ -13,11 +13,19 @@ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-comm
|
|
|
13
13
|
import { NodeSelection } from 'prosemirror-state';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { SelectionBasedNodeView } from '../../../../nodeviews';
|
|
16
|
-
import WithPluginState from '../../../../ui/WithPluginState';
|
|
17
|
-
import { pluginKey as widthPluginKey } from '../../../width';
|
|
18
16
|
import MediaNode from './media';
|
|
19
17
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
20
18
|
import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
|
|
19
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
20
|
+
var MediaNodeWithProviders = function MediaNodeWithProviders(_ref) {
|
|
21
|
+
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
22
|
+
innerComponent = _ref.innerComponent;
|
|
23
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
24
|
+
widthState = _useSharedPluginState.widthState;
|
|
25
|
+
return innerComponent({
|
|
26
|
+
width: widthState
|
|
27
|
+
});
|
|
28
|
+
};
|
|
21
29
|
var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
22
30
|
_inherits(MediaNodeView, _SelectionBasedNodeVi);
|
|
23
31
|
var _super = _createSuper(MediaNodeView);
|
|
@@ -29,8 +37,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
29
37
|
}
|
|
30
38
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
39
|
_defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithState", function (mediaProvider, contextIdentifierProvider) {
|
|
32
|
-
return function (
|
|
33
|
-
var editorWidth =
|
|
40
|
+
return function (_ref2) {
|
|
41
|
+
var editorWidth = _ref2.width;
|
|
34
42
|
var getPos = _this.getPos;
|
|
35
43
|
var mediaOptions = _this.reactComponentProps.mediaOptions;
|
|
36
44
|
var selection = _this.view.state.selection;
|
|
@@ -74,15 +82,13 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
74
82
|
});
|
|
75
83
|
};
|
|
76
84
|
});
|
|
77
|
-
_defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithProviders", function (
|
|
78
|
-
var mediaProvider =
|
|
79
|
-
contextIdentifierProvider =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
render: _this.renderMediaNodeWithState(mediaProvider, contextIdentifierProvider)
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithProviders", function (_ref3) {
|
|
86
|
+
var mediaProvider = _ref3.mediaProvider,
|
|
87
|
+
contextIdentifierProvider = _ref3.contextIdentifierProvider;
|
|
88
|
+
var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
|
|
89
|
+
return /*#__PURE__*/React.createElement(MediaNodeWithProviders, {
|
|
90
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
91
|
+
innerComponent: _this.renderMediaNodeWithState(mediaProvider, contextIdentifierProvider)
|
|
86
92
|
});
|
|
87
93
|
});
|
|
88
94
|
return _this;
|
|
@@ -145,12 +151,14 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
145
151
|
}(SelectionBasedNodeView);
|
|
146
152
|
export var ReactMediaNode = function ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory) {
|
|
147
153
|
var mediaOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
154
|
+
var pluginInjectionApi = arguments.length > 4 ? arguments[4] : undefined;
|
|
148
155
|
return function (node, view, getPos) {
|
|
149
156
|
var hasIntlContext = true;
|
|
150
157
|
return new MediaNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
151
158
|
eventDispatcher: eventDispatcher,
|
|
152
159
|
providerFactory: providerFactory,
|
|
153
|
-
mediaOptions: mediaOptions
|
|
160
|
+
mediaOptions: mediaOptions,
|
|
161
|
+
pluginInjectionApi: pluginInjectionApi
|
|
154
162
|
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
155
163
|
};
|
|
156
164
|
};
|
|
@@ -20,11 +20,9 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
|
20
20
|
import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
21
21
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
22
22
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
23
|
-
import WithPluginState from '../../../ui/WithPluginState';
|
|
24
|
-
import { pluginKey as widthPluginKey } from '../../width';
|
|
25
23
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
26
24
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
27
|
-
import {
|
|
25
|
+
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
28
26
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
29
27
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
30
28
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -37,6 +35,7 @@ import ReactNodeView from '../../../nodeviews/ReactNodeView';
|
|
|
37
35
|
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
38
36
|
import { NodeSelection } from 'prosemirror-state';
|
|
39
37
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
38
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
40
39
|
var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
41
40
|
_inherits(MediaSingleNode, _Component);
|
|
42
41
|
var _super = _createSuper(MediaSingleNode);
|
|
@@ -224,11 +223,11 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
224
223
|
(_this$captionPlaceHol = _this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
|
|
225
224
|
});
|
|
226
225
|
_defineProperty(_assertThisInitialized(_this), "displayGrid", function (visible, gridType, highlight) {
|
|
227
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
226
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
228
227
|
var _this$props = _this.props,
|
|
229
228
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
230
229
|
view = _this$props.view;
|
|
231
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.displayGrid(view)({
|
|
230
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.actions) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.displayGrid(view)({
|
|
232
231
|
visible: visible,
|
|
233
232
|
gridType: gridType,
|
|
234
233
|
highlight: highlight
|
|
@@ -405,6 +404,40 @@ _defineProperty(MediaSingleNode, "defaultProps", {
|
|
|
405
404
|
});
|
|
406
405
|
_defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
|
|
407
406
|
export { MediaSingleNode as default };
|
|
407
|
+
var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
408
|
+
var pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
409
|
+
mediaProvider = _ref5.mediaProvider,
|
|
410
|
+
contextIdentifierProvider = _ref5.contextIdentifierProvider,
|
|
411
|
+
node = _ref5.node,
|
|
412
|
+
getPos = _ref5.getPos,
|
|
413
|
+
mediaOptions = _ref5.mediaOptions,
|
|
414
|
+
view = _ref5.view,
|
|
415
|
+
fullWidthMode = _ref5.fullWidthMode,
|
|
416
|
+
selected = _ref5.selected,
|
|
417
|
+
eventDispatcher = _ref5.eventDispatcher,
|
|
418
|
+
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent,
|
|
419
|
+
forwardRef = _ref5.forwardRef;
|
|
420
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media']),
|
|
421
|
+
widthState = _useSharedPluginState.widthState,
|
|
422
|
+
mediaState = _useSharedPluginState.mediaState;
|
|
423
|
+
return jsx(MediaSingleNode, {
|
|
424
|
+
width: widthState.width,
|
|
425
|
+
lineLength: widthState.lineLength,
|
|
426
|
+
node: node,
|
|
427
|
+
getPos: getPos,
|
|
428
|
+
mediaProvider: mediaProvider,
|
|
429
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
430
|
+
mediaOptions: mediaOptions,
|
|
431
|
+
view: view,
|
|
432
|
+
fullWidthMode: fullWidthMode,
|
|
433
|
+
selected: selected,
|
|
434
|
+
eventDispatcher: eventDispatcher,
|
|
435
|
+
mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
|
|
436
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
437
|
+
forwardRef: forwardRef,
|
|
438
|
+
pluginInjectionApi: pluginInjectionApi
|
|
439
|
+
});
|
|
440
|
+
};
|
|
408
441
|
var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
409
442
|
_inherits(MediaSingleNodeView, _ReactNodeView);
|
|
410
443
|
var _super2 = _createSuper(MediaSingleNodeView);
|
|
@@ -505,36 +538,22 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
505
538
|
return jsx(WithProviders, {
|
|
506
539
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
507
540
|
providerFactory: providerFactory,
|
|
508
|
-
renderNode: function renderNode(
|
|
509
|
-
var mediaProvider =
|
|
510
|
-
contextIdentifierProvider =
|
|
511
|
-
return jsx(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
getPos: getPos,
|
|
525
|
-
mediaProvider: mediaProvider,
|
|
526
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
527
|
-
mediaOptions: mediaOptions,
|
|
528
|
-
view: _this4.view,
|
|
529
|
-
fullWidthMode: fullWidthMode,
|
|
530
|
-
selected: _this4.isNodeSelected,
|
|
531
|
-
eventDispatcher: eventDispatcher,
|
|
532
|
-
mediaPluginState: mediaPluginState,
|
|
533
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
534
|
-
forwardRef: forwardRef,
|
|
535
|
-
pluginInjectionApi: pluginInjectionApi
|
|
536
|
-
});
|
|
537
|
-
}
|
|
541
|
+
renderNode: function renderNode(_ref6) {
|
|
542
|
+
var mediaProvider = _ref6.mediaProvider,
|
|
543
|
+
contextIdentifierProvider = _ref6.contextIdentifierProvider;
|
|
544
|
+
return jsx(MediaSingleNodeWrapper, {
|
|
545
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
546
|
+
mediaProvider: mediaProvider,
|
|
547
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
548
|
+
node: _this4.node,
|
|
549
|
+
getPos: getPos,
|
|
550
|
+
mediaOptions: mediaOptions,
|
|
551
|
+
view: _this4.view,
|
|
552
|
+
fullWidthMode: fullWidthMode,
|
|
553
|
+
selected: _this4.isNodeSelected,
|
|
554
|
+
eventDispatcher: eventDispatcher,
|
|
555
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
556
|
+
forwardRef: forwardRef
|
|
538
557
|
});
|
|
539
558
|
}
|
|
540
559
|
});
|
|
@@ -4,8 +4,8 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { N60, B200 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { fileCardImageViewSelector,
|
|
8
|
-
export var mediaStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n
|
|
7
|
+
import { fileCardImageViewSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
|
|
8
|
+
export var mediaStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: ", "; /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), mediaSingleSharedStyle, richMediaClassName, richMediaClassName, richMediaClassName, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPadding, richMediaClassName, richMediaClassName, "var(--ds-border, ".concat(N60, ")"), akEditorSelectedNodeClassName, akEditorSelectedNodeClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, "var(--ds-border-focused, ".concat(B200, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), richMediaClassName, fileCardImageViewSelector, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, inlinePlayerClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, newFileExperienceClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))");
|
|
9
9
|
|
|
10
10
|
/* `left: unset` above is to work around Chrome bug where rendering a div with
|
|
11
11
|
* that style applied inside a container that has a scroll, causes any svgs on
|
|
@@ -187,7 +187,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
187
187
|
}];
|
|
188
188
|
return items;
|
|
189
189
|
};
|
|
190
|
-
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, getEditorFeatureFlags) {
|
|
190
|
+
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, widthPluginDependencyApi, getEditorFeatureFlags) {
|
|
191
191
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
192
192
|
var allowResizing = options.allowResizing,
|
|
193
193
|
allowLinking = options.allowLinking,
|
|
@@ -224,7 +224,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
if (allowAdvancedToolBarOptions) {
|
|
227
|
-
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables)));
|
|
227
|
+
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPluginDependencyApi, allowResizing, allowResizingInTables)));
|
|
228
228
|
if (toolbarButtons.length) {
|
|
229
229
|
toolbarButtons.push({
|
|
230
230
|
type: 'separator'
|
|
@@ -304,6 +304,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
304
304
|
};
|
|
305
305
|
export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
306
306
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
307
|
+
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
307
308
|
var _state$schema$nodes = state.schema.nodes,
|
|
308
309
|
media = _state$schema$nodes.media,
|
|
309
310
|
mediaInline = _state$schema$nodes.mediaInline,
|
|
@@ -369,7 +370,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
369
370
|
var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(MediaSingleNodeSelector));
|
|
370
371
|
return element || mediaPluginState.element;
|
|
371
372
|
};
|
|
372
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, getEditorFeatureFlags);
|
|
373
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, getEditorFeatureFlags);
|
|
373
374
|
}
|
|
374
375
|
return _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
375
376
|
items: items,
|
|
@@ -31,6 +31,7 @@ import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
|
31
31
|
import { extractSliceFromStep } from '../../../utils/step';
|
|
32
32
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
33
33
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
34
|
+
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
34
35
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
35
36
|
var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
36
37
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
@@ -178,6 +179,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
178
179
|
var placeholder = state.schema.nodes.placeholder;
|
|
179
180
|
var isPastingTextInsidePlaceholderText = ((_state$doc$resolve$no = state.doc.resolve(state.selection.$anchor.pos).nodeAfter) === null || _state$doc$resolve$no === void 0 ? void 0 : _state$doc$resolve$no.type) === placeholder;
|
|
180
181
|
|
|
182
|
+
// Don't add closeHistory if we're pasting over layout columns, as we will appendTransaction
|
|
183
|
+
// to cleanup the layout's structure and we want to keep the paste and re-structuring as
|
|
184
|
+
// one event.
|
|
185
|
+
var isPastingOverLayoutColumns = hasParentNodeOfType(state.schema.nodes.layoutColumn)(state.selection);
|
|
186
|
+
|
|
181
187
|
// don't add closeHistory call if we're pasting a table, as some tables may involve additional
|
|
182
188
|
// appendedTransactions to repair them (if they're partial or incomplete) and we don't want
|
|
183
189
|
// to split those repairing transactions in prosemirror-history when they're being added to the
|
|
@@ -193,7 +199,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
193
199
|
});
|
|
194
200
|
return tableExists;
|
|
195
201
|
});
|
|
196
|
-
if (!isPastingTextInsidePlaceholderText && !isPastingTable) {
|
|
202
|
+
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns) {
|
|
197
203
|
tr.setMeta(betterTypePluginKey, true);
|
|
198
204
|
}
|
|
199
205
|
addLinkMetadata(view.state.selection, tr, {
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -45,6 +45,9 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
45
45
|
var _acc$nodes;
|
|
46
46
|
(_acc$nodes = acc.nodes).push.apply(_acc$nodes, _toConsumableArray(editorPlugin.nodes()));
|
|
47
47
|
}
|
|
48
|
+
if (editorPlugin.contentComponent) {
|
|
49
|
+
acc.contentComponents.push(editorPlugin.contentComponent);
|
|
50
|
+
}
|
|
48
51
|
if (editorPlugin.onEditorViewStateUpdated) {
|
|
49
52
|
acc.onEditorViewStateUpdatedCallbacks.push(editorPlugin.onEditorViewStateUpdated);
|
|
50
53
|
}
|
|
@@ -53,6 +56,7 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
53
56
|
nodes: [],
|
|
54
57
|
marks: [],
|
|
55
58
|
plugins: [],
|
|
59
|
+
contentComponents: [],
|
|
56
60
|
onEditorViewStateUpdatedCallbacks: []
|
|
57
61
|
});
|
|
58
62
|
}
|
|
@@ -77,7 +81,8 @@ export var createPMSchemaAndPlugins = function createPMSchemaAndPlugins() {
|
|
|
77
81
|
return {
|
|
78
82
|
plugins: plugins,
|
|
79
83
|
schema: schema,
|
|
80
|
-
onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks
|
|
84
|
+
onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks,
|
|
85
|
+
editorConfig: editorConfig
|
|
81
86
|
};
|
|
82
87
|
};
|
|
83
88
|
};
|
|
@@ -27,7 +27,7 @@ import WithFlash from '../../WithFlash';
|
|
|
27
27
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
28
28
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
29
29
|
import WidthEmitter from '../../WidthEmitter';
|
|
30
|
-
import { GRID_GUTTER } from '
|
|
30
|
+
import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
|
|
31
31
|
import classnames from 'classnames';
|
|
32
32
|
import { injectIntl } from 'react-intl-next';
|
|
33
33
|
import messages from '../../../messages';
|
|
@@ -13,7 +13,7 @@ import { jsx } from '@emotion/react';
|
|
|
13
13
|
import rafSchedule from 'raf-schd';
|
|
14
14
|
import { akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
|
|
15
15
|
import { fullPageEditorWrapper } from './StyledComponents';
|
|
16
|
-
import { ContextPanelWidthProvider } from '
|
|
16
|
+
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
18
18
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
19
19
|
export var FullPageEditor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx, useTheme } from '@emotion/react';
|
|
3
3
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { ContextPanelConsumer } from '
|
|
4
|
+
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { ClickAreaBlock } from '../../Addon';
|
|
@@ -8,7 +8,7 @@ import FindReplaceToolbarButtonWithState from '../../../plugins/find-replace/Fin
|
|
|
8
8
|
import { BeforePrimaryToolbarWrapper } from '../../../plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper';
|
|
9
9
|
import Toolbar from '../../Toolbar';
|
|
10
10
|
import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyle, mainToolbarSecondChildStyle, nonCustomToolbarWrapperStyle, customToolbarWrapperStyle, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
|
|
11
|
-
import { ContextPanelConsumer } from '
|
|
11
|
+
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import messages from './messages';
|
|
13
13
|
import { ToolbarArrowKeyNavigationProvider } from '../../ToolbarArrowKeyNavigationProvider';
|
|
14
14
|
export var EditorToolbar = /*#__PURE__*/React.memo(function (props) {
|
|
@@ -159,8 +159,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
159
159
|
};
|
|
160
160
|
var title = props.title || '';
|
|
161
161
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
162
|
-
var buttonStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", "
|
|
163
|
-
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) ||
|
|
162
|
+
var buttonStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n }\n "])), "var(--ds-background-neutral, transparent)", /* If custom props size height, override the button base height property */
|
|
163
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px');
|
|
164
164
|
return jsx("div", {
|
|
165
165
|
css: colorPickerButtonWrapper
|
|
166
166
|
}, jsx(Tooltip, {
|
|
@@ -10,8 +10,6 @@ import { Field } from '@atlaskit/form';
|
|
|
10
10
|
import { hexToEditorTableChartsPaletteColor } from '@atlaskit/editor-palette';
|
|
11
11
|
import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
|
|
12
12
|
import { validate as _validate } from '../utils';
|
|
13
|
-
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
14
|
-
import { gridSize } from '@atlaskit/theme/constants';
|
|
15
13
|
import { requiredIndicator } from './common/RequiredIndicator';
|
|
16
14
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
17
15
|
import FieldMessages from '../FieldMessages';
|
|
@@ -368,13 +366,10 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
368
366
|
showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames,
|
|
369
367
|
cols: EXPANDED_COLOR_PICKER_COLUMNS,
|
|
370
368
|
alignX: "right",
|
|
371
|
-
placement: "ConfigPanel"
|
|
372
|
-
// TODO: Migrate away from gridSize
|
|
373
|
-
// Recommendation: Update types of size object to accept string width/height and then replace gridSize with tokens
|
|
374
|
-
,
|
|
369
|
+
placement: "ConfigPanel",
|
|
375
370
|
size: {
|
|
376
|
-
width:
|
|
377
|
-
height:
|
|
371
|
+
width: "var(--ds-space-300, 24px)",
|
|
372
|
+
height: "var(--ds-space-300, 24px)"
|
|
378
373
|
}
|
|
379
374
|
}) : jsx(ColorPickerButton, {
|
|
380
375
|
title: title,
|
|
@@ -385,8 +380,8 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
385
380
|
alignX: "right",
|
|
386
381
|
placement: "ConfigPanel",
|
|
387
382
|
size: {
|
|
388
|
-
width:
|
|
389
|
-
height:
|
|
383
|
+
width: "var(--ds-space-300, 24px)",
|
|
384
|
+
height: "var(--ds-space-300, 24px)"
|
|
390
385
|
}
|
|
391
386
|
});
|
|
392
387
|
};
|
|
@@ -3,7 +3,7 @@ var _templateObject;
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
5
|
import { jsx, css, useTheme } from '@emotion/react';
|
|
6
|
-
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
6
|
+
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
|
|
9
9
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
@@ -22,7 +22,6 @@ import { mentionsStyles } from '../../plugins/mentions/styles';
|
|
|
22
22
|
import { emojiStyles } from '../../plugins/emoji/styles';
|
|
23
23
|
import { textFormattingStyles } from '../../plugins/text-formatting/styles';
|
|
24
24
|
import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
|
|
25
|
-
import { gridStyles } from '../../plugins/grid/styles';
|
|
26
25
|
import { linkStyles } from '../../plugins/hyperlink/styles';
|
|
27
26
|
import { extensionStyles } from '../../plugins/extension/ui/styles';
|
|
28
27
|
import { expandStyles } from '../../plugins/expand/ui/styles';
|