@atlaskit/editor-core 203.6.3 → 203.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/cjs/composable-editor/hooks/useProviderFactory.js +14 -4
- package/dist/cjs/presets/default.js +3 -1
- package/dist/cjs/ui/ContentStyles/layout.js +1 -1
- package/dist/cjs/utils/extensions.js +27 -8
- package/dist/cjs/utils/prepare-quick-insert-provider.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/hooks/useProviderFactory.js +13 -3
- package/dist/es2019/presets/default.js +4 -1
- package/dist/es2019/ui/ContentStyles/layout.js +1 -1
- package/dist/es2019/utils/extensions.js +25 -6
- package/dist/es2019/utils/prepare-quick-insert-provider.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/hooks/useProviderFactory.js +14 -4
- package/dist/esm/presets/default.js +3 -1
- package/dist/esm/ui/ContentStyles/layout.js +1 -1
- package/dist/esm/utils/extensions.js +27 -8
- package/dist/esm/utils/prepare-quick-insert-provider.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +23 -22
- package/dist/types/presets/default.d.ts +12 -10
- package/dist/types/presets/universal.d.ts +23 -22
- package/dist/types/presets/useUniversalPreset.d.ts +23 -22
- package/dist/types/utils/extensions.d.ts +4 -1
- package/dist/types/utils/prepare-quick-insert-provider.d.ts +4 -1
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +24 -23
- package/dist/types-ts4.5/presets/default.d.ts +12 -10
- package/dist/types-ts4.5/presets/universal.d.ts +24 -23
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +24 -23
- package/dist/types-ts4.5/utils/extensions.d.ts +6 -1
- package/dist/types-ts4.5/utils/prepare-quick-insert-provider.d.ts +6 -1
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 203.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#180960](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180960)
|
|
8
|
+
[`3ee72a54bc1bb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3ee72a54bc1bb) -
|
|
9
|
+
ED-26040 fix editor layout padding issue
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 203.6.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#180750](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180750)
|
|
20
|
+
[`f019b16b9161a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f019b16b9161a) -
|
|
21
|
+
[ux] Introduces access to the ExtensionAPI from extension module quickInsert actions
|
|
22
|
+
- [#180067](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180067)
|
|
23
|
+
[`fdee6c449ca83`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fdee6c449ca83) -
|
|
24
|
+
[ux] Adding block quote as an option to the text formatting menu for full page editors
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 203.6.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -11,11 +11,20 @@ var _prepareExtensionProvider = _interopRequireDefault(require("../../utils/prep
|
|
|
11
11
|
var _prepareQuickInsertProvider = _interopRequireDefault(require("../../utils/prepare-quick-insert-provider"));
|
|
12
12
|
var _getProvidersFromEditorProps = _interopRequireDefault(require("../utils/getProvidersFromEditorProps"));
|
|
13
13
|
var _handleProviders = _interopRequireDefault(require("../utils/handleProviders"));
|
|
14
|
-
function
|
|
14
|
+
function useEditorRef(preset) {
|
|
15
|
+
var apiRef = (0, _react.useRef)();
|
|
16
|
+
(0, _react.useEffect)(function () {
|
|
17
|
+
return preset === null || preset === void 0 ? void 0 : preset.apiResolver.on(function (api) {
|
|
18
|
+
apiRef.current = api;
|
|
19
|
+
});
|
|
20
|
+
}, [preset === null || preset === void 0 ? void 0 : preset.apiResolver]);
|
|
21
|
+
return apiRef;
|
|
22
|
+
}
|
|
23
|
+
function prepareProviders(editorActions, apiRef, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
15
24
|
var extensionProvider = (0, _prepareExtensionProvider.default)(function () {
|
|
16
25
|
return editorActions;
|
|
17
26
|
})(extensionProviders);
|
|
18
|
-
var quickInsertProvider = (0, _prepareQuickInsertProvider.default)(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
27
|
+
var quickInsertProvider = (0, _prepareQuickInsertProvider.default)(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
19
28
|
return {
|
|
20
29
|
extensionProvider: extensionProvider,
|
|
21
30
|
quickInsertProvider: quickInsertProvider
|
|
@@ -63,14 +72,15 @@ function useProviderFactory(props, editorActions, createAnalyticsEvent) {
|
|
|
63
72
|
});
|
|
64
73
|
}, [autoformattingProvider, emojiProvider, mentionProvider, legacyImageUploadProvider, taskDecisionProvider, contextIdentifierProvider, searchProvider, macroProvider, activityProvider, collabEdit, collabEditProvider, presenceProvider]);
|
|
65
74
|
var providerFactory = (0, _react.useRef)(new _providerFactory.ProviderFactory());
|
|
75
|
+
var editorRef = useEditorRef(props.preset);
|
|
66
76
|
var preparedProviders = (0, _react.useMemo)(function () {
|
|
67
77
|
return (
|
|
68
78
|
// Though this will introduce some performance regression related to quick insert
|
|
69
79
|
// loading but we can remove it soon when Forge will move to new API.
|
|
70
80
|
// quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
|
|
71
|
-
prepareProviders(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)
|
|
81
|
+
prepareProviders(editorActions, editorRef, quickInsert, extensionProviders, createAnalyticsEvent)
|
|
72
82
|
);
|
|
73
|
-
}, [extensionProviders, quickInsert, editorActions, createAnalyticsEvent]);
|
|
83
|
+
}, [extensionProviders, quickInsert, editorActions, createAnalyticsEvent, editorRef]);
|
|
74
84
|
(0, _react.useEffect)(function () {
|
|
75
85
|
(0, _handleProviders.default)(providerFactory.current, providers, preparedProviders.extensionProvider, preparedProviders.quickInsertProvider);
|
|
76
86
|
}, [providers, preparedProviders]);
|
|
@@ -56,7 +56,9 @@ function createDefaultPreset(options) {
|
|
|
56
56
|
isFullPage: isFullPage
|
|
57
57
|
})]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
|
|
58
58
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
59
|
-
}]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).add(_primaryToolbar.primaryToolbarPlugin).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([_blockType.blockTypePlugin, options.blockType
|
|
59
|
+
}]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).add(_primaryToolbar.primaryToolbarPlugin).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([_blockType.blockTypePlugin, _objectSpread(_objectSpread({}, options.blockType), {}, {
|
|
60
|
+
includeBlockQuoteAsTextstyleOption: isFullPage
|
|
61
|
+
})]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).add([_selectionToolbar.selectionToolbarPlugin, {
|
|
60
62
|
preferenceToolbarAboveSelection: !!options.preferenceToolbarAboveSelection
|
|
61
63
|
}]).add([_hyperlink.hyperlinkPlugin, _objectSpread(_objectSpread({}, options.hyperlinkOptions), {}, {
|
|
62
64
|
// @ts-ignore Temporary solution to check for Live Page editor.
|
|
@@ -69,5 +69,5 @@ var layoutResponsiveStyles = function layoutResponsiveStyles(viewMode) {
|
|
|
69
69
|
|
|
70
70
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
71
71
|
var layoutStyles = exports.layoutStyles = function layoutStyles(viewMode) {
|
|
72
|
-
return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", _editorSharedStyles.akLayoutGutterOffset, _editorSharedStyles.akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' || (0, _experiments.editorExperiment)('advanced_layouts', true) ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", _styles.LAYOUT_COLUMN_PADDING, _styles.LAYOUT_COLUMN_PADDING + ((0, _experiments.editorExperiment)('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), (0, _experiments.editorExperiment)('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), (0, _experiments.editorExperiment)('advanced_layouts', true) && layoutResponsiveStyles(viewMode), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && (0, _experiments.editorExperiment)('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", _editorSharedStyles.akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
72
|
+
return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", _editorSharedStyles.akLayoutGutterOffset + ((0, _experiments.editorExperiment)('nested-dnd', true) && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_2') ? 8 : 0), _editorSharedStyles.akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' || (0, _experiments.editorExperiment)('advanced_layouts', true) ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", _styles.LAYOUT_COLUMN_PADDING, _styles.LAYOUT_COLUMN_PADDING + ((0, _experiments.editorExperiment)('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), (0, _experiments.editorExperiment)('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), (0, _experiments.editorExperiment)('advanced_layouts', true) && layoutResponsiveStyles(viewMode), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && (0, _experiments.editorExperiment)('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", _editorSharedStyles.akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
73
73
|
};
|
|
@@ -13,6 +13,7 @@ var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
15
15
|
var _providerHelpers = require("@atlaskit/editor-common/provider-helpers");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
/**
|
|
17
18
|
* Utils to send analytics event when a extension is inserted using quickInsert
|
|
18
19
|
*/
|
|
@@ -34,11 +35,11 @@ function sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source) {
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
function extensionProviderToQuickInsertProvider(_x, _x2, _x3) {
|
|
38
|
+
function extensionProviderToQuickInsertProvider(_x, _x2, _x3, _x4) {
|
|
38
39
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
39
40
|
}
|
|
40
41
|
function _extensionProviderToQuickInsertProvider() {
|
|
41
|
-
_extensionProviderToQuickInsertProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(extensionProvider, editorActions, createAnalyticsEvent) {
|
|
42
|
+
_extensionProviderToQuickInsertProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(extensionProvider, editorActions, apiRef, createAnalyticsEvent) {
|
|
42
43
|
var extensions;
|
|
43
44
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
44
45
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -70,12 +71,30 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
70
71
|
isDisabledOffline: true,
|
|
71
72
|
action: function action(insert, state, source) {
|
|
72
73
|
if (typeof item.node === 'function') {
|
|
73
|
-
(0,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_add_extension_api_to_quick_insert')) {
|
|
75
|
+
var _apiRef$current;
|
|
76
|
+
var extensionAPI = apiRef === null || apiRef === void 0 || (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api();
|
|
77
|
+
// While the api can be "undefined" there are no runtime scenarios where this is the case because:
|
|
78
|
+
// - The quick insert API can only be called from an active editor
|
|
79
|
+
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
80
|
+
// Therefore this should always be run unless there is something very wrong.
|
|
81
|
+
if (extensionAPI) {
|
|
82
|
+
(0, _extensions.resolveImport)(item.node(extensionAPI)).then(function (node) {
|
|
83
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
84
|
+
if (node) {
|
|
85
|
+
editorActions.replaceSelection(node);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
77
88
|
}
|
|
78
|
-
}
|
|
89
|
+
} else {
|
|
90
|
+
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
91
|
+
(0, _extensions.resolveImport)(item.node()).then(function (node) {
|
|
92
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
93
|
+
if (node) {
|
|
94
|
+
editorActions.replaceSelection(node);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
79
98
|
return insert('');
|
|
80
99
|
} else {
|
|
81
100
|
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
@@ -95,7 +114,7 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
95
114
|
}));
|
|
96
115
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
97
116
|
}
|
|
98
|
-
function combineQuickInsertProviders(
|
|
117
|
+
function combineQuickInsertProviders(_x5) {
|
|
99
118
|
return _combineQuickInsertProviders.apply(this, arguments);
|
|
100
119
|
}
|
|
101
120
|
function _combineQuickInsertProviders() {
|
|
@@ -15,8 +15,8 @@ var _extensions = require("./extensions");
|
|
|
15
15
|
* @param createAnalyticsEvent
|
|
16
16
|
* @returns Quick insert provider if available
|
|
17
17
|
*/
|
|
18
|
-
function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
18
|
+
function prepareQuickInsertProvider(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
19
19
|
var quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
20
|
-
var extensionQuickInsertProvider = extensionProvider && (0, _extensions.extensionProviderToQuickInsertProvider)(extensionProvider, editorActions, createAnalyticsEvent);
|
|
20
|
+
var extensionQuickInsertProvider = extensionProvider && (0, _extensions.extensionProviderToQuickInsertProvider)(extensionProvider, editorActions, apiRef, createAnalyticsEvent);
|
|
21
21
|
return quickInsertProvider && extensionQuickInsertProvider ? (0, _extensions.combineQuickInsertProviders)([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
22
22
|
}
|
|
@@ -4,9 +4,18 @@ import prepareExtensionProvider from '../../utils/prepare-extension-provider';
|
|
|
4
4
|
import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
|
|
5
5
|
import getProvidersFromEditorProps from '../utils/getProvidersFromEditorProps';
|
|
6
6
|
import handleProviders from '../utils/handleProviders';
|
|
7
|
-
function
|
|
7
|
+
function useEditorRef(preset) {
|
|
8
|
+
const apiRef = useRef();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
return preset === null || preset === void 0 ? void 0 : preset.apiResolver.on(api => {
|
|
11
|
+
apiRef.current = api;
|
|
12
|
+
});
|
|
13
|
+
}, [preset === null || preset === void 0 ? void 0 : preset.apiResolver]);
|
|
14
|
+
return apiRef;
|
|
15
|
+
}
|
|
16
|
+
function prepareProviders(editorActions, apiRef, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
8
17
|
const extensionProvider = prepareExtensionProvider(() => editorActions)(extensionProviders);
|
|
9
|
-
const quickInsertProvider = prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
18
|
+
const quickInsertProvider = prepareQuickInsertProvider(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
10
19
|
return {
|
|
11
20
|
extensionProvider,
|
|
12
21
|
quickInsertProvider
|
|
@@ -54,11 +63,12 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
54
63
|
presenceProvider
|
|
55
64
|
}), [autoformattingProvider, emojiProvider, mentionProvider, legacyImageUploadProvider, taskDecisionProvider, contextIdentifierProvider, searchProvider, macroProvider, activityProvider, collabEdit, collabEditProvider, presenceProvider]);
|
|
56
65
|
const providerFactory = useRef(new ProviderFactory());
|
|
66
|
+
const editorRef = useEditorRef(props.preset);
|
|
57
67
|
const preparedProviders = useMemo(() =>
|
|
58
68
|
// Though this will introduce some performance regression related to quick insert
|
|
59
69
|
// loading but we can remove it soon when Forge will move to new API.
|
|
60
70
|
// quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
|
|
61
|
-
prepareProviders(editorActions, quickInsert, extensionProviders, createAnalyticsEvent), [extensionProviders, quickInsert, editorActions, createAnalyticsEvent]);
|
|
71
|
+
prepareProviders(editorActions, editorRef, quickInsert, extensionProviders, createAnalyticsEvent), [extensionProviders, quickInsert, editorActions, createAnalyticsEvent, editorRef]);
|
|
62
72
|
useEffect(() => {
|
|
63
73
|
handleProviders(providerFactory.current, providers, preparedProviders.extensionProvider, preparedProviders.quickInsertProvider);
|
|
64
74
|
}, [providers, preparedProviders]);
|
|
@@ -48,7 +48,10 @@ export function createDefaultPreset(options) {
|
|
|
48
48
|
isFullPage
|
|
49
49
|
}]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
50
50
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
51
|
-
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(primaryToolbarPlugin).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin,
|
|
51
|
+
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(primaryToolbarPlugin).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, {
|
|
52
|
+
...options.blockType,
|
|
53
|
+
includeBlockQuoteAsTextstyleOption: isFullPage
|
|
54
|
+
}]).add(clearMarksOnEmptyDocPlugin).add([selectionToolbarPlugin, {
|
|
52
55
|
preferenceToolbarAboveSelection: !!options.preferenceToolbarAboveSelection
|
|
53
56
|
}]).add([hyperlinkPlugin, {
|
|
54
57
|
...options.hyperlinkOptions,
|
|
@@ -307,7 +307,7 @@ export const layoutStyles = viewMode => css`
|
|
|
307
307
|
[data-layout-section] {
|
|
308
308
|
// TODO: Migrate away from gridSize
|
|
309
309
|
// Recommendation: Replace directly with 7px
|
|
310
|
-
margin: ${"var(--ds-space-100, 8px)"} -${akLayoutGutterOffset}px 0;
|
|
310
|
+
margin: ${"var(--ds-space-100, 8px)"} -${akLayoutGutterOffset + (editorExperiment('nested-dnd', true) && fg('platform_editor_advanced_layouts_post_fix_patch_2') ? 8 : 0)}px 0;
|
|
311
311
|
transition: border-color 0.3s ${akEditorSwoopCubicBezier};
|
|
312
312
|
cursor: ${viewMode === 'view' ? 'default' : 'pointer'};
|
|
313
313
|
|
|
@@ -3,6 +3,7 @@ import Loadable from 'react-loadable';
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { getQuickInsertItemsFromModule, resolveImport } from '@atlaskit/editor-common/extensions';
|
|
5
5
|
import { combineProviders } from '@atlaskit/editor-common/provider-helpers';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
/**
|
|
7
8
|
* Utils to send analytics event when a extension is inserted using quickInsert
|
|
8
9
|
*/
|
|
@@ -24,7 +25,7 @@ function sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source) {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
export async function extensionProviderToQuickInsertProvider(extensionProvider, editorActions, createAnalyticsEvent) {
|
|
28
|
+
export async function extensionProviderToQuickInsertProvider(extensionProvider, editorActions, apiRef, createAnalyticsEvent) {
|
|
28
29
|
const extensions = await extensionProvider.getExtensions();
|
|
29
30
|
return {
|
|
30
31
|
getItems: () => {
|
|
@@ -45,12 +46,30 @@ export async function extensionProviderToQuickInsertProvider(extensionProvider,
|
|
|
45
46
|
isDisabledOffline: true,
|
|
46
47
|
action: (insert, state, source) => {
|
|
47
48
|
if (typeof item.node === 'function') {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (fg('platform_editor_add_extension_api_to_quick_insert')) {
|
|
50
|
+
var _apiRef$current, _apiRef$current$exten, _apiRef$current$exten2;
|
|
51
|
+
const extensionAPI = apiRef === null || apiRef === void 0 ? void 0 : (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : (_apiRef$current$exten = _apiRef$current.extension) === null || _apiRef$current$exten === void 0 ? void 0 : (_apiRef$current$exten2 = _apiRef$current$exten.actions) === null || _apiRef$current$exten2 === void 0 ? void 0 : _apiRef$current$exten2.api();
|
|
52
|
+
// While the api can be "undefined" there are no runtime scenarios where this is the case because:
|
|
53
|
+
// - The quick insert API can only be called from an active editor
|
|
54
|
+
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
55
|
+
// Therefore this should always be run unless there is something very wrong.
|
|
56
|
+
if (extensionAPI) {
|
|
57
|
+
resolveImport(item.node(extensionAPI)).then(node => {
|
|
58
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
59
|
+
if (node) {
|
|
60
|
+
editorActions.replaceSelection(node);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
52
63
|
}
|
|
53
|
-
}
|
|
64
|
+
} else {
|
|
65
|
+
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
66
|
+
resolveImport(item.node()).then(node => {
|
|
67
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
68
|
+
if (node) {
|
|
69
|
+
editorActions.replaceSelection(node);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
54
73
|
return insert('');
|
|
55
74
|
} else {
|
|
56
75
|
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
@@ -10,8 +10,8 @@ import { combineQuickInsertProviders, extensionProviderToQuickInsertProvider } f
|
|
|
10
10
|
* @param createAnalyticsEvent
|
|
11
11
|
* @returns Quick insert provider if available
|
|
12
12
|
*/
|
|
13
|
-
export default function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
13
|
+
export default function prepareQuickInsertProvider(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
14
14
|
const quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
15
|
-
const extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, createAnalyticsEvent);
|
|
15
|
+
const extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, apiRef, createAnalyticsEvent);
|
|
16
16
|
return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
17
17
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "203.
|
|
2
|
+
export const version = "203.7.0";
|
|
@@ -4,11 +4,20 @@ import prepareExtensionProvider from '../../utils/prepare-extension-provider';
|
|
|
4
4
|
import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
|
|
5
5
|
import getProvidersFromEditorProps from '../utils/getProvidersFromEditorProps';
|
|
6
6
|
import handleProviders from '../utils/handleProviders';
|
|
7
|
-
function
|
|
7
|
+
function useEditorRef(preset) {
|
|
8
|
+
var apiRef = useRef();
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
return preset === null || preset === void 0 ? void 0 : preset.apiResolver.on(function (api) {
|
|
11
|
+
apiRef.current = api;
|
|
12
|
+
});
|
|
13
|
+
}, [preset === null || preset === void 0 ? void 0 : preset.apiResolver]);
|
|
14
|
+
return apiRef;
|
|
15
|
+
}
|
|
16
|
+
function prepareProviders(editorActions, apiRef, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
8
17
|
var extensionProvider = prepareExtensionProvider(function () {
|
|
9
18
|
return editorActions;
|
|
10
19
|
})(extensionProviders);
|
|
11
|
-
var quickInsertProvider = prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
20
|
+
var quickInsertProvider = prepareQuickInsertProvider(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
12
21
|
return {
|
|
13
22
|
extensionProvider: extensionProvider,
|
|
14
23
|
quickInsertProvider: quickInsertProvider
|
|
@@ -56,14 +65,15 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
56
65
|
});
|
|
57
66
|
}, [autoformattingProvider, emojiProvider, mentionProvider, legacyImageUploadProvider, taskDecisionProvider, contextIdentifierProvider, searchProvider, macroProvider, activityProvider, collabEdit, collabEditProvider, presenceProvider]);
|
|
58
67
|
var providerFactory = useRef(new ProviderFactory());
|
|
68
|
+
var editorRef = useEditorRef(props.preset);
|
|
59
69
|
var preparedProviders = useMemo(function () {
|
|
60
70
|
return (
|
|
61
71
|
// Though this will introduce some performance regression related to quick insert
|
|
62
72
|
// loading but we can remove it soon when Forge will move to new API.
|
|
63
73
|
// quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
|
|
64
|
-
prepareProviders(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)
|
|
74
|
+
prepareProviders(editorActions, editorRef, quickInsert, extensionProviders, createAnalyticsEvent)
|
|
65
75
|
);
|
|
66
|
-
}, [extensionProviders, quickInsert, editorActions, createAnalyticsEvent]);
|
|
76
|
+
}, [extensionProviders, quickInsert, editorActions, createAnalyticsEvent, editorRef]);
|
|
67
77
|
useEffect(function () {
|
|
68
78
|
handleProviders(providerFactory.current, providers, preparedProviders.extensionProvider, preparedProviders.quickInsertProvider);
|
|
69
79
|
}, [providers, preparedProviders]);
|
|
@@ -50,7 +50,9 @@ export function createDefaultPreset(options) {
|
|
|
50
50
|
isFullPage: isFullPage
|
|
51
51
|
})]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
52
52
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
53
|
-
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(primaryToolbarPlugin).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, options.blockType
|
|
53
|
+
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(primaryToolbarPlugin).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, _objectSpread(_objectSpread({}, options.blockType), {}, {
|
|
54
|
+
includeBlockQuoteAsTextstyleOption: isFullPage
|
|
55
|
+
})]).add(clearMarksOnEmptyDocPlugin).add([selectionToolbarPlugin, {
|
|
54
56
|
preferenceToolbarAboveSelection: !!options.preferenceToolbarAboveSelection
|
|
55
57
|
}]).add([hyperlinkPlugin, _objectSpread(_objectSpread({}, options.hyperlinkOptions), {}, {
|
|
56
58
|
// @ts-ignore Temporary solution to check for Live Page editor.
|
|
@@ -63,5 +63,5 @@ var layoutResponsiveStyles = function layoutResponsiveStyles(viewMode) {
|
|
|
63
63
|
|
|
64
64
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
65
65
|
export var layoutStyles = function layoutStyles(viewMode) {
|
|
66
|
-
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", akLayoutGutterOffset, akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', fg('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' || editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), editorExperiment('advanced_layouts', true) && layoutResponsiveStyles(viewMode), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && editorExperiment('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
66
|
+
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", akLayoutGutterOffset + (editorExperiment('nested-dnd', true) && fg('platform_editor_advanced_layouts_post_fix_patch_2') ? 8 : 0), akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', fg('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' || editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), editorExperiment('advanced_layouts', true) && layoutResponsiveStyles(viewMode), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && editorExperiment('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
67
67
|
};
|
|
@@ -5,6 +5,7 @@ import Loadable from 'react-loadable';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { getQuickInsertItemsFromModule, resolveImport } from '@atlaskit/editor-common/extensions';
|
|
7
7
|
import { combineProviders } from '@atlaskit/editor-common/provider-helpers';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
/**
|
|
9
10
|
* Utils to send analytics event when a extension is inserted using quickInsert
|
|
10
11
|
*/
|
|
@@ -26,11 +27,11 @@ function sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
export function extensionProviderToQuickInsertProvider(_x, _x2, _x3) {
|
|
30
|
+
export function extensionProviderToQuickInsertProvider(_x, _x2, _x3, _x4) {
|
|
30
31
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
31
32
|
}
|
|
32
33
|
function _extensionProviderToQuickInsertProvider() {
|
|
33
|
-
_extensionProviderToQuickInsertProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(extensionProvider, editorActions, createAnalyticsEvent) {
|
|
34
|
+
_extensionProviderToQuickInsertProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(extensionProvider, editorActions, apiRef, createAnalyticsEvent) {
|
|
34
35
|
var extensions;
|
|
35
36
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
37
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -62,12 +63,30 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
62
63
|
isDisabledOffline: true,
|
|
63
64
|
action: function action(insert, state, source) {
|
|
64
65
|
if (typeof item.node === 'function') {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (fg('platform_editor_add_extension_api_to_quick_insert')) {
|
|
67
|
+
var _apiRef$current;
|
|
68
|
+
var extensionAPI = apiRef === null || apiRef === void 0 || (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api();
|
|
69
|
+
// While the api can be "undefined" there are no runtime scenarios where this is the case because:
|
|
70
|
+
// - The quick insert API can only be called from an active editor
|
|
71
|
+
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
72
|
+
// Therefore this should always be run unless there is something very wrong.
|
|
73
|
+
if (extensionAPI) {
|
|
74
|
+
resolveImport(item.node(extensionAPI)).then(function (node) {
|
|
75
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
76
|
+
if (node) {
|
|
77
|
+
editorActions.replaceSelection(node);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
69
80
|
}
|
|
70
|
-
}
|
|
81
|
+
} else {
|
|
82
|
+
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
83
|
+
resolveImport(item.node()).then(function (node) {
|
|
84
|
+
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
85
|
+
if (node) {
|
|
86
|
+
editorActions.replaceSelection(node);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
71
90
|
return insert('');
|
|
72
91
|
} else {
|
|
73
92
|
sendExtensionQuickInsertAnalytics(item, createAnalyticsEvent, source);
|
|
@@ -87,7 +106,7 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
87
106
|
}));
|
|
88
107
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
89
108
|
}
|
|
90
|
-
export function combineQuickInsertProviders(
|
|
109
|
+
export function combineQuickInsertProviders(_x5) {
|
|
91
110
|
return _combineQuickInsertProviders.apply(this, arguments);
|
|
92
111
|
}
|
|
93
112
|
function _combineQuickInsertProviders() {
|
|
@@ -10,8 +10,8 @@ import { combineQuickInsertProviders, extensionProviderToQuickInsertProvider } f
|
|
|
10
10
|
* @param createAnalyticsEvent
|
|
11
11
|
* @returns Quick insert provider if available
|
|
12
12
|
*/
|
|
13
|
-
export default function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
13
|
+
export default function prepareQuickInsertProvider(editorActions, apiRef, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
14
14
|
var quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
15
|
-
var extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, createAnalyticsEvent);
|
|
15
|
+
var extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, apiRef, createAnalyticsEvent);
|
|
16
16
|
return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
17
17
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "203.
|
|
2
|
+
export var version = "203.7.0";
|