@atlaskit/prosemirror-input-rules 2.2.1 → 2.2.3

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/prosemirror-input-rules
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
8
+
9
+ ## 2.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`a142ba1aa28`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a142ba1aa28) - [ED17172] Bump prosemirror-model to 1.16.0 and prosemirror-view to 1.23.7 and removed work-arounds for fixed issues
14
+ - Updated dependencies
15
+
3
16
  ## 2.2.1
4
17
 
5
18
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,3 @@
1
+ export declare const leafNodeReplacementCharacter = "\uFFFC";
2
+ export declare const TEXT_INPUT_RULE_TRANSACTION_KEY = "input_rule_plugin_transaction";
3
+ export declare const MAX_REGEX_MATCH = 500;
@@ -0,0 +1,11 @@
1
+ import type { PluginKey } from 'prosemirror-state';
2
+ import type { HandleInputEvent, InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
3
+ 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
+ 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 type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
4
+ export type HandleInputEvent = (props: {
5
+ view: EditorView;
6
+ from: number;
7
+ to: number;
8
+ text: string;
9
+ }) => boolean;
10
+ export type InputRulePluginState = {
11
+ matchedRule: MatchedRule;
12
+ from: number;
13
+ to: number;
14
+ textInserted: string;
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
+ export type MatchedRule = InputRuleWrapper & {
23
+ result: RegExpExecArray;
24
+ };
25
+ export type OnInputEvent = (props: {
26
+ state: EditorState;
27
+ from: number;
28
+ to: number;
29
+ }) => boolean;
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.1",
3
+ "version": "2.2.3",
4
4
  "description": "A package that contains helpers to create autoformatting rules for ProseMirror",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,7 +27,7 @@
27
27
  "releaseModel": "scheduled"
28
28
  },
29
29
  "dependencies": {
30
- "@atlaskit/editor-common": "^74.0.0",
30
+ "@atlaskit/editor-common": "^74.1.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "prosemirror-state": "1.3.4"
33
33
  },
@@ -39,7 +39,7 @@
39
39
  "@types/prosemirror-model": "^1.11.0",
40
40
  "@types/prosemirror-state": "^1.2.0",
41
41
  "@types/prosemirror-view": "^1.9.0",
42
- "prosemirror-view": "1.23.2"
42
+ "prosemirror-view": "1.23.7"
43
43
  },
44
44
  "techstack": {
45
45
  "@atlassian/frontend": {