@atlaskit/editor-core 185.2.24 → 185.2.26
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 +14 -0
- package/dist/cjs/editor-next/editor-internal.js +3 -3
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/labs/next/Editor.js +3 -3
- package/dist/cjs/labs/next/presets/universal.js +6 -5
- package/dist/cjs/nodeviews/index.js +1 -16
- package/dist/cjs/plugins/annotation/index.js +31 -21
- package/dist/cjs/plugins/annotation/nodeviews/index.js +2 -2
- package/dist/cjs/plugins/base/index.js +0 -6
- package/dist/cjs/plugins/caption/index.js +1 -2
- package/dist/cjs/plugins/caption/nodeviews/index.js +3 -3
- package/dist/cjs/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/extension/actions.js +6 -4
- package/dist/cjs/plugins/extension/commands.js +19 -16
- package/dist/cjs/plugins/extension/context-panel.js +4 -4
- package/dist/cjs/plugins/extension/extension-api.js +1 -1
- package/dist/cjs/plugins/extension/index.js +11 -4
- package/dist/cjs/plugins/extension/nodeviews/extension.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/cjs/plugins/extension/toolbar.js +8 -6
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/jira-issue/index.js +2 -2
- package/dist/cjs/plugins/media/index.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +25 -19
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +3 -3
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +16 -10
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +25 -8
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +6 -4
- package/dist/cjs/test-utils.js +0 -7
- package/dist/cjs/ui/ContextPanel/index.js +9 -2
- package/dist/cjs/utils/action.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/editor-next/editor-internal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/Editor.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +7 -6
- package/dist/es2019/nodeviews/index.js +1 -2
- package/dist/es2019/plugins/annotation/index.js +34 -23
- package/dist/es2019/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/es2019/plugins/base/index.js +0 -4
- package/dist/es2019/plugins/caption/index.js +1 -4
- package/dist/es2019/plugins/caption/nodeviews/index.js +2 -2
- package/dist/es2019/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
- package/dist/es2019/plugins/extension/actions.js +6 -4
- package/dist/es2019/plugins/extension/commands.js +6 -7
- package/dist/es2019/plugins/extension/context-panel.js +4 -4
- package/dist/es2019/plugins/extension/extension-api.js +1 -1
- package/dist/es2019/plugins/extension/index.js +11 -4
- package/dist/es2019/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/es2019/plugins/extension/toolbar.js +8 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/jira-issue/index.js +1 -1
- package/dist/es2019/plugins/media/index.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +21 -14
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +13 -9
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +28 -11
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/test-utils.js +0 -1
- package/dist/es2019/ui/ContextPanel/index.js +8 -1
- package/dist/es2019/utils/action.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/editor-next/editor-internal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/Editor.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +7 -6
- package/dist/esm/nodeviews/index.js +1 -2
- package/dist/esm/plugins/annotation/index.js +32 -22
- package/dist/esm/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/esm/plugins/base/index.js +0 -6
- package/dist/esm/plugins/caption/index.js +1 -2
- package/dist/esm/plugins/caption/nodeviews/index.js +2 -2
- package/dist/esm/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/esm/plugins/extension/actions.js +6 -4
- package/dist/esm/plugins/extension/commands.js +18 -15
- package/dist/esm/plugins/extension/context-panel.js +4 -4
- package/dist/esm/plugins/extension/extension-api.js +1 -1
- package/dist/esm/plugins/extension/index.js +11 -4
- package/dist/esm/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/esm/plugins/extension/toolbar.js +8 -6
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/jira-issue/index.js +1 -1
- package/dist/esm/plugins/media/index.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -18
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +15 -9
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +26 -9
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/test-utils.js +0 -1
- package/dist/esm/ui/ContextPanel/index.js +8 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
- package/dist/types/labs/next/presets/default.d.ts +36 -4
- package/dist/types/labs/next/presets/mobile.d.ts +18 -2
- package/dist/types/nodeviews/index.d.ts +0 -2
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types/plugins/extension/actions.d.ts +2 -1
- package/dist/types/plugins/extension/commands.d.ts +4 -3
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types/plugins/extension/index.d.ts +4 -2
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +5 -3
- package/dist/types/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types/plugins/extension/types.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types/plugins/media/types.d.ts +4 -0
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types/test-utils.d.ts +0 -1
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
- package/dist/types-ts4.5/nodeviews/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
- package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +5 -3
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/test-utils.d.ts +0 -1
- package/package.json +3 -2
- package/report.api.md +20 -85
- package/tmp/api-report-tmp.d.ts +18 -68
- package/dist/cjs/nodeviews/ReactNodeView.js +0 -224
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +0 -169
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +0 -72
- package/dist/cjs/plugins/context-panel/index.js +0 -66
- package/dist/cjs/plugins/context-panel/transforms.js +0 -13
- package/dist/cjs/plugins/context-panel/types.js +0 -5
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +0 -43
- package/dist/cjs/ui/PortalProvider/index.js +0 -252
- package/dist/es2019/nodeviews/ReactNodeView.js +0 -170
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +0 -158
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +0 -48
- package/dist/es2019/plugins/context-panel/index.js +0 -45
- package/dist/es2019/plugins/context-panel/transforms.js +0 -4
- package/dist/es2019/plugins/context-panel/types.js +0 -1
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +0 -37
- package/dist/es2019/ui/PortalProvider/index.js +0 -184
- package/dist/esm/nodeviews/ReactNodeView.js +0 -217
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +0 -163
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +0 -62
- package/dist/esm/plugins/context-panel/index.js +0 -57
- package/dist/esm/plugins/context-panel/transforms.js +0 -6
- package/dist/esm/plugins/context-panel/types.js +0 -1
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +0 -36
- package/dist/esm/ui/PortalProvider/index.js +0 -242
- package/dist/types/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types/plugins/context-panel/index.d.ts +0 -11
- package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types/plugins/context-panel/types.d.ts +0 -1
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types/ui/PortalProvider/index.d.ts +0 -51
- package/dist/types-ts4.5/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types-ts4.5/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types-ts4.5/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +0 -51
package/dist/es2019/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
|
51
51
|
export { default as EditorActions } from './actions';
|
|
52
52
|
// Re-export from provider factory to not cause a breaking change
|
|
53
53
|
|
|
54
|
-
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '
|
|
54
|
+
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
|
|
55
55
|
export { GapCursorSelection, Side as GapCursorSide } from './plugins/selection/gap-cursor-selection';
|
|
56
56
|
export { selectionPluginKey } from './plugins/mobile-selection';
|
|
57
57
|
export { insertExpand } from './plugins/expand/commands';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IntlProvider } from 'react-intl-next';
|
|
4
|
-
import { PortalRenderer, PortalProvider } from '
|
|
4
|
+
import { PortalRenderer, PortalProvider } from '@atlaskit/editor-common/portal-provider';
|
|
5
5
|
import { EditorInternal } from './internal/components/EditorInternal';
|
|
6
6
|
import { usePresetContext, PresetProvider } from './internal/context/preset-context';
|
|
7
7
|
import { EditorSharedConfigConsumer, useEditorSharedConfig } from './internal/context/shared-config';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin,
|
|
1
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
|
|
2
|
+
import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
2
3
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
3
4
|
import cardPlugin from '../../../plugins/card';
|
|
4
5
|
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
@@ -227,6 +228,11 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
227
228
|
}]);
|
|
228
229
|
}
|
|
229
230
|
return builder;
|
|
231
|
+
}).maybeAdd(contextPanelPlugin, (plugin, builder) => {
|
|
232
|
+
if (isFullPage) {
|
|
233
|
+
return builder.add(contextPanelPlugin);
|
|
234
|
+
}
|
|
235
|
+
return builder;
|
|
230
236
|
}).maybeAdd(extensionPlugin, (plugin, builder) => {
|
|
231
237
|
if (props.allowExtension) {
|
|
232
238
|
const extensionConfig = typeof props.allowExtension === 'object' ? props.allowExtension : {};
|
|
@@ -306,11 +312,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
306
312
|
return builder.add(plugin);
|
|
307
313
|
}
|
|
308
314
|
return builder;
|
|
309
|
-
}).maybeAdd(contextPanelPlugin, (plugin, builder) => {
|
|
310
|
-
if (isFullPage) {
|
|
311
|
-
return builder.add(contextPanelPlugin);
|
|
312
|
-
}
|
|
313
|
-
return builder;
|
|
314
315
|
}).maybeAdd(scrollIntoViewPlugin, (plugin, builder) => {
|
|
315
316
|
if (props.autoScrollIntoView !== false) {
|
|
316
317
|
return builder.add(scrollIntoViewPlugin);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { SelectionBasedNodeView } from './SelectionBasedNodeView';
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { annotation } from '@atlaskit/adf-schema';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
-
import { stateKey as reactPluginKey } from '../../plugins/base/pm-plugins/react-nodeview';
|
|
5
3
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
6
4
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
5
|
import { AnnotationUpdateEmitter } from './update-provider';
|
|
8
|
-
import { getPluginState
|
|
6
|
+
import { getPluginState } from './utils';
|
|
9
7
|
import { buildToolbar } from './toolbar';
|
|
10
8
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
11
|
-
|
|
9
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
const annotationPlugin = (annotationProviders, api) => {
|
|
12
11
|
return {
|
|
13
12
|
name: 'annotation',
|
|
14
13
|
marks() {
|
|
@@ -17,6 +16,12 @@ const annotationPlugin = annotationProviders => {
|
|
|
17
16
|
mark: annotation
|
|
18
17
|
}];
|
|
19
18
|
},
|
|
19
|
+
getSharedState(editorState) {
|
|
20
|
+
if (!editorState) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return getPluginState(editorState);
|
|
24
|
+
},
|
|
20
25
|
pmPlugins: () => [{
|
|
21
26
|
name: 'annotation',
|
|
22
27
|
plugin: ({
|
|
@@ -64,28 +69,34 @@ const annotationPlugin = annotationProviders => {
|
|
|
64
69
|
if (!annotationProviders) {
|
|
65
70
|
return null;
|
|
66
71
|
}
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
render: ({
|
|
73
|
-
inlineCommentState
|
|
74
|
-
}) => {
|
|
75
|
-
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
"data-editor-popup": "true"
|
|
80
|
-
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
81
|
-
providers: annotationProviders,
|
|
82
|
-
editorView: editorView,
|
|
83
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
72
|
+
return /*#__PURE__*/React.createElement(AnnotationContentComponent, {
|
|
73
|
+
api: api,
|
|
74
|
+
editorView: editorView,
|
|
75
|
+
annotationProviders: annotationProviders,
|
|
76
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
86
77
|
});
|
|
87
78
|
}
|
|
88
79
|
};
|
|
89
80
|
};
|
|
81
|
+
function AnnotationContentComponent({
|
|
82
|
+
api,
|
|
83
|
+
editorView,
|
|
84
|
+
annotationProviders,
|
|
85
|
+
dispatchAnalyticsEvent
|
|
86
|
+
}) {
|
|
87
|
+
const {
|
|
88
|
+
annotationState: inlineCommentState
|
|
89
|
+
} = useSharedPluginState(api, ['annotation']);
|
|
90
|
+
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
"data-editor-popup": "true"
|
|
95
|
+
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
96
|
+
providers: annotationProviders,
|
|
97
|
+
editorView: editorView,
|
|
98
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
90
101
|
export default annotationPlugin;
|
|
91
102
|
export { AnnotationUpdateEmitter };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import
|
|
3
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
export class AnnotationNodeView extends ReactNodeView {
|
|
5
5
|
createDomRef() {
|
|
6
6
|
return document.createElement('span');
|
|
@@ -10,7 +10,6 @@ import contextIdentifierPlugin from './pm-plugins/context-identifier';
|
|
|
10
10
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
11
11
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
12
12
|
import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
|
|
13
|
-
import { plugin as reactNodeView } from './pm-plugins/react-nodeview';
|
|
14
13
|
import scrollGutter from './pm-plugins/scroll-gutter';
|
|
15
14
|
import { keymap } from '../../utils/keymap';
|
|
16
15
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
@@ -50,9 +49,6 @@ const basePlugin = (options, api) => {
|
|
|
50
49
|
}, {
|
|
51
50
|
name: 'newlinePreserveMarksPlugin',
|
|
52
51
|
plugin: newlinePreserveMarksPlugin
|
|
53
|
-
}, {
|
|
54
|
-
name: 'reactNodeView',
|
|
55
|
-
plugin: () => reactNodeView
|
|
56
52
|
}, {
|
|
57
53
|
name: 'frozenEditor',
|
|
58
54
|
plugin: ({
|
|
@@ -18,10 +18,7 @@ const captionPlugin = (_, api) => {
|
|
|
18
18
|
providerFactory,
|
|
19
19
|
eventDispatcher,
|
|
20
20
|
dispatch
|
|
21
|
-
}) =>
|
|
22
|
-
var _api$dependencies$ana;
|
|
23
|
-
return createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
24
|
-
}
|
|
21
|
+
}) => createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api)
|
|
25
22
|
}, {
|
|
26
23
|
name: 'captionKeymap',
|
|
27
24
|
plugin: captionKeymap
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { SelectionBasedNodeView } from '
|
|
4
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
5
5
|
export class CaptionNodeView extends SelectionBasedNodeView {
|
|
6
6
|
constructor(...args) {
|
|
7
7
|
super(...args);
|
|
@@ -39,7 +39,7 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
39
39
|
return selectedStateChange;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
export default function captionNodeView(portalProviderAPI, eventDispatcher) {
|
|
42
|
+
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
43
43
|
return (node, view, getPos) => {
|
|
44
44
|
const hasIntlContext = true;
|
|
45
45
|
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
@@ -11,7 +11,9 @@ const fireAnalytics = (tr, action, analyticsApi) => {
|
|
|
11
11
|
actionSubjectId: ACTION_SUBJECT_ID.CAPTION
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
|
-
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
14
|
+
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) => {
|
|
15
|
+
var _pluginInjectionApi$d;
|
|
16
|
+
const analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
|
|
15
17
|
return new SafePlugin({
|
|
16
18
|
appendTransaction(transactions, oldState, newState) {
|
|
17
19
|
// only run for transactions that change selection
|
|
@@ -41,7 +43,7 @@ export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
|
41
43
|
key: pluginKey,
|
|
42
44
|
props: {
|
|
43
45
|
nodeViews: {
|
|
44
|
-
caption: captionNodeView(portalProviderAPI, eventDispatcher)
|
|
46
|
+
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
});
|
|
@@ -7,7 +7,7 @@ import rafSchedule from 'raf-schd';
|
|
|
7
7
|
import { Card } from './genericCard';
|
|
8
8
|
import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import
|
|
10
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
11
11
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
12
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
13
13
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
@@ -327,7 +327,7 @@ _defineProperty(EmbedCardComponent, "contextTypes", {
|
|
|
327
327
|
contextAdapter: PropTypes.object
|
|
328
328
|
});
|
|
329
329
|
const WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
|
|
330
|
-
export class EmbedCard extends
|
|
330
|
+
export class EmbedCard extends ReactNodeView {
|
|
331
331
|
viewShouldUpdate(nextNode) {
|
|
332
332
|
if (this.node.attrs !== nextNode.attrs) {
|
|
333
333
|
return true;
|
|
@@ -132,11 +132,12 @@ export const updateExtensionParams = (updateExtension, node, actions) => async (
|
|
|
132
132
|
export const editSelectedExtension = editorActions => {
|
|
133
133
|
const editorView = editorActions._privateGetEditorView();
|
|
134
134
|
const {
|
|
135
|
-
updateExtension
|
|
135
|
+
updateExtension,
|
|
136
|
+
applyChangeToContextPanel
|
|
136
137
|
} = getPluginState(editorView.state);
|
|
137
|
-
return editExtension(null, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
138
|
+
return editExtension(null, applyChangeToContextPanel, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
138
139
|
};
|
|
139
|
-
export const editExtension = (macroProvider, updateExtension) => (state, dispatch, view) => {
|
|
140
|
+
export const editExtension = (macroProvider, applyChangeToContextPanel, updateExtension) => (state, dispatch, view) => {
|
|
140
141
|
if (!view) {
|
|
141
142
|
return false;
|
|
142
143
|
}
|
|
@@ -156,7 +157,8 @@ export const editExtension = (macroProvider, updateExtension) => (state, dispatc
|
|
|
156
157
|
if (updateMethod && view) {
|
|
157
158
|
const actions = createExtensionAPI({
|
|
158
159
|
editorView: view,
|
|
159
|
-
editInLegacyMacroBrowser
|
|
160
|
+
editInLegacyMacroBrowser,
|
|
161
|
+
applyChange: applyChangeToContextPanel
|
|
160
162
|
});
|
|
161
163
|
updateExtensionParams(updateMethod, nodeWithPos, actions)(state, dispatch, view);
|
|
162
164
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { removeSelectedNode, removeParentNodeOfType } from 'prosemirror-utils';
|
|
2
|
-
import { applyChange } from '../context-panel/transforms';
|
|
3
2
|
import { createCommand } from './plugin-factory';
|
|
4
3
|
import { getSelectedExtension } from './utils';
|
|
5
4
|
import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
|
|
@@ -11,7 +10,7 @@ export function updateState(state) {
|
|
|
11
10
|
data: state
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter) {
|
|
13
|
+
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter, applyChangeToContextPanel) {
|
|
15
14
|
return createCommand({
|
|
16
15
|
type: 'UPDATE_STATE',
|
|
17
16
|
data: {
|
|
@@ -19,23 +18,23 @@ export function setEditingContextToContextPanel(processParametersBefore, process
|
|
|
19
18
|
processParametersBefore,
|
|
20
19
|
processParametersAfter
|
|
21
20
|
}
|
|
22
|
-
},
|
|
21
|
+
}, applyChangeToContextPanel);
|
|
23
22
|
}
|
|
24
|
-
export const clearEditingContext = createCommand({
|
|
23
|
+
export const clearEditingContext = applyChangeToContextPanel => createCommand({
|
|
25
24
|
type: 'UPDATE_STATE',
|
|
26
25
|
data: {
|
|
27
26
|
showContextPanel: false,
|
|
28
27
|
processParametersBefore: undefined,
|
|
29
28
|
processParametersAfter: undefined
|
|
30
29
|
}
|
|
31
|
-
},
|
|
32
|
-
export const forceAutoSave = (resolve, reject) => createCommand({
|
|
30
|
+
}, applyChangeToContextPanel);
|
|
31
|
+
export const forceAutoSave = applyChangeToContextPanel => (resolve, reject) => createCommand({
|
|
33
32
|
type: 'UPDATE_STATE',
|
|
34
33
|
data: {
|
|
35
34
|
autoSaveResolve: resolve,
|
|
36
35
|
autoSaveReject: reject
|
|
37
36
|
}
|
|
38
|
-
},
|
|
37
|
+
}, applyChangeToContextPanel);
|
|
39
38
|
export const updateExtensionLayout = layout => createCommand({
|
|
40
39
|
type: 'UPDATE_STATE',
|
|
41
40
|
data: {
|
|
@@ -16,7 +16,7 @@ const areParametersEqual = (firstParameters, secondParameters) => {
|
|
|
16
16
|
}
|
|
17
17
|
return firstParameters === secondParameters;
|
|
18
18
|
};
|
|
19
|
-
export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
19
|
+
export const getContextPanel = (allowAutoSave, featureFlags, applyChange) => state => {
|
|
20
20
|
const nodeWithPos = getSelectedExtension(state, true);
|
|
21
21
|
|
|
22
22
|
// Adding checks to bail out early
|
|
@@ -72,14 +72,14 @@ export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
|
72
72
|
autoSaveResolve();
|
|
73
73
|
}
|
|
74
74
|
if (!allowAutoSave) {
|
|
75
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
75
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
onCancel: async () => {
|
|
79
79
|
if (allowAutoSave) {
|
|
80
80
|
try {
|
|
81
81
|
await new Promise((resolve, reject) => {
|
|
82
|
-
forceAutoSave(resolve, reject)(editorView.state, editorView.dispatch);
|
|
82
|
+
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
83
83
|
});
|
|
84
84
|
} catch (e) {
|
|
85
85
|
// Even if the save failed, we should proceed with closing the panel
|
|
@@ -87,7 +87,7 @@ export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
|
87
87
|
console.error(`Autosave failed with error`, e);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
90
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
91
91
|
},
|
|
92
92
|
featureFlags: featureFlags
|
|
93
93
|
});
|
|
@@ -260,7 +260,7 @@ export const createExtensionAPI = options => {
|
|
|
260
260
|
const {
|
|
261
261
|
editorView
|
|
262
262
|
} = options;
|
|
263
|
-
setEditingContextToContextPanel(transformBefore, transformAfter)(editorView.state, editorView.dispatch, editorView);
|
|
263
|
+
setEditingContextToContextPanel(transformBefore, transformAfter, options.applyChange)(editorView.state, editorView.dispatch, editorView);
|
|
264
264
|
},
|
|
265
265
|
_editInLegacyMacroBrowser: () => {
|
|
266
266
|
const {
|
|
@@ -5,7 +5,7 @@ import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
|
5
5
|
import { getToolbarConfig } from './toolbar';
|
|
6
6
|
import { getContextPanel } from './context-panel';
|
|
7
7
|
const extensionPlugin = (options = {}, api) => {
|
|
8
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
8
|
+
var _api$dependencies, _api$dependencies$fea, _api$dependencies$con2, _api$dependencies$con3;
|
|
9
9
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
10
10
|
return {
|
|
11
11
|
name: 'extension',
|
|
@@ -37,15 +37,22 @@ const extensionPlugin = (options = {}, api) => {
|
|
|
37
37
|
}
|
|
38
38
|
}, {
|
|
39
39
|
name: 'extensionKeymap',
|
|
40
|
-
plugin:
|
|
40
|
+
plugin: () => {
|
|
41
|
+
var _api$dependencies$con;
|
|
42
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange);
|
|
43
|
+
}
|
|
41
44
|
}, {
|
|
42
45
|
name: 'extensionUniqueId',
|
|
43
46
|
plugin: () => createUniqueIdPlugin()
|
|
44
47
|
}];
|
|
45
48
|
},
|
|
46
49
|
pluginsOptions: {
|
|
47
|
-
floatingToolbar: getToolbarConfig(
|
|
48
|
-
|
|
50
|
+
floatingToolbar: getToolbarConfig({
|
|
51
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
52
|
+
hoverDecoration: api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration,
|
|
53
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con2 = api.dependencies.contextPanel) === null || _api$dependencies$con2 === void 0 ? void 0 : _api$dependencies$con2.actions.applyChange
|
|
54
|
+
}),
|
|
55
|
+
contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$con3 = api.dependencies.contextPanel) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.actions.applyChange)
|
|
49
56
|
}
|
|
50
57
|
};
|
|
51
58
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import Extension from '../ui/Extension';
|
|
4
4
|
import ExtensionNodeWrapper from '../ui/Extension/ExtensionNodeWrapper';
|
|
5
5
|
// getInlineNodeViewProducer is a new api to use instead of ReactNodeView
|
|
@@ -2,14 +2,14 @@ import { keymap } from 'prosemirror-keymap';
|
|
|
2
2
|
import { getPluginState } from './main';
|
|
3
3
|
import * as keymaps from '../../../keymaps';
|
|
4
4
|
import { clearEditingContext } from '../commands';
|
|
5
|
-
export default function keymapPlugin() {
|
|
5
|
+
export default function keymapPlugin(applyChange) {
|
|
6
6
|
const list = {};
|
|
7
7
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, (state, dispatch) => {
|
|
8
8
|
const extensionState = getPluginState(state);
|
|
9
9
|
if (!extensionState.showContextPanel) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
|
-
return clearEditingContext(state, dispatch);
|
|
12
|
+
return clearEditingContext(applyChange)(state, dispatch);
|
|
13
13
|
}, list);
|
|
14
14
|
return keymap(list);
|
|
15
15
|
}
|
|
@@ -60,7 +60,8 @@ export const handleUpdate = ({
|
|
|
60
60
|
view,
|
|
61
61
|
prevState,
|
|
62
62
|
domAtPos,
|
|
63
|
-
extensionHandlers
|
|
63
|
+
extensionHandlers,
|
|
64
|
+
applyChange
|
|
64
65
|
}) => {
|
|
65
66
|
const {
|
|
66
67
|
state,
|
|
@@ -78,7 +79,7 @@ export const handleUpdate = ({
|
|
|
78
79
|
const selectedExtension = getSelectedExtension(state, true);
|
|
79
80
|
if (!selectedExtension) {
|
|
80
81
|
if (showContextPanel) {
|
|
81
|
-
clearEditingContext(state, dispatch);
|
|
82
|
+
clearEditingContext(applyChange)(state, dispatch);
|
|
82
83
|
}
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
@@ -96,7 +97,7 @@ export const handleUpdate = ({
|
|
|
96
97
|
element !== newElement;
|
|
97
98
|
if (isNewNodeSelected || shouldUpdateEditButton) {
|
|
98
99
|
if (showContextPanel) {
|
|
99
|
-
clearEditingContext(state, dispatch);
|
|
100
|
+
clearEditingContext(applyChange)(state, dispatch);
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
const {
|
|
@@ -126,9 +127,11 @@ export const handleUpdate = ({
|
|
|
126
127
|
return true;
|
|
127
128
|
};
|
|
128
129
|
const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}) => {
|
|
130
|
+
var _pluginInjectionApi$d;
|
|
129
131
|
const state = createPluginState(dispatch, {
|
|
130
132
|
showEditButton: false,
|
|
131
|
-
showContextPanel: false
|
|
133
|
+
showContextPanel: false,
|
|
134
|
+
applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.applyChange
|
|
132
135
|
});
|
|
133
136
|
const extensionNodeViewOptions = {
|
|
134
137
|
appearance: options.appearance
|
|
@@ -143,11 +146,13 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
143
146
|
providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
|
|
144
147
|
return {
|
|
145
148
|
update: (view, prevState) => {
|
|
149
|
+
var _pluginInjectionApi$d2;
|
|
146
150
|
handleUpdate({
|
|
147
151
|
view,
|
|
148
152
|
prevState,
|
|
149
153
|
domAtPos,
|
|
150
|
-
extensionHandlers
|
|
154
|
+
extensionHandlers,
|
|
155
|
+
applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.applyChange
|
|
151
156
|
});
|
|
152
157
|
},
|
|
153
158
|
destroy: () => {
|
|
@@ -95,7 +95,7 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled)
|
|
|
95
95
|
}
|
|
96
96
|
return [];
|
|
97
97
|
};
|
|
98
|
-
const editButton = (formatMessage, extensionState) => {
|
|
98
|
+
const editButton = (formatMessage, extensionState, applyChangeToContextPanel) => {
|
|
99
99
|
if (!extensionState.showEditButton) {
|
|
100
100
|
return [];
|
|
101
101
|
}
|
|
@@ -110,7 +110,7 @@ const editButton = (formatMessage, extensionState) => {
|
|
|
110
110
|
const {
|
|
111
111
|
updateExtension
|
|
112
112
|
} = getPluginState(state);
|
|
113
|
-
editExtension(macroState && macroState.macroProvider, updateExtension)(state, dispatch, view);
|
|
113
|
+
editExtension(macroState && macroState.macroProvider, applyChangeToContextPanel, updateExtension)(state, dispatch, view);
|
|
114
114
|
return true;
|
|
115
115
|
},
|
|
116
116
|
title: formatMessage(messages.edit),
|
|
@@ -118,14 +118,18 @@ const editButton = (formatMessage, extensionState) => {
|
|
|
118
118
|
focusEditoronEnter: true
|
|
119
119
|
}];
|
|
120
120
|
};
|
|
121
|
-
export const getToolbarConfig = (
|
|
121
|
+
export const getToolbarConfig = ({
|
|
122
|
+
breakoutEnabled = true,
|
|
123
|
+
hoverDecoration,
|
|
124
|
+
applyChangeToContextPanel
|
|
125
|
+
}) => (state, intl) => {
|
|
122
126
|
const {
|
|
123
127
|
formatMessage
|
|
124
128
|
} = intl;
|
|
125
129
|
const extensionState = getPluginState(state);
|
|
126
130
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
127
131
|
const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
|
|
128
|
-
const editButtonArray = editButton(formatMessage, extensionState);
|
|
132
|
+
const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel);
|
|
129
133
|
const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
130
134
|
const extensionObj = getSelectedExtension(state, true);
|
|
131
135
|
|
|
@@ -21,7 +21,8 @@ const ExtensionButton = props => {
|
|
|
21
21
|
const {
|
|
22
22
|
item,
|
|
23
23
|
node,
|
|
24
|
-
editorView
|
|
24
|
+
editorView,
|
|
25
|
+
applyChangeToContextPanel
|
|
25
26
|
} = props;
|
|
26
27
|
const ButtonIcon = React.useMemo(() => item.icon ? Loadable({
|
|
27
28
|
loader: async () => resolveExtensionIcon(item.icon),
|
|
@@ -33,7 +34,8 @@ const ExtensionButton = props => {
|
|
|
33
34
|
}
|
|
34
35
|
const targetNodeAdf = nodeToJSON(node);
|
|
35
36
|
const api = createExtensionAPI({
|
|
36
|
-
editorView
|
|
37
|
+
editorView,
|
|
38
|
+
applyChange: applyChangeToContextPanel
|
|
37
39
|
});
|
|
38
40
|
item.action(targetNodeAdf, api);
|
|
39
41
|
};
|
|
@@ -53,7 +55,8 @@ export const ExtensionsPlaceholder = props => {
|
|
|
53
55
|
node,
|
|
54
56
|
editorView,
|
|
55
57
|
extensionProvider,
|
|
56
|
-
separator
|
|
58
|
+
separator,
|
|
59
|
+
applyChangeToContextPanel
|
|
57
60
|
} = props;
|
|
58
61
|
const [extensions, setExtensions] = useState([]);
|
|
59
62
|
useEffect(() => {
|
|
@@ -69,9 +72,10 @@ export const ExtensionsPlaceholder = props => {
|
|
|
69
72
|
const nodeAdf = React.useMemo(() => nodeToJSON(node), [node]);
|
|
70
73
|
const extensionItems = React.useMemo(() => {
|
|
71
74
|
return getContextualToolbarItemsFromModule(extensions, nodeAdf, createExtensionAPI({
|
|
72
|
-
editorView
|
|
75
|
+
editorView,
|
|
76
|
+
applyChange: applyChangeToContextPanel
|
|
73
77
|
}));
|
|
74
|
-
}, [extensions, nodeAdf, editorView]);
|
|
78
|
+
}, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
|
|
75
79
|
if (!extensionItems.length) {
|
|
76
80
|
return null;
|
|
77
81
|
}
|
|
@@ -86,7 +90,8 @@ export const ExtensionsPlaceholder = props => {
|
|
|
86
90
|
children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
|
|
87
91
|
node: node,
|
|
88
92
|
item: item,
|
|
89
|
-
editorView: editorView
|
|
93
|
+
editorView: editorView,
|
|
94
|
+
applyChangeToContextPanel: applyChangeToContextPanel
|
|
90
95
|
}));
|
|
91
96
|
if (index < extensionItems.length - 1) {
|
|
92
97
|
children.push( /*#__PURE__*/React.createElement(Separator, null));
|
|
@@ -41,7 +41,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
41
41
|
node,
|
|
42
42
|
setDisableScroll,
|
|
43
43
|
mountRef,
|
|
44
|
-
featureFlags
|
|
44
|
+
featureFlags,
|
|
45
|
+
api
|
|
45
46
|
}) => {
|
|
46
47
|
const emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
47
48
|
const {
|
|
@@ -50,6 +51,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
50
51
|
useSomewhatSemanticTextColorNames: false
|
|
51
52
|
};
|
|
52
53
|
return jsx(ButtonGroup, null, items.filter(item => !item.hidden).map((item, idx) => {
|
|
54
|
+
var _api$dependencies$con;
|
|
53
55
|
switch (item.type) {
|
|
54
56
|
case 'button':
|
|
55
57
|
const ButtonIcon = item.icon;
|
|
@@ -205,7 +207,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
205
207
|
node: node,
|
|
206
208
|
editorView: editorView,
|
|
207
209
|
extensionProvider: extensionsProvider,
|
|
208
|
-
separator: item.separator
|
|
210
|
+
separator: item.separator,
|
|
211
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange
|
|
209
212
|
});
|
|
210
213
|
case 'separator':
|
|
211
214
|
return jsx(Separator, {
|
|
@@ -52,7 +52,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
|
52
52
|
export { default as scrollIntoViewPlugin } from './scroll-into-view';
|
|
53
53
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
54
54
|
export { default as findReplacePlugin } from './find-replace';
|
|
55
|
-
export { default as contextPanelPlugin } from './context-panel';
|
|
56
55
|
export { default as selectionPlugin } from './selection';
|
|
57
56
|
export { default as mobileSelectionPlugin } from './mobile-selection';
|
|
58
57
|
export { default as clipboardPlugin } from './clipboard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { confluenceJiraIssue } from '@atlaskit/adf-schema';
|
|
4
|
-
import
|
|
4
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import ReactJIRAIssueNode from './nodeviews/jira-issue';
|
|
6
6
|
export const pluginKey = new PluginKey('jiraIssuePlugin');
|
|
7
7
|
const createPlugin = ({
|
|
@@ -85,10 +85,10 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
85
85
|
return createPlugin(schema, {
|
|
86
86
|
providerFactory,
|
|
87
87
|
nodeViews: {
|
|
88
|
-
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
88
|
+
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
89
89
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options, api),
|
|
90
90
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
91
|
-
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory)
|
|
91
|
+
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
92
92
|
},
|
|
93
93
|
errorReporter,
|
|
94
94
|
uploadErrorHandler: options && options.uploadErrorHandler,
|