@atlaskit/prosemirror-input-rules 2.3.1 → 2.3.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 +7 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +15 -2
- package/dist/types/types.d.ts +14 -7
- package/dist/types/utils.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +15 -2
- package/dist/types-ts4.5/types.d.ts +14 -7
- package/dist/types-ts4.5/utils.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +6 -22
- package/src/index.ts +12 -2
- package/src/types.ts +20 -19
- package/src/utils.ts +5 -1
- package/tmp/api-report-tmp.d.ts +6 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/prosemirror-input-rules
|
|
2
2
|
|
|
3
|
+
## 2.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d2ecb6bf1a3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2ecb6bf1a3) - [ED-19203] Moved input rule types to editor-common to avoid circular dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 2.3.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply
|
|
1
|
+
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { OnInputEvent } from './types';
|
|
2
3
|
export { leafNodeReplacementCharacter, TEXT_INPUT_RULE_TRANSACTION_KEY, MAX_REGEX_MATCH, } from './constants';
|
|
3
4
|
export { createInputRulePlugin } from './plugin';
|
|
4
|
-
export type {
|
|
5
|
+
export type {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
8
|
+
*/
|
|
9
|
+
InputRuleWrapper,
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
12
|
+
*/
|
|
13
|
+
InputRuleHandler, OnInputEvent,
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
16
|
+
*/
|
|
17
|
+
OnHandlerApply, };
|
|
5
18
|
export { createRule, createPlugin } from './utils';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
|
|
4
4
|
export type HandleInputEvent = (props: {
|
|
5
5
|
view: EditorView;
|
|
6
6
|
from: number;
|
|
@@ -13,12 +13,6 @@ export type InputRulePluginState = {
|
|
|
13
13
|
to: number;
|
|
14
14
|
textInserted: string;
|
|
15
15
|
} | null;
|
|
16
|
-
export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
|
|
17
|
-
export interface InputRuleWrapper {
|
|
18
|
-
match: RegExp;
|
|
19
|
-
handler: InputRuleHandler;
|
|
20
|
-
onHandlerApply?: OnHandlerApply;
|
|
21
|
-
}
|
|
22
16
|
export type MatchedRule = InputRuleWrapper & {
|
|
23
17
|
result: RegExpExecArray;
|
|
24
18
|
};
|
|
@@ -28,3 +22,16 @@ export type OnInputEvent = (props: {
|
|
|
28
22
|
to: number;
|
|
29
23
|
}) => boolean;
|
|
30
24
|
export type OnBeforeRegexMatch = (tr: Transaction) => void;
|
|
25
|
+
export type {
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
28
|
+
*/
|
|
29
|
+
InputRuleHandler,
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
32
|
+
*/
|
|
33
|
+
OnHandlerApply,
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
36
|
+
*/
|
|
37
|
+
InputRuleWrapper, };
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { InputRuleHandler, InputRuleWrapper } from '
|
|
2
|
+
import type { InputRuleHandler, InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
3
3
|
export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
|
|
4
4
|
type Options = {
|
|
5
5
|
isBlockNodeRule?: boolean;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply
|
|
1
|
+
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { OnInputEvent } from './types';
|
|
2
3
|
export { leafNodeReplacementCharacter, TEXT_INPUT_RULE_TRANSACTION_KEY, MAX_REGEX_MATCH, } from './constants';
|
|
3
4
|
export { createInputRulePlugin } from './plugin';
|
|
4
|
-
export type {
|
|
5
|
+
export type {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
8
|
+
*/
|
|
9
|
+
InputRuleWrapper,
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
12
|
+
*/
|
|
13
|
+
InputRuleHandler, OnInputEvent,
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
16
|
+
*/
|
|
17
|
+
OnHandlerApply, };
|
|
5
18
|
export { createRule, createPlugin } from './utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
|
|
4
4
|
export type HandleInputEvent = (props: {
|
|
5
5
|
view: EditorView;
|
|
6
6
|
from: number;
|
|
@@ -13,12 +13,6 @@ export type InputRulePluginState = {
|
|
|
13
13
|
to: number;
|
|
14
14
|
textInserted: string;
|
|
15
15
|
} | null;
|
|
16
|
-
export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
|
|
17
|
-
export interface InputRuleWrapper {
|
|
18
|
-
match: RegExp;
|
|
19
|
-
handler: InputRuleHandler;
|
|
20
|
-
onHandlerApply?: OnHandlerApply;
|
|
21
|
-
}
|
|
22
16
|
export type MatchedRule = InputRuleWrapper & {
|
|
23
17
|
result: RegExpExecArray;
|
|
24
18
|
};
|
|
@@ -28,3 +22,16 @@ export type OnInputEvent = (props: {
|
|
|
28
22
|
to: number;
|
|
29
23
|
}) => boolean;
|
|
30
24
|
export type OnBeforeRegexMatch = (tr: Transaction) => void;
|
|
25
|
+
export type {
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
28
|
+
*/
|
|
29
|
+
InputRuleHandler,
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
32
|
+
*/
|
|
33
|
+
OnHandlerApply,
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
36
|
+
*/
|
|
37
|
+
InputRuleWrapper, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { InputRuleHandler, InputRuleWrapper } from '
|
|
2
|
+
import type { InputRuleHandler, InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
3
3
|
export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
|
|
4
4
|
type Options = {
|
|
5
5
|
isBlockNodeRule?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/prosemirror-input-rules",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "A package that contains helpers to create autoformatting rules for ProseMirror",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"releaseModel": "continuous"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/editor-common": "^74.
|
|
31
|
+
"@atlaskit/editor-common": "^74.32.0",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "1.0.2",
|
|
33
33
|
"@babel/runtime": "^7.0.0"
|
|
34
34
|
},
|
package/report.api.md
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
19
|
+
import type { InputRuleHandler } from '@atlaskit/editor-common/types';
|
|
20
|
+
import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
21
|
+
import type { OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
19
22
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
20
23
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
21
24
|
|
|
@@ -39,23 +42,9 @@ export const createRule: (
|
|
|
39
42
|
handler: InputRuleHandler,
|
|
40
43
|
) => InputRuleWrapper;
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
export type InputRuleHandler = (
|
|
44
|
-
state: EditorState,
|
|
45
|
-
matchResult: RegExpExecArray,
|
|
46
|
-
start: number,
|
|
47
|
-
end: number,
|
|
48
|
-
) => Transaction | null;
|
|
45
|
+
export { InputRuleHandler };
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
export interface InputRuleWrapper {
|
|
52
|
-
// (undocumented)
|
|
53
|
-
handler: InputRuleHandler;
|
|
54
|
-
// (undocumented)
|
|
55
|
-
match: RegExp;
|
|
56
|
-
// (undocumented)
|
|
57
|
-
onHandlerApply?: OnHandlerApply;
|
|
58
|
-
}
|
|
47
|
+
export { InputRuleWrapper };
|
|
59
48
|
|
|
60
49
|
// @public (undocumented)
|
|
61
50
|
export const leafNodeReplacementCharacter = '\uFFFC';
|
|
@@ -66,12 +55,7 @@ export const MAX_REGEX_MATCH = 500;
|
|
|
66
55
|
// @public (undocumented)
|
|
67
56
|
type OnBeforeRegexMatch = (tr: Transaction) => void;
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
export type OnHandlerApply = (
|
|
71
|
-
state: EditorState,
|
|
72
|
-
tr: Transaction,
|
|
73
|
-
matchResult: RegExpExecArray,
|
|
74
|
-
) => void;
|
|
58
|
+
export { OnHandlerApply };
|
|
75
59
|
|
|
76
60
|
// @public (undocumented)
|
|
77
61
|
export type OnInputEvent = (props: {
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type {
|
|
|
2
2
|
InputRuleHandler,
|
|
3
3
|
InputRuleWrapper,
|
|
4
4
|
OnHandlerApply,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
} from '@atlaskit/editor-common/types';
|
|
6
|
+
|
|
7
|
+
import type { OnInputEvent } from './types';
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
leafNodeReplacementCharacter,
|
|
@@ -12,9 +13,18 @@ export {
|
|
|
12
13
|
} from './constants';
|
|
13
14
|
export { createInputRulePlugin } from './plugin';
|
|
14
15
|
export type {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
18
|
+
*/
|
|
15
19
|
InputRuleWrapper,
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
22
|
+
*/
|
|
16
23
|
InputRuleHandler,
|
|
17
24
|
OnInputEvent,
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
27
|
+
*/
|
|
18
28
|
OnHandlerApply,
|
|
19
29
|
};
|
|
20
30
|
|
package/src/types.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InputRuleHandler,
|
|
3
|
+
InputRuleWrapper,
|
|
4
|
+
OnHandlerApply,
|
|
5
|
+
} from '@atlaskit/editor-common/types';
|
|
1
6
|
import type {
|
|
2
7
|
EditorState,
|
|
3
8
|
Transaction,
|
|
4
9
|
} from '@atlaskit/editor-prosemirror/state';
|
|
5
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
11
|
|
|
7
|
-
export type InputRuleHandler = (
|
|
8
|
-
state: EditorState,
|
|
9
|
-
matchResult: RegExpExecArray,
|
|
10
|
-
start: number,
|
|
11
|
-
end: number,
|
|
12
|
-
) => Transaction | null;
|
|
13
|
-
|
|
14
12
|
export type HandleInputEvent = (props: {
|
|
15
13
|
view: EditorView;
|
|
16
14
|
from: number;
|
|
@@ -25,18 +23,6 @@ export type InputRulePluginState = {
|
|
|
25
23
|
textInserted: string;
|
|
26
24
|
} | null;
|
|
27
25
|
|
|
28
|
-
export type OnHandlerApply = (
|
|
29
|
-
state: EditorState,
|
|
30
|
-
tr: Transaction,
|
|
31
|
-
matchResult: RegExpExecArray,
|
|
32
|
-
) => void;
|
|
33
|
-
|
|
34
|
-
export interface InputRuleWrapper {
|
|
35
|
-
match: RegExp;
|
|
36
|
-
handler: InputRuleHandler;
|
|
37
|
-
onHandlerApply?: OnHandlerApply;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
26
|
export type MatchedRule = InputRuleWrapper & {
|
|
41
27
|
result: RegExpExecArray;
|
|
42
28
|
};
|
|
@@ -48,3 +34,18 @@ export type OnInputEvent = (props: {
|
|
|
48
34
|
}) => boolean;
|
|
49
35
|
|
|
50
36
|
export type OnBeforeRegexMatch = (tr: Transaction) => void;
|
|
37
|
+
|
|
38
|
+
export type {
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
41
|
+
*/
|
|
42
|
+
InputRuleHandler,
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
45
|
+
*/
|
|
46
|
+
OnHandlerApply,
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Please import this type from @atlaskit/editor-commmon/types
|
|
49
|
+
*/
|
|
50
|
+
InputRuleWrapper,
|
|
51
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import type {
|
|
4
|
+
InputRuleHandler,
|
|
5
|
+
InputRuleWrapper,
|
|
6
|
+
} from '@atlaskit/editor-common/types';
|
|
3
7
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
4
8
|
import { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
5
9
|
import { EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
10
|
|
|
7
11
|
import { createInputRulePlugin } from './plugin';
|
|
8
|
-
import type {
|
|
12
|
+
import type { OnInputEvent } from './types';
|
|
9
13
|
|
|
10
14
|
export const createRule = (
|
|
11
15
|
match: RegExp,
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
7
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { InputRuleHandler } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { OnHandlerApply } from '@atlaskit/editor-common/types';
|
|
8
11
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
12
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
10
13
|
|
|
@@ -17,18 +20,9 @@ export const createPlugin: (pluginName: string, rules: Array<InputRuleWrapper>,
|
|
|
17
20
|
// @public (undocumented)
|
|
18
21
|
export const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
|
|
23
|
+
export { InputRuleHandler }
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
export interface InputRuleWrapper {
|
|
25
|
-
// (undocumented)
|
|
26
|
-
handler: InputRuleHandler;
|
|
27
|
-
// (undocumented)
|
|
28
|
-
match: RegExp;
|
|
29
|
-
// (undocumented)
|
|
30
|
-
onHandlerApply?: OnHandlerApply;
|
|
31
|
-
}
|
|
25
|
+
export { InputRuleWrapper }
|
|
32
26
|
|
|
33
27
|
// @public (undocumented)
|
|
34
28
|
export const leafNodeReplacementCharacter = "\uFFFC";
|
|
@@ -39,8 +33,7 @@ export const MAX_REGEX_MATCH = 500;
|
|
|
39
33
|
// @public (undocumented)
|
|
40
34
|
type OnBeforeRegexMatch = (tr: Transaction) => void;
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
|
|
36
|
+
export { OnHandlerApply }
|
|
44
37
|
|
|
45
38
|
// @public (undocumented)
|
|
46
39
|
export type OnInputEvent = (props: {
|