@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/prosemirror-input-rules
2
2
 
3
+ ## 2.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 2.1.7
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
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
+ 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.7",
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": "^69.0.0",
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": "^23.2.0",
28
- "@atlaskit/editor-test-helpers": "^17.1.0",
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. It is a report generated by [API Extractor](https://api-extractor.com/).
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';
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "../../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "noImplicitAny": true,
5
4
  "baseUrl": "./"
6
5
  },
7
6
  "include": [