@atlaskit/editor-plugin-block-menu 5.2.22 → 5.2.24
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 +16 -0
- package/dist/cjs/editor-commands/transform-node-utils/marks.js +18 -0
- package/dist/cjs/editor-commands/transform-node-utils/wrapIntoLayoutStep.js +4 -7
- package/dist/cjs/editor-commands/transform-node-utils/wrapStep.js +3 -5
- package/dist/cjs/ui/format-menu-nested.js +1 -1
- package/dist/es2019/editor-commands/transform-node-utils/marks.js +8 -0
- package/dist/es2019/editor-commands/transform-node-utils/wrapIntoLayoutStep.js +4 -7
- package/dist/es2019/editor-commands/transform-node-utils/wrapStep.js +3 -5
- package/dist/es2019/ui/format-menu-nested.js +1 -1
- package/dist/esm/editor-commands/transform-node-utils/marks.js +12 -0
- package/dist/esm/editor-commands/transform-node-utils/wrapIntoLayoutStep.js +4 -7
- package/dist/esm/editor-commands/transform-node-utils/wrapStep.js +3 -5
- package/dist/esm/ui/format-menu-nested.js +1 -1
- package/dist/types/editor-commands/transform-node-utils/marks.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/marks.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 5.2.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ec581339891b4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec581339891b4) -
|
|
8
|
+
Fix code block transformation to remove block marks (breakout, alignment) when wrapping into
|
|
9
|
+
layout, blockquote, expand, or panel
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 5.2.23
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`6c9c4e73b1c39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c9c4e73b1c39) -
|
|
17
|
+
EDITOR-4037 Block menu selection extension tests
|
|
18
|
+
|
|
3
19
|
## 5.2.22
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeBlockMarks = void 0;
|
|
7
|
+
var removeMarks = function removeMarks(disallowedMarks) {
|
|
8
|
+
return function (node) {
|
|
9
|
+
var filteredMarks = node.marks.filter(function (mark) {
|
|
10
|
+
return !disallowedMarks.includes(mark.type);
|
|
11
|
+
});
|
|
12
|
+
return node.mark(filteredMarks);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var removeBlockMarks = exports.removeBlockMarks = function removeBlockMarks(nodes, schema) {
|
|
16
|
+
var disallowedMarks = [schema.marks.breakout, schema.marks.alignment];
|
|
17
|
+
return nodes.map(removeMarks(disallowedMarks));
|
|
18
|
+
};
|
|
@@ -4,20 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapIntoLayoutStep = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _marks = require("./marks");
|
|
8
8
|
var wrapIntoLayoutStep = exports.wrapIntoLayoutStep = function wrapIntoLayoutStep(nodes, context) {
|
|
9
9
|
var schema = context.schema;
|
|
10
10
|
var _ref = schema.nodes || {},
|
|
11
11
|
layoutSection = _ref.layoutSection,
|
|
12
12
|
layoutColumn = _ref.layoutColumn;
|
|
13
|
-
var columnOne = layoutColumn.createAndFill({},
|
|
13
|
+
var columnOne = layoutColumn.createAndFill({}, (0, _marks.removeBlockMarks)(nodes, schema));
|
|
14
14
|
var columnTwo = layoutColumn.createAndFill();
|
|
15
15
|
if (!columnOne || !columnTwo) {
|
|
16
16
|
return nodes;
|
|
17
17
|
}
|
|
18
|
-
var layout = layoutSection.createAndFill({},
|
|
19
|
-
|
|
20
|
-
return nodes;
|
|
21
|
-
}
|
|
22
|
-
return [layout];
|
|
18
|
+
var layout = layoutSection.createAndFill({}, [columnOne, columnTwo]);
|
|
19
|
+
return layout ? [layout] : nodes;
|
|
23
20
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapStep = void 0;
|
|
7
|
+
var _marks = require("./marks");
|
|
7
8
|
var _utils = require("./utils");
|
|
8
9
|
/**
|
|
9
10
|
* Wraps nodes into the target container type.
|
|
@@ -26,9 +27,6 @@ var wrapStep = exports.wrapStep = function wrapStep(nodes, context) {
|
|
|
26
27
|
return node;
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, processedNodes);
|
|
30
|
-
|
|
31
|
-
return [outputNode];
|
|
32
|
-
}
|
|
33
|
-
return nodes;
|
|
30
|
+
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, (0, _marks.removeBlockMarks)(processedNodes, schema));
|
|
31
|
+
return outputNode ? [outputNode] : nodes;
|
|
34
32
|
};
|
|
@@ -46,7 +46,7 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
|
|
|
46
46
|
}),
|
|
47
47
|
enableMaxHeight: true,
|
|
48
48
|
onClick: handleClick,
|
|
49
|
-
dropdownTestId: "editor-
|
|
49
|
+
dropdownTestId: "editor-turn-into-menu",
|
|
50
50
|
shouldFitContainer: true
|
|
51
51
|
}, children);
|
|
52
52
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const removeMarks = disallowedMarks => node => {
|
|
2
|
+
const filteredMarks = node.marks.filter(mark => !disallowedMarks.includes(mark.type));
|
|
3
|
+
return node.mark(filteredMarks);
|
|
4
|
+
};
|
|
5
|
+
export const removeBlockMarks = (nodes, schema) => {
|
|
6
|
+
const disallowedMarks = [schema.marks.breakout, schema.marks.alignment];
|
|
7
|
+
return nodes.map(removeMarks(disallowedMarks));
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { removeBlockMarks } from './marks';
|
|
2
2
|
export const wrapIntoLayoutStep = (nodes, context) => {
|
|
3
3
|
const {
|
|
4
4
|
schema
|
|
@@ -7,14 +7,11 @@ export const wrapIntoLayoutStep = (nodes, context) => {
|
|
|
7
7
|
layoutSection,
|
|
8
8
|
layoutColumn
|
|
9
9
|
} = schema.nodes || {};
|
|
10
|
-
const columnOne = layoutColumn.createAndFill({},
|
|
10
|
+
const columnOne = layoutColumn.createAndFill({}, removeBlockMarks(nodes, schema));
|
|
11
11
|
const columnTwo = layoutColumn.createAndFill();
|
|
12
12
|
if (!columnOne || !columnTwo) {
|
|
13
13
|
return nodes;
|
|
14
14
|
}
|
|
15
|
-
const layout = layoutSection.createAndFill({},
|
|
16
|
-
|
|
17
|
-
return nodes;
|
|
18
|
-
}
|
|
19
|
-
return [layout];
|
|
15
|
+
const layout = layoutSection.createAndFill({}, [columnOne, columnTwo]);
|
|
16
|
+
return layout ? [layout] : nodes;
|
|
20
17
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeBlockMarks } from './marks';
|
|
1
2
|
import { convertExpandToNestedExpand } from './utils';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -23,9 +24,6 @@ export const wrapStep = (nodes, context) => {
|
|
|
23
24
|
return node;
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
const outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, processedNodes);
|
|
27
|
-
|
|
28
|
-
return [outputNode];
|
|
29
|
-
}
|
|
30
|
-
return nodes;
|
|
27
|
+
const outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, removeBlockMarks(processedNodes, schema));
|
|
28
|
+
return outputNode ? [outputNode] : nodes;
|
|
31
29
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var removeMarks = function removeMarks(disallowedMarks) {
|
|
2
|
+
return function (node) {
|
|
3
|
+
var filteredMarks = node.marks.filter(function (mark) {
|
|
4
|
+
return !disallowedMarks.includes(mark.type);
|
|
5
|
+
});
|
|
6
|
+
return node.mark(filteredMarks);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export var removeBlockMarks = function removeBlockMarks(nodes, schema) {
|
|
10
|
+
var disallowedMarks = [schema.marks.breakout, schema.marks.alignment];
|
|
11
|
+
return nodes.map(removeMarks(disallowedMarks));
|
|
12
|
+
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { removeBlockMarks } from './marks';
|
|
2
2
|
export var wrapIntoLayoutStep = function wrapIntoLayoutStep(nodes, context) {
|
|
3
3
|
var schema = context.schema;
|
|
4
4
|
var _ref = schema.nodes || {},
|
|
5
5
|
layoutSection = _ref.layoutSection,
|
|
6
6
|
layoutColumn = _ref.layoutColumn;
|
|
7
|
-
var columnOne = layoutColumn.createAndFill({},
|
|
7
|
+
var columnOne = layoutColumn.createAndFill({}, removeBlockMarks(nodes, schema));
|
|
8
8
|
var columnTwo = layoutColumn.createAndFill();
|
|
9
9
|
if (!columnOne || !columnTwo) {
|
|
10
10
|
return nodes;
|
|
11
11
|
}
|
|
12
|
-
var layout = layoutSection.createAndFill({},
|
|
13
|
-
|
|
14
|
-
return nodes;
|
|
15
|
-
}
|
|
16
|
-
return [layout];
|
|
12
|
+
var layout = layoutSection.createAndFill({}, [columnOne, columnTwo]);
|
|
13
|
+
return layout ? [layout] : nodes;
|
|
17
14
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeBlockMarks } from './marks';
|
|
1
2
|
import { convertExpandToNestedExpand } from './utils';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -21,9 +22,6 @@ export var wrapStep = function wrapStep(nodes, context) {
|
|
|
21
22
|
return node;
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, processedNodes);
|
|
25
|
-
|
|
26
|
-
return [outputNode];
|
|
27
|
-
}
|
|
28
|
-
return nodes;
|
|
25
|
+
var outputNode = schema.nodes[targetNodeTypeName].createAndFill({}, removeBlockMarks(processedNodes, schema));
|
|
26
|
+
return outputNode ? [outputNode] : nodes;
|
|
29
27
|
};
|
|
@@ -37,7 +37,7 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
|
|
|
37
37
|
}),
|
|
38
38
|
enableMaxHeight: true,
|
|
39
39
|
onClick: handleClick,
|
|
40
|
-
dropdownTestId: "editor-
|
|
40
|
+
dropdownTestId: "editor-turn-into-menu",
|
|
41
41
|
shouldFitContainer: true
|
|
42
42
|
}, children);
|
|
43
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.24",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/css": "^0.19.0",
|
|
32
32
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
34
|
-
"@atlaskit/editor-plugin-block-controls": "^7.
|
|
34
|
+
"@atlaskit/editor-plugin-block-controls": "^7.18.0",
|
|
35
35
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.49.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|