@atlaskit/editor-plugin-type-ahead 0.8.6 → 0.9.0
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 +10 -0
- package/dist/cjs/insert-utils.js +19 -0
- package/dist/es2019/insert-utils.js +21 -0
- package/dist/esm/insert-utils.js +19 -0
- package/package.json +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#64335](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64335) [`efc8826c907f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/efc8826c907f) - [ux] [ED-16509] Restart numbered list inserting nodes via QUICK INSERT, nodes including : panels, expands, decisions, tables, layout, quotes, actions, dividers, headings. Changes are being guarded behind feature flag platform.editor.ordered-list-inserting-nodes_bh0vo
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 0.8.6
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/cjs/insert-utils.js
CHANGED
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.insertInlineNodeOrFragment = exports.insertBlockNode = void 0;
|
|
7
7
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
8
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
12
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
11
13
|
var $pos = doc.resolve(pos);
|
|
12
14
|
var createInsertPosition = function createInsertPosition(from, to) {
|
|
@@ -71,6 +73,23 @@ var insertBlockNode = exports.insertBlockNode = function insertBlockNode(_ref) {
|
|
|
71
73
|
tr.delete(start, end);
|
|
72
74
|
var mappedStart = tr.mapping.map(start);
|
|
73
75
|
var nodeNormalized = (0, _insert.normaliseNestedLayout)(tr, node);
|
|
76
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.ordered-list-inserting-nodes_bh0vo')) {
|
|
77
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
78
|
+
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
79
|
+
|
|
80
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
81
|
+
/* e.g.
|
|
82
|
+
* panel (
|
|
83
|
+
* 1. text (insertion)
|
|
84
|
+
* )
|
|
85
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
86
|
+
*/
|
|
87
|
+
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;
|
|
88
|
+
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;
|
|
89
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
90
|
+
return (0, _utils.transformNodeIntoListItem)(tr, nodeNormalized);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
74
93
|
|
|
75
94
|
// Handle edge cases for hr and mediaSingle
|
|
76
95
|
var inserted = (0, _insert.safeInsert)(nodeNormalized, mappedStart)(tr);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { normaliseNestedLayout, safeInsert } from '@atlaskit/editor-common/insert';
|
|
2
|
+
import { transformNodeIntoListItem } from '@atlaskit/editor-common/utils';
|
|
2
3
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
6
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
5
7
|
const $pos = doc.resolve(pos);
|
|
6
8
|
const createInsertPosition = (from, to) => ({
|
|
@@ -66,6 +68,25 @@ export const insertBlockNode = ({
|
|
|
66
68
|
tr.delete(start, end);
|
|
67
69
|
const mappedStart = tr.mapping.map(start);
|
|
68
70
|
const nodeNormalized = normaliseNestedLayout(tr, node);
|
|
71
|
+
if (getBooleanFF('platform.editor.ordered-list-inserting-nodes_bh0vo')) {
|
|
72
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
73
|
+
const {
|
|
74
|
+
listItem
|
|
75
|
+
} = tr.doc.type.schema.nodes;
|
|
76
|
+
|
|
77
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
78
|
+
/* e.g.
|
|
79
|
+
* panel (
|
|
80
|
+
* 1. text (insertion)
|
|
81
|
+
* )
|
|
82
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
83
|
+
*/
|
|
84
|
+
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;
|
|
85
|
+
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;
|
|
86
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
87
|
+
return transformNodeIntoListItem(tr, nodeNormalized);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
69
90
|
|
|
70
91
|
// Handle edge cases for hr and mediaSingle
|
|
71
92
|
const inserted = safeInsert(nodeNormalized, mappedStart)(tr);
|
package/dist/esm/insert-utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { normaliseNestedLayout, safeInsert } from '@atlaskit/editor-common/insert';
|
|
2
|
+
import { transformNodeIntoListItem } from '@atlaskit/editor-common/utils';
|
|
2
3
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
6
|
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
5
7
|
var $pos = doc.resolve(pos);
|
|
6
8
|
var createInsertPosition = function createInsertPosition(from, to) {
|
|
@@ -65,6 +67,23 @@ export var insertBlockNode = function insertBlockNode(_ref) {
|
|
|
65
67
|
tr.delete(start, end);
|
|
66
68
|
var mappedStart = tr.mapping.map(start);
|
|
67
69
|
var nodeNormalized = normaliseNestedLayout(tr, node);
|
|
70
|
+
if (getBooleanFF('platform.editor.ordered-list-inserting-nodes_bh0vo')) {
|
|
71
|
+
var _tr$selection$$from$n, _tr$selection$$from$n2;
|
|
72
|
+
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
73
|
+
|
|
74
|
+
// Handle edge cases if it's in a list or that it's inserting a node in the same node type
|
|
75
|
+
/* e.g.
|
|
76
|
+
* panel (
|
|
77
|
+
* 1. text (insertion)
|
|
78
|
+
* )
|
|
79
|
+
* at insertion, text is parent (0), listItem is grandParent (-1), list is greatGrandparent (-2), panel is ggreatGrandParent (-3)
|
|
80
|
+
*/
|
|
81
|
+
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;
|
|
82
|
+
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;
|
|
83
|
+
if (grandParentNodeType === listItem && !(ggreatGrandParentNodeType === node.type)) {
|
|
84
|
+
return transformNodeIntoListItem(tr, nodeNormalized);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
68
87
|
|
|
69
88
|
// Handle edge cases for hr and mediaSingle
|
|
70
89
|
var inserted = safeInsert(nodeNormalized, mappedStart)(tr);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Lego",
|
|
12
12
|
"releaseModel": "continuous",
|
|
13
|
-
"singleton": true
|
|
13
|
+
"singleton": true,
|
|
14
|
+
"runReact18": false
|
|
14
15
|
},
|
|
15
16
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
16
17
|
"main": "dist/cjs/index.js",
|
|
@@ -33,14 +34,15 @@
|
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@atlaskit/adf-schema": "^35.2.0",
|
|
35
36
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^76.
|
|
37
|
+
"@atlaskit/editor-common": "^76.34.0",
|
|
37
38
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
39
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
40
|
+
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
40
41
|
"@atlaskit/menu": "^2.1.0",
|
|
42
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
41
43
|
"@atlaskit/prosemirror-input-rules": "^2.4.0",
|
|
42
44
|
"@atlaskit/theme": "^12.6.0",
|
|
43
|
-
"@atlaskit/tokens": "^1.
|
|
45
|
+
"@atlaskit/tokens": "^1.33.0",
|
|
44
46
|
"@babel/runtime": "^7.0.0",
|
|
45
47
|
"@emotion/react": "^11.7.1",
|
|
46
48
|
"lodash": "^4.17.21",
|
|
@@ -85,5 +87,10 @@
|
|
|
85
87
|
]
|
|
86
88
|
}
|
|
87
89
|
},
|
|
88
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
90
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
91
|
+
"platform-feature-flags": {
|
|
92
|
+
"platform.editor.ordered-list-inserting-nodes_bh0vo": {
|
|
93
|
+
"type": "boolean"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
89
96
|
}
|