@atlaskit/editor-plugin-layout 18.0.1 → 18.0.3
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
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 18.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 18.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`848b5c3689131`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/848b5c3689131) -
|
|
14
|
+
Cache `isEmptyLayout` on the vanilla `LayoutSectionView` behind
|
|
15
|
+
`platform_editor_vanilla_node_views_patch_1` so `update()` does not walk the layout twice.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 18.0.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -14,8 +14,9 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
14
14
|
var _utils = require("./utils");
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
var toDOM = function toDOM(node) {
|
|
17
|
+
var toDOM = function toDOM(node, isEmpty) {
|
|
18
18
|
var _node$attrs$columnRul, _node$attrs$localId;
|
|
19
|
+
var computedEmpty = isEmpty !== null && isEmpty !== void 0 ? isEmpty : (0, _utils.isEmptyLayout)(node);
|
|
19
20
|
return ['div', {
|
|
20
21
|
class: 'layoutSectionView-content-wrap'
|
|
21
22
|
}, ['div', {
|
|
@@ -25,7 +26,7 @@ var toDOM = function toDOM(node) {
|
|
|
25
26
|
// `?? ''` keeps unset attributes out of the DOM as `"null"`, which adf-schema's`parseDOM`
|
|
26
27
|
// reads back as a truthy string.
|
|
27
28
|
'data-column-rule-style': (_node$attrs$columnRul = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul !== void 0 ? _node$attrs$columnRul : '',
|
|
28
|
-
'data-empty-layout': String(
|
|
29
|
+
'data-empty-layout': String(computedEmpty)
|
|
29
30
|
}, (0, _fg.fg)('platform_editor_adf_with_localid') && {
|
|
30
31
|
'data-local-id': (_node$attrs$localId = node.attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : ''
|
|
31
32
|
}), 0]]];
|
|
@@ -43,12 +44,14 @@ var toDOM = function toDOM(node) {
|
|
|
43
44
|
var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function () {
|
|
44
45
|
function LayoutSectionView(node) {
|
|
45
46
|
(0, _classCallCheck2.default)(this, LayoutSectionView);
|
|
46
|
-
var
|
|
47
|
+
var isEmpty = (0, _fg.fg)('platform_editor_vanilla_node_views_patch_1') ? (0, _utils.isEmptyLayout)(node) : undefined;
|
|
48
|
+
var _ref = _model.DOMSerializer.renderSpec(document, toDOM(node, isEmpty)),
|
|
47
49
|
dom = _ref.dom,
|
|
48
50
|
contentDOM = _ref.contentDOM;
|
|
49
51
|
this.dom = dom;
|
|
50
52
|
this.contentDOM = contentDOM;
|
|
51
53
|
this.node = node;
|
|
54
|
+
this.isEmpty = isEmpty;
|
|
52
55
|
}
|
|
53
56
|
return (0, _createClass2.default)(LayoutSectionView, [{
|
|
54
57
|
key: "update",
|
|
@@ -58,7 +61,13 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function () {
|
|
|
58
61
|
this.contentDOM.setAttribute('data-column-rule-style', (_node$attrs$columnRul2 = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul2 !== void 0 ? _node$attrs$columnRul2 : '');
|
|
59
62
|
}
|
|
60
63
|
var isEmpty = (0, _utils.isEmptyLayout)(node);
|
|
61
|
-
if (
|
|
64
|
+
if ((0, _fg.fg)('platform_editor_vanilla_node_views_patch_1')) {
|
|
65
|
+
// Cache isEmpty so update() does not call isEmptyLayout on the previous node.
|
|
66
|
+
if (isEmpty !== this.isEmpty) {
|
|
67
|
+
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
68
|
+
this.isEmpty = isEmpty;
|
|
69
|
+
}
|
|
70
|
+
} else if (isEmpty !== (0, _utils.isEmptyLayout)(this.node)) {
|
|
62
71
|
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
63
72
|
}
|
|
64
73
|
if ((0, _fg.fg)('platform_editor_adf_with_localid') && node.attrs.localId !== this.node.attrs.localId) {
|
|
@@ -2,8 +2,9 @@ import { ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
|
2
2
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { isEmptyLayout } from './utils';
|
|
5
|
-
const toDOM = node => {
|
|
5
|
+
const toDOM = (node, isEmpty) => {
|
|
6
6
|
var _node$attrs$columnRul, _node$attrs$localId;
|
|
7
|
+
const computedEmpty = isEmpty !== null && isEmpty !== void 0 ? isEmpty : isEmptyLayout(node);
|
|
7
8
|
return ['div', {
|
|
8
9
|
class: 'layoutSectionView-content-wrap'
|
|
9
10
|
}, ['div', {
|
|
@@ -13,7 +14,7 @@ const toDOM = node => {
|
|
|
13
14
|
// `?? ''` keeps unset attributes out of the DOM as `"null"`, which adf-schema's`parseDOM`
|
|
14
15
|
// reads back as a truthy string.
|
|
15
16
|
'data-column-rule-style': (_node$attrs$columnRul = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul !== void 0 ? _node$attrs$columnRul : '',
|
|
16
|
-
'data-empty-layout': String(
|
|
17
|
+
'data-empty-layout': String(computedEmpty),
|
|
17
18
|
...(fg('platform_editor_adf_with_localid') && {
|
|
18
19
|
'data-local-id': (_node$attrs$localId = node.attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : ''
|
|
19
20
|
})
|
|
@@ -31,13 +32,15 @@ const toDOM = node => {
|
|
|
31
32
|
*/
|
|
32
33
|
export class LayoutSectionView {
|
|
33
34
|
constructor(node) {
|
|
35
|
+
const isEmpty = fg('platform_editor_vanilla_node_views_patch_1') ? isEmptyLayout(node) : undefined;
|
|
34
36
|
const {
|
|
35
37
|
dom,
|
|
36
38
|
contentDOM
|
|
37
|
-
} = DOMSerializer.renderSpec(document, toDOM(node));
|
|
39
|
+
} = DOMSerializer.renderSpec(document, toDOM(node, isEmpty));
|
|
38
40
|
this.dom = dom;
|
|
39
41
|
this.contentDOM = contentDOM;
|
|
40
42
|
this.node = node;
|
|
43
|
+
this.isEmpty = isEmpty;
|
|
41
44
|
}
|
|
42
45
|
update(node) {
|
|
43
46
|
if (node.attrs.columnRuleStyle !== this.node.attrs.columnRuleStyle) {
|
|
@@ -45,7 +48,13 @@ export class LayoutSectionView {
|
|
|
45
48
|
this.contentDOM.setAttribute('data-column-rule-style', (_node$attrs$columnRul2 = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul2 !== void 0 ? _node$attrs$columnRul2 : '');
|
|
46
49
|
}
|
|
47
50
|
const isEmpty = isEmptyLayout(node);
|
|
48
|
-
if (
|
|
51
|
+
if (fg('platform_editor_vanilla_node_views_patch_1')) {
|
|
52
|
+
// Cache isEmpty so update() does not call isEmptyLayout on the previous node.
|
|
53
|
+
if (isEmpty !== this.isEmpty) {
|
|
54
|
+
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
55
|
+
this.isEmpty = isEmpty;
|
|
56
|
+
}
|
|
57
|
+
} else if (isEmpty !== isEmptyLayout(this.node)) {
|
|
49
58
|
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
50
59
|
}
|
|
51
60
|
if (fg('platform_editor_adf_with_localid') && node.attrs.localId !== this.node.attrs.localId) {
|
|
@@ -7,8 +7,9 @@ import { ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
|
7
7
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
9
|
import { isEmptyLayout } from './utils';
|
|
10
|
-
var toDOM = function toDOM(node) {
|
|
10
|
+
var toDOM = function toDOM(node, isEmpty) {
|
|
11
11
|
var _node$attrs$columnRul, _node$attrs$localId;
|
|
12
|
+
var computedEmpty = isEmpty !== null && isEmpty !== void 0 ? isEmpty : isEmptyLayout(node);
|
|
12
13
|
return ['div', {
|
|
13
14
|
class: 'layoutSectionView-content-wrap'
|
|
14
15
|
}, ['div', {
|
|
@@ -18,7 +19,7 @@ var toDOM = function toDOM(node) {
|
|
|
18
19
|
// `?? ''` keeps unset attributes out of the DOM as `"null"`, which adf-schema's`parseDOM`
|
|
19
20
|
// reads back as a truthy string.
|
|
20
21
|
'data-column-rule-style': (_node$attrs$columnRul = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul !== void 0 ? _node$attrs$columnRul : '',
|
|
21
|
-
'data-empty-layout': String(
|
|
22
|
+
'data-empty-layout': String(computedEmpty)
|
|
22
23
|
}, fg('platform_editor_adf_with_localid') && {
|
|
23
24
|
'data-local-id': (_node$attrs$localId = node.attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : ''
|
|
24
25
|
}), 0]]];
|
|
@@ -36,12 +37,14 @@ var toDOM = function toDOM(node) {
|
|
|
36
37
|
export var LayoutSectionView = /*#__PURE__*/function () {
|
|
37
38
|
function LayoutSectionView(node) {
|
|
38
39
|
_classCallCheck(this, LayoutSectionView);
|
|
39
|
-
var
|
|
40
|
+
var isEmpty = fg('platform_editor_vanilla_node_views_patch_1') ? isEmptyLayout(node) : undefined;
|
|
41
|
+
var _ref = DOMSerializer.renderSpec(document, toDOM(node, isEmpty)),
|
|
40
42
|
dom = _ref.dom,
|
|
41
43
|
contentDOM = _ref.contentDOM;
|
|
42
44
|
this.dom = dom;
|
|
43
45
|
this.contentDOM = contentDOM;
|
|
44
46
|
this.node = node;
|
|
47
|
+
this.isEmpty = isEmpty;
|
|
45
48
|
}
|
|
46
49
|
return _createClass(LayoutSectionView, [{
|
|
47
50
|
key: "update",
|
|
@@ -51,7 +54,13 @@ export var LayoutSectionView = /*#__PURE__*/function () {
|
|
|
51
54
|
this.contentDOM.setAttribute('data-column-rule-style', (_node$attrs$columnRul2 = node.attrs.columnRuleStyle) !== null && _node$attrs$columnRul2 !== void 0 ? _node$attrs$columnRul2 : '');
|
|
52
55
|
}
|
|
53
56
|
var isEmpty = isEmptyLayout(node);
|
|
54
|
-
if (
|
|
57
|
+
if (fg('platform_editor_vanilla_node_views_patch_1')) {
|
|
58
|
+
// Cache isEmpty so update() does not call isEmptyLayout on the previous node.
|
|
59
|
+
if (isEmpty !== this.isEmpty) {
|
|
60
|
+
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
61
|
+
this.isEmpty = isEmpty;
|
|
62
|
+
}
|
|
63
|
+
} else if (isEmpty !== isEmptyLayout(this.node)) {
|
|
55
64
|
this.contentDOM.setAttribute('data-empty-layout', String(isEmpty));
|
|
56
65
|
}
|
|
57
66
|
if (fg('platform_editor_adf_with_localid') && node.attrs.localId !== this.node.attrs.localId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.3",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/icon-lab": "^7.8.0",
|
|
44
44
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^182.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^16.11.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
},
|
|
67
67
|
"platform_editor_layout_column_menu_kill_switch_1": {
|
|
68
68
|
"type": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"platform_editor_vanilla_node_views_patch_1": {
|
|
71
|
+
"type": "boolean"
|
|
69
72
|
}
|
|
70
73
|
},
|
|
71
74
|
"devDependencies": {
|