@atlaskit/editor-core 205.5.1 → 205.5.2
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 +8 -0
- package/dist/cjs/utils/findChangedNodesFromTransaction.js +12 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/utils/findChangedNodesFromTransaction.js +13 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/utils/findChangedNodesFromTransaction.js +13 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 205.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142763](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142763)
|
|
8
|
+
[`5b4752c09f19b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5b4752c09f19b) -
|
|
9
|
+
Improve Node Validation
|
|
10
|
+
|
|
3
11
|
## 205.5.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.findChangedNodesFromTransaction = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
9
|
/**
|
|
8
10
|
* Finds all top level nodes affected by the transaction
|
|
9
11
|
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
@@ -15,10 +17,18 @@ var findChangedNodesFromTransaction = exports.findChangedNodesFromTransaction =
|
|
|
15
17
|
steps.forEach(function (step) {
|
|
16
18
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
17
19
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node) {
|
|
20
|
+
var nodeToCheck = node;
|
|
21
|
+
if ((0, _platformFeatureFlags.fg)('cc_complexit_fe_improve_node_validation')) {
|
|
22
|
+
var schema = tr.selection.$from.doc.type.schema;
|
|
23
|
+
var parentNode = (0, _utils.findParentNode)(function (node) {
|
|
24
|
+
return node.type !== schema.nodes.paragraph;
|
|
25
|
+
})(tr.selection);
|
|
26
|
+
nodeToCheck = parentNode ? parentNode.node : node;
|
|
27
|
+
}
|
|
18
28
|
if (!nodes.find(function (n) {
|
|
19
|
-
return n ===
|
|
29
|
+
return n === nodeToCheck;
|
|
20
30
|
})) {
|
|
21
|
-
nodes.push(
|
|
31
|
+
nodes.push(nodeToCheck);
|
|
22
32
|
}
|
|
23
33
|
return false;
|
|
24
34
|
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Finds all top level nodes affected by the transaction
|
|
3
6
|
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
@@ -9,8 +12,16 @@ export const findChangedNodesFromTransaction = tr => {
|
|
|
9
12
|
steps.forEach(step => {
|
|
10
13
|
step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
11
14
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), node => {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
let nodeToCheck = node;
|
|
16
|
+
if (fg('cc_complexit_fe_improve_node_validation')) {
|
|
17
|
+
const {
|
|
18
|
+
schema
|
|
19
|
+
} = tr.selection.$from.doc.type;
|
|
20
|
+
const parentNode = findParentNode(node => node.type !== schema.nodes.paragraph)(tr.selection);
|
|
21
|
+
nodeToCheck = parentNode ? parentNode.node : node;
|
|
22
|
+
}
|
|
23
|
+
if (!nodes.find(n => n === nodeToCheck)) {
|
|
24
|
+
nodes.push(nodeToCheck);
|
|
14
25
|
}
|
|
15
26
|
return false;
|
|
16
27
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "205.5.
|
|
2
|
+
export const version = "205.5.2";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Finds all top level nodes affected by the transaction
|
|
3
6
|
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
@@ -9,10 +12,18 @@ export var findChangedNodesFromTransaction = function findChangedNodesFromTransa
|
|
|
9
12
|
steps.forEach(function (step) {
|
|
10
13
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
11
14
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node) {
|
|
15
|
+
var nodeToCheck = node;
|
|
16
|
+
if (fg('cc_complexit_fe_improve_node_validation')) {
|
|
17
|
+
var schema = tr.selection.$from.doc.type.schema;
|
|
18
|
+
var parentNode = findParentNode(function (node) {
|
|
19
|
+
return node.type !== schema.nodes.paragraph;
|
|
20
|
+
})(tr.selection);
|
|
21
|
+
nodeToCheck = parentNode ? parentNode.node : node;
|
|
22
|
+
}
|
|
12
23
|
if (!nodes.find(function (n) {
|
|
13
|
-
return n ===
|
|
24
|
+
return n === nodeToCheck;
|
|
14
25
|
})) {
|
|
15
|
-
nodes.push(
|
|
26
|
+
nodes.push(nodeToCheck);
|
|
16
27
|
}
|
|
17
28
|
return false;
|
|
18
29
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "205.5.
|
|
2
|
+
export var version = "205.5.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "205.5.
|
|
3
|
+
"version": "205.5.2",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -146,6 +146,9 @@
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
"platform-feature-flags": {
|
|
149
|
+
"cc_complexit_fe_improve_node_validation": {
|
|
150
|
+
"type": "boolean"
|
|
151
|
+
},
|
|
149
152
|
"platform_editor_emotion_refactor_renderer": {
|
|
150
153
|
"type": "boolean",
|
|
151
154
|
"referenceOnly": "true"
|