@atlaskit/editor-core 183.1.6 → 184.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -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/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/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/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/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/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/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 +1 -1
- 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 +1 -1
- 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 +18 -16
- 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
|
@@ -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) {
|
|
@@ -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';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -7,6 +8,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
10
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
11
|
+
var _excluded = ["actions"];
|
|
10
12
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
11
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -18,10 +20,9 @@ import { css, jsx } from '@emotion/react';
|
|
|
18
20
|
import Transition from 'react-transition-group/Transition';
|
|
19
21
|
import { N30 } from '@atlaskit/theme/colors';
|
|
20
22
|
import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
|
|
21
|
-
import { ContextPanelConsumer } from '
|
|
23
|
+
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
22
24
|
import WithPluginState from '../WithPluginState';
|
|
23
25
|
import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
|
|
24
|
-
import { pluginKey as widthPluginKey } from '../../plugins/width';
|
|
25
26
|
import WithEditorActions from '../WithEditorActions';
|
|
26
27
|
import { getChildBreakoutModes } from '../../utils/document';
|
|
27
28
|
var ANIM_SPEED_MS = 500;
|
|
@@ -57,6 +58,13 @@ export var SwappableContentArea = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
57
58
|
mounted: false,
|
|
58
59
|
currentPluginContent: undefined
|
|
59
60
|
});
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "focusEditor", function () {
|
|
62
|
+
var editorView = _this.props.editorView;
|
|
63
|
+
if (editorView && !editorView.hasFocus()) {
|
|
64
|
+
var _editorView$focus;
|
|
65
|
+
(_editorView$focus = editorView.focus) === null || _editorView$focus === void 0 ? void 0 : _editorView$focus.call(editorView);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
60
68
|
_defineProperty(_assertThisInitialized(_this), "showPluginContent", function () {
|
|
61
69
|
var pluginContent = _this.props.pluginContent;
|
|
62
70
|
var currentPluginContent = _this.state.currentPluginContent;
|
|
@@ -82,7 +90,8 @@ export var SwappableContentArea = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
82
90
|
timeout: _this.state.mounted ? ANIM_SPEED_MS : 0,
|
|
83
91
|
in: isVisible,
|
|
84
92
|
mountOnEnter: true,
|
|
85
|
-
unmountOnExit: true
|
|
93
|
+
unmountOnExit: true,
|
|
94
|
+
onExiting: _this.focusEditor
|
|
86
95
|
}, children);
|
|
87
96
|
});
|
|
88
97
|
return _this;
|
|
@@ -114,8 +123,9 @@ export var SwappableContentArea = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
114
123
|
var broadcastWidth = _ref.broadcastWidth,
|
|
115
124
|
broadcastPosition = _ref.broadcastPosition,
|
|
116
125
|
positionedOverEditor = _ref.positionedOverEditor;
|
|
126
|
+
var contextPanelWidth = visible ? width : 0;
|
|
117
127
|
var newPosition = editorWidth ? shouldPanelBePositionedOverEditor(editorWidth, width) : false;
|
|
118
|
-
broadcastWidth(
|
|
128
|
+
broadcastWidth(contextPanelWidth);
|
|
119
129
|
(newPosition && visible) !== positionedOverEditor && broadcastPosition(newPosition && visible);
|
|
120
130
|
return jsx("div", {
|
|
121
131
|
css: [panel, !visible && panelHidden,
|
|
@@ -146,55 +156,56 @@ export var SwappableContentArea = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
146
156
|
}]);
|
|
147
157
|
return SwappableContentArea;
|
|
148
158
|
}(React.PureComponent);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
|
|
160
|
+
// TODO: ED-17837 We have this workaround because we do
|
|
161
|
+
// not have access to the pluginInjectionApi at this location.
|
|
162
|
+
// It might be that we need to inject the pluginInjectionApi
|
|
163
|
+
// via context so that we can use it in this file (similar to
|
|
164
|
+
// WithEditorActions). To be investigated further.
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
var widthPluginKey = {
|
|
167
|
+
key: 'widthPlugin$',
|
|
168
|
+
getState: function getState(state) {
|
|
169
|
+
return state['widthPlugin$'];
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
width: 0,
|
|
180
|
-
containerWidth: 0,
|
|
181
|
-
lineLength: akEditorDefaultLayoutWidth
|
|
182
|
-
} : _ref2$widthState;
|
|
183
|
-
var firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
184
|
-
var editorWidth = _objectSpread(_objectSpread({}, widthState), {}, {
|
|
185
|
-
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
186
|
-
});
|
|
187
|
-
return jsx(SwappableContentArea, _extends({}, _this3.props, {
|
|
188
|
-
editorView: editorView,
|
|
189
|
-
pluginContent: firstContent,
|
|
190
|
-
editorWidth: editorWidth
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
171
|
+
};
|
|
172
|
+
function ContextPanelWithActions(_ref2) {
|
|
173
|
+
var actions = _ref2.actions,
|
|
174
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
175
|
+
var eventDispatcher = actions._privateGetEventDispatcher();
|
|
176
|
+
var editorView = actions._privateGetEditorView();
|
|
177
|
+
if (!eventDispatcher) {
|
|
178
|
+
return jsx(SwappableContentArea, _extends({
|
|
179
|
+
editorView: editorView
|
|
180
|
+
}, props));
|
|
181
|
+
}
|
|
182
|
+
return jsx(WithPluginState, {
|
|
183
|
+
eventDispatcher: eventDispatcher,
|
|
184
|
+
plugins: {
|
|
185
|
+
contextPanel: contextPanelPluginKey,
|
|
186
|
+
widthState: widthPluginKey
|
|
187
|
+
},
|
|
188
|
+
render: function render(_ref3) {
|
|
189
|
+
var contextPanel = _ref3.contextPanel,
|
|
190
|
+
widthState = _ref3.widthState;
|
|
191
|
+
var firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
192
|
+
var editorWidth = _objectSpread(_objectSpread({}, widthState), {}, {
|
|
193
|
+
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
195
194
|
});
|
|
195
|
+
return jsx(SwappableContentArea, _extends({}, props, {
|
|
196
|
+
editorView: editorView,
|
|
197
|
+
pluginContent: firstContent,
|
|
198
|
+
editorWidth: editorWidth
|
|
199
|
+
}));
|
|
196
200
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
export default function ContextPanel(props) {
|
|
204
|
+
return jsx(WithEditorActions, {
|
|
205
|
+
render: function render(actions) {
|
|
206
|
+
return jsx(ContextPanelWithActions, _extends({
|
|
207
|
+
actions: actions
|
|
208
|
+
}, props));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
@@ -10,7 +10,6 @@ import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
|
10
10
|
import EditorAlignImageRight from '@atlaskit/icon/glyph/editor/align-image-right';
|
|
11
11
|
import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-center';
|
|
12
12
|
import { alignAttributes } from '../../utils/rich-media-utils';
|
|
13
|
-
import { pluginKey as widthPluginKey } from '../../plugins/width';
|
|
14
13
|
import { DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
15
14
|
import { addAnalytics } from '../../plugins/analytics/utils';
|
|
16
15
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION } from '../../plugins/analytics';
|
|
@@ -61,7 +60,7 @@ var getNodeWidth = function getNodeWidth(node, schema) {
|
|
|
61
60
|
}
|
|
62
61
|
return node.firstChild && node.firstChild.attrs.width || node.attrs.width;
|
|
63
62
|
};
|
|
64
|
-
var makeAlign = function makeAlign(layout, nodeType) {
|
|
63
|
+
var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi) {
|
|
65
64
|
return function (state, dispatch) {
|
|
66
65
|
var _ref = state.selection,
|
|
67
66
|
node = _ref.node;
|
|
@@ -70,7 +69,7 @@ var makeAlign = function makeAlign(layout, nodeType) {
|
|
|
70
69
|
if (!dispatch) {
|
|
71
70
|
return false;
|
|
72
71
|
}
|
|
73
|
-
var widthPluginState =
|
|
72
|
+
var widthPluginState = widthPluginDependencyApi === null || widthPluginDependencyApi === void 0 ? void 0 : widthPluginDependencyApi.sharedState.currentState();
|
|
74
73
|
if (!node || node.type !== nodeType || !widthPluginState) {
|
|
75
74
|
return false;
|
|
76
75
|
}
|
|
@@ -100,7 +99,7 @@ var makeAlign = function makeAlign(layout, nodeType) {
|
|
|
100
99
|
return true;
|
|
101
100
|
};
|
|
102
101
|
};
|
|
103
|
-
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType) {
|
|
102
|
+
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType, widthPluginDependencyApi) {
|
|
104
103
|
return icons.map(function (toolbarItem) {
|
|
105
104
|
var id = toolbarItem.id,
|
|
106
105
|
value = toolbarItem.value;
|
|
@@ -110,7 +109,7 @@ var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl,
|
|
|
110
109
|
icon: toolbarItem.icon,
|
|
111
110
|
title: intl.formatMessage(layoutToMessages[value]),
|
|
112
111
|
selected: layout === value,
|
|
113
|
-
onClick: makeAlign(value, nodeType)
|
|
112
|
+
onClick: makeAlign(value, nodeType, widthPluginDependencyApi)
|
|
114
113
|
};
|
|
115
114
|
});
|
|
116
115
|
};
|
|
@@ -118,17 +117,17 @@ var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2,
|
|
|
118
117
|
var nodes = _ref2.nodes;
|
|
119
118
|
return hasParentNodeOfType([nodes.bodiedExtension, nodes.listItem, nodes.expand, nodes.nestedExpand].concat(_toConsumableArray(allowResizingInTables ? [] : [nodes.table])).filter(Boolean))(selection);
|
|
120
119
|
};
|
|
121
|
-
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, allowResizing, allowResizingInTables) {
|
|
122
|
-
var allowWrapping = arguments.length >
|
|
123
|
-
var allowAlignment = arguments.length >
|
|
120
|
+
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, allowResizing, allowResizingInTables) {
|
|
121
|
+
var allowWrapping = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
|
|
122
|
+
var allowAlignment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
124
123
|
var selection = state.selection;
|
|
125
124
|
if (!(selection instanceof NodeSelection) || !selection.node || !nodeType || shouldHideLayoutToolbar(selection, state.schema, allowResizingInTables)) {
|
|
126
125
|
return [];
|
|
127
126
|
}
|
|
128
127
|
var layout = selection.node.attrs.layout;
|
|
129
|
-
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType) : [];
|
|
130
|
-
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType) : [];
|
|
131
|
-
var breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType) : [];
|
|
128
|
+
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
129
|
+
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
130
|
+
var breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
132
131
|
var items = [].concat(_toConsumableArray(alignmentToolbarItems), _toConsumableArray(getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping)), _toConsumableArray(wrappingToolbarItems), _toConsumableArray(getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing)), _toConsumableArray(breakOutToolbarItems));
|
|
133
132
|
return items;
|
|
134
133
|
};
|
|
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { Resizable } from 're-resizable';
|
|
13
|
-
import { gridTypeForLayout } from '
|
|
13
|
+
import { gridTypeForLayout } from '@atlaskit/editor-common/utils';
|
|
14
14
|
import { snapTo, handleSides } from './utils';
|
|
15
15
|
import { richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import { akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|