@atlaskit/editor-plugin-layout 13.4.0 → 13.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 +17 -0
- package/dist/cjs/pm-plugins/utils/index.js +11 -4
- package/dist/cjs/ui/LayoutBlockMenuItem.js +1 -1
- package/dist/es2019/pm-plugins/utils/index.js +9 -4
- package/dist/es2019/ui/LayoutBlockMenuItem.js +1 -1
- package/dist/esm/pm-plugins/utils/index.js +11 -4
- package/dist/esm/ui/LayoutBlockMenuItem.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 13.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`9425f3fa081e4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9425f3fa081e4) -
|
|
14
|
+
Fix nested content selection inside layouts
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 13.4.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -8,6 +8,7 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
13
14
|
|
|
@@ -58,6 +59,14 @@ var selectIntoLayout = exports.selectIntoLayout = function selectIntoLayout(view
|
|
|
58
59
|
return tr;
|
|
59
60
|
}
|
|
60
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* These node views can fill a layout column while leaving visually blank space that ProseMirror
|
|
64
|
+
* cannot map to a document position. Interactive atomic nodes must receive clicks normally.
|
|
65
|
+
*/
|
|
66
|
+
var supportsBlankSpaceGapCursorFallback = function supportsBlankSpaceGapCursorFallback(node) {
|
|
67
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaSingle' || (node === null || node === void 0 ? void 0 : node.type.name) === 'expand';
|
|
68
|
+
};
|
|
69
|
+
|
|
61
70
|
/**
|
|
62
71
|
* For a blank-space click inside a layout column — above the first child (middle/bottom-aligned
|
|
63
72
|
* columns) or below the last child (any alignment) — return the ProseMirror position and side
|
|
@@ -152,10 +161,8 @@ var getGapCursorTargetForBlankSpaceClick = exports.getGapCursorTargetForBlankSpa
|
|
|
152
161
|
// so the above/below checks never fired.
|
|
153
162
|
if (columnNode.childCount === 1) {
|
|
154
163
|
var onlyChild = columnNode.firstChild;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// native gap cursor).
|
|
158
|
-
if (onlyChild && onlyChild.type.name !== 'paragraph' && onlyChild.type.name !== 'panel') {
|
|
164
|
+
var shouldHandleAtomicChild = (0, _expValEquals.expValEquals)('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
|
|
165
|
+
if (onlyChild && shouldHandleAtomicChild) {
|
|
159
166
|
// Bail when the click is on the child's own content. For media the wrapper is full-width
|
|
160
167
|
// so test against the <img> rect; resolve it only for a direct mediaSingle child (else
|
|
161
168
|
// getContentRect could grab an image nested in an expand and break its toggle).
|
|
@@ -3,6 +3,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
export const getMaybeLayoutSection = state => {
|
|
8
9
|
const {
|
|
@@ -55,6 +56,12 @@ export const selectIntoLayout = (view, posOfLayout, childIndex = 0) => {
|
|
|
55
56
|
return tr;
|
|
56
57
|
}
|
|
57
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* These node views can fill a layout column while leaving visually blank space that ProseMirror
|
|
61
|
+
* cannot map to a document position. Interactive atomic nodes must receive clicks normally.
|
|
62
|
+
*/
|
|
63
|
+
const supportsBlankSpaceGapCursorFallback = node => (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaSingle' || (node === null || node === void 0 ? void 0 : node.type.name) === 'expand';
|
|
64
|
+
|
|
58
65
|
/**
|
|
59
66
|
* For a blank-space click inside a layout column — above the first child (middle/bottom-aligned
|
|
60
67
|
* columns) or below the last child (any alignment) — return the ProseMirror position and side
|
|
@@ -149,10 +156,8 @@ export const getGapCursorTargetForBlankSpaceClick = (view, event) => {
|
|
|
149
156
|
// so the above/below checks never fired.
|
|
150
157
|
if (columnNode.childCount === 1) {
|
|
151
158
|
const onlyChild = columnNode.firstChild;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// native gap cursor).
|
|
155
|
-
if (onlyChild && onlyChild.type.name !== 'paragraph' && onlyChild.type.name !== 'panel') {
|
|
159
|
+
const shouldHandleAtomicChild = expValEquals('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
|
|
160
|
+
if (onlyChild && shouldHandleAtomicChild) {
|
|
156
161
|
// Bail when the click is on the child's own content. For media the wrapper is full-width
|
|
157
162
|
// so test against the <img> rect; resolve it only for a direct mediaSingle child (else
|
|
158
163
|
// getContentRect could grab an image nested in an expand and break its toggle).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* LayoutBlockMenuItem.tsx generated by @compiled/babel-plugin
|
|
1
|
+
/* LayoutBlockMenuItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
2
|
import "./LayoutBlockMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
@@ -3,6 +3,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
export var getMaybeLayoutSection = function getMaybeLayoutSection(state) {
|
|
8
9
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -51,6 +52,14 @@ export var selectIntoLayout = function selectIntoLayout(view, posOfLayout) {
|
|
|
51
52
|
return tr;
|
|
52
53
|
}
|
|
53
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* These node views can fill a layout column while leaving visually blank space that ProseMirror
|
|
57
|
+
* cannot map to a document position. Interactive atomic nodes must receive clicks normally.
|
|
58
|
+
*/
|
|
59
|
+
var supportsBlankSpaceGapCursorFallback = function supportsBlankSpaceGapCursorFallback(node) {
|
|
60
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaSingle' || (node === null || node === void 0 ? void 0 : node.type.name) === 'expand';
|
|
61
|
+
};
|
|
62
|
+
|
|
54
63
|
/**
|
|
55
64
|
* For a blank-space click inside a layout column — above the first child (middle/bottom-aligned
|
|
56
65
|
* columns) or below the last child (any alignment) — return the ProseMirror position and side
|
|
@@ -145,10 +154,8 @@ export var getGapCursorTargetForBlankSpaceClick = function getGapCursorTargetFor
|
|
|
145
154
|
// so the above/below checks never fired.
|
|
146
155
|
if (columnNode.childCount === 1) {
|
|
147
156
|
var onlyChild = columnNode.firstChild;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// native gap cursor).
|
|
151
|
-
if (onlyChild && onlyChild.type.name !== 'paragraph' && onlyChild.type.name !== 'panel') {
|
|
157
|
+
var shouldHandleAtomicChild = expValEquals('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
|
|
158
|
+
if (onlyChild && shouldHandleAtomicChild) {
|
|
152
159
|
// Bail when the click is on the child's own content. For media the wrapper is full-width
|
|
153
160
|
// so test against the <img> rect; resolve it only for a direct mediaSingle child (else
|
|
154
161
|
// getContentRect could grab an image nested in an expand and break its toggle).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* LayoutBlockMenuItem.tsx generated by @compiled/babel-plugin
|
|
1
|
+
/* LayoutBlockMenuItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
2
|
import "./LayoutBlockMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.5.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^56.
|
|
24
|
+
"@atlaskit/adf-schema": "^56.4.0",
|
|
25
25
|
"@atlaskit/css": "^1.0.0",
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^12.1.0",
|
|
27
27
|
"@atlaskit/editor-plugin-block-controls": "^13.4.0",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@atlaskit/icon": "^37.2.0",
|
|
43
43
|
"@atlaskit/icon-lab": "^7.4.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^136.0.0",
|
|
46
46
|
"@atlaskit/tokens": "^16.3.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"@emotion/react": "^11.7.1",
|
|
49
49
|
"bind-event-listener": "^3.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^116.
|
|
52
|
+
"@atlaskit/editor-common": "^116.48.0",
|
|
53
53
|
"react": "^18.2.0 || ^19.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
55
|
},
|