@atlaskit/prosemirror-input-rules 2.1.7 → 2.1.8
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-ts4.0/constants.d.ts +3 -0
- package/dist/types-ts4.0/handler.d.ts +11 -0
- package/dist/types-ts4.0/index.d.ts +4 -0
- package/dist/types-ts4.0/plugin.d.ts +9 -0
- package/dist/types-ts4.0/types.d.ts +30 -0
- package/package.json +11 -4
- package/report.api.md +4 -2
- package/tsconfig.json +0 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginKey } from 'prosemirror-state';
|
|
2
|
+
import type { HandleInputEvent, InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
|
|
3
|
+
declare type Options = {
|
|
4
|
+
pluginKey: PluginKey;
|
|
5
|
+
rules: InputRuleWrapper[];
|
|
6
|
+
allowInsertTextOnDocument: boolean;
|
|
7
|
+
onInputEvent?: OnInputEvent;
|
|
8
|
+
onBeforeRegexMatch?: OnBeforeRegexMatch;
|
|
9
|
+
};
|
|
10
|
+
export declare const createInputEventHandler: ({ rules, pluginKey, allowInsertTextOnDocument, onInputEvent, onBeforeRegexMatch, }: Options) => HandleInputEvent;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply, OnInputEvent } from './types';
|
|
2
|
+
export { leafNodeReplacementCharacter, TEXT_INPUT_RULE_TRANSACTION_KEY, MAX_REGEX_MATCH, } from './constants';
|
|
3
|
+
export { createInputRulePlugin } from './plugin';
|
|
4
|
+
export type { InputRuleWrapper, InputRuleHandler, OnInputEvent, OnHandlerApply, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
|
|
3
|
+
declare type Options = {
|
|
4
|
+
allowInsertTextOnDocument?: boolean;
|
|
5
|
+
onInputEvent?: OnInputEvent;
|
|
6
|
+
onBeforeRegexMatch?: OnBeforeRegexMatch;
|
|
7
|
+
};
|
|
8
|
+
export declare function createInputRulePlugin(pluginName: string, rules: InputRuleWrapper[], options?: Options): SafePlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
+
import type { EditorView } from 'prosemirror-view';
|
|
3
|
+
export declare type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
|
|
4
|
+
export declare type HandleInputEvent = (props: {
|
|
5
|
+
view: EditorView;
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
text: string;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
export declare type InputRulePluginState = {
|
|
11
|
+
matchedRule: MatchedRule;
|
|
12
|
+
from: number;
|
|
13
|
+
to: number;
|
|
14
|
+
textInserted: string;
|
|
15
|
+
} | null;
|
|
16
|
+
export declare type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
|
|
17
|
+
export interface InputRuleWrapper {
|
|
18
|
+
match: RegExp;
|
|
19
|
+
handler: InputRuleHandler;
|
|
20
|
+
onHandlerApply?: OnHandlerApply;
|
|
21
|
+
}
|
|
22
|
+
export declare type MatchedRule = InputRuleWrapper & {
|
|
23
|
+
result: RegExpExecArray;
|
|
24
|
+
};
|
|
25
|
+
export declare type OnInputEvent = (props: {
|
|
26
|
+
state: EditorState;
|
|
27
|
+
from: number;
|
|
28
|
+
to: number;
|
|
29
|
+
}) => boolean;
|
|
30
|
+
export declare 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.1.
|
|
3
|
+
"version": "2.1.8",
|
|
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,13 @@
|
|
|
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.0 <4.5": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.0/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
15
22
|
"sideEffects": false,
|
|
16
23
|
"atlaskit:src": "src/index.ts",
|
|
17
24
|
"atlassian": {
|
|
@@ -19,13 +26,13 @@
|
|
|
19
26
|
"releaseModel": "scheduled"
|
|
20
27
|
},
|
|
21
28
|
"dependencies": {
|
|
22
|
-
"@atlaskit/editor-common": "^
|
|
29
|
+
"@atlaskit/editor-common": "^70.0.0",
|
|
23
30
|
"@babel/runtime": "^7.0.0",
|
|
24
31
|
"prosemirror-state": "1.3.4"
|
|
25
32
|
},
|
|
26
33
|
"devDependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^
|
|
28
|
-
"@atlaskit/editor-test-helpers": "^17.
|
|
34
|
+
"@atlaskit/adf-schema": "^24.0.0",
|
|
35
|
+
"@atlaskit/editor-test-helpers": "^17.2.0",
|
|
29
36
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
30
37
|
"@types/prosemirror-history": "^1.0.1",
|
|
31
38
|
"@types/prosemirror-model": "^1.11.0",
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/prosemirror-input-rules"
|
|
1
|
+
## API Report File for "@atlaskit/prosemirror-input-rules".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
import type { EditorState } from 'prosemirror-state';
|