@atlaskit/editor-plugin-block-type 34.0.3 → 34.0.5

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,25 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 34.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 34.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b2cba09ce9ad0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2cba09ce9ad0) -
14
+ Add a shared cell-local mark-presence helper and use it for clear-formatting and block-type
15
+ formatting-presence checks behind `platform_editor_improve_inp`. Reuse resolved cell-selection
16
+ ranges and stop scanning at the first matching mark.
17
+
18
+ Share schema mark-name resolution through `getSupportedMarkTypes`, caching results per schema and
19
+ mark-name array to avoid repeated allocation during selection changes.
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 34.0.3
4
24
 
5
25
  ### Patch Changes
@@ -12,10 +12,14 @@ exports.isNodeAWrappingBlockNode = exports.hasBlockQuoteInOptions = void 0;
12
12
  exports.isSelectionInsideBlockquote = isSelectionInsideBlockquote;
13
13
  exports.isSelectionInsideListNode = isSelectionInsideListNode;
14
14
  var _mark = require("@atlaskit/editor-common/mark");
15
+ var _cellSelectionHasAnyMark = require("@atlaskit/editor-common/mark/cell-selection-has-any-mark");
16
+ var _getSupportedMarkTypes = require("@atlaskit/editor-common/mark/get-supported-mark-types");
15
17
  var _transforms = require("@atlaskit/editor-common/transforms");
16
18
  var _utils = require("@atlaskit/editor-common/utils");
17
19
  var _inputRules = require("@atlaskit/editor-common/utils/input-rules");
18
20
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
21
+ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
22
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
19
23
  var _blockTypes = require("./block-types");
20
24
  var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
21
25
  if (!node) {
@@ -216,6 +220,9 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
216
220
  return isBlockStyling;
217
221
  };
218
222
  var marksArePresent = function marksArePresent(state) {
223
+ if (state.selection instanceof _cellSelection.CellSelection && !state.selection.empty && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp')) {
224
+ return (0, _cellSelectionHasAnyMark.cellSelectionHasAnyMark)(state.selection, (0, _getSupportedMarkTypes.getSupportedMarkTypes)(state.schema, _blockTypes.FORMATTING_MARK_TYPES));
225
+ }
219
226
  var activeMarkTypes = _blockTypes.FORMATTING_MARK_TYPES.filter(function (mark) {
220
227
  if (!!state.schema.marks[mark]) {
221
228
  var _state$selection6 = state.selection,
@@ -1,8 +1,12 @@
1
1
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
2
+ import { cellSelectionHasAnyMark } from '@atlaskit/editor-common/mark/cell-selection-has-any-mark';
3
+ import { getSupportedMarkTypes } from '@atlaskit/editor-common/mark/get-supported-mark-types';
2
4
  import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
3
5
  import { createRule } from '@atlaskit/editor-common/utils';
4
6
  import { createWrappingJoinRule } from '@atlaskit/editor-common/utils/input-rules';
5
7
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
10
  import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
7
11
  export const isNodeAWrappingBlockNode = node => {
8
12
  if (!node) {
@@ -203,6 +207,9 @@ const blockStylingIsPresent = state => {
203
207
  return isBlockStyling;
204
208
  };
205
209
  const marksArePresent = state => {
210
+ if (state.selection instanceof CellSelection && !state.selection.empty && isExperimentEnabled('platform_editor_improve_inp')) {
211
+ return cellSelectionHasAnyMark(state.selection, getSupportedMarkTypes(state.schema, FORMATTING_MARK_TYPES));
212
+ }
206
213
  const activeMarkTypes = FORMATTING_MARK_TYPES.filter(mark => {
207
214
  if (!!state.schema.marks[mark]) {
208
215
  const {
@@ -1,8 +1,12 @@
1
1
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
2
+ import { cellSelectionHasAnyMark } from '@atlaskit/editor-common/mark/cell-selection-has-any-mark';
3
+ import { getSupportedMarkTypes } from '@atlaskit/editor-common/mark/get-supported-mark-types';
2
4
  import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
3
5
  import { createRule } from '@atlaskit/editor-common/utils';
4
6
  import { createWrappingJoinRule } from '@atlaskit/editor-common/utils/input-rules';
5
7
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
10
  import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
7
11
  export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
8
12
  if (!node) {
@@ -203,6 +207,9 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
203
207
  return isBlockStyling;
204
208
  };
205
209
  var marksArePresent = function marksArePresent(state) {
210
+ if (state.selection instanceof CellSelection && !state.selection.empty && isExperimentEnabled('platform_editor_improve_inp')) {
211
+ return cellSelectionHasAnyMark(state.selection, getSupportedMarkTypes(state.schema, FORMATTING_MARK_TYPES));
212
+ }
206
213
  var activeMarkTypes = FORMATTING_MARK_TYPES.filter(function (mark) {
207
214
  if (!!state.schema.marks[mark]) {
208
215
  var _state$selection6 = state.selection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "34.0.3",
3
+ "version": "34.0.5",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/editor-plugin-selection-toolbar": "^31.0.0",
33
33
  "@atlaskit/editor-plugin-toolbar": "^27.0.0",
34
34
  "@atlaskit/editor-prosemirror": "^9.0.0",
35
- "@atlaskit/editor-shared-styles": "^4.6.0",
35
+ "@atlaskit/editor-shared-styles": "^5.0.0",
36
36
  "@atlaskit/editor-tables": "^3.2.0",
37
37
  "@atlaskit/editor-toolbar": "^2.8.0",
38
38
  "@atlaskit/editor-toolbar-model": "^1.2.0",
@@ -43,14 +43,14 @@
43
43
  "@atlaskit/primitives": "^22.6.0",
44
44
  "@atlaskit/prosemirror-history": "^1.3.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^249.0.0",
47
- "@atlaskit/tokens": "^20.8.0",
46
+ "@atlaskit/tmp-editor-statsig": "^250.0.0",
47
+ "@atlaskit/tokens": "^20.9.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@compiled/react": "^1.0.2",
50
50
  "@emotion/react": "^11.7.1"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^134.2.0",
53
+ "@atlaskit/editor-common": "^134.4.0",
54
54
  "react": "^18.2.0 || ^19.2.0",
55
55
  "react-dom": "^18.2.0 || ^19.2.0",
56
56
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"