@atlaskit/editor-core 201.4.0 → 201.5.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 +24 -0
- package/dist/cjs/actions/index.js +1 -2
- package/dist/cjs/ui/ContentStyles/layout.js +18 -8
- package/dist/cjs/use-preset.js +15 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +1 -2
- package/dist/es2019/ui/ContentStyles/layout.js +92 -12
- package/dist/es2019/use-preset.js +15 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +1 -2
- package/dist/esm/ui/ContentStyles/layout.js +19 -9
- package/dist/esm/use-preset.js +15 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +20 -20
- package/dist/types/presets/default.d.ts +12 -12
- package/dist/types/presets/universal.d.ts +20 -20
- package/dist/types/presets/useUniversalPreset.d.ts +20 -20
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +20 -20
- package/dist/types-ts4.5/presets/default.d.ts +12 -12
- package/dist/types-ts4.5/presets/universal.d.ts +20 -20
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +20 -20
- package/package.json +10 -7
- package/dist/cjs/utils/processRawFragmentValue.js +0 -22
- package/dist/es2019/utils/processRawFragmentValue.js +0 -12
- package/dist/esm/utils/processRawFragmentValue.js +0 -16
- package/dist/types/utils/processRawFragmentValue.d.ts +0 -6
- package/dist/types-ts4.5/utils/processRawFragmentValue.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 201.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#163126](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163126)
|
|
8
|
+
[`bae044582a28f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bae044582a28f) -
|
|
9
|
+
[ux] ED-25055: Updated layout to use separator
|
|
10
|
+
|
|
11
|
+
## 201.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#163532](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163532)
|
|
16
|
+
[`b80779d45e179`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b80779d45e179) -
|
|
17
|
+
moved processRawFragmentValue to editor-common
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#165273](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165273)
|
|
22
|
+
[`665190aa04bde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/665190aa04bde) -
|
|
23
|
+
Fix setting up editorApi with usePreset for react strict mode by adding new apiResolver for
|
|
24
|
+
preset.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 201.4.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -19,7 +19,6 @@ var _eventDispatcher = require("../event-dispatcher");
|
|
|
19
19
|
var _action = require("../utils/action");
|
|
20
20
|
var _deprecationWarnings = _interopRequireDefault(require("../utils/deprecation-warnings"));
|
|
21
21
|
var _nodesByLocalIds = require("../utils/nodes-by-localIds");
|
|
22
|
-
var _processRawFragmentValue = require("../utils/processRawFragmentValue");
|
|
23
22
|
var _tempIsEmptyDocument = require("./temp-is-empty-document");
|
|
24
23
|
var _tempNodesByLocalids = require("./temp-nodes-by-localids");
|
|
25
24
|
var _tempToJson = require("./temp-to-json");
|
|
@@ -343,7 +342,7 @@ var EditorActions = exports.default = /*#__PURE__*/function () {
|
|
|
343
342
|
return true;
|
|
344
343
|
}
|
|
345
344
|
var schema = state.schema;
|
|
346
|
-
var content = Array.isArray(rawValue) ? (0,
|
|
345
|
+
var content = Array.isArray(rawValue) ? (0, _processRawValue.processRawFragmentValue)(schema, rawValue) : (0, _processRawValue.processRawValue)(schema, rawValue);
|
|
347
346
|
if (!content) {
|
|
348
347
|
return false;
|
|
349
348
|
}
|
|
@@ -25,7 +25,7 @@ var _consts = require("@atlaskit/editor-plugins/table/ui/consts");
|
|
|
25
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
27
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
29
29
|
var isPreRelease2 = function isPreRelease2() {
|
|
30
30
|
return (0, _experiments.editorExperiment)('advanced_layouts', true) || (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_pre_release_2');
|
|
31
31
|
};
|
|
@@ -38,7 +38,7 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
38
38
|
// TODO handle responsive
|
|
39
39
|
var layoutColumnStyles = function layoutColumnStyles() {
|
|
40
40
|
return isPreRelease2() ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
41
|
-
(0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t> [data-layout-column] {\n\t\t\t\t\tmargin: 0 ", "px;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:first-of-type {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:last-of-type {\n\t\t\t\t\tmargin-right: 0;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column].", ":not(.danger) {\n\t\t\t\t\t", ";\n\t\t\t\t\
|
|
41
|
+
(0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t> [data-layout-column] {\n\t\t\t\t\tmargin: 0 ", "px;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:first-of-type {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:last-of-type {\n\t\t\t\t\tmargin-right: 0;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column].", ":not(.danger) {\n\t\t\t\t\t", ";\n\t\t\t\t\t/* layout column selection shorter after layout border has been removed */\n\t\t\t\t\t::before {\n\t\t\t\t\t\ttop: 12px;\n\t\t\t\t\t\theight: calc(100% - 24px);\n\t\t\t\t\t\twidth: calc(100% - 8px);\n\t\t\t\t\t\tleft: 4px;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _styles.LAYOUT_SECTION_MARGIN / 2, _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket])) : // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
42
42
|
(0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: ", "px;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin-left: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _styles.LAYOUT_SECTION_MARGIN, _editorSharedStyles.gridMediumMaxWidth);
|
|
43
43
|
};
|
|
44
44
|
var layoutSectionStyles = function layoutSectionStyles() {
|
|
@@ -49,14 +49,24 @@ var layoutSectionStyles = function layoutSectionStyles() {
|
|
|
49
49
|
|
|
50
50
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
51
51
|
var layoutBorderStyles = function layoutBorderStyles(viewMode) {
|
|
52
|
-
return (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t/* Shows the border when cursor is inside a layout */\n\t&.selected [data-layout-column],\n\t&:hover [data-layout-column] {\n\t\tborder: ", "px solid ", ";\n\t}\n\n\t&.selected.danger [data-layout-column] {\n\t\tbackground-color: ", ";\n\t\tborder-color: ", ";\n\t}\n\n\t&.", ":not(.danger) {\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t}\n\t}\n"])), viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _editorSharedStyles.akEditorSelectedNodeClassName,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
return (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t/* Shows the border when cursor is inside a layout */\n\t&.selected [data-layout-column],\n\t&:hover [data-layout-column] {\n\t\tborder: ", "px solid ", ";\n\t}\n\n\t&.selected.danger [data-layout-column] {\n\t\tbackground-color: ", ";\n\t\tborder-color: ", ";\n\t}\n\n\t&.", ":not(.danger) {\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t\t::after {\n\t\t\t\tbackground-color: transparent;\n\t\t\t}\n\t\t}\n\t}\n"])), viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Border, _editorSharedStyles.SelectionStyle.Blanket]));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
56
|
+
var columnSeparatorStyles = function columnSeparatorStyles(viewMode) {
|
|
57
|
+
return (0, _react.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n\t[data-layout-content]::before {\n\t\tcontent: '';\n\t\tborder-left: ", "px solid\n\t\t\t", ";\n\t\tposition: absolute;\n\t\theight: calc(100% - 24px);\n\t\tmargin-left: -25px;\n\t}\n"])), viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)");
|
|
58
|
+
};
|
|
59
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
60
|
+
var rowSeparatorStyles = function rowSeparatorStyles(viewMode) {
|
|
61
|
+
return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n\t[data-layout-content]::before {\n\t\tcontent: '';\n\t\tborder-top: ", "px solid\n\t\t\t", ";\n\t\tposition: absolute;\n\t\twidth: calc(100% - 32px);\n\t\tmargin-top: -13px;\n\t}\n"])), viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)");
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
65
|
+
var layoutWithSeparatorBorderStyles = function layoutWithSeparatorBorderStyles(viewMode) {
|
|
66
|
+
return (0, _react.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n\t&.selected [data-layout-column]:not(:first-of-type),\n\t&:hover [data-layout-column]:not(:first-of-type) {\n\t\t", " {\n\t\t\t", "\n\t\t}\n\t\t", " {\n\t\t\t", "\n\t\t}\n\t}\n\n\t&.selected.danger\n\t\t", " {\n\t\tbackground-color: ", ";\n\n\t\tbox-shadow: 0 0 0 ", "px\n\t\t\t", ";\n\t\tborder-radius: 4px;\n\t\t[data-layout-column]:not(:first-of-type) {\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t}\n\n\t&.", ":not(.danger)\n\t\t", " {\n\t\tbox-shadow: 0 0 0 ", "px\n\t\t\t", ";\n\t\tborder-radius: 4px;\n\t\tbackground-color: ", ";\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t\tborder: 0px;\n\t\t\t::before {\n\t\t\t\tbackground-color: transparent;\n\t\t\t}\n\t\t}\n\t\t[data-layout-column]:not(:first-of-type) {\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t}\n"])), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(_editorSharedStyles.gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(_editorSharedStyles.gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "[data-layout-section]" : "", "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(_editorSharedStyles.gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(_editorSharedStyles.gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "[data-layout-section]" : "", viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-selected, #0C66E4)", "var(--ds-background-selected, #E9F2FF)", (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket]), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(_editorSharedStyles.gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(_editorSharedStyles.layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(_editorSharedStyles.gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode));
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
60
70
|
var layoutStyles = exports.layoutStyles = function layoutStyles(viewMode) {
|
|
61
|
-
return (0, _react.css)(
|
|
71
|
+
return (0, _react.css)(_templateObject11 || (_templateObject11 = (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.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), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && !(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing') && ".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}"));
|
|
62
72
|
};
|
package/dist/cjs/use-preset.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.usePreset = usePreset;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -55,9 +56,20 @@ function usePreset(createPreset) {
|
|
|
55
56
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
57
|
dependencies);
|
|
57
58
|
(0, _react.useLayoutEffect)(function () {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_api_strict_mode')) {
|
|
60
|
+
return preset.apiResolver.on(function (api) {
|
|
61
|
+
setAPI(api);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, [preset.apiResolver]);
|
|
65
|
+
|
|
66
|
+
// Deprecated approach (not compatible with strict mode)
|
|
67
|
+
(0, _react.useLayoutEffect)(function () {
|
|
68
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_api_strict_mode')) {
|
|
69
|
+
preset.apiPromise.then(function (api) {
|
|
70
|
+
setAPI(api);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
61
73
|
}, [preset.apiPromise]);
|
|
62
74
|
return {
|
|
63
75
|
editorApi: editorApi,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
2
|
+
import { processRawFragmentValue, processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
3
3
|
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
4
4
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -8,7 +8,6 @@ import { createDispatch } from '../event-dispatcher';
|
|
|
8
8
|
import { getEditorValueWithMedia } from '../utils/action';
|
|
9
9
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
10
10
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
11
|
-
import { processRawFragmentValue } from '../utils/processRawFragmentValue';
|
|
12
11
|
import { isEmptyDocument } from './temp-is-empty-document';
|
|
13
12
|
import { findNodePosByLocalIds } from './temp-nodes-by-localids';
|
|
14
13
|
import { toJSON } from './temp-to-json';
|
|
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import { columnLayoutResponsiveSharedStyle, columnLayoutSharedStyle, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { TableCssClassName } from '@atlaskit/editor-plugins/table/types';
|
|
5
5
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
|
|
6
|
-
import { akEditorDeleteBackground, akEditorDeleteBorder,
|
|
6
|
+
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, akEditorSwoopCubicBezier, akLayoutGutterOffset, getSelectionStyles, gridMediumMaxWidth, layoutBreakpointWidth, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
@@ -58,7 +58,13 @@ css`
|
|
|
58
58
|
|
|
59
59
|
> [data-layout-column].${akEditorSelectedNodeClassName}:not(.danger) {
|
|
60
60
|
${getSelectionStyles([SelectionStyle.Blanket])};
|
|
61
|
-
border
|
|
61
|
+
/* layout column selection shorter after layout border has been removed */
|
|
62
|
+
::before {
|
|
63
|
+
top: 12px;
|
|
64
|
+
height: calc(100% - 24px);
|
|
65
|
+
width: calc(100% - 8px);
|
|
66
|
+
left: 4px;
|
|
67
|
+
}
|
|
62
68
|
}
|
|
63
69
|
` :
|
|
64
70
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
@@ -128,13 +134,86 @@ const layoutBorderStyles = viewMode => css`
|
|
|
128
134
|
|
|
129
135
|
&.${akEditorSelectedNodeClassName}:not(.danger) {
|
|
130
136
|
[data-layout-column] {
|
|
131
|
-
${
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
${getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket])}
|
|
138
|
+
::after {
|
|
139
|
+
background-color: transparent;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
146
|
+
const columnSeparatorStyles = viewMode => css`
|
|
147
|
+
[data-layout-content]::before {
|
|
148
|
+
content: '';
|
|
149
|
+
border-left: ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px solid
|
|
150
|
+
${"var(--ds-border, #091E4224)"};
|
|
151
|
+
position: absolute;
|
|
152
|
+
height: calc(100% - 24px);
|
|
153
|
+
margin-left: -25px;
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
156
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
157
|
+
const rowSeparatorStyles = viewMode => css`
|
|
158
|
+
[data-layout-content]::before {
|
|
159
|
+
content: '';
|
|
160
|
+
border-top: ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px solid
|
|
161
|
+
${"var(--ds-border, #091E4224)"};
|
|
162
|
+
position: absolute;
|
|
163
|
+
width: calc(100% - 32px);
|
|
164
|
+
margin-top: -13px;
|
|
165
|
+
}
|
|
166
|
+
`;
|
|
167
|
+
|
|
168
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
169
|
+
const layoutWithSeparatorBorderStyles = viewMode => css`
|
|
170
|
+
&.selected [data-layout-column]:not(:first-of-type),
|
|
171
|
+
&:hover [data-layout-column]:not(:first-of-type) {
|
|
172
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (min-width:${layoutBreakpointWidth.MEDIUM}px)` : ` @media screen and (min-width: ${gridMediumMaxWidth}px)`} {
|
|
173
|
+
${columnSeparatorStyles(viewMode)}
|
|
174
|
+
}
|
|
175
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (max-width:${layoutBreakpointWidth.MEDIUM - 1}px)` : `@media screen and (max-width: ${gridMediumMaxWidth - 1}px)`} {
|
|
176
|
+
${rowSeparatorStyles(viewMode)}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.selected.danger
|
|
181
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `[data-layout-section]` : ``} {
|
|
182
|
+
background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackground})`};
|
|
183
|
+
|
|
184
|
+
box-shadow: 0 0 0 ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px
|
|
185
|
+
${akEditorDeleteBorder};
|
|
186
|
+
border-radius: 4px;
|
|
187
|
+
[data-layout-column]:not(:first-of-type) {
|
|
188
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (min-width:${layoutBreakpointWidth.MEDIUM}px)` : ` @media screen and (min-width: ${gridMediumMaxWidth}px)`} {
|
|
189
|
+
${columnSeparatorStyles(viewMode)}
|
|
190
|
+
}
|
|
191
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (max-width:${layoutBreakpointWidth.MEDIUM - 1}px)` : `@media screen and (max-width: ${gridMediumMaxWidth - 1}px)`} {
|
|
192
|
+
${rowSeparatorStyles(viewMode)}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&.${akEditorSelectedNodeClassName}:not(.danger)
|
|
198
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `[data-layout-section]` : ``} {
|
|
199
|
+
box-shadow: 0 0 0 ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px
|
|
200
|
+
${"var(--ds-border-selected, #0C66E4)"};
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
background-color: ${"var(--ds-background-selected, #E9F2FF)"};
|
|
203
|
+
[data-layout-column] {
|
|
204
|
+
${getSelectionStyles([SelectionStyle.Blanket])}
|
|
205
|
+
border: 0px;
|
|
206
|
+
::before {
|
|
207
|
+
background-color: transparent;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
[data-layout-column]:not(:first-of-type) {
|
|
211
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (min-width:${layoutBreakpointWidth.MEDIUM}px)` : ` @media screen and (min-width: ${gridMediumMaxWidth}px)`} {
|
|
212
|
+
${columnSeparatorStyles(viewMode)}
|
|
213
|
+
}
|
|
214
|
+
${fg('platform_editor_advanced_layouts_breakout_resizing') ? `@container layout-area (max-width:${layoutBreakpointWidth.MEDIUM - 1}px)` : `@media screen and (max-width: ${gridMediumMaxWidth - 1}px)`} {
|
|
215
|
+
${rowSeparatorStyles(viewMode)}
|
|
216
|
+
}
|
|
138
217
|
}
|
|
139
218
|
}
|
|
140
219
|
`;
|
|
@@ -156,8 +235,9 @@ export const layoutStyles = viewMode => css`
|
|
|
156
235
|
${fg('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : ''}
|
|
157
236
|
|
|
158
237
|
min-width: 0;
|
|
159
|
-
|
|
160
|
-
|
|
238
|
+
/* disable 4 borders when in view mode and advanced layouts is on */
|
|
239
|
+
border: ${viewMode === 'view' || editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize}px
|
|
240
|
+
solid ${"var(--ds-border, #091E4224)"};
|
|
161
241
|
border-radius: 4px;
|
|
162
242
|
padding: ${LAYOUT_COLUMN_PADDING}px
|
|
163
243
|
${LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0)}px;
|
|
@@ -225,7 +305,7 @@ export const layoutStyles = viewMode => css`
|
|
|
225
305
|
// styles to support borders for layout
|
|
226
306
|
[data-layout-section],
|
|
227
307
|
.layoutSectionView-content-wrap {
|
|
228
|
-
${layoutBorderStyles(viewMode)}
|
|
308
|
+
${editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode)}
|
|
229
309
|
}
|
|
230
310
|
}
|
|
231
311
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
|
|
@@ -42,9 +43,20 @@ export function usePreset(createPreset, dependencies = []) {
|
|
|
42
43
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
44
|
dependencies);
|
|
44
45
|
useLayoutEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (fg('platform_editor_fix_api_strict_mode')) {
|
|
47
|
+
return preset.apiResolver.on(api => {
|
|
48
|
+
setAPI(api);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, [preset.apiResolver]);
|
|
52
|
+
|
|
53
|
+
// Deprecated approach (not compatible with strict mode)
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
if (!fg('platform_editor_fix_api_strict_mode')) {
|
|
56
|
+
preset.apiPromise.then(api => {
|
|
57
|
+
setAPI(api);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
48
60
|
}, [preset.apiPromise]);
|
|
49
61
|
return {
|
|
50
62
|
editorApi,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "201.
|
|
2
|
+
export const version = "201.5.1";
|
|
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
6
|
+
import { processRawFragmentValue, processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
7
7
|
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
8
8
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -12,7 +12,6 @@ import { createDispatch } from '../event-dispatcher';
|
|
|
12
12
|
import { getEditorValueWithMedia } from '../utils/action';
|
|
13
13
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
14
14
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
15
|
-
import { processRawFragmentValue } from '../utils/processRawFragmentValue';
|
|
16
15
|
import { isEmptyDocument } from './temp-is-empty-document';
|
|
17
16
|
import { findNodePosByLocalIds } from './temp-nodes-by-localids';
|
|
18
17
|
import { toJSON } from './temp-to-json';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { columnLayoutResponsiveSharedStyle, columnLayoutSharedStyle, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { TableCssClassName } from '@atlaskit/editor-plugins/table/types';
|
|
7
7
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
|
|
8
|
-
import { akEditorDeleteBackground, akEditorDeleteBorder,
|
|
8
|
+
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, akEditorSwoopCubicBezier, akLayoutGutterOffset, getSelectionStyles, gridMediumMaxWidth, layoutBreakpointWidth, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
11
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
@@ -21,7 +21,7 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
21
21
|
// TODO handle responsive
|
|
22
22
|
var layoutColumnStyles = function layoutColumnStyles() {
|
|
23
23
|
return isPreRelease2() ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
24
|
-
css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t\t\t\t> [data-layout-column] {\n\t\t\t\t\tmargin: 0 ", "px;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:first-of-type {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:last-of-type {\n\t\t\t\t\tmargin-right: 0;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column].", ":not(.danger) {\n\t\t\t\t\t", ";\n\t\t\t\t\
|
|
24
|
+
css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t\t\t\t> [data-layout-column] {\n\t\t\t\t\tmargin: 0 ", "px;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:first-of-type {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column]:last-of-type {\n\t\t\t\t\tmargin-right: 0;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t> [data-layout-column].", ":not(.danger) {\n\t\t\t\t\t", ";\n\t\t\t\t\t/* layout column selection shorter after layout border has been removed */\n\t\t\t\t\t::before {\n\t\t\t\t\t\ttop: 12px;\n\t\t\t\t\t\theight: calc(100% - 24px);\n\t\t\t\t\t\twidth: calc(100% - 8px);\n\t\t\t\t\t\tleft: 4px;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), LAYOUT_SECTION_MARGIN / 2, gridMediumMaxWidth, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Blanket])) : // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
25
25
|
css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: ", "px;\n\t\t\t\t}\n\n\t\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\t\tmargin-left: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), LAYOUT_SECTION_MARGIN, gridMediumMaxWidth);
|
|
26
26
|
};
|
|
27
27
|
var layoutSectionStyles = function layoutSectionStyles() {
|
|
@@ -32,14 +32,24 @@ var layoutSectionStyles = function layoutSectionStyles() {
|
|
|
32
32
|
|
|
33
33
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
34
34
|
var layoutBorderStyles = function layoutBorderStyles(viewMode) {
|
|
35
|
-
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t/* Shows the border when cursor is inside a layout */\n\t&.selected [data-layout-column],\n\t&:hover [data-layout-column] {\n\t\tborder: ", "px solid ", ";\n\t}\n\n\t&.selected.danger [data-layout-column] {\n\t\tbackground-color: ", ";\n\t\tborder-color: ", ";\n\t}\n\n\t&.", ":not(.danger) {\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t}\n\t}\n"])), viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t/* Shows the border when cursor is inside a layout */\n\t&.selected [data-layout-column],\n\t&:hover [data-layout-column] {\n\t\tborder: ", "px solid ", ";\n\t}\n\n\t&.selected.danger [data-layout-column] {\n\t\tbackground-color: ", ";\n\t\tborder-color: ", ";\n\t}\n\n\t&.", ":not(.danger) {\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t\t::after {\n\t\t\t\tbackground-color: transparent;\n\t\t\t}\n\t\t}\n\t}\n"])), viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
39
|
+
var columnSeparatorStyles = function columnSeparatorStyles(viewMode) {
|
|
40
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n\t[data-layout-content]::before {\n\t\tcontent: '';\n\t\tborder-left: ", "px solid\n\t\t\t", ";\n\t\tposition: absolute;\n\t\theight: calc(100% - 24px);\n\t\tmargin-left: -25px;\n\t}\n"])), viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)");
|
|
41
|
+
};
|
|
42
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
43
|
+
var rowSeparatorStyles = function rowSeparatorStyles(viewMode) {
|
|
44
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n\t[data-layout-content]::before {\n\t\tcontent: '';\n\t\tborder-top: ", "px solid\n\t\t\t", ";\n\t\tposition: absolute;\n\t\twidth: calc(100% - 32px);\n\t\tmargin-top: -13px;\n\t}\n"])), viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
48
|
+
var layoutWithSeparatorBorderStyles = function layoutWithSeparatorBorderStyles(viewMode) {
|
|
49
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n\t&.selected [data-layout-column]:not(:first-of-type),\n\t&:hover [data-layout-column]:not(:first-of-type) {\n\t\t", " {\n\t\t\t", "\n\t\t}\n\t\t", " {\n\t\t\t", "\n\t\t}\n\t}\n\n\t&.selected.danger\n\t\t", " {\n\t\tbackground-color: ", ";\n\n\t\tbox-shadow: 0 0 0 ", "px\n\t\t\t", ";\n\t\tborder-radius: 4px;\n\t\t[data-layout-column]:not(:first-of-type) {\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t}\n\n\t&.", ":not(.danger)\n\t\t", " {\n\t\tbox-shadow: 0 0 0 ", "px\n\t\t\t", ";\n\t\tborder-radius: 4px;\n\t\tbackground-color: ", ";\n\t\t[data-layout-column] {\n\t\t\t", "\n\t\t\tborder: 0px;\n\t\t\t::before {\n\t\t\t\tbackground-color: transparent;\n\t\t\t}\n\t\t}\n\t\t[data-layout-column]:not(:first-of-type) {\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t\t", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t}\n"])), fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode), fg('platform_editor_advanced_layouts_breakout_resizing') ? "[data-layout-section]" : "", "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), viewMode === 'view' ? 0 : akEditorSelectedBorderSize, akEditorDeleteBorder, fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode), akEditorSelectedNodeClassName, fg('platform_editor_advanced_layouts_breakout_resizing') ? "[data-layout-section]" : "", viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border-selected, #0C66E4)", "var(--ds-background-selected, #E9F2FF)", getSelectionStyles([SelectionStyle.Blanket]), fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (min-width:".concat(layoutBreakpointWidth.MEDIUM, "px)") : "\t@media screen and (min-width: ".concat(gridMediumMaxWidth, "px)"), columnSeparatorStyles(viewMode), fg('platform_editor_advanced_layouts_breakout_resizing') ? "@container layout-area (max-width:".concat(layoutBreakpointWidth.MEDIUM - 1, "px)") : "@media screen and (max-width: ".concat(gridMediumMaxWidth - 1, "px)"), rowSeparatorStyles(viewMode));
|
|
40
50
|
};
|
|
41
51
|
|
|
42
52
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
43
53
|
export var layoutStyles = function layoutStyles(viewMode) {
|
|
44
|
-
return css(
|
|
54
|
+
return css(_templateObject11 || (_templateObject11 = _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.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), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && !fg('platform_editor_advanced_layouts_breakout_resizing') && ".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}"));
|
|
45
55
|
};
|
package/dist/esm/use-preset.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
|
|
@@ -49,9 +50,20 @@ export function usePreset(createPreset) {
|
|
|
49
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
51
|
dependencies);
|
|
51
52
|
useLayoutEffect(function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if (fg('platform_editor_fix_api_strict_mode')) {
|
|
54
|
+
return preset.apiResolver.on(function (api) {
|
|
55
|
+
setAPI(api);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}, [preset.apiResolver]);
|
|
59
|
+
|
|
60
|
+
// Deprecated approach (not compatible with strict mode)
|
|
61
|
+
useLayoutEffect(function () {
|
|
62
|
+
if (!fg('platform_editor_fix_api_strict_mode')) {
|
|
63
|
+
preset.apiPromise.then(function (api) {
|
|
64
|
+
setAPI(api);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
55
67
|
}, [preset.apiPromise]);
|
|
56
68
|
return {
|
|
57
69
|
editorApi: editorApi,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "201.
|
|
2
|
+
export var version = "201.5.1";
|