@atlaskit/prosemirror-input-rules 2.2.0 → 2.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 +6 -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/handler.d.ts +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/types.d.ts +7 -7
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
package/dist/types/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginKey } from 'prosemirror-state';
|
|
2
2
|
import type { HandleInputEvent, InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
|
|
3
|
-
|
|
3
|
+
type Options = {
|
|
4
4
|
pluginKey: PluginKey;
|
|
5
5
|
rules: InputRuleWrapper[];
|
|
6
6
|
allowInsertTextOnDocument: boolean;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
|
|
3
|
-
|
|
3
|
+
type Options = {
|
|
4
4
|
allowInsertTextOnDocument?: boolean;
|
|
5
5
|
onInputEvent?: OnInputEvent;
|
|
6
6
|
onBeforeRegexMatch?: OnBeforeRegexMatch;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from 'prosemirror-state';
|
|
2
2
|
import type { EditorView } from 'prosemirror-view';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
|
|
4
|
+
export type HandleInputEvent = (props: {
|
|
5
5
|
view: EditorView;
|
|
6
6
|
from: number;
|
|
7
7
|
to: number;
|
|
8
8
|
text: string;
|
|
9
9
|
}) => boolean;
|
|
10
|
-
export
|
|
10
|
+
export type InputRulePluginState = {
|
|
11
11
|
matchedRule: MatchedRule;
|
|
12
12
|
from: number;
|
|
13
13
|
to: number;
|
|
14
14
|
textInserted: string;
|
|
15
15
|
} | null;
|
|
16
|
-
export
|
|
16
|
+
export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
|
|
17
17
|
export interface InputRuleWrapper {
|
|
18
18
|
match: RegExp;
|
|
19
19
|
handler: InputRuleHandler;
|
|
20
20
|
onHandlerApply?: OnHandlerApply;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type MatchedRule = InputRuleWrapper & {
|
|
23
23
|
result: RegExpExecArray;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type OnInputEvent = (props: {
|
|
26
26
|
state: EditorState;
|
|
27
27
|
from: number;
|
|
28
28
|
to: number;
|
|
29
29
|
}) => boolean;
|
|
30
|
-
export
|
|
30
|
+
export type OnBeforeRegexMatch = (tr: Transaction) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/prosemirror-input-rules",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.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/"
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
">=4.5 <4.9": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.5/*",
|
|
19
|
+
"dist/types-ts4.5/index.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
15
23
|
"sideEffects": false,
|
|
16
24
|
"atlaskit:src": "src/index.ts",
|
|
17
25
|
"atlassian": {
|
|
@@ -25,7 +33,7 @@
|
|
|
25
33
|
},
|
|
26
34
|
"devDependencies": {
|
|
27
35
|
"@atlaskit/adf-schema": "^25.6.0",
|
|
28
|
-
"@atlaskit/editor-test-helpers": "^18.
|
|
36
|
+
"@atlaskit/editor-test-helpers": "^18.3.0",
|
|
29
37
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
30
38
|
"@types/prosemirror-history": "^1.0.1",
|
|
31
39
|
"@types/prosemirror-model": "^1.11.0",
|