@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
|
@@ -7,11 +7,9 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
|
7
7
|
import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
10
|
-
import WithPluginState from '../../../ui/WithPluginState';
|
|
11
|
-
import { pluginKey as widthPluginKey } from '../../width';
|
|
12
10
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
13
11
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
14
|
-
import {
|
|
12
|
+
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
15
13
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
16
14
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
17
15
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -24,6 +22,7 @@ import ReactNodeView from '../../../nodeviews/ReactNodeView';
|
|
|
24
22
|
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
25
23
|
import { NodeSelection } from 'prosemirror-state';
|
|
26
24
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
25
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
27
26
|
export default class MediaSingleNode extends Component {
|
|
28
27
|
constructor(...args) {
|
|
29
28
|
super(...args);
|
|
@@ -158,12 +157,12 @@ export default class MediaSingleNode extends Component {
|
|
|
158
157
|
(_this$captionPlaceHol = this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
|
|
159
158
|
});
|
|
160
159
|
_defineProperty(this, "displayGrid", (visible, gridType, highlight) => {
|
|
161
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
160
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
162
161
|
const {
|
|
163
162
|
pluginInjectionApi,
|
|
164
163
|
view
|
|
165
164
|
} = this.props;
|
|
166
|
-
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)({
|
|
165
|
+
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)({
|
|
167
166
|
visible,
|
|
168
167
|
gridType,
|
|
169
168
|
highlight: highlight
|
|
@@ -321,6 +320,42 @@ _defineProperty(MediaSingleNode, "defaultProps", {
|
|
|
321
320
|
mediaOptions: {}
|
|
322
321
|
});
|
|
323
322
|
_defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
|
|
323
|
+
const MediaSingleNodeWrapper = ({
|
|
324
|
+
pluginInjectionApi,
|
|
325
|
+
mediaProvider,
|
|
326
|
+
contextIdentifierProvider,
|
|
327
|
+
node,
|
|
328
|
+
getPos,
|
|
329
|
+
mediaOptions,
|
|
330
|
+
view,
|
|
331
|
+
fullWidthMode,
|
|
332
|
+
selected,
|
|
333
|
+
eventDispatcher,
|
|
334
|
+
dispatchAnalyticsEvent,
|
|
335
|
+
forwardRef
|
|
336
|
+
}) => {
|
|
337
|
+
const {
|
|
338
|
+
widthState,
|
|
339
|
+
mediaState
|
|
340
|
+
} = useSharedPluginState(pluginInjectionApi, ['width', 'media']);
|
|
341
|
+
return jsx(MediaSingleNode, {
|
|
342
|
+
width: widthState.width,
|
|
343
|
+
lineLength: widthState.lineLength,
|
|
344
|
+
node: node,
|
|
345
|
+
getPos: getPos,
|
|
346
|
+
mediaProvider: mediaProvider,
|
|
347
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
348
|
+
mediaOptions: mediaOptions,
|
|
349
|
+
view: view,
|
|
350
|
+
fullWidthMode: fullWidthMode,
|
|
351
|
+
selected: selected,
|
|
352
|
+
eventDispatcher: eventDispatcher,
|
|
353
|
+
mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
|
|
354
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
355
|
+
forwardRef: forwardRef,
|
|
356
|
+
pluginInjectionApi: pluginInjectionApi
|
|
357
|
+
});
|
|
358
|
+
};
|
|
324
359
|
class MediaSingleNodeView extends ReactNodeView {
|
|
325
360
|
constructor(...args) {
|
|
326
361
|
super(...args);
|
|
@@ -404,34 +439,19 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
404
439
|
mediaProvider,
|
|
405
440
|
contextIdentifierProvider
|
|
406
441
|
}) => {
|
|
407
|
-
return jsx(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
node: this.node,
|
|
421
|
-
getPos: getPos,
|
|
422
|
-
mediaProvider: mediaProvider,
|
|
423
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
424
|
-
mediaOptions: mediaOptions,
|
|
425
|
-
view: this.view,
|
|
426
|
-
fullWidthMode: fullWidthMode,
|
|
427
|
-
selected: this.isNodeSelected,
|
|
428
|
-
eventDispatcher: eventDispatcher,
|
|
429
|
-
mediaPluginState: mediaPluginState,
|
|
430
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
431
|
-
forwardRef: forwardRef,
|
|
432
|
-
pluginInjectionApi: pluginInjectionApi
|
|
433
|
-
});
|
|
434
|
-
}
|
|
442
|
+
return jsx(MediaSingleNodeWrapper, {
|
|
443
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
444
|
+
mediaProvider: mediaProvider,
|
|
445
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
446
|
+
node: this.node,
|
|
447
|
+
getPos: getPos,
|
|
448
|
+
mediaOptions: mediaOptions,
|
|
449
|
+
view: this.view,
|
|
450
|
+
fullWidthMode: fullWidthMode,
|
|
451
|
+
selected: this.isNodeSelected,
|
|
452
|
+
eventDispatcher: eventDispatcher,
|
|
453
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
454
|
+
forwardRef: forwardRef
|
|
435
455
|
});
|
|
436
456
|
}
|
|
437
457
|
});
|
|
@@ -2,7 +2,7 @@ import { css } from '@emotion/react';
|
|
|
2
2
|
import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { N60, B200 } from '@atlaskit/theme/colors';
|
|
5
|
-
import { fileCardImageViewSelector,
|
|
5
|
+
import { fileCardImageViewSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
|
|
6
6
|
export const mediaStyles = css`
|
|
7
7
|
.ProseMirror {
|
|
8
8
|
${mediaSingleSharedStyle} & [layout='full-width'] .${richMediaClassName},
|
|
@@ -120,12 +120,6 @@ export const mediaStyles = css`
|
|
|
120
120
|
${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
|
|
121
121
|
transition: background-color 0s, box-shadow 0s;
|
|
122
122
|
}
|
|
123
|
-
.mediaGroupView-content-wrap.danger {
|
|
124
|
-
/* Media inline */
|
|
125
|
-
.${fileCardImageViewSelectedSelector}::after {
|
|
126
|
-
border: 1px solid ${`var(--ds-border-danger, ${akEditorDeleteIconColor})`};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
123
|
/* Danger when nested node or common */
|
|
130
124
|
.danger {
|
|
131
125
|
/* Media single */
|
|
@@ -187,7 +187,7 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
187
187
|
}];
|
|
188
188
|
return items;
|
|
189
189
|
};
|
|
190
|
-
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, getEditorFeatureFlags) => {
|
|
190
|
+
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, widthPluginDependencyApi, getEditorFeatureFlags) => {
|
|
191
191
|
const {
|
|
192
192
|
mediaSingle
|
|
193
193
|
} = state.schema.nodes;
|
|
@@ -230,7 +230,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
if (allowAdvancedToolBarOptions) {
|
|
233
|
-
toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables)];
|
|
233
|
+
toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPluginDependencyApi, allowResizing, allowResizingInTables)];
|
|
234
234
|
if (toolbarButtons.length) {
|
|
235
235
|
toolbarButtons.push({
|
|
236
236
|
type: 'separator'
|
|
@@ -312,7 +312,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
312
312
|
}, removeButton];
|
|
313
313
|
return items;
|
|
314
314
|
};
|
|
315
|
-
export const floatingToolbar = (state, intl, options = {}) => {
|
|
315
|
+
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
316
316
|
const {
|
|
317
317
|
media,
|
|
318
318
|
mediaInline,
|
|
@@ -379,7 +379,7 @@ export const floatingToolbar = (state, intl, options = {}) => {
|
|
|
379
379
|
const element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(`.${MediaSingleNodeSelector}`);
|
|
380
380
|
return element || mediaPluginState.element;
|
|
381
381
|
};
|
|
382
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, getEditorFeatureFlags);
|
|
382
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, getEditorFeatureFlags);
|
|
383
383
|
}
|
|
384
384
|
return {
|
|
385
385
|
...baseToolbar,
|
|
@@ -29,6 +29,7 @@ import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
|
29
29
|
import { extractSliceFromStep } from '../../../utils/step';
|
|
30
30
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
31
31
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
32
|
+
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
32
33
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
33
34
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
34
35
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
@@ -158,6 +159,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
158
159
|
} = state.schema.nodes;
|
|
159
160
|
const 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;
|
|
160
161
|
|
|
162
|
+
// Don't add closeHistory if we're pasting over layout columns, as we will appendTransaction
|
|
163
|
+
// to cleanup the layout's structure and we want to keep the paste and re-structuring as
|
|
164
|
+
// one event.
|
|
165
|
+
const isPastingOverLayoutColumns = hasParentNodeOfType(state.schema.nodes.layoutColumn)(state.selection);
|
|
166
|
+
|
|
161
167
|
// don't add closeHistory call if we're pasting a table, as some tables may involve additional
|
|
162
168
|
// appendedTransactions to repair them (if they're partial or incomplete) and we don't want
|
|
163
169
|
// to split those repairing transactions in prosemirror-history when they're being added to the
|
|
@@ -173,7 +179,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
173
179
|
});
|
|
174
180
|
return tableExists;
|
|
175
181
|
});
|
|
176
|
-
if (!isPastingTextInsidePlaceholderText && !isPastingTable) {
|
|
182
|
+
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns) {
|
|
177
183
|
tr.setMeta(betterTypePluginKey, true);
|
|
178
184
|
}
|
|
179
185
|
addLinkMetadata(view.state.selection, tr, {
|
|
@@ -38,6 +38,9 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
38
38
|
if (editorPlugin.nodes) {
|
|
39
39
|
acc.nodes.push(...editorPlugin.nodes());
|
|
40
40
|
}
|
|
41
|
+
if (editorPlugin.contentComponent) {
|
|
42
|
+
acc.contentComponents.push(editorPlugin.contentComponent);
|
|
43
|
+
}
|
|
41
44
|
if (editorPlugin.onEditorViewStateUpdated) {
|
|
42
45
|
acc.onEditorViewStateUpdatedCallbacks.push(editorPlugin.onEditorViewStateUpdated);
|
|
43
46
|
}
|
|
@@ -46,6 +49,7 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
46
49
|
nodes: [],
|
|
47
50
|
marks: [],
|
|
48
51
|
plugins: [],
|
|
52
|
+
contentComponents: [],
|
|
49
53
|
onEditorViewStateUpdatedCallbacks: []
|
|
50
54
|
});
|
|
51
55
|
}
|
|
@@ -66,7 +70,8 @@ export const createPMSchemaAndPlugins = (inputPreset = new EditorPresetBuilder()
|
|
|
66
70
|
return {
|
|
67
71
|
plugins,
|
|
68
72
|
schema,
|
|
69
|
-
onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks
|
|
73
|
+
onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks,
|
|
74
|
+
editorConfig
|
|
70
75
|
};
|
|
71
76
|
};
|
|
72
77
|
export { PortalProviderAPI } from './ui/PortalProvider';
|
|
@@ -17,7 +17,7 @@ import WithFlash from '../../WithFlash';
|
|
|
17
17
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
18
18
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import WidthEmitter from '../../WidthEmitter';
|
|
20
|
-
import { GRID_GUTTER } from '
|
|
20
|
+
import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
|
|
21
21
|
import classnames from 'classnames';
|
|
22
22
|
import { injectIntl } from 'react-intl-next';
|
|
23
23
|
import messages from '../../../messages';
|
|
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import rafSchedule from 'raf-schd';
|
|
6
6
|
import { akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { fullPageEditorWrapper } from './StyledComponents';
|
|
8
|
-
import { ContextPanelWidthProvider } from '
|
|
8
|
+
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
10
10
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
11
11
|
export class FullPageEditor extends 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';
|
|
@@ -7,7 +7,7 @@ import FindReplaceToolbarButtonWithState from '../../../plugins/find-replace/Fin
|
|
|
7
7
|
import { BeforePrimaryToolbarWrapper } from '../../../plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper';
|
|
8
8
|
import Toolbar from '../../Toolbar';
|
|
9
9
|
import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyle, mainToolbarSecondChildStyle, nonCustomToolbarWrapperStyle, customToolbarWrapperStyle, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
|
|
10
|
-
import { ContextPanelConsumer } from '
|
|
10
|
+
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
import { ToolbarArrowKeyNavigationProvider } from '../../ToolbarArrowKeyNavigationProvider';
|
|
13
13
|
export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { jsx, css, useTheme } from '@emotion/react';
|
|
4
|
-
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
|
|
7
7
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
@@ -20,7 +20,6 @@ import { mentionsStyles } from '../../plugins/mentions/styles';
|
|
|
20
20
|
import { emojiStyles } from '../../plugins/emoji/styles';
|
|
21
21
|
import { textFormattingStyles } from '../../plugins/text-formatting/styles';
|
|
22
22
|
import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
|
|
23
|
-
import { gridStyles } from '../../plugins/grid/styles';
|
|
24
23
|
import { linkStyles } from '../../plugins/hyperlink/styles';
|
|
25
24
|
import { extensionStyles } from '../../plugins/extension/ui/styles';
|
|
26
25
|
import { expandStyles } from '../../plugins/expand/ui/styles';
|
|
@@ -6,10 +6,9 @@ import { css, jsx } from '@emotion/react';
|
|
|
6
6
|
import Transition from 'react-transition-group/Transition';
|
|
7
7
|
import { N30 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { ContextPanelConsumer } from '
|
|
9
|
+
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
10
10
|
import WithPluginState from '../WithPluginState';
|
|
11
11
|
import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
|
|
12
|
-
import { pluginKey as widthPluginKey } from '../../plugins/width';
|
|
13
12
|
import WithEditorActions from '../WithEditorActions';
|
|
14
13
|
import { getChildBreakoutModes } from '../../utils/document';
|
|
15
14
|
const ANIM_SPEED_MS = 500;
|
|
@@ -58,6 +57,15 @@ export class SwappableContentArea extends React.PureComponent {
|
|
|
58
57
|
mounted: false,
|
|
59
58
|
currentPluginContent: undefined
|
|
60
59
|
});
|
|
60
|
+
_defineProperty(this, "focusEditor", () => {
|
|
61
|
+
const {
|
|
62
|
+
editorView
|
|
63
|
+
} = this.props;
|
|
64
|
+
if (editorView && !editorView.hasFocus()) {
|
|
65
|
+
var _editorView$focus;
|
|
66
|
+
(_editorView$focus = editorView.focus) === null || _editorView$focus === void 0 ? void 0 : _editorView$focus.call(editorView);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
61
69
|
_defineProperty(this, "showPluginContent", () => {
|
|
62
70
|
const {
|
|
63
71
|
pluginContent
|
|
@@ -87,7 +95,8 @@ export class SwappableContentArea extends React.PureComponent {
|
|
|
87
95
|
timeout: this.state.mounted ? ANIM_SPEED_MS : 0,
|
|
88
96
|
in: isVisible,
|
|
89
97
|
mountOnEnter: true,
|
|
90
|
-
unmountOnExit: true
|
|
98
|
+
unmountOnExit: true,
|
|
99
|
+
onExiting: this.focusEditor
|
|
91
100
|
}, children);
|
|
92
101
|
});
|
|
93
102
|
}
|
|
@@ -123,8 +132,9 @@ export class SwappableContentArea extends React.PureComponent {
|
|
|
123
132
|
broadcastPosition,
|
|
124
133
|
positionedOverEditor
|
|
125
134
|
}) => {
|
|
135
|
+
const contextPanelWidth = visible ? width : 0;
|
|
126
136
|
const newPosition = editorWidth ? shouldPanelBePositionedOverEditor(editorWidth, width) : false;
|
|
127
|
-
broadcastWidth(
|
|
137
|
+
broadcastWidth(contextPanelWidth);
|
|
128
138
|
(newPosition && visible) !== positionedOverEditor && broadcastPosition(newPosition && visible);
|
|
129
139
|
return jsx("div", {
|
|
130
140
|
css: [panel, !visible && panelHidden,
|
|
@@ -143,44 +153,57 @@ export class SwappableContentArea extends React.PureComponent {
|
|
|
143
153
|
});
|
|
144
154
|
}
|
|
145
155
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
}) => {
|
|
171
|
-
const firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
172
|
-
const editorWidth = {
|
|
173
|
-
...widthState,
|
|
174
|
-
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
175
|
-
};
|
|
176
|
-
return jsx(SwappableContentArea, _extends({}, this.props, {
|
|
177
|
-
editorView: editorView,
|
|
178
|
-
pluginContent: firstContent,
|
|
179
|
-
editorWidth: editorWidth
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
});
|
|
156
|
+
|
|
157
|
+
// TODO: ED-17837 We have this workaround because we do
|
|
158
|
+
// not have access to the pluginInjectionApi at this location.
|
|
159
|
+
// It might be that we need to inject the pluginInjectionApi
|
|
160
|
+
// via context so that we can use it in this file (similar to
|
|
161
|
+
// WithEditorActions). To be investigated further.
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
const widthPluginKey = {
|
|
164
|
+
key: 'widthPlugin$',
|
|
165
|
+
getState: state => {
|
|
166
|
+
return state['widthPlugin$'];
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function ContextPanelWithActions({
|
|
170
|
+
actions,
|
|
171
|
+
...props
|
|
172
|
+
}) {
|
|
173
|
+
const eventDispatcher = actions._privateGetEventDispatcher();
|
|
174
|
+
const editorView = actions._privateGetEditorView();
|
|
175
|
+
if (!eventDispatcher) {
|
|
176
|
+
return jsx(SwappableContentArea, _extends({
|
|
177
|
+
editorView: editorView
|
|
178
|
+
}, props));
|
|
185
179
|
}
|
|
180
|
+
return jsx(WithPluginState, {
|
|
181
|
+
eventDispatcher: eventDispatcher,
|
|
182
|
+
plugins: {
|
|
183
|
+
contextPanel: contextPanelPluginKey,
|
|
184
|
+
widthState: widthPluginKey
|
|
185
|
+
},
|
|
186
|
+
render: ({
|
|
187
|
+
contextPanel,
|
|
188
|
+
widthState
|
|
189
|
+
}) => {
|
|
190
|
+
const firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
191
|
+
const editorWidth = {
|
|
192
|
+
...widthState,
|
|
193
|
+
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
194
|
+
};
|
|
195
|
+
return jsx(SwappableContentArea, _extends({}, props, {
|
|
196
|
+
editorView: editorView,
|
|
197
|
+
pluginContent: firstContent,
|
|
198
|
+
editorWidth: editorWidth
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
export default function ContextPanel(props) {
|
|
204
|
+
return jsx(WithEditorActions, {
|
|
205
|
+
render: actions => jsx(ContextPanelWithActions, _extends({
|
|
206
|
+
actions: actions
|
|
207
|
+
}, props))
|
|
208
|
+
});
|
|
186
209
|
}
|
|
@@ -9,7 +9,6 @@ import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
|
9
9
|
import EditorAlignImageRight from '@atlaskit/icon/glyph/editor/align-image-right';
|
|
10
10
|
import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-center';
|
|
11
11
|
import { alignAttributes } from '../../utils/rich-media-utils';
|
|
12
|
-
import { pluginKey as widthPluginKey } from '../../plugins/width';
|
|
13
12
|
import { DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
14
13
|
import { addAnalytics } from '../../plugins/analytics/utils';
|
|
15
14
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION } from '../../plugins/analytics';
|
|
@@ -62,7 +61,7 @@ const getNodeWidth = (node, schema) => {
|
|
|
62
61
|
}
|
|
63
62
|
return node.firstChild && node.firstChild.attrs.width || node.attrs.width;
|
|
64
63
|
};
|
|
65
|
-
const makeAlign = (layout, nodeType) => {
|
|
64
|
+
const makeAlign = (layout, nodeType, widthPluginDependencyApi) => {
|
|
66
65
|
return (state, dispatch) => {
|
|
67
66
|
const {
|
|
68
67
|
node
|
|
@@ -76,7 +75,7 @@ const makeAlign = (layout, nodeType) => {
|
|
|
76
75
|
if (!dispatch) {
|
|
77
76
|
return false;
|
|
78
77
|
}
|
|
79
|
-
const widthPluginState =
|
|
78
|
+
const widthPluginState = widthPluginDependencyApi === null || widthPluginDependencyApi === void 0 ? void 0 : widthPluginDependencyApi.sharedState.currentState();
|
|
80
79
|
if (!node || node.type !== nodeType || !widthPluginState) {
|
|
81
80
|
return false;
|
|
82
81
|
}
|
|
@@ -116,7 +115,7 @@ const makeAlign = (layout, nodeType) => {
|
|
|
116
115
|
return true;
|
|
117
116
|
};
|
|
118
117
|
};
|
|
119
|
-
const mapIconsToToolbarItem = (icons, layout, intl, nodeType) => icons.map(toolbarItem => {
|
|
118
|
+
const mapIconsToToolbarItem = (icons, layout, intl, nodeType, widthPluginDependencyApi) => icons.map(toolbarItem => {
|
|
120
119
|
const {
|
|
121
120
|
id,
|
|
122
121
|
value
|
|
@@ -127,7 +126,7 @@ const mapIconsToToolbarItem = (icons, layout, intl, nodeType) => icons.map(toolb
|
|
|
127
126
|
icon: toolbarItem.icon,
|
|
128
127
|
title: intl.formatMessage(layoutToMessages[value]),
|
|
129
128
|
selected: layout === value,
|
|
130
|
-
onClick: makeAlign(value, nodeType)
|
|
129
|
+
onClick: makeAlign(value, nodeType, widthPluginDependencyApi)
|
|
131
130
|
};
|
|
132
131
|
});
|
|
133
132
|
const shouldHideLayoutToolbar = (selection, {
|
|
@@ -135,7 +134,7 @@ const shouldHideLayoutToolbar = (selection, {
|
|
|
135
134
|
}, allowResizingInTables) => {
|
|
136
135
|
return hasParentNodeOfType([nodes.bodiedExtension, nodes.listItem, nodes.expand, nodes.nestedExpand, ...(allowResizingInTables ? [] : [nodes.table])].filter(Boolean))(selection);
|
|
137
136
|
};
|
|
138
|
-
const buildLayoutButtons = (state, intl, nodeType, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true) => {
|
|
137
|
+
const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true) => {
|
|
139
138
|
const {
|
|
140
139
|
selection
|
|
141
140
|
} = state;
|
|
@@ -145,9 +144,9 @@ const buildLayoutButtons = (state, intl, nodeType, allowResizing, allowResizingI
|
|
|
145
144
|
const {
|
|
146
145
|
layout
|
|
147
146
|
} = selection.node.attrs;
|
|
148
|
-
const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType) : [];
|
|
149
|
-
const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType) : [];
|
|
150
|
-
const breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType) : [];
|
|
147
|
+
const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
148
|
+
const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
149
|
+
const breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
|
|
151
150
|
const items = [...alignmentToolbarItems, ...getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping), ...wrappingToolbarItems, ...getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing), ...breakOutToolbarItems];
|
|
152
151
|
return items;
|
|
153
152
|
};
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Resizable } from 're-resizable';
|
|
5
|
-
import { gridTypeForLayout } from '
|
|
5
|
+
import { gridTypeForLayout } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { snapTo, handleSides } from './utils';
|
|
7
7
|
import { richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
8
8
|
import { akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { ContextPanel, WidthContext } from '@atlaskit/editor-common/ui';
|
|
3
|
+
// TODO: ED-17870 This workaround will be removed here.
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
const widthPluginKey = {
|
|
6
|
+
key: 'widthPlugin$',
|
|
7
|
+
getState: state => {
|
|
8
|
+
return state['widthPlugin$'];
|
|
9
|
+
}
|
|
10
|
+
};
|
|
5
11
|
// Why do we need this? Why not just use the width from the context directly rather than this?
|
|
6
12
|
// Well my friend - some of the VR tests break, seemingly due to the fact that existing behaviour
|
|
7
13
|
// assumes the initial value is 0, the width from context may not start from 0 however.
|
|
@@ -43,19 +43,24 @@ export const copyHTMLToClipboard = async (elementToCopy, plainTextToCopy) => {
|
|
|
43
43
|
type: 'text/html'
|
|
44
44
|
})
|
|
45
45
|
});
|
|
46
|
-
|
|
47
46
|
// @ts-ignore
|
|
48
47
|
await navigator.clipboard.write([data]);
|
|
49
48
|
} catch (error) {
|
|
50
49
|
throw new Error('Clipboard api is not supported');
|
|
51
50
|
}
|
|
52
51
|
} else {
|
|
53
|
-
//
|
|
52
|
+
// ED-17083 extension copy seems have issue with ClipboardItem API
|
|
54
53
|
// Hence of use of this polyfill
|
|
55
|
-
|
|
56
|
-
const dt = new Clipboard.DT();
|
|
57
|
-
dt.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
|
|
58
|
-
dt.setData('text/html', elementToCopy.innerHTML);
|
|
59
|
-
Clipboard.write(dt);
|
|
54
|
+
copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
|
|
60
55
|
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// At the time of development, Firefox doesn't support ClipboardItem API
|
|
59
|
+
// Hence of use of this polyfill
|
|
60
|
+
export const copyHTMLToClipboardPolyfill = (elementToCopy, plainTextToCopy) => {
|
|
61
|
+
const Clipboard = clipboard;
|
|
62
|
+
const dt = new Clipboard.DT();
|
|
63
|
+
dt.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
|
|
64
|
+
dt.setData('text/html', elementToCopy.innerHTML);
|
|
65
|
+
Clipboard.write(dt);
|
|
61
66
|
};
|
|
@@ -39,18 +39,31 @@ export class InstrumentedPlugin extends SafePlugin {
|
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
const {
|
|
43
|
+
samplingRate: uiTrackingSamplingRate = 100
|
|
44
|
+
} = uiTracking;
|
|
42
45
|
if (uiTracking.enabled && spec.view) {
|
|
43
46
|
const originalView = spec.view.bind(spec);
|
|
44
47
|
spec.view = editorView => {
|
|
45
48
|
const self = this;
|
|
46
49
|
const measure = `🦉${self.key}::view::update`;
|
|
47
50
|
const view = originalView(editorView);
|
|
51
|
+
let uiTrackingSamplingCounter = 0;
|
|
48
52
|
if (view.update) {
|
|
49
53
|
const originalUpdate = view.update;
|
|
50
54
|
view.update = (view, state) => {
|
|
51
|
-
|
|
55
|
+
const shouldTrack = uiTrackingSamplingRate && uiTrackingSamplingCounter === 0;
|
|
56
|
+
if (shouldTrack) {
|
|
57
|
+
startMeasure(measure);
|
|
58
|
+
}
|
|
52
59
|
originalUpdate(view, state);
|
|
53
|
-
|
|
60
|
+
if (shouldTrack) {
|
|
61
|
+
stopMeasure(measure, () => {});
|
|
62
|
+
}
|
|
63
|
+
uiTrackingSamplingCounter++;
|
|
64
|
+
if (uiTrackingSamplingRate && uiTrackingSamplingCounter >= uiTrackingSamplingRate) {
|
|
65
|
+
uiTrackingSamplingCounter = 0;
|
|
66
|
+
}
|
|
54
67
|
};
|
|
55
68
|
}
|
|
56
69
|
return view;
|
package/dist/es2019/version.json
CHANGED