@atlaskit/prosemirror-input-rules 3.2.0 → 3.2.1
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.js +2 -1
- package/dist/es2019/utils.js +3 -2
- package/dist/esm/utils.js +3 -2
- package/package.json +2 -2
- package/src/utils.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/prosemirror-input-rules
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132619](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132619)
|
|
8
|
+
[`492710c431738`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/492710c431738) -
|
|
9
|
+
[ux] [EO2024-22] Fix typeahead interaction when node or table selection
|
|
10
|
+
|
|
3
11
|
## 3.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/cjs/utils.js
CHANGED
|
@@ -41,7 +41,8 @@ var createPlugin = exports.createPlugin = function createPlugin(pluginName, rule
|
|
|
41
41
|
to = _ref.to;
|
|
42
42
|
var unsupportedMarks = isBlockNodeRule ? ['code', 'link', 'typeAheadQuery'] : ['code'];
|
|
43
43
|
var $from = state.selection.$from;
|
|
44
|
-
|
|
44
|
+
var isInline = state.selection instanceof _state.NodeSelection && state.selection.node.type.isInline;
|
|
45
|
+
if ($from.parent.type.spec.code || !(state.selection instanceof _state.TextSelection) && !(0, _editorCommon.isGapCursorSelection)(state.selection) && !isInline || hasUnsupportedMarks(state, from, to, unsupportedMarks) || isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks)) {
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
47
48
|
return true;
|
package/dist/es2019/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
2
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { isGapCursorSelection } from './editor-common';
|
|
4
4
|
import { createInputRulePlugin } from './plugin';
|
|
5
5
|
const hasUnsupportedMarks = (state, start, end, marksNameUnsupported) => {
|
|
@@ -35,7 +35,8 @@ export const createPlugin = (pluginName, rules, options = {}) => {
|
|
|
35
35
|
}) => {
|
|
36
36
|
const unsupportedMarks = isBlockNodeRule ? ['code', 'link', 'typeAheadQuery'] : ['code'];
|
|
37
37
|
const $from = state.selection.$from;
|
|
38
|
-
|
|
38
|
+
const isInline = state.selection instanceof NodeSelection && state.selection.node.type.isInline;
|
|
39
|
+
if ($from.parent.type.spec.code || !(state.selection instanceof TextSelection) && !isGapCursorSelection(state.selection) && !isInline || hasUnsupportedMarks(state, from, to, unsupportedMarks) || isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks)) {
|
|
39
40
|
return false;
|
|
40
41
|
}
|
|
41
42
|
return true;
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
2
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { isGapCursorSelection } from './editor-common';
|
|
4
4
|
import { createInputRulePlugin } from './plugin';
|
|
5
5
|
var hasUnsupportedMarks = function hasUnsupportedMarks(state, start, end, marksNameUnsupported) {
|
|
@@ -35,7 +35,8 @@ export var createPlugin = function createPlugin(pluginName, rules) {
|
|
|
35
35
|
to = _ref.to;
|
|
36
36
|
var unsupportedMarks = isBlockNodeRule ? ['code', 'link', 'typeAheadQuery'] : ['code'];
|
|
37
37
|
var $from = state.selection.$from;
|
|
38
|
-
|
|
38
|
+
var isInline = state.selection instanceof NodeSelection && state.selection.node.type.isInline;
|
|
39
|
+
if ($from.parent.type.spec.code || !(state.selection instanceof TextSelection) && !isGapCursorSelection(state.selection) && !isInline || hasUnsupportedMarks(state, from, to, unsupportedMarks) || isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks)) {
|
|
39
40
|
return false;
|
|
40
41
|
}
|
|
41
42
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/prosemirror-input-rules",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "A package that contains helpers to create autoformatting rules for ProseMirror",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@babel/runtime": "^7.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
35
|
+
"@atlaskit/editor-common": "^88.0.0"
|
|
36
36
|
},
|
|
37
37
|
"techstack": {
|
|
38
38
|
"@atlassian/frontend": {
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
2
2
|
import type { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState, SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
|
|
6
6
|
import { isGapCursorSelection } from './editor-common';
|
|
7
7
|
import { createInputRulePlugin } from './plugin';
|
|
@@ -51,10 +51,13 @@ export const createPlugin = (
|
|
|
51
51
|
const unsupportedMarks = isBlockNodeRule ? ['code', 'link', 'typeAheadQuery'] : ['code'];
|
|
52
52
|
|
|
53
53
|
const $from = state.selection.$from;
|
|
54
|
+
const isInline = state.selection instanceof NodeSelection && state.selection.node.type.isInline;
|
|
54
55
|
|
|
55
56
|
if (
|
|
56
57
|
$from.parent.type.spec.code ||
|
|
57
|
-
(!(state.selection instanceof TextSelection) &&
|
|
58
|
+
(!(state.selection instanceof TextSelection) &&
|
|
59
|
+
!isGapCursorSelection(state.selection) &&
|
|
60
|
+
!isInline) ||
|
|
58
61
|
hasUnsupportedMarks(state, from, to, unsupportedMarks) ||
|
|
59
62
|
(isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks))
|
|
60
63
|
) {
|