@atlaskit/editor-plugin-text-formatting 30.0.2 → 30.1.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,27 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 30.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b2cba09ce9ad0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2cba09ce9ad0) -
8
+ Add a shared cell-local mark-presence helper and use it for clear-formatting and block-type
9
+ formatting-presence checks behind `platform_editor_improve_inp`. Reuse resolved cell-selection
10
+ ranges and stop scanning at the first matching mark.
11
+
12
+ Share schema mark-name resolution through `getSupportedMarkTypes`, caching results per schema and
13
+ mark-name array to avoid repeated allocation during selection changes.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 30.0.3
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 30.0.2
4
26
 
5
27
  ### Patch Changes
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.markActive = exports.isArrayContainsContent = exports.hasCode = exports.compareItemsArrays = exports.checkFormattingIsPresent = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _cellSelectionHasAnyMark = require("@atlaskit/editor-common/mark/cell-selection-has-any-mark");
9
+ var _getSupportedMarkTypes = require("@atlaskit/editor-common/mark/get-supported-mark-types");
10
+ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
8
12
  var _clearFormatting = require("./clear-formatting");
9
13
  var hasCode = exports.hasCode = function hasCode(state, pos) {
10
14
  var code = state.schema.marks.code;
@@ -51,6 +55,9 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
51
55
  return isBlockStyling;
52
56
  };
53
57
  var marksArePresent = function marksArePresent(state) {
58
+ if (state.selection instanceof _cellSelection.CellSelection && !state.selection.empty && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp')) {
59
+ return (0, _cellSelectionHasAnyMark.cellSelectionHasAnyMark)(state.selection, (0, _getSupportedMarkTypes.getSupportedMarkTypes)(state.schema, _clearFormatting.FORMATTING_MARK_TYPES));
60
+ }
54
61
  var activeMarkTypes = _clearFormatting.FORMATTING_MARK_TYPES.filter(function (mark) {
55
62
  if (!!state.schema.marks[mark]) {
56
63
  var _state$selection3 = state.selection,
@@ -1,4 +1,8 @@
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';
4
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
6
  import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './clear-formatting';
3
7
  export const hasCode = (state, pos) => {
4
8
  const {
@@ -47,6 +51,9 @@ const blockStylingIsPresent = state => {
47
51
  return isBlockStyling;
48
52
  };
49
53
  const marksArePresent = state => {
54
+ if (state.selection instanceof CellSelection && !state.selection.empty && isExperimentEnabled('platform_editor_improve_inp')) {
55
+ return cellSelectionHasAnyMark(state.selection, getSupportedMarkTypes(state.schema, FORMATTING_MARK_TYPES));
56
+ }
50
57
  const activeMarkTypes = FORMATTING_MARK_TYPES.filter(mark => {
51
58
  if (!!state.schema.marks[mark]) {
52
59
  const {
@@ -1,4 +1,8 @@
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';
4
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
6
  import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './clear-formatting';
3
7
  export var hasCode = function hasCode(state, pos) {
4
8
  var code = state.schema.marks.code;
@@ -45,6 +49,9 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
45
49
  return isBlockStyling;
46
50
  };
47
51
  var marksArePresent = function marksArePresent(state) {
52
+ if (state.selection instanceof CellSelection && !state.selection.empty && isExperimentEnabled('platform_editor_improve_inp')) {
53
+ return cellSelectionHasAnyMark(state.selection, getSupportedMarkTypes(state.schema, FORMATTING_MARK_TYPES));
54
+ }
48
55
  var activeMarkTypes = FORMATTING_MARK_TYPES.filter(function (mark) {
49
56
  if (!!state.schema.marks[mark]) {
50
57
  var _state$selection3 = state.selection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "30.0.2",
3
+ "version": "30.1.0",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,20 +36,20 @@
36
36
  "@atlaskit/editor-toolbar": "^2.8.0",
37
37
  "@atlaskit/editor-toolbar-model": "^1.2.0",
38
38
  "@atlaskit/icon": "^38.0.0",
39
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
39
40
  "@atlaskit/platform-feature-flags": "^2.2.0",
40
41
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
41
- "@atlaskit/tmp-editor-statsig": "^248.0.0",
42
- "@atlaskit/tokens": "^20.8.0",
42
+ "@atlaskit/tmp-editor-statsig": "^250.0.0",
43
+ "@atlaskit/tokens": "^20.9.0",
43
44
  "@babel/runtime": "^7.0.0",
44
45
  "@emotion/react": "^11.7.1"
45
46
  },
46
47
  "peerDependencies": {
47
- "@atlaskit/editor-common": "^134.1.0",
48
+ "@atlaskit/editor-common": "^134.3.0",
48
49
  "react": "^18.2.0 || ^19.2.0",
49
50
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@testing-library/react": "^16.3.0",
53
53
  "react": "^19.2.0",
54
54
  "react-intl": "^7.0.0"
55
55
  },