@atlaskit/editor-plugin-block-type 3.0.24 → 3.0.25

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,35 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 3.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - [#75482](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75482) [`18b5a6fb910a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18b5a6fb910a) - # MAJOR CHANGE to `@atlaskit/prosemirror-input-rules` package.
8
+
9
+ ## WHY?
10
+
11
+ Removing editor-common dependencies from prosemirror-input-rules package.
12
+
13
+ This makes it easier for editor updates because it simplifies our dependency graph.
14
+
15
+ ## WHAT and HOW?
16
+
17
+ These are no longer available via `@atlaskit/prosemirror-input-rules` but are available from `@atlaskit/editor-common/types`:
18
+
19
+ - InputRuleWrapper
20
+ - InputRuleHandler
21
+ - OnHandlerApply
22
+ - createRule
23
+
24
+ These have changed from a `SafePlugin` to a `SafePluginSpec`. In order to update your code you need to instantiate a `SafePlugin` (ie. `new SafePlugin(createPlugin( ... ))`).
25
+
26
+ `SafePlugin` exists in `@atlaskit/editor-common/safe-plugin`.
27
+
28
+ - createPlugin
29
+ - createInputRulePlugin
30
+
31
+ - Updated dependencies
32
+
3
33
  ## 3.0.24
4
34
 
5
35
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _commands = require("@atlaskit/editor-common/commands");
11
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
12
  var _utils = require("@atlaskit/editor-common/utils");
12
13
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
13
14
  var _utils2 = require("../utils");
@@ -37,7 +38,7 @@ function blockQuoteRule(nodeType) {
37
38
  function getHeadingRules(editorAnalyticsAPI, schema) {
38
39
  // '# ' for h1, '## ' for h2 and etc
39
40
  var hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
40
- var leftNodeReplacementHashRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
41
+ var leftNodeReplacementHashRule = (0, _utils.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
41
42
  var level = match[1].length;
42
43
  return (0, _commands.insertBlock)(state, schema.nodes.heading, start, end, {
43
44
  level: level
@@ -69,7 +70,7 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
69
70
  function getBlockQuoteRules(editorAnalyticsAPI, schema) {
70
71
  // '> ' for blockquote
71
72
  var greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
72
- var leftNodeReplacementGreatherRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
73
+ var leftNodeReplacementGreatherRule = (0, _utils.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
73
74
  return (0, _commands.insertBlock)(state, schema.nodes.blockquote, start, end);
74
75
  });
75
76
 
@@ -94,9 +95,9 @@ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
94
95
  rules.push.apply(rules, (0, _toConsumableArray2.default)(getBlockQuoteRules(editorAnalyticsAPI, schema)));
95
96
  }
96
97
  if (rules.length !== 0) {
97
- return (0, _prosemirrorInputRules.createPlugin)('block-type', rules, {
98
+ return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('block-type', rules, {
98
99
  isBlockNodeRule: true
99
- });
100
+ }));
100
101
  }
101
102
  return;
102
103
  }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.areBlockTypesDisabled = areBlockTypesDisabled;
7
7
  exports.isNodeAWrappingBlockNode = exports.createWrappingTextBlockRule = exports.createJoinNodesRule = void 0;
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
- var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
10
9
  var _blockTypes = require("./block-types");
11
10
  var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
12
11
  if (!node) {
@@ -40,7 +39,7 @@ var createWrappingTextBlockRule = exports.createWrappingTextBlockRule = function
40
39
  }
41
40
  return state.tr.delete(fixedStart, end).setBlockType(fixedStart, fixedStart, nodeType, attrs);
42
41
  };
43
- return (0, _prosemirrorInputRules.createRule)(match, handler);
42
+ return (0, _utils.createRule)(match, handler);
44
43
  };
45
44
 
46
45
  /**
@@ -1,7 +1,8 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { insertBlock } from '@atlaskit/editor-common/commands';
3
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
4
- import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
5
+ import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
5
6
  import { createJoinNodesRule, createWrappingTextBlockRule } from '../utils';
6
7
  const MAX_HEADING_LEVEL = 6;
7
8
  function getHeadingLevel(match) {
@@ -84,9 +85,9 @@ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
84
85
  rules.push(...getBlockQuoteRules(editorAnalyticsAPI, schema));
85
86
  }
86
87
  if (rules.length !== 0) {
87
- return createPlugin('block-type', rules, {
88
+ return new SafePlugin(createPlugin('block-type', rules, {
88
89
  isBlockNodeRule: true
89
- });
90
+ }));
90
91
  }
91
92
  return;
92
93
  }
@@ -1,5 +1,4 @@
1
- import { createWrappingJoinRule } from '@atlaskit/editor-common/utils';
2
- import { createRule } from '@atlaskit/prosemirror-input-rules';
1
+ import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
3
2
  import { WRAPPER_BLOCK_TYPES } from './block-types';
4
3
  export const isNodeAWrappingBlockNode = node => {
5
4
  if (!node) {
@@ -1,8 +1,9 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { insertBlock } from '@atlaskit/editor-common/commands';
4
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
5
- import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
4
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
6
+ import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
6
7
  import { createJoinNodesRule, createWrappingTextBlockRule } from '../utils';
7
8
  var MAX_HEADING_LEVEL = 6;
8
9
  function getHeadingLevel(match) {
@@ -87,9 +88,9 @@ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
87
88
  rules.push.apply(rules, _toConsumableArray(getBlockQuoteRules(editorAnalyticsAPI, schema)));
88
89
  }
89
90
  if (rules.length !== 0) {
90
- return createPlugin('block-type', rules, {
91
+ return new SafePlugin(createPlugin('block-type', rules, {
91
92
  isBlockNodeRule: true
92
- });
93
+ }));
93
94
  }
94
95
  return;
95
96
  }
@@ -1,5 +1,4 @@
1
- import { createWrappingJoinRule } from '@atlaskit/editor-common/utils';
2
- import { createRule } from '@atlaskit/prosemirror-input-rules';
1
+ import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
3
2
  import { WRAPPER_BLOCK_TYPES } from './block-types';
4
3
  export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
5
4
  if (!node) {
@@ -1,5 +1,5 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  declare function inputRulePlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined, schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
@@ -1,6 +1,6 @@
1
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
1
2
  import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
4
4
  export declare const isNodeAWrappingBlockNode: (node?: PMNode | null) => boolean;
5
5
  export declare const createJoinNodesRule: (match: RegExp, nodeType: NodeType) => InputRuleWrapper;
6
6
  type WrappingTextRuleProps = {
@@ -1,5 +1,5 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  declare function inputRulePlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined, schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
@@ -1,6 +1,6 @@
1
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
1
2
  import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
4
4
  export declare const isNodeAWrappingBlockNode: (node?: PMNode | null) => boolean;
5
5
  export declare const createJoinNodesRule: (match: RegExp, nodeType: NodeType) => InputRuleWrapper;
6
6
  type WrappingTextRuleProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "3.0.24",
3
+ "version": "3.0.25",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,16 +36,16 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@atlaskit/adf-schema": "^35.5.1",
39
- "@atlaskit/editor-common": "^78.0.0",
39
+ "@atlaskit/editor-common": "^78.4.0",
40
40
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
41
41
  "@atlaskit/editor-prosemirror": "3.0.0",
42
42
  "@atlaskit/editor-shared-styles": "^2.9.0",
43
43
  "@atlaskit/editor-tables": "^2.5.0",
44
- "@atlaskit/icon": "^22.0.0",
44
+ "@atlaskit/icon": "^22.1.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.2.5",
46
- "@atlaskit/prosemirror-input-rules": "^2.4.0",
46
+ "@atlaskit/prosemirror-input-rules": "^3.0.0",
47
47
  "@atlaskit/theme": "^12.6.0",
48
- "@atlaskit/tokens": "^1.37.0",
48
+ "@atlaskit/tokens": "^1.38.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "@emotion/react": "^11.7.1"
51
51
  },