@atlaskit/editor-plugin-indentation 3.1.6 → 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 +22 -0
- package/dist/cjs/pm-plugins/keymap.js +10 -3
- package/dist/es2019/pm-plugins/keymap.js +9 -3
- package/dist/esm/pm-plugins/keymap.js +10 -3
- package/dist/types/editor-commands/utils.d.ts +2 -2
- package/dist/types/indentationPluginType.d.ts +5 -5
- package/dist/types-ts4.5/editor-commands/utils.d.ts +2 -2
- package/dist/types-ts4.5/indentationPluginType.d.ts +5 -5
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-indentation
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
|
|
8
|
+
Sorted type and interface props to improve Atlaskit docs
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 3.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`d2a535bed291e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2a535bed291e) -
|
|
16
|
+
[EDITOR-1153] Let the `editor-plugin-indentation` handle `paragraphs` when they are selected in a
|
|
17
|
+
range with `blockTaskItem`, but don't indent the `paragraphs` inside `blockTaskItem`s
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`d2a535bed291e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2a535bed291e) -
|
|
22
|
+
[EDITOR-1153] Make sure that Tab works for range selections for `blockTaskItem`
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 3.1.6
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -17,17 +17,24 @@ function keymapPlugin(editorAnalyticsAPI) {
|
|
|
17
17
|
// Ignored via go/ees005
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
19
|
(0, _keymaps.findShortcutByKeymap)(_keymaps.indent), function (state, dispatch) {
|
|
20
|
-
var
|
|
20
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
21
|
+
blockTaskItem = _state$schema$nodes.blockTaskItem,
|
|
22
|
+
paragraph = _state$schema$nodes.paragraph,
|
|
23
|
+
doc = _state$schema$nodes.doc;
|
|
21
24
|
if (blockTaskItem) {
|
|
22
25
|
var hasBlockTaskItem = false;
|
|
26
|
+
var hasParagraphAtDocLevel = false;
|
|
23
27
|
// Check if the selection contains a blockTaskItem
|
|
24
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
|
|
28
|
+
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
|
|
25
29
|
if (node.type === blockTaskItem) {
|
|
26
30
|
hasBlockTaskItem = true;
|
|
27
31
|
return false; // stop iterating
|
|
28
32
|
}
|
|
33
|
+
if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
|
|
34
|
+
hasParagraphAtDocLevel = true;
|
|
35
|
+
}
|
|
29
36
|
});
|
|
30
|
-
if (hasBlockTaskItem) {
|
|
37
|
+
if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
|
|
31
38
|
return false; // let `editor-plugin-tasks-and-decisions` handle indentation
|
|
32
39
|
}
|
|
33
40
|
}
|
|
@@ -11,18 +11,24 @@ export function keymapPlugin(editorAnalyticsAPI) {
|
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
12
|
findShortcutByKeymap(indent), (state, dispatch) => {
|
|
13
13
|
const {
|
|
14
|
-
blockTaskItem
|
|
14
|
+
blockTaskItem,
|
|
15
|
+
paragraph,
|
|
16
|
+
doc
|
|
15
17
|
} = state.schema.nodes;
|
|
16
18
|
if (blockTaskItem) {
|
|
17
19
|
let hasBlockTaskItem = false;
|
|
20
|
+
let hasParagraphAtDocLevel = false;
|
|
18
21
|
// Check if the selection contains a blockTaskItem
|
|
19
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, node => {
|
|
22
|
+
state.doc.nodesBetween(state.selection.from, state.selection.to, (node, _pos, parent) => {
|
|
20
23
|
if (node.type === blockTaskItem) {
|
|
21
24
|
hasBlockTaskItem = true;
|
|
22
25
|
return false; // stop iterating
|
|
23
26
|
}
|
|
27
|
+
if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
|
|
28
|
+
hasParagraphAtDocLevel = true;
|
|
29
|
+
}
|
|
24
30
|
});
|
|
25
|
-
if (hasBlockTaskItem) {
|
|
31
|
+
if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
|
|
26
32
|
return false; // let `editor-plugin-tasks-and-decisions` handle indentation
|
|
27
33
|
}
|
|
28
34
|
}
|
|
@@ -10,17 +10,24 @@ export function keymapPlugin(editorAnalyticsAPI) {
|
|
|
10
10
|
// Ignored via go/ees005
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
12
|
findShortcutByKeymap(indent), function (state, dispatch) {
|
|
13
|
-
var
|
|
13
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
14
|
+
blockTaskItem = _state$schema$nodes.blockTaskItem,
|
|
15
|
+
paragraph = _state$schema$nodes.paragraph,
|
|
16
|
+
doc = _state$schema$nodes.doc;
|
|
14
17
|
if (blockTaskItem) {
|
|
15
18
|
var hasBlockTaskItem = false;
|
|
19
|
+
var hasParagraphAtDocLevel = false;
|
|
16
20
|
// Check if the selection contains a blockTaskItem
|
|
17
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
|
|
21
|
+
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
|
|
18
22
|
if (node.type === blockTaskItem) {
|
|
19
23
|
hasBlockTaskItem = true;
|
|
20
24
|
return false; // stop iterating
|
|
21
25
|
}
|
|
26
|
+
if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
|
|
27
|
+
hasParagraphAtDocLevel = true;
|
|
28
|
+
}
|
|
22
29
|
});
|
|
23
|
-
if (hasBlockTaskItem) {
|
|
30
|
+
if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
|
|
24
31
|
return false; // let `editor-plugin-tasks-and-decisions` handle indentation
|
|
25
32
|
}
|
|
26
33
|
}
|
|
@@ -29,9 +29,9 @@ export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
31
|
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
|
+
dispatch?: (tr: Transaction) => void;
|
|
33
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
32
34
|
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
35
|
inputMethod: IndentationInputMethod;
|
|
34
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
35
36
|
state: EditorState;
|
|
36
|
-
dispatch?: (tr: Transaction) => void;
|
|
37
37
|
}): (tr: Transaction) => void;
|
|
@@ -3,8 +3,8 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { IndentationInputMethod } from './editor-commands/utils';
|
|
5
5
|
type IndentationPluginSharedState = {
|
|
6
|
-
isIndentationAllowed: boolean;
|
|
7
6
|
indentDisabled: boolean;
|
|
7
|
+
isIndentationAllowed: boolean;
|
|
8
8
|
outdentDisabled: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type IndentationPluginDependencies = [OptionalPlugin<AnalyticsPlugin>];
|
|
@@ -13,18 +13,18 @@ export type IndentationPluginActions = {
|
|
|
13
13
|
outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
14
14
|
};
|
|
15
15
|
export type IndentationPlugin = NextEditorPlugin<'indentation', {
|
|
16
|
-
dependencies: IndentationPluginDependencies;
|
|
17
16
|
actions: IndentationPluginActions;
|
|
17
|
+
dependencies: IndentationPluginDependencies;
|
|
18
18
|
sharedState: IndentationPluginSharedState | undefined;
|
|
19
19
|
}>;
|
|
20
20
|
export interface GetAttrsChange<T, V> {
|
|
21
|
-
node: Node;
|
|
22
|
-
prevAttrs?: T;
|
|
23
21
|
newAttrs: T | false | undefined;
|
|
22
|
+
node: Node;
|
|
24
23
|
options: V;
|
|
24
|
+
prevAttrs?: T;
|
|
25
25
|
}
|
|
26
26
|
export type GetAttrsWithChangesRecorder<T, V> = {
|
|
27
|
-
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
28
27
|
getAndResetAttrsChanges(): GetAttrsChange<T, V>[];
|
|
28
|
+
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
29
29
|
};
|
|
30
30
|
export {};
|
|
@@ -29,9 +29,9 @@ export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
31
|
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
|
+
dispatch?: (tr: Transaction) => void;
|
|
33
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
32
34
|
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
35
|
inputMethod: IndentationInputMethod;
|
|
34
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
35
36
|
state: EditorState;
|
|
36
|
-
dispatch?: (tr: Transaction) => void;
|
|
37
37
|
}): (tr: Transaction) => void;
|
|
@@ -3,8 +3,8 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { IndentationInputMethod } from './editor-commands/utils';
|
|
5
5
|
type IndentationPluginSharedState = {
|
|
6
|
-
isIndentationAllowed: boolean;
|
|
7
6
|
indentDisabled: boolean;
|
|
7
|
+
isIndentationAllowed: boolean;
|
|
8
8
|
outdentDisabled: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type IndentationPluginDependencies = [
|
|
@@ -15,18 +15,18 @@ export type IndentationPluginActions = {
|
|
|
15
15
|
outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
16
16
|
};
|
|
17
17
|
export type IndentationPlugin = NextEditorPlugin<'indentation', {
|
|
18
|
-
dependencies: IndentationPluginDependencies;
|
|
19
18
|
actions: IndentationPluginActions;
|
|
19
|
+
dependencies: IndentationPluginDependencies;
|
|
20
20
|
sharedState: IndentationPluginSharedState | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
export interface GetAttrsChange<T, V> {
|
|
23
|
-
node: Node;
|
|
24
|
-
prevAttrs?: T;
|
|
25
23
|
newAttrs: T | false | undefined;
|
|
24
|
+
node: Node;
|
|
26
25
|
options: V;
|
|
26
|
+
prevAttrs?: T;
|
|
27
27
|
}
|
|
28
28
|
export type GetAttrsWithChangesRecorder<T, V> = {
|
|
29
|
-
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
30
29
|
getAndResetAttrsChanges(): GetAttrsChange<T, V>[];
|
|
30
|
+
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
31
31
|
};
|
|
32
32
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-indentation",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Indentation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@babel/runtime": "^7.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^107.
|
|
39
|
+
"@atlaskit/editor-common": "^107.28.0",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0"
|
|
42
42
|
},
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"@af/integration-testing": "workspace:^",
|
|
45
45
|
"@af/visual-regression": "workspace:^",
|
|
46
46
|
"@atlaskit/ssr": "workspace:^",
|
|
47
|
-
"@atlaskit/visual-regression": "workspace:^",
|
|
48
47
|
"@testing-library/react": "^13.4.0",
|
|
49
48
|
"wait-for-expect": "^1.2.0"
|
|
50
49
|
},
|