@atlaskit/prosemirror-input-rules 2.3.2 → 2.4.0

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,15 @@
1
1
  # @atlaskit/prosemirror-input-rules
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1944b35b538`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1944b35b538) - move common utilities to editor-common, to help with decoupling block-type plugin
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
3
13
  ## 2.3.2
4
14
 
5
15
  ### Patch Changes
package/dist/cjs/utils.js CHANGED
@@ -3,21 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createRule = exports.createPlugin = void 0;
6
+ exports.createPlugin = void 0;
7
+ Object.defineProperty(exports, "createRule", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _utils.createRule;
11
+ }
12
+ });
7
13
  var _selection = require("@atlaskit/editor-common/selection");
8
14
  var _history = require("@atlaskit/editor-prosemirror/history");
9
15
  var _state = require("@atlaskit/editor-prosemirror/state");
10
16
  var _plugin = require("./plugin");
11
- var createRule = function createRule(match, handler) {
12
- return {
13
- match: match,
14
- handler: handler,
15
- onHandlerApply: function onHandlerApply(state, tr) {
16
- (0, _history.closeHistory)(tr);
17
- }
18
- };
19
- };
20
- exports.createRule = createRule;
17
+ var _utils = require("@atlaskit/editor-common/utils");
21
18
  var hasUnsupportedMarks = function hasUnsupportedMarks(state, start, end, marksNameUnsupported) {
22
19
  var isUnsupportedMark = function isUnsupportedMark(node) {
23
20
  return (marksNameUnsupported || []).includes(node.type.name);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,15 +2,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { createInputRulePlugin } from './plugin';
5
- export const createRule = (match, handler) => {
6
- return {
7
- match,
8
- handler,
9
- onHandlerApply: (state, tr) => {
10
- closeHistory(tr);
11
- }
12
- };
13
- };
5
+ export { createRule } from '@atlaskit/editor-common/utils';
14
6
  const hasUnsupportedMarks = (state, start, end, marksNameUnsupported) => {
15
7
  const isUnsupportedMark = node => (marksNameUnsupported || []).includes(node.type.name);
16
8
  const $from = state.doc.resolve(start);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/utils.js CHANGED
@@ -2,15 +2,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { createInputRulePlugin } from './plugin';
5
- export var createRule = function createRule(match, handler) {
6
- return {
7
- match: match,
8
- handler: handler,
9
- onHandlerApply: function onHandlerApply(state, tr) {
10
- closeHistory(tr);
11
- }
12
- };
13
- };
5
+ export { createRule } from '@atlaskit/editor-common/utils';
14
6
  var hasUnsupportedMarks = function hasUnsupportedMarks(state, start, end, marksNameUnsupported) {
15
7
  var isUnsupportedMark = function isUnsupportedMark(node) {
16
8
  return (marksNameUnsupported || []).includes(node.type.name);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,9 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { InputRuleHandler, InputRuleWrapper } from '@atlaskit/editor-common/types';
3
- export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
2
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
3
+ export { createRule } from '@atlaskit/editor-common/utils';
4
4
  type Options = {
5
5
  isBlockNodeRule?: boolean;
6
6
  allowInsertTextOnDocument?: boolean;
7
7
  };
8
8
  export declare const createPlugin: (pluginName: string, rules: Array<InputRuleWrapper>, options?: Options) => SafePlugin;
9
- export {};
@@ -1,9 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { InputRuleHandler, InputRuleWrapper } from '@atlaskit/editor-common/types';
3
- export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
2
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
3
+ export { createRule } from '@atlaskit/editor-common/utils';
4
4
  type Options = {
5
5
  isBlockNodeRule?: boolean;
6
6
  allowInsertTextOnDocument?: boolean;
7
7
  };
8
8
  export declare const createPlugin: (pluginName: string, rules: Array<InputRuleWrapper>, options?: Options) => SafePlugin;
9
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
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,7 +28,7 @@
28
28
  "releaseModel": "continuous"
29
29
  },
30
30
  "dependencies": {
31
- "@atlaskit/editor-common": "^74.32.0",
31
+ "@atlaskit/editor-common": "^74.34.0",
32
32
  "@atlaskit/editor-prosemirror": "1.0.2",
33
33
  "@babel/runtime": "^7.0.0"
34
34
  },
package/report.api.md CHANGED
@@ -15,6 +15,7 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ import { createRule } from '@atlaskit/editor-common/utils';
18
19
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
19
20
  import type { InputRuleHandler } from '@atlaskit/editor-common/types';
20
21
  import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
@@ -36,11 +37,7 @@ export const createPlugin: (
36
37
  options?: Options_2,
37
38
  ) => SafePlugin;
38
39
 
39
- // @public (undocumented)
40
- export const createRule: (
41
- match: RegExp,
42
- handler: InputRuleHandler,
43
- ) => InputRuleWrapper;
40
+ export { createRule };
44
41
 
45
42
  export { InputRuleHandler };
46
43
 
package/src/utils.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
- import type {
4
- InputRuleHandler,
5
- InputRuleWrapper,
6
- } from '@atlaskit/editor-common/types';
3
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
7
4
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
8
5
  import { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
9
6
  import { EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -11,18 +8,7 @@ import { EditorState, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
8
  import { createInputRulePlugin } from './plugin';
12
9
  import type { OnInputEvent } from './types';
13
10
 
14
- export const createRule = (
15
- match: RegExp,
16
- handler: InputRuleHandler,
17
- ): InputRuleWrapper => {
18
- return {
19
- match,
20
- handler,
21
- onHandlerApply: (state, tr) => {
22
- closeHistory(tr);
23
- },
24
- };
25
- };
11
+ export { createRule } from '@atlaskit/editor-common/utils';
26
12
 
27
13
  const hasUnsupportedMarks = (
28
14
  state: EditorState,
@@ -4,6 +4,7 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ import { createRule } from '@atlaskit/editor-common/utils';
7
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
8
9
  import type { InputRuleHandler } from '@atlaskit/editor-common/types';
9
10
  import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
@@ -17,8 +18,7 @@ export function createInputRulePlugin(pluginName: string, rules: InputRuleWrappe
17
18
  // @public (undocumented)
18
19
  export const createPlugin: (pluginName: string, rules: Array<InputRuleWrapper>, options?: Options_2) => SafePlugin;
19
20
 
20
- // @public (undocumented)
21
- export const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
21
+ export { createRule }
22
22
 
23
23
  export { InputRuleHandler }
24
24