@atlaskit/editor-plugin-type-ahead 1.1.1 → 1.1.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 +16 -0
- package/dist/cjs/insert-utils.js +13 -16
- package/dist/es2019/insert-utils.js +15 -18
- package/dist/esm/insert-utils.js +13 -16
- package/package.json +7 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 1.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#94901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94901) [`da964fcdc828`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/da964fcdc828) - [ED-23097] Bump ADF schema to version 35.12.1
|
|
8
|
+
|
|
9
|
+
## 1.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#94717](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94717) [`40f38eb0a512`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40f38eb0a512) - Cleaning up feature flag for inserting nodes in ordered list.
|
|
14
|
+
|
|
15
|
+
Fix bugs for incorrect ordered list order with action & improve selection behaviour on insert
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 1.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/insert-utils.js
CHANGED
|
@@ -8,7 +8,6 @@ var _insert = require("@atlaskit/editor-common/insert");
|
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
13
12
|
var $pos = doc.resolve(pos);
|
|
14
13
|
var createInsertPosition = function createInsertPosition(from, to) {
|
|
@@ -70,25 +69,23 @@ var insertBlockNode = exports.insertBlockNode = function insertBlockNode(_ref) {
|
|
|
70
69
|
return tr.replaceWith(start, end, node);
|
|
71
70
|
}
|
|
72
71
|
if (node.isBlock) {
|
|
72
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
73
73
|
tr.delete(start, end);
|
|
74
74
|
var mappedStart = tr.mapping.map(start);
|
|
75
75
|
var nodeNormalized = (0, _insert.normaliseNestedLayout)(tr, node);
|
|
76
|
-
|
|
77
|
-
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
78
|
-
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
76
|
+
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
78
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
79
|
+
/* e.g.
|
|
80
|
+
* panel (
|
|
81
|
+
* 1. text (insertion)
|
|
82
|
+
* )
|
|
83
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
84
|
+
*/
|
|
85
|
+
var grandParentNodeType = (_tr$selection$$from$n = tr.selection.$from.node(-1)) === null || _tr$selection$$from$n === void 0 ? void 0 : _tr$selection$$from$n.type;
|
|
86
|
+
var ggreatGrandParentNodeType = (_tr$selection$$from$n2 = tr.selection.$from.node(-3)) === null || _tr$selection$$from$n2 === void 0 ? void 0 : _tr$selection$$from$n2.type;
|
|
87
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
88
|
+
return (0, _utils.transformNodeIntoListItem)(tr, nodeNormalized);
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
// Handle edge cases for hr and mediaSingle
|
|
@@ -2,7 +2,6 @@ import { normaliseNestedLayout, safeInsert } from '@atlaskit/editor-common/inser
|
|
|
2
2
|
import { transformNodeIntoListItem } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
7
6
|
const $pos = doc.resolve(pos);
|
|
8
7
|
const createInsertPosition = (from, to) => ({
|
|
@@ -65,27 +64,25 @@ export const insertBlockNode = ({
|
|
|
65
64
|
return tr.replaceWith(start, end, node);
|
|
66
65
|
}
|
|
67
66
|
if (node.isBlock) {
|
|
67
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
68
68
|
tr.delete(start, end);
|
|
69
69
|
const mappedStart = tr.mapping.map(start);
|
|
70
70
|
const nodeNormalized = normaliseNestedLayout(tr, node);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
listItem
|
|
75
|
-
} = tr.doc.type.schema.nodes;
|
|
71
|
+
const {
|
|
72
|
+
listItem
|
|
73
|
+
} = tr.doc.type.schema.nodes;
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
75
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
76
|
+
/* e.g.
|
|
77
|
+
* panel (
|
|
78
|
+
* 1. text (insertion)
|
|
79
|
+
* )
|
|
80
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
81
|
+
*/
|
|
82
|
+
const grandParentNodeType = (_tr$selection$$from$n = tr.selection.$from.node(-1)) === null || _tr$selection$$from$n === void 0 ? void 0 : _tr$selection$$from$n.type;
|
|
83
|
+
const ggreatGrandParentNodeType = (_tr$selection$$from$n2 = tr.selection.$from.node(-3)) === null || _tr$selection$$from$n2 === void 0 ? void 0 : _tr$selection$$from$n2.type;
|
|
84
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
85
|
+
return transformNodeIntoListItem(tr, nodeNormalized);
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
// Handle edge cases for hr and mediaSingle
|
package/dist/esm/insert-utils.js
CHANGED
|
@@ -2,7 +2,6 @@ import { normaliseNestedLayout, safeInsert } from '@atlaskit/editor-common/inser
|
|
|
2
2
|
import { transformNodeIntoListItem } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
7
6
|
var $pos = doc.resolve(pos);
|
|
8
7
|
var createInsertPosition = function createInsertPosition(from, to) {
|
|
@@ -64,25 +63,23 @@ export var insertBlockNode = function insertBlockNode(_ref) {
|
|
|
64
63
|
return tr.replaceWith(start, end, node);
|
|
65
64
|
}
|
|
66
65
|
if (node.isBlock) {
|
|
66
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
67
67
|
tr.delete(start, end);
|
|
68
68
|
var mappedStart = tr.mapping.map(start);
|
|
69
69
|
var nodeNormalized = normaliseNestedLayout(tr, node);
|
|
70
|
-
|
|
71
|
-
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
72
|
-
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
70
|
+
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
72
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
73
|
+
/* e.g.
|
|
74
|
+
* panel (
|
|
75
|
+
* 1. text (insertion)
|
|
76
|
+
* )
|
|
77
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
78
|
+
*/
|
|
79
|
+
var grandParentNodeType = (_tr$selection$$from$n = tr.selection.$from.node(-1)) === null || _tr$selection$$from$n === void 0 ? void 0 : _tr$selection$$from$n.type;
|
|
80
|
+
var ggreatGrandParentNodeType = (_tr$selection$$from$n2 = tr.selection.$from.node(-3)) === null || _tr$selection$$from$n2 === void 0 ? void 0 : _tr$selection$$from$n2.type;
|
|
81
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
82
|
+
return transformNodeIntoListItem(tr, nodeNormalized);
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
// Handle edge cases for hr and mediaSingle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,17 +32,16 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^35.
|
|
35
|
+
"@atlaskit/adf-schema": "^35.12.1",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
37
|
-
"@atlaskit/editor-common": "^78.
|
|
37
|
+
"@atlaskit/editor-common": "^78.36.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
40
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
41
|
-
"@atlaskit/menu": "^2.
|
|
42
|
-
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
40
|
+
"@atlaskit/editor-shared-styles": "^2.10.0",
|
|
41
|
+
"@atlaskit/menu": "^2.2.0",
|
|
43
42
|
"@atlaskit/prosemirror-input-rules": "^3.1.0",
|
|
44
43
|
"@atlaskit/theme": "^12.7.0",
|
|
45
|
-
"@atlaskit/tokens": "^1.
|
|
44
|
+
"@atlaskit/tokens": "^1.44.0",
|
|
46
45
|
"@babel/runtime": "^7.0.0",
|
|
47
46
|
"@emotion/react": "^11.7.1",
|
|
48
47
|
"lodash": "^4.17.21",
|
|
@@ -86,10 +85,5 @@
|
|
|
86
85
|
]
|
|
87
86
|
}
|
|
88
87
|
},
|
|
89
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
90
|
-
"platform-feature-flags": {
|
|
91
|
-
"platform.editor.ordered-list-inserting-nodes_bh0vo": {
|
|
92
|
-
"type": "boolean"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
88
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
95
89
|
}
|