@atlaskit/prosemirror-input-rules 2.3.0 → 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 CHANGED
@@ -1,5 +1,18 @@
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
+
10
+ ## 2.3.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
15
+
3
16
  ## 2.3.0
4
17
 
5
18
  ### Minor Changes
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createInputRulePlugin = createInputRulePlugin;
7
- var _prosemirrorState = require("prosemirror-state");
8
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _constants = require("./constants");
10
10
  var _handler = require("./handler");
11
11
  function createInputRulePlugin(pluginName, rules) {
@@ -13,7 +13,7 @@ function createInputRulePlugin(pluginName, rules) {
13
13
  var onInputEvent = options === null || options === void 0 ? void 0 : options.onInputEvent;
14
14
  var onBeforeRegexMatch = options === null || options === void 0 ? void 0 : options.onBeforeRegexMatch;
15
15
  var allowInsertTextOnDocument = Boolean(options === null || options === void 0 ? void 0 : options.allowInsertTextOnDocument);
16
- var pluginKey = new _prosemirrorState.PluginKey("inputRulePlugin__".concat(pluginName));
16
+ var pluginKey = new _state.PluginKey("inputRulePlugin__".concat(pluginName));
17
17
  var inputEvent = (0, _handler.createInputEventHandler)({
18
18
  allowInsertTextOnDocument: allowInsertTextOnDocument,
19
19
  pluginKey: pluginKey,
@@ -71,7 +71,7 @@ function createInputRulePlugin(pluginName, rules) {
71
71
  compositionend: function compositionend(view) {
72
72
  setTimeout(function () {
73
73
  var selection = view.state.selection;
74
- if (!(selection instanceof _prosemirrorState.TextSelection)) {
74
+ if (!(selection instanceof _state.TextSelection)) {
75
75
  return;
76
76
  }
77
77
  var $cursor = selection.$cursor;
package/dist/cjs/utils.js CHANGED
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createRule = exports.createPlugin = void 0;
7
- var _prosemirrorHistory = require("prosemirror-history");
8
- var _prosemirrorState = require("prosemirror-state");
9
7
  var _selection = require("@atlaskit/editor-common/selection");
8
+ var _history = require("@atlaskit/editor-prosemirror/history");
9
+ var _state = require("@atlaskit/editor-prosemirror/state");
10
10
  var _plugin = require("./plugin");
11
11
  var createRule = function createRule(match, handler) {
12
12
  return {
13
13
  match: match,
14
14
  handler: handler,
15
15
  onHandlerApply: function onHandlerApply(state, tr) {
16
- (0, _prosemirrorHistory.closeHistory)(tr);
16
+ (0, _history.closeHistory)(tr);
17
17
  }
18
18
  };
19
19
  };
@@ -30,7 +30,7 @@ var hasUnsupportedMarks = function hasUnsupportedMarks(state, start, end, marksN
30
30
  var isCursorInsideUnsupportedMarks = function isCursorInsideUnsupportedMarks(state, marksNameUnsupported) {
31
31
  var _$cursor$nodeBefore, _$cursor$nodeBefore$m;
32
32
  var selection = state.selection;
33
- if (!(selection instanceof _prosemirrorState.TextSelection)) {
33
+ if (!(selection instanceof _state.TextSelection)) {
34
34
  return false;
35
35
  }
36
36
  var $cursor = selection.$cursor;
@@ -51,7 +51,7 @@ var createPlugin = function createPlugin(pluginName, rules) {
51
51
  to = _ref.to;
52
52
  var unsupportedMarks = isBlockNodeRule ? ['code', 'link', 'typeAheadQuery'] : ['code'];
53
53
  var $from = state.selection.$from;
54
- if ($from.parent.type.spec.code || !(state.selection instanceof _prosemirrorState.TextSelection) && !(state.selection instanceof _selection.GapCursorSelection) || hasUnsupportedMarks(state, from, to, unsupportedMarks) || isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks)) {
54
+ if ($from.parent.type.spec.code || !(state.selection instanceof _state.TextSelection) && !(state.selection instanceof _selection.GapCursorSelection) || hasUnsupportedMarks(state, from, to, unsupportedMarks) || isBlockNodeRule && isCursorInsideUnsupportedMarks(state, unsupportedMarks)) {
55
55
  return false;
56
56
  }
57
57
  return true;
@@ -60,7 +60,7 @@ var createPlugin = function createPlugin(pluginName, rules) {
60
60
  allowInsertTextOnDocument: allowInsertTextOnDocument,
61
61
  onInputEvent: onInputEvent,
62
62
  onBeforeRegexMatch: function onBeforeRegexMatch(tr) {
63
- (0, _prosemirrorHistory.closeHistory)(tr);
63
+ (0, _history.closeHistory)(tr);
64
64
  }
65
65
  });
66
66
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
- import { PluginKey, TextSelection } from 'prosemirror-state';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { TEXT_INPUT_RULE_TRANSACTION_KEY } from './constants';
4
4
  import { createInputEventHandler } from './handler';
5
5
  export function createInputRulePlugin(pluginName, rules, options = {}) {
@@ -1,6 +1,6 @@
1
- import { closeHistory } from 'prosemirror-history';
2
- import { TextSelection } from 'prosemirror-state';
3
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
+ import { closeHistory } from '@atlaskit/editor-prosemirror/history';
3
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { createInputRulePlugin } from './plugin';
5
5
  export const createRule = (match, handler) => {
6
6
  return {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
- import { PluginKey, TextSelection } from 'prosemirror-state';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { TEXT_INPUT_RULE_TRANSACTION_KEY } from './constants';
4
4
  import { createInputEventHandler } from './handler';
5
5
  export function createInputRulePlugin(pluginName, rules) {
package/dist/esm/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { closeHistory } from 'prosemirror-history';
2
- import { TextSelection } from 'prosemirror-state';
3
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
+ import { closeHistory } from '@atlaskit/editor-prosemirror/history';
3
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { createInputRulePlugin } from './plugin';
5
5
  export var createRule = function createRule(match, handler) {
6
6
  return {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { PluginKey } from 'prosemirror-state';
1
+ import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { HandleInputEvent, InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
3
3
  type Options = {
4
4
  pluginKey: PluginKey;
@@ -1,5 +1,18 @@
1
- import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply, OnInputEvent } from './types';
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 { InputRuleWrapper, InputRuleHandler, OnInputEvent, OnHandlerApply, };
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 { 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;
1
+ import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
2
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
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 './types';
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,4 +1,4 @@
1
- import type { PluginKey } from 'prosemirror-state';
1
+ import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { HandleInputEvent, InputRuleWrapper, OnBeforeRegexMatch, OnInputEvent } from './types';
3
3
  type Options = {
4
4
  pluginKey: PluginKey;
@@ -1,5 +1,18 @@
1
- import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply, OnInputEvent } from './types';
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 { InputRuleWrapper, InputRuleHandler, OnInputEvent, OnHandlerApply, };
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 { 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;
1
+ import type { InputRuleHandler, InputRuleWrapper, OnHandlerApply } from '@atlaskit/editor-common/types';
2
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
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 './types';
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.0",
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,16 +28,13 @@
28
28
  "releaseModel": "continuous"
29
29
  },
30
30
  "dependencies": {
31
- "@atlaskit/editor-common": "^74.20.0",
32
- "@babel/runtime": "^7.0.0",
33
- "prosemirror-history": "^1.1.3",
34
- "prosemirror-model": "1.16.0",
35
- "prosemirror-state": "1.3.4"
31
+ "@atlaskit/editor-common": "^74.32.0",
32
+ "@atlaskit/editor-prosemirror": "1.0.2",
33
+ "@babel/runtime": "^7.0.0"
36
34
  },
37
35
  "devDependencies": {
38
36
  "@atlaskit/editor-test-helpers": "^18.10.0",
39
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
40
- "prosemirror-view": "1.23.7"
37
+ "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1"
41
38
  },
42
39
  "techstack": {
43
40
  "@atlassian/frontend": {
package/report.api.md CHANGED
@@ -15,9 +15,12 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
- import type { EditorState } from 'prosemirror-state';
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
- import type { Transaction } from 'prosemirror-state';
23
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
21
24
 
22
25
  // @public (undocumented)
23
26
  export function createInputRulePlugin(
@@ -39,23 +42,9 @@ export const createRule: (
39
42
  handler: InputRuleHandler,
40
43
  ) => InputRuleWrapper;
41
44
 
42
- // @public (undocumented)
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
- // @public (undocumented)
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
- // @public (undocumented)
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: {
@@ -1,6 +1,9 @@
1
- import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
2
- import { EditorView } from 'prosemirror-view';
3
-
1
+ import {
2
+ EditorState,
3
+ PluginKey,
4
+ Transaction,
5
+ } from '@atlaskit/editor-prosemirror/state';
6
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
7
  import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
5
8
  import { code_block, doc, p } from '@atlaskit/editor-test-helpers/doc-builder';
6
9
 
@@ -1,7 +1,6 @@
1
- import { EditorState } from 'prosemirror-state';
2
- import { EditorView } from 'prosemirror-view';
3
-
4
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
6
5
  import { doc, DocBuilder, p } from '@atlaskit/editor-test-helpers/doc-builder';
7
6
 
package/src/handler.ts CHANGED
@@ -1,6 +1,9 @@
1
- import type { EditorState, PluginKey, Transaction } from 'prosemirror-state';
2
-
3
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
+ import type {
3
+ EditorState,
4
+ PluginKey,
5
+ Transaction,
6
+ } from '@atlaskit/editor-prosemirror/state';
4
7
 
5
8
  import {
6
9
  leafNodeReplacementCharacter,
package/src/index.ts CHANGED
@@ -2,8 +2,9 @@ import type {
2
2
  InputRuleHandler,
3
3
  InputRuleWrapper,
4
4
  OnHandlerApply,
5
- OnInputEvent,
6
- } from './types';
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/plugin.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { PluginKey, TextSelection } from 'prosemirror-state';
2
-
3
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
3
 
5
4
  import { TEXT_INPUT_RULE_TRANSACTION_KEY } from './constants';
6
5
  import { createInputEventHandler } from './handler';
package/src/types.ts CHANGED
@@ -1,12 +1,13 @@
1
- import type { EditorState, Transaction } from 'prosemirror-state';
2
- import type { EditorView } from 'prosemirror-view';
3
-
4
- export type InputRuleHandler = (
5
- state: EditorState,
6
- matchResult: RegExpExecArray,
7
- start: number,
8
- end: number,
9
- ) => Transaction | null;
1
+ import type {
2
+ InputRuleHandler,
3
+ InputRuleWrapper,
4
+ OnHandlerApply,
5
+ } from '@atlaskit/editor-common/types';
6
+ import type {
7
+ EditorState,
8
+ Transaction,
9
+ } from '@atlaskit/editor-prosemirror/state';
10
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
11
 
11
12
  export type HandleInputEvent = (props: {
12
13
  view: EditorView;
@@ -22,18 +23,6 @@ export type InputRulePluginState = {
22
23
  textInserted: string;
23
24
  } | null;
24
25
 
25
- export type OnHandlerApply = (
26
- state: EditorState,
27
- tr: Transaction,
28
- matchResult: RegExpExecArray,
29
- ) => void;
30
-
31
- export interface InputRuleWrapper {
32
- match: RegExp;
33
- handler: InputRuleHandler;
34
- onHandlerApply?: OnHandlerApply;
35
- }
36
-
37
26
  export type MatchedRule = InputRuleWrapper & {
38
27
  result: RegExpExecArray;
39
28
  };
@@ -45,3 +34,18 @@ export type OnInputEvent = (props: {
45
34
  }) => boolean;
46
35
 
47
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,12 +1,15 @@
1
- import { closeHistory } from 'prosemirror-history';
2
- import { Mark as PMMark } from 'prosemirror-model';
3
- import { EditorState, TextSelection } from 'prosemirror-state';
4
-
5
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
2
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
+ import type {
4
+ InputRuleHandler,
5
+ InputRuleWrapper,
6
+ } from '@atlaskit/editor-common/types';
7
+ import { closeHistory } from '@atlaskit/editor-prosemirror/history';
8
+ import { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
9
+ import { EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
10
 
8
11
  import { createInputRulePlugin } from './plugin';
9
- import type { InputRuleHandler, InputRuleWrapper, OnInputEvent } from './types';
12
+ import type { OnInputEvent } from './types';
10
13
 
11
14
  export const createRule = (
12
15
  match: RegExp,
@@ -0,0 +1,63 @@
1
+ ## API Report File for "@atlaskit/prosemirror-input-rules"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
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';
11
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
12
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
13
+
14
+ // @public (undocumented)
15
+ export function createInputRulePlugin(pluginName: string, rules: InputRuleWrapper[], options?: Options): SafePlugin;
16
+
17
+ // @public (undocumented)
18
+ export const createPlugin: (pluginName: string, rules: Array<InputRuleWrapper>, options?: Options_2) => SafePlugin;
19
+
20
+ // @public (undocumented)
21
+ export const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
22
+
23
+ export { InputRuleHandler }
24
+
25
+ export { InputRuleWrapper }
26
+
27
+ // @public (undocumented)
28
+ export const leafNodeReplacementCharacter = "\uFFFC";
29
+
30
+ // @public (undocumented)
31
+ export const MAX_REGEX_MATCH = 500;
32
+
33
+ // @public (undocumented)
34
+ type OnBeforeRegexMatch = (tr: Transaction) => void;
35
+
36
+ export { OnHandlerApply }
37
+
38
+ // @public (undocumented)
39
+ export type OnInputEvent = (props: {
40
+ state: EditorState;
41
+ from: number;
42
+ to: number;
43
+ }) => boolean;
44
+
45
+ // @public (undocumented)
46
+ type Options = {
47
+ allowInsertTextOnDocument?: boolean;
48
+ onInputEvent?: OnInputEvent;
49
+ onBeforeRegexMatch?: OnBeforeRegexMatch;
50
+ };
51
+
52
+ // @public (undocumented)
53
+ type Options_2 = {
54
+ isBlockNodeRule?: boolean;
55
+ allowInsertTextOnDocument?: boolean;
56
+ };
57
+
58
+ // @public (undocumented)
59
+ export const TEXT_INPUT_RULE_TRANSACTION_KEY = "input_rule_plugin_transaction";
60
+
61
+ // (No @packageDocumentation comment for this package)
62
+
63
+ ```