@atlaskit/editor-core 220.0.3 → 220.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/codemods/createRenameVariableTransform.ts +17 -0
- package/codemods/findImportFromPackage.ts +54 -0
- package/codemods/migrates/createJSXRenameVariableToNestedKeyTransform.ts +43 -0
- package/codemods/migrates/createUpdateEditorToMigrationComponent.ts +25 -0
- package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +1 -1
- package/codemods/migrates/remove-config-panel-width-prop.ts +1 -1
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +1 -22
- package/codemods/migrates/rename-smartlinks-prop.ts +1 -40
- package/codemods/migrates/rename-unsafe-allowUndoRedoButtons-prop.ts +1 -1
- package/codemods/migrates/rename-unsafe-cards-prop.ts +1 -1
- package/codemods/utils.ts +0 -67
- package/dist/cjs/actions/isEmptyParagraph.js +12 -0
- package/dist/cjs/actions/temp-is-empty-document.js +2 -9
- package/dist/cjs/composable-editor/BaseThemeWrapper.js +24 -5
- package/dist/cjs/composable-editor/editor-internal-compiled.js +5 -1
- package/dist/cjs/composable-editor/editor-internal-emotion.js +6 -2
- package/dist/cjs/composable-editor/editor-internal.js +11 -2
- package/dist/cjs/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
- package/dist/cjs/create-editor/ReactEditorView.js +6 -4
- package/dist/cjs/create-editor/addMetadataAttributes.js +36 -0
- package/dist/cjs/create-editor/create-editor.js +0 -62
- package/dist/cjs/create-editor/create-plugins-list.js +2 -15
- package/dist/cjs/create-editor/create-schema.js +4 -35
- package/dist/cjs/create-editor/createErrorReporter.js +14 -0
- package/dist/cjs/create-editor/createPMPlugins.js +39 -0
- package/dist/cjs/create-editor/fixExcludes.js +22 -0
- package/dist/cjs/create-editor/getScrollGutterOptions.js +19 -0
- package/dist/cjs/create-editor/sortByRank.js +9 -0
- package/dist/cjs/entry-points/test-utils.js +4 -2
- package/dist/cjs/isElementBySelectorInDocument.js +15 -0
- package/dist/cjs/setTextSelection.js +12 -0
- package/dist/cjs/test-utils.js +1 -18
- package/dist/cjs/ui/Addon/checkForModal.js +25 -0
- package/dist/cjs/ui/Addon/click-area-helper.js +5 -52
- package/dist/cjs/ui/Addon/outsideProsemirrorEditorClickHandler.js +35 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +4 -16
- package/dist/cjs/ui/Appearance/ChromelessEditorContainer.js +19 -0
- package/dist/cjs/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +13 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +5 -2
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +2 -15
- package/dist/cjs/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +13 -0
- package/dist/cjs/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +13 -0
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +15 -21
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-emotion.js +12 -17
- package/dist/cjs/ui/EditorContentContainer/styles/mentions.js +19 -0
- package/dist/cjs/utils/combineQuickInsertProviders.js +16 -0
- package/dist/cjs/utils/extensions.js +0 -11
- package/dist/cjs/utils/getNodesVisibleInViewport.js +3 -12
- package/dist/cjs/utils/isNodeVisible.js +15 -0
- package/dist/cjs/utils/prepare-quick-insert-provider.js +2 -1
- package/dist/cjs/utils/validNode.js +14 -0
- package/dist/cjs/utils/validateNodes.js +3 -11
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/isEmptyParagraph.js +6 -0
- package/dist/es2019/actions/temp-is-empty-document.js +1 -6
- package/dist/es2019/composable-editor/BaseThemeWrapper.js +19 -3
- package/dist/es2019/composable-editor/editor-internal-compiled.js +5 -1
- package/dist/es2019/composable-editor/editor-internal-emotion.js +6 -2
- package/dist/es2019/composable-editor/editor-internal.js +11 -2
- package/dist/es2019/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
- package/dist/es2019/create-editor/ReactEditorView.js +3 -1
- package/dist/es2019/create-editor/addMetadataAttributes.js +29 -0
- package/dist/es2019/create-editor/create-editor.js +0 -53
- package/dist/es2019/create-editor/create-plugins-list.js +1 -13
- package/dist/es2019/create-editor/create-schema.js +2 -31
- package/dist/es2019/create-editor/createErrorReporter.js +8 -0
- package/dist/es2019/create-editor/createPMPlugins.js +30 -0
- package/dist/es2019/create-editor/fixExcludes.js +12 -0
- package/dist/es2019/create-editor/getScrollGutterOptions.js +13 -0
- package/dist/es2019/create-editor/sortByRank.js +3 -0
- package/dist/es2019/entry-points/test-utils.js +3 -1
- package/dist/es2019/isElementBySelectorInDocument.js +9 -0
- package/dist/es2019/setTextSelection.js +8 -0
- package/dist/es2019/test-utils.js +0 -18
- package/dist/es2019/ui/Addon/checkForModal.js +19 -0
- package/dist/es2019/ui/Addon/click-area-helper.js +2 -53
- package/dist/es2019/ui/Addon/outsideProsemirrorEditorClickHandler.js +33 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +2 -12
- package/dist/es2019/ui/Appearance/ChromelessEditorContainer.js +12 -0
- package/dist/es2019/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +5 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +3 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -1
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +1 -8
- package/dist/es2019/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +5 -0
- package/dist/es2019/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +5 -0
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +14 -19
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-emotion.js +17 -14
- package/dist/es2019/ui/EditorContentContainer/styles/mentions.js +19 -0
- package/dist/es2019/utils/combineQuickInsertProviders.js +11 -0
- package/dist/es2019/utils/extensions.js +0 -11
- package/dist/es2019/utils/getNodesVisibleInViewport.js +1 -9
- package/dist/es2019/utils/isNodeVisible.js +9 -0
- package/dist/es2019/utils/prepare-quick-insert-provider.js +2 -1
- package/dist/es2019/utils/validNode.js +8 -0
- package/dist/es2019/utils/validateNodes.js +1 -8
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/isEmptyParagraph.js +6 -0
- package/dist/esm/actions/temp-is-empty-document.js +1 -6
- package/dist/esm/composable-editor/BaseThemeWrapper.js +23 -4
- package/dist/esm/composable-editor/editor-internal-compiled.js +5 -1
- package/dist/esm/composable-editor/editor-internal-emotion.js +6 -2
- package/dist/esm/composable-editor/editor-internal.js +11 -2
- package/dist/esm/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
- package/dist/esm/create-editor/ReactEditorView.js +3 -1
- package/dist/esm/create-editor/addMetadataAttributes.js +29 -0
- package/dist/esm/create-editor/create-editor.js +0 -58
- package/dist/esm/create-editor/create-plugins-list.js +1 -13
- package/dist/esm/create-editor/create-schema.js +2 -31
- package/dist/esm/create-editor/createErrorReporter.js +8 -0
- package/dist/esm/create-editor/createPMPlugins.js +32 -0
- package/dist/esm/create-editor/fixExcludes.js +16 -0
- package/dist/esm/create-editor/getScrollGutterOptions.js +13 -0
- package/dist/esm/create-editor/sortByRank.js +3 -0
- package/dist/esm/entry-points/test-utils.js +3 -1
- package/dist/esm/isElementBySelectorInDocument.js +9 -0
- package/dist/esm/setTextSelection.js +6 -0
- package/dist/esm/test-utils.js +0 -16
- package/dist/esm/ui/Addon/checkForModal.js +19 -0
- package/dist/esm/ui/Addon/click-area-helper.js +2 -49
- package/dist/esm/ui/Addon/outsideProsemirrorEditorClickHandler.js +29 -0
- package/dist/esm/ui/Appearance/Chromeless.js +2 -14
- package/dist/esm/ui/Appearance/ChromelessEditorContainer.js +14 -0
- package/dist/esm/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +7 -0
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +3 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -1
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +1 -14
- package/dist/esm/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +7 -0
- package/dist/esm/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +7 -0
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +18 -21
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-emotion.js +11 -11
- package/dist/esm/ui/EditorContentContainer/styles/mentions.js +19 -0
- package/dist/esm/utils/combineQuickInsertProviders.js +10 -0
- package/dist/esm/utils/extensions.js +0 -10
- package/dist/esm/utils/getNodesVisibleInViewport.js +1 -9
- package/dist/esm/utils/isNodeVisible.js +9 -0
- package/dist/esm/utils/prepare-quick-insert-provider.js +2 -1
- package/dist/esm/utils/validNode.js +8 -0
- package/dist/esm/utils/validateNodes.js +1 -8
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/actions/isEmptyParagraph.d.ts +5 -0
- package/dist/types/actions/temp-is-empty-document.d.ts +0 -4
- package/dist/types/composable-editor/BaseThemeWrapper.d.ts +1 -1
- package/dist/types/composable-editor/editor-internal-compiled.d.ts +2 -1
- package/dist/types/composable-editor/editor-internal-emotion.d.ts +2 -1
- package/dist/types/composable-editor/editor-internal.d.ts +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +2 -2
- package/dist/types/create-editor/addMetadataAttributes.d.ts +16 -0
- package/dist/types/create-editor/create-editor.d.ts +1 -17
- package/dist/types/create-editor/create-plugins-list.d.ts +1 -4
- package/dist/types/create-editor/create-schema.d.ts +0 -15
- package/dist/types/create-editor/create-universal-preset.d.ts +1 -1
- package/dist/types/create-editor/createErrorReporter.d.ts +3 -0
- package/dist/types/create-editor/createPMPlugins.d.ts +3 -0
- package/dist/types/create-editor/fixExcludes.d.ts +6 -0
- package/dist/types/create-editor/get-ui-component.d.ts +1 -1
- package/dist/types/create-editor/getScrollGutterOptions.d.ts +3 -0
- package/dist/types/create-editor/sortByRank.d.ts +5 -0
- package/dist/types/editor.d.ts +1 -1
- package/dist/types/entry-points/editor.d.ts +10 -1
- package/dist/types/entry-points/test-utils.d.ts +5 -2
- package/dist/types/index.d.ts +3 -1
- package/dist/types/isElementBySelectorInDocument.d.ts +7 -0
- package/dist/types/presets/universal.d.ts +1 -2
- package/dist/types/setTextSelection.d.ts +2 -0
- package/dist/types/test-utils.d.ts +1 -10
- package/dist/types/types/with-appearance-component.d.ts +1 -1
- package/dist/types/ui/Addon/ClickAreaBlock/contentComponentWrapper.d.ts +1 -1
- package/dist/types/ui/Addon/checkForModal.d.ts +10 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +0 -11
- package/dist/types/ui/Addon/outsideProsemirrorEditorClickHandler.d.ts +2 -0
- package/dist/types/ui/Appearance/Chromeless.d.ts +2 -10
- package/dist/types/ui/Appearance/ChromelessEditorContainer.d.ts +9 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/CustomToolbarWrapperMigration.d.ts +4 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -10
- package/dist/types/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.d.ts +4 -0
- package/dist/types/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.d.ts +4 -0
- package/dist/types/utils/combineQuickInsertProviders.d.ts +2 -0
- package/dist/types/utils/extensions.d.ts +0 -1
- package/dist/types/utils/getNodesVisibleInViewport.d.ts +0 -5
- package/dist/types/utils/isNodeVisible.d.ts +5 -0
- package/dist/types/utils/validNode.d.ts +2 -0
- package/dist/types/utils/validateNodes.d.ts +0 -1
- package/dist/types-ts4.5/actions/isEmptyParagraph.d.ts +5 -0
- package/dist/types-ts4.5/actions/temp-is-empty-document.d.ts +0 -4
- package/dist/types-ts4.5/composable-editor/BaseThemeWrapper.d.ts +1 -1
- package/dist/types-ts4.5/composable-editor/editor-internal-compiled.d.ts +2 -1
- package/dist/types-ts4.5/composable-editor/editor-internal-emotion.d.ts +2 -1
- package/dist/types-ts4.5/composable-editor/editor-internal.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +2 -2
- package/dist/types-ts4.5/create-editor/addMetadataAttributes.d.ts +16 -0
- package/dist/types-ts4.5/create-editor/create-editor.d.ts +1 -17
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +1 -4
- package/dist/types-ts4.5/create-editor/create-schema.d.ts +0 -15
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/createErrorReporter.d.ts +3 -0
- package/dist/types-ts4.5/create-editor/createPMPlugins.d.ts +3 -0
- package/dist/types-ts4.5/create-editor/fixExcludes.d.ts +6 -0
- package/dist/types-ts4.5/create-editor/get-ui-component.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/getScrollGutterOptions.d.ts +3 -0
- package/dist/types-ts4.5/create-editor/sortByRank.d.ts +5 -0
- package/dist/types-ts4.5/editor.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/editor.d.ts +10 -1
- package/dist/types-ts4.5/entry-points/test-utils.d.ts +5 -2
- package/dist/types-ts4.5/index.d.ts +3 -1
- package/dist/types-ts4.5/isElementBySelectorInDocument.d.ts +7 -0
- package/dist/types-ts4.5/presets/universal.d.ts +1 -2
- package/dist/types-ts4.5/setTextSelection.d.ts +2 -0
- package/dist/types-ts4.5/test-utils.d.ts +1 -10
- package/dist/types-ts4.5/types/with-appearance-component.d.ts +1 -1
- package/dist/types-ts4.5/ui/Addon/ClickAreaBlock/contentComponentWrapper.d.ts +1 -1
- package/dist/types-ts4.5/ui/Addon/checkForModal.d.ts +10 -0
- package/dist/types-ts4.5/ui/Addon/click-area-helper.d.ts +0 -11
- package/dist/types-ts4.5/ui/Addon/outsideProsemirrorEditorClickHandler.d.ts +2 -0
- package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +2 -10
- package/dist/types-ts4.5/ui/Appearance/ChromelessEditorContainer.d.ts +9 -0
- package/dist/types-ts4.5/ui/Appearance/Comment/Comment.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/CustomToolbarWrapperMigration.d.ts +4 -0
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPage.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbar.d.ts +0 -10
- package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.d.ts +4 -0
- package/dist/types-ts4.5/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.d.ts +4 -0
- package/dist/types-ts4.5/utils/combineQuickInsertProviders.d.ts +2 -0
- package/dist/types-ts4.5/utils/extensions.d.ts +0 -1
- package/dist/types-ts4.5/utils/getNodesVisibleInViewport.d.ts +0 -5
- package/dist/types-ts4.5/utils/isNodeVisible.d.ts +5 -0
- package/dist/types-ts4.5/utils/validNode.d.ts +2 -0
- package/dist/types-ts4.5/utils/validateNodes.d.ts +0 -1
- package/package.json +16 -16
- package/dist/cjs/types/index.js +0 -1
- package/dist/es2019/types/index.js +0 -0
- package/dist/esm/types/index.js +0 -0
- package/dist/types/types/index.d.ts +0 -9
- package/dist/types-ts4.5/types/index.d.ts +0 -9
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
|
-
import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { createEditorNativeAnchorSupportPlugin } from './editorNativeAnchorSupportPlugin';
|
|
5
|
-
import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
|
|
6
|
-
export function sortByRank(a, b) {
|
|
7
|
-
return a.rank - b.rank;
|
|
8
|
-
}
|
|
9
|
-
export function fixExcludes(marks) {
|
|
10
|
-
const markKeys = Object.keys(marks);
|
|
11
|
-
const markGroups = new Set(markKeys.map(mark => marks[mark].group));
|
|
12
|
-
markKeys.forEach(markKey => {
|
|
13
|
-
const mark = marks[markKey];
|
|
14
|
-
if (mark.excludes) {
|
|
15
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
16
|
-
mark.excludes = mark.excludes.split(' ').filter(group => markGroups.has(group)).join(' ');
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return marks;
|
|
20
|
-
}
|
|
21
1
|
export function processPluginsList(plugins) {
|
|
22
2
|
/**
|
|
23
3
|
* First pass to collect pluginsOptions
|
|
@@ -83,37 +63,4 @@ export function processPluginsList(plugins) {
|
|
|
83
63
|
secondaryToolbarComponents: [],
|
|
84
64
|
onEditorViewStateUpdatedCallbacks: []
|
|
85
65
|
});
|
|
86
|
-
}
|
|
87
|
-
export function createPMPlugins(config) {
|
|
88
|
-
const {
|
|
89
|
-
editorConfig
|
|
90
|
-
} = config;
|
|
91
|
-
const pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(({
|
|
92
|
-
plugin
|
|
93
|
-
}) => plugin({
|
|
94
|
-
schema: config.schema,
|
|
95
|
-
dispatch: config.dispatch,
|
|
96
|
-
eventDispatcher: config.eventDispatcher,
|
|
97
|
-
providerFactory: config.providerFactory,
|
|
98
|
-
errorReporter: config.errorReporter,
|
|
99
|
-
portalProviderAPI: config.portalProviderAPI,
|
|
100
|
-
nodeViewPortalProviderAPI: config.nodeViewPortalProviderAPI,
|
|
101
|
-
dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
|
|
102
|
-
featureFlags: config.featureFlags || {},
|
|
103
|
-
getIntl: config.getIntl
|
|
104
|
-
})).filter(plugin => typeof plugin !== 'undefined');
|
|
105
|
-
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
106
|
-
pmPlugins.push(createEditorNativeAnchorSupportPlugin(config.schema));
|
|
107
|
-
}
|
|
108
|
-
if (config.onEditorStateUpdated !== undefined) {
|
|
109
|
-
return [createEditorStateNotificationPlugin(config.onEditorStateUpdated, config.editorConfig.onEditorViewStateUpdatedCallbacks), ...pmPlugins];
|
|
110
|
-
}
|
|
111
|
-
return pmPlugins;
|
|
112
|
-
}
|
|
113
|
-
export function createErrorReporter(errorReporterHandler) {
|
|
114
|
-
const errorReporter = new ErrorReporter();
|
|
115
|
-
if (errorReporterHandler) {
|
|
116
|
-
errorReporter.handler = errorReporterHandler;
|
|
117
|
-
}
|
|
118
|
-
return errorReporter;
|
|
119
66
|
}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
|
|
2
|
-
import {
|
|
2
|
+
import { getScrollGutterOptions } from './getScrollGutterOptions';
|
|
3
3
|
const isCodeBlockAllowed = options => {
|
|
4
4
|
const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
|
5
5
|
return exclude.indexOf('codeBlock') === -1;
|
|
6
6
|
};
|
|
7
|
-
export function getScrollGutterOptions(props) {
|
|
8
|
-
const {
|
|
9
|
-
appearance
|
|
10
|
-
} = props;
|
|
11
|
-
if (fullPageCheck(appearance)) {
|
|
12
|
-
// Full Page appearance uses a scrollable div wrapper.
|
|
13
|
-
return {
|
|
14
|
-
getScrollElement: () => document.querySelector('.fabric-editor-popup-scroll-parent')
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
7
|
export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent
|
|
20
8
|
// Omit placeholder since it's an existing prop in `DefaultPresetPluginOptions` and will get overridden there
|
|
21
9
|
) {
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
import { sanitizeNodes } from '@atlaskit/adf-schema/schema';
|
|
2
2
|
import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
3
|
-
import { createProseMirrorMetadata } from '@atlaskit/editor-common/prosemirror-dom-metadata';
|
|
4
3
|
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
* 🧱 Internal Helper Function: Editor FE Platform
|
|
8
|
-
*
|
|
9
|
-
* Adds generic metadata attributes to a DOMOutputSpec array based on the provided node or mark.
|
|
10
|
-
* This function ensures that the DOMOutputSpec is annotated with ProseMirror-specific metadata.
|
|
11
|
-
*
|
|
12
|
-
* @param {object} params - Parameters object.
|
|
13
|
-
* @param {PMNode | PMMark} params.nodeOrMark - The ProseMirror node or mark to extract metadata from.
|
|
14
|
-
* @param {DOMOutputSpec} params.domSpec - The DOMOutputSpec to which attributes will be added.
|
|
15
|
-
* @returns {DOMOutputSpec} The modified DOMOutputSpec with additional metadata.
|
|
16
|
-
*/
|
|
17
|
-
export const addMetadataAttributes = ({
|
|
18
|
-
nodeOrMark,
|
|
19
|
-
domSpec
|
|
20
|
-
}) => {
|
|
21
|
-
if (!Array.isArray(domSpec)) {
|
|
22
|
-
return domSpec;
|
|
23
|
-
}
|
|
24
|
-
const maybeDefinedAttributes = domSpec[1];
|
|
25
|
-
const metadata = createProseMirrorMetadata(nodeOrMark);
|
|
26
|
-
const hasDefinedAttributes = typeof maybeDefinedAttributes === 'object' && !Array.isArray(maybeDefinedAttributes);
|
|
27
|
-
if (hasDefinedAttributes) {
|
|
28
|
-
domSpec[1] = Object.assign(maybeDefinedAttributes, metadata);
|
|
29
|
-
} else {
|
|
30
|
-
domSpec.splice(1, 0, metadata);
|
|
31
|
-
}
|
|
32
|
-
return domSpec;
|
|
33
|
-
};
|
|
34
|
-
|
|
4
|
+
import { addMetadataAttributes } from './addMetadataAttributes';
|
|
5
|
+
import { fixExcludes } from './fixExcludes';
|
|
35
6
|
/**
|
|
36
7
|
* 🧱 Internal Helper Function: Editor FE Platform
|
|
37
8
|
*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
|
+
export function createErrorReporter(errorReporterHandler) {
|
|
3
|
+
const errorReporter = new ErrorReporter();
|
|
4
|
+
if (errorReporterHandler) {
|
|
5
|
+
errorReporter.handler = errorReporterHandler;
|
|
6
|
+
}
|
|
7
|
+
return errorReporter;
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { createEditorNativeAnchorSupportPlugin } from './editorNativeAnchorSupportPlugin';
|
|
4
|
+
import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
|
|
5
|
+
export function createPMPlugins(config) {
|
|
6
|
+
const {
|
|
7
|
+
editorConfig
|
|
8
|
+
} = config;
|
|
9
|
+
const pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(({
|
|
10
|
+
plugin
|
|
11
|
+
}) => plugin({
|
|
12
|
+
schema: config.schema,
|
|
13
|
+
dispatch: config.dispatch,
|
|
14
|
+
eventDispatcher: config.eventDispatcher,
|
|
15
|
+
providerFactory: config.providerFactory,
|
|
16
|
+
errorReporter: config.errorReporter,
|
|
17
|
+
portalProviderAPI: config.portalProviderAPI,
|
|
18
|
+
nodeViewPortalProviderAPI: config.nodeViewPortalProviderAPI,
|
|
19
|
+
dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
|
|
20
|
+
featureFlags: config.featureFlags || {},
|
|
21
|
+
getIntl: config.getIntl
|
|
22
|
+
})).filter(plugin => typeof plugin !== 'undefined');
|
|
23
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
24
|
+
pmPlugins.push(createEditorNativeAnchorSupportPlugin(config.schema));
|
|
25
|
+
}
|
|
26
|
+
if (config.onEditorStateUpdated !== undefined) {
|
|
27
|
+
return [createEditorStateNotificationPlugin(config.onEditorStateUpdated, config.editorConfig.onEditorViewStateUpdatedCallbacks), ...pmPlugins];
|
|
28
|
+
}
|
|
29
|
+
return pmPlugins;
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function fixExcludes(marks) {
|
|
2
|
+
const markKeys = Object.keys(marks);
|
|
3
|
+
const markGroups = new Set(markKeys.map(mark => marks[mark].group));
|
|
4
|
+
markKeys.forEach(markKey => {
|
|
5
|
+
const mark = marks[markKey];
|
|
6
|
+
if (mark.excludes) {
|
|
7
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
8
|
+
mark.excludes = mark.excludes.split(' ').filter(group => markGroups.has(group)).join(' ');
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return marks;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
2
|
+
export function getScrollGutterOptions(props) {
|
|
3
|
+
const {
|
|
4
|
+
appearance
|
|
5
|
+
} = props;
|
|
6
|
+
if (fullPageCheck(appearance)) {
|
|
7
|
+
// Full Page appearance uses a scrollable div wrapper.
|
|
8
|
+
return {
|
|
9
|
+
getScrollElement: () => document.querySelector('.fabric-editor-popup-scroll-parent')
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export {
|
|
2
|
+
export { isElementBySelectorInDocument } from '../isElementBySelectorInDocument';
|
|
3
|
+
export { setTextSelection } from '../setTextSelection';
|
|
4
|
+
export { createPMSchemaAndPlugins } from '../test-utils';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a selector, checks if an element matching the selector exists in the
|
|
3
|
+
* document.
|
|
4
|
+
* @param selector
|
|
5
|
+
* @returns true if element matching selector exists in document, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export const isElementBySelectorInDocument = selector => {
|
|
8
|
+
return Boolean(document.querySelector(selector));
|
|
9
|
+
};
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
5
5
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
6
6
|
import { basePlugin } from '@atlaskit/editor-plugins/base';
|
|
7
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
7
|
import { createSchema } from './create-editor/create-schema';
|
|
9
8
|
function lightProcessPluginsList(editorPlugins) {
|
|
10
9
|
/**
|
|
@@ -84,21 +83,4 @@ export const createPMSchemaAndPlugins = (inputPreset = new EditorPresetBuilder()
|
|
|
84
83
|
onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks,
|
|
85
84
|
editorConfig
|
|
86
85
|
};
|
|
87
|
-
};
|
|
88
|
-
export function setTextSelection(view, anchor, head) {
|
|
89
|
-
const {
|
|
90
|
-
state
|
|
91
|
-
} = view;
|
|
92
|
-
const tr = state.tr.setSelection(TextSelection.create(state.doc, anchor, head));
|
|
93
|
-
view.dispatch(tr);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Given a selector, checks if an element matching the selector exists in the
|
|
98
|
-
* document.
|
|
99
|
-
* @param selector
|
|
100
|
-
* @returns true if element matching selector exists in document, false otherwise
|
|
101
|
-
*/
|
|
102
|
-
export const isElementBySelectorInDocument = selector => {
|
|
103
|
-
return Boolean(document.querySelector(selector));
|
|
104
86
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
|
|
3
|
+
* any part of the editor container is clicked
|
|
4
|
+
*
|
|
5
|
+
* Handles two cases when a click event is fired:
|
|
6
|
+
*
|
|
7
|
+
* 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
|
|
8
|
+
* 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
|
|
9
|
+
*/
|
|
10
|
+
export const checkForModal = target => {
|
|
11
|
+
const modalDialog = target === null || target === void 0 ? void 0 : target.closest('[role=dialog]');
|
|
12
|
+
if (modalDialog) {
|
|
13
|
+
// return false if not an editor inside modal, otherwise return true
|
|
14
|
+
return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// no modal present so we can return true
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import { addParagraphAtEnd } from '@atlaskit/editor-common/commands';
|
|
3
|
-
import { setSelectionTopLevelBlocks } from '@atlaskit/editor-common/selection';
|
|
4
1
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { checkForModal } from './checkForModal';
|
|
5
3
|
import { ignoreAttribute } from './ClickAreaBlock/contentComponentWrapper';
|
|
4
|
+
import { outsideProsemirrorEditorClickHandler } from './outsideProsemirrorEditorClickHandler';
|
|
6
5
|
|
|
7
6
|
// we ignore all of the clicks made inside <div class="ak-editor-content-area" /> (but not clicks on the node itself)
|
|
8
7
|
const insideContentArea = ref => {
|
|
@@ -19,26 +18,6 @@ const insideContentArea = ref => {
|
|
|
19
18
|
const insideProseMirrorEditableArea = ref => {
|
|
20
19
|
return Boolean(ref === null || ref === void 0 ? void 0 : ref.closest('.ProseMirror'));
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
|
|
25
|
-
* any part of the editor container is clicked
|
|
26
|
-
*
|
|
27
|
-
* Handles two cases when a click event is fired:
|
|
28
|
-
*
|
|
29
|
-
* 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
|
|
30
|
-
* 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
|
|
31
|
-
*/
|
|
32
|
-
export const checkForModal = target => {
|
|
33
|
-
const modalDialog = target === null || target === void 0 ? void 0 : target.closest('[role=dialog]');
|
|
34
|
-
if (modalDialog) {
|
|
35
|
-
// return false if not an editor inside modal, otherwise return true
|
|
36
|
-
return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// no modal present so we can return true
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
21
|
const clickAreaClickHandler = (view, event) => {
|
|
43
22
|
var _view$hasFocus, _target$parentElement, _event$currentTarget, _event$currentTarget2;
|
|
44
23
|
const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus = view.hasFocus) !== null && _view$hasFocus !== void 0 && _view$hasFocus.call(view));
|
|
@@ -100,34 +79,4 @@ const clickAreaClickHandler = (view, event) => {
|
|
|
100
79
|
outsideProsemirrorEditorClickHandler(view, event);
|
|
101
80
|
}
|
|
102
81
|
};
|
|
103
|
-
export const outsideProsemirrorEditorClickHandler = (view, event) => {
|
|
104
|
-
var _view$hasFocus2;
|
|
105
|
-
const {
|
|
106
|
-
dispatch,
|
|
107
|
-
dom,
|
|
108
|
-
state
|
|
109
|
-
} = view;
|
|
110
|
-
const {
|
|
111
|
-
tr
|
|
112
|
-
} = state;
|
|
113
|
-
const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus2 = view.hasFocus) !== null && _view$hasFocus2 !== void 0 && _view$hasFocus2.call(view));
|
|
114
|
-
const isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
|
|
115
|
-
if (isBottomAreaClicked) {
|
|
116
|
-
tr.setMeta('outsideProsemirrorEditorClicked', true);
|
|
117
|
-
addParagraphAtEnd(tr);
|
|
118
|
-
}
|
|
119
|
-
setSelectionTopLevelBlocks(tr, event,
|
|
120
|
-
// Ignored via go/ees005
|
|
121
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
122
|
-
dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
123
|
-
tintDirtyTransaction(tr);
|
|
124
|
-
if (!tr.docChanged && !tr.selectionSet) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (dispatch) {
|
|
128
|
-
dispatch(tr);
|
|
129
|
-
}
|
|
130
|
-
view.focus();
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
};
|
|
133
82
|
export { clickAreaClickHandler };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import { addParagraphAtEnd } from '@atlaskit/editor-common/commands';
|
|
3
|
+
import { setSelectionTopLevelBlocks } from '@atlaskit/editor-common/selection';
|
|
4
|
+
export const outsideProsemirrorEditorClickHandler = (view, event) => {
|
|
5
|
+
var _view$hasFocus;
|
|
6
|
+
const {
|
|
7
|
+
dispatch,
|
|
8
|
+
dom,
|
|
9
|
+
state
|
|
10
|
+
} = view;
|
|
11
|
+
const {
|
|
12
|
+
tr
|
|
13
|
+
} = state;
|
|
14
|
+
const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus = view.hasFocus) !== null && _view$hasFocus !== void 0 && _view$hasFocus.call(view));
|
|
15
|
+
const isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
|
|
16
|
+
if (isBottomAreaClicked) {
|
|
17
|
+
tr.setMeta('outsideProsemirrorEditorClicked', true);
|
|
18
|
+
addParagraphAtEnd(tr);
|
|
19
|
+
}
|
|
20
|
+
setSelectionTopLevelBlocks(tr, event,
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
23
|
+
dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
24
|
+
tintDirtyTransaction(tr);
|
|
25
|
+
if (!tr.docChanged && !tr.selectionSet) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (dispatch) {
|
|
29
|
+
dispatch(tr);
|
|
30
|
+
}
|
|
31
|
+
view.focus();
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
5
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import EditorContentContainer from '../EditorContentContainer/EditorContentContainer';
|
|
7
6
|
import PluginSlot from '../PluginSlot';
|
|
8
7
|
import WithFlash from '../WithFlash';
|
|
9
|
-
import {
|
|
10
|
-
import { ChromelessEditorContainerEmotion } from './Chromeless-emotion';
|
|
8
|
+
import { ChromelessEditorContainer } from './ChromelessEditorContainer';
|
|
11
9
|
/**
|
|
12
10
|
* Render the editor in a chromeless appearance.
|
|
13
11
|
* Example use is the inline comment editor, which doesn't have editor toolbar
|
|
@@ -105,12 +103,4 @@ function RenderWithPluginState({
|
|
|
105
103
|
return /*#__PURE__*/React.createElement(Fragment, null, renderChrome({
|
|
106
104
|
maxContentSize
|
|
107
105
|
}));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Container for the chromeless editor appearance. This is used to set the max and min height
|
|
112
|
-
* of the editor content area, and to provide a ref to the container element for the popups.
|
|
113
|
-
* @param param0 props for the chromeless editor container
|
|
114
|
-
* @returns JSX element representing the chromeless editor container
|
|
115
|
-
*/
|
|
116
|
-
export const ChromelessEditorContainer = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), ChromelessEditorContainerCompiled, ChromelessEditorContainerEmotion);
|
|
106
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { ChromelessEditorContainerCompiled } from './Chromeless-compiled';
|
|
4
|
+
import { ChromelessEditorContainerEmotion } from './Chromeless-emotion';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Container for the chromeless editor appearance. This is used to set the max and min height
|
|
8
|
+
* of the editor content area, and to provide a ref to the container element for the popups.
|
|
9
|
+
* @param param0 props for the chromeless editor container
|
|
10
|
+
* @returns JSX element representing the chromeless editor container
|
|
11
|
+
*/
|
|
12
|
+
export const ChromelessEditorContainer = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), ChromelessEditorContainerCompiled, ChromelessEditorContainerEmotion);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { CustomToolbarWrapperCompiled } from './MainToolbar-compiled';
|
|
4
|
+
import { CustomToolbarWrapperEmotion } from './MainToolbar-emotion';
|
|
5
|
+
export const CustomToolbarWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), CustomToolbarWrapperCompiled, CustomToolbarWrapperEmotion);
|
|
@@ -12,9 +12,10 @@ import { injectIntl } from 'react-intl';
|
|
|
12
12
|
import { decisionListSelector, taskListSelector } from '@atlaskit/adf-schema';
|
|
13
13
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
14
14
|
import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
|
-
import { akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
import { akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
16
16
|
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
19
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
19
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
21
|
// Ignored via go/ees005
|
|
@@ -226,7 +227,7 @@ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
226
227
|
const contentAreaRef = useRef(null);
|
|
227
228
|
const containerRef = useRef(null);
|
|
228
229
|
const allowScrollGutter = (_props$editorAPI = props.editorAPI) === null || _props$editorAPI === void 0 ? void 0 : (_props$editorAPI$base = _props$editorAPI.base) === null || _props$editorAPI$base === void 0 ? void 0 : (_props$editorAPI$base2 = _props$editorAPI$base.sharedState.currentState()) === null || _props$editorAPI$base2 === void 0 ? void 0 : _props$editorAPI$base2.allowScrollGutter;
|
|
229
|
-
const contentAreaMaxWidth = getTotalPadding() + (!fullWidthMode ? maxWidthMode ? akEditorUltraWideLayoutWidth : theme.layoutMaxWidth : akEditorFullWidthLayoutWidth);
|
|
230
|
+
const contentAreaMaxWidth = getTotalPadding() + (!fullWidthMode ? maxWidthMode ? akEditorUltraWideLayoutWidth : expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) || expValEquals('platform_editor_core_static_css', 'isEnabled', true) ? akEditorDefaultLayoutWidth : theme.layoutMaxWidth : akEditorFullWidthLayoutWidth);
|
|
230
231
|
|
|
231
232
|
// Get useStandardNodeWidth from block menu plugin shared state
|
|
232
233
|
// Only access editorAPI when the experiment is enabled to avoid performance impact
|
|
@@ -8,8 +8,11 @@ import { ToolbarPortalMountPoint, useToolbarPortal } from '../../Toolbar/Toolbar
|
|
|
8
8
|
import { ToolbarWithSizeDetector as Toolbar } from '../../Toolbar/ToolbarWithSizeDetector';
|
|
9
9
|
import { BeforePrimaryToolbarWrapper } from './BeforeWrapper';
|
|
10
10
|
import { MainToolbarForFirstChildWrapper, MainToolbarForSecondChildWrapper } from './CustomToolbarWrapper';
|
|
11
|
-
import { CustomToolbarWrapperMigration
|
|
11
|
+
import { CustomToolbarWrapperMigration } from './CustomToolbarWrapperMigration';
|
|
12
|
+
import { MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
|
|
13
|
+
import { MainToolbarIconBeforeMigration } from './MainToolbarIconBeforeMigration';
|
|
12
14
|
import { MainToolbarWrapper } from './MainToolbarWrapper';
|
|
15
|
+
import { NonCustomToolbarWrapperMigration } from './NonCustomToolbarWrapperMigration';
|
|
13
16
|
export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
14
17
|
var _props$primaryToolbar, _useToolbarPortal, _props$customPrimaryT;
|
|
15
18
|
const [shouldSplitToolbar, setShouldSplitToolbar] = useState(false);
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import { CustomToolbarWrapperCompiled, MainToolbarIconBeforeCompiled, NonCustomToolbarWrapperCompiled } from './MainToolbar-compiled';
|
|
4
|
-
import { CustomToolbarWrapperEmotion, MainToolbarIconBeforeEmotion, NonCustomToolbarWrapperEmotion } from './MainToolbar-emotion';
|
|
5
|
-
export const MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 868;
|
|
6
|
-
export const NonCustomToolbarWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), NonCustomToolbarWrapperCompiled, NonCustomToolbarWrapperEmotion);
|
|
7
|
-
export const CustomToolbarWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), CustomToolbarWrapperCompiled, CustomToolbarWrapperEmotion);
|
|
8
|
-
export const MainToolbarIconBeforeMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), MainToolbarIconBeforeCompiled, MainToolbarIconBeforeEmotion);
|
|
1
|
+
export const MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 868;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { MainToolbarIconBeforeCompiled } from './MainToolbar-compiled';
|
|
4
|
+
import { MainToolbarIconBeforeEmotion } from './MainToolbar-emotion';
|
|
5
|
+
export const MainToolbarIconBeforeMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), MainToolbarIconBeforeCompiled, MainToolbarIconBeforeEmotion);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { NonCustomToolbarWrapperCompiled } from './MainToolbar-compiled';
|
|
4
|
+
import { NonCustomToolbarWrapperEmotion } from './MainToolbar-emotion';
|
|
5
|
+
export const NonCustomToolbarWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), NonCustomToolbarWrapperCompiled, NonCustomToolbarWrapperEmotion);
|
|
@@ -14,7 +14,7 @@ import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
|
14
14
|
import { AnnotationSharedClassNames, richMediaClassName, expandClassNames, SmartCardSharedCssClassName, CodeBlockSharedCssClassName, tableCellBorderWidth, tableCellMinWidth, TaskDecisionSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
15
15
|
import { BodiedSyncBlockSharedCssClassName, SyncBlockSharedCssClassName, SyncBlockLabelSharedCssClassName, SyncBlockStateCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
16
16
|
import { tableCellBackgroundStyleOverrideForCompiled } from '@atlaskit/editor-common/table-cell-background-for-compiled';
|
|
17
|
-
import { akEditorFullPageDefaultFontSize, akEditorFullPageDenseFontSize, akEditorGutterPaddingDynamic, akEditorSwoopCubicBezier, akEditorTableNumberColumnWidth
|
|
17
|
+
import { akEditorFullPageDefaultFontSize, akEditorFullPageDenseFontSize, akEditorGutterPaddingDynamic, akEditorSwoopCubicBezier, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
18
18
|
import { overflowShadowForCompiled } from '@atlaskit/editor-shared-styles/overflow-shadow-for-compiled';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -404,23 +404,18 @@ export const EditorContentContainerCompiled = /*#__PURE__*/React.forwardRef((pro
|
|
|
404
404
|
const tableOverflowShadow = overflowShadowForCompiled({
|
|
405
405
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
406
406
|
});
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
baseFontSize
|
|
420
|
-
}
|
|
421
|
-
})}px`,
|
|
422
|
-
'--ak-editor--large-gutter-padding': `${akEditorGutterPaddingDynamic()}px`,
|
|
423
|
-
'--ak-editor--table-overflow-shadow': tableOverflowShadow
|
|
407
|
+
|
|
408
|
+
// Under the static-CSS experiment, --ak-editor-base-font-size is set earlier on the
|
|
409
|
+
// root div in editor-internal.tsx and inherited via the CSS cascade — do not set it here.
|
|
410
|
+
// For the legacy path, compute it from the Emotion theme as before.
|
|
411
|
+
const style = {
|
|
412
|
+
'--ak-editor--table-overflow-shadow': tableOverflowShadow,
|
|
413
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
414
|
+
...(!editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
415
|
+
exposure: true
|
|
416
|
+
}) && {
|
|
417
|
+
'--ak-editor--large-gutter-padding': `${akEditorGutterPaddingDynamic()}px`
|
|
418
|
+
})
|
|
424
419
|
};
|
|
425
420
|
const browser = getBrowserInfo();
|
|
426
421
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -450,7 +445,7 @@ export const EditorContentContainerCompiled = /*#__PURE__*/React.forwardRef((pro
|
|
|
450
445
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
451
446
|
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) ? editorContentStyles.paragraphStylesWithScaledMargin : editorContentStyles.paragraphStylesUGCRefreshed : contentMode === 'compact' && (expValEquals('confluence_compact_text_format', 'isEnabled', true) ||
|
|
452
447
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
453
|
-
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) ? editorContentStyles.paragraphStylesOldWithScaledMargin : editorContentStyles.paragraphStylesOld, editorContentStyles.linkStyles, browser.safari && editorContentStyles.listsStylesSafariFix, editorExperiment('platform_synced_block', true) && editorContentStyles.pragmaticResizerStylesSyncedBlock, expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) &&
|
|
448
|
+
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) ? editorContentStyles.paragraphStylesOldWithScaledMargin : editorContentStyles.paragraphStylesOld, editorContentStyles.linkStyles, browser.safari && editorContentStyles.listsStylesSafariFix, editorExperiment('platform_synced_block', true) && editorContentStyles.pragmaticResizerStylesSyncedBlock, expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && editorContentStyles.pragmaticResizerStyles, expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && editorExperiment('platform_synced_block', true) && editorContentStyles.pragmaticResizerStylesCodeBlockSyncedBlockPatch, expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && !editorExperiment('platform_synced_block', true) && editorContentStyles.pragmaticResizerStylesCodeBlockLegacy, editorExperiment('advanced_layouts', true) && expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && editorContentStyles.pragmaticStylesLayoutFirstNodeResizeHandleFix, expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && editorContentStyles.pragmaticResizerStylesForTooltip, editorExperiment('platform_editor_preview_panel_responsiveness', true) && (editorExperiment('advanced_layouts', true) || expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true)) && editorContentStyles.pragmaticResizerStylesWithReducedEditorGutter, editorContentStyles.aiPanelBaseStyles, isFirefox && editorContentStyles.aiPanelBaseFirefoxStyles, colorMode === 'dark' && editorContentStyles.aiPanelDarkStyles, colorMode === 'dark' && isFirefox && editorContentStyles.aiPanelDarkFirefoxStyles, viewMode === 'view' && editorContentStyles.layoutStylesForView, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutSelectedStylesForViewAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', false) && editorContentStyles.layoutSelectedStylesForViewNotAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutResponsiveStylesForView, isComment && editorContentStyles.commentEditorStyles, isComment && editorContentStyles.tableCommentEditorStyles, isFullPage && editorContentStyles.fullPageEditorStyles, isFullPage && editorContentStyles.scrollbarStyles, fg('platform_editor_nested_dnd_styles_changes') ? editorContentStyles.firstCodeBlockWithNoMargin : editorContentStyles.firstCodeBlockWithNoMarginOld, editorContentStyles.firstBlockNodeStyles, editorContentStyles.mentionNodeStyles, expValEqualsNoExposure('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? editorContentStyles.mentionsSelectionStylesWithSearchMatch : editorContentStyles.mentionsSelectionStyles, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? editorContentStyles.scaledEmojiStyles : editorContentStyles.emojiStyles, contentMode === 'compact' && isDense && (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) && expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.scaledEmojiDenseStyles, contentMode === 'compact' && isDense && (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) && !expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.emojiDenseStyles, editorContentStyles.panelViewStyles, editorContentStyles.mediaGroupStyles, editorContentStyles.mediaAlignmentStyles, expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? editorContentStyles.tableLayoutFixesWithFontSize : editorContentStyles.tableLayoutFixes, editorContentStyles.tableContainerStyles, editorContentStyles.tableSharedStyle, (browser.gecko || browser.ie || browser.mac && browser.chrome) && editorContentStyles.tableSharedStyleBackgroundClipFix, editorContentStyles.tableEmptyRowStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && editorContentStyles.tableContentModeStyles, editorContentStyles.hyperLinkFloatingToolbarStyles, editorContentStyles.selectionToolbarAnimationStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.blockquoteDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.textDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.listDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.dangerDateStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.emojiDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.mentionDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.decisionDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.statusDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.dangerRuleStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.mediaDangerStyles, editorExperiment('platform_editor_block_menu', true) && editorContentStyles.nestedPanelDangerStyles, className]),
|
|
454
449
|
ref: ref,
|
|
455
450
|
"data-editor-scroll-container": isScrollable ? 'true' : undefined,
|
|
456
451
|
"data-testid": "editor-content-container"
|
|
@@ -123,20 +123,23 @@ export const EditorContentContainerEmotion = /*#__PURE__*/React.forwardRef((prop
|
|
|
123
123
|
const isComment = appearance === 'comment';
|
|
124
124
|
const isChromeless = appearance === 'chromeless';
|
|
125
125
|
const baseFontSize = getBaseFontSize(appearance, contentMode);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
|
|
127
|
+
// Under the static-CSS experiment, --ak-editor-base-font-size is set earlier on the
|
|
128
|
+
// root div in editor-internal.tsx and inherited via the CSS cascade — do not set it here.
|
|
129
|
+
// For the legacy path, compute it from the Emotion theme as before.
|
|
130
|
+
const style = {
|
|
131
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
132
|
+
...(!expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) && {
|
|
133
|
+
'--ak-editor-base-font-size': `${editorFontSize({
|
|
134
|
+
theme
|
|
135
|
+
})}px`
|
|
136
|
+
}),
|
|
137
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
138
|
+
...(!editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
139
|
+
exposure: true
|
|
140
|
+
}) && {
|
|
141
|
+
'--ak-editor--large-gutter-padding': `${akEditorGutterPaddingDynamic()}px`
|
|
142
|
+
})
|
|
140
143
|
};
|
|
141
144
|
const browser = getBrowserInfo();
|
|
142
145
|
return jsx("div", {
|