@atlaskit/editor-plugin-text-color 1.3.0 → 1.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,24 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#101524](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101524)
8
+ [`4821570088e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4821570088e6) -
9
+ ED-23362 Bump ADF schema to version 36.8.1 and add support for adf validation and transformation
10
+
11
+ ## 1.3.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#100495](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100495)
16
+ [`dbb78a011fac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dbb78a011fac) -
17
+ [ux] [ED-23150] Added `changeColor` command for editor-plugin-highlight, including new
18
+ `removeMark` command for editor-common. Fixed bug with editor-plugin-text-color which prevented
19
+ color from being removed when user selects all.
20
+ - Updated dependencies
21
+
3
22
  ## 1.3.0
4
23
 
5
24
  ### Minor Changes
@@ -7,22 +7,14 @@ exports.removeColor = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
8
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
9
9
  var _main = require("../pm-plugins/main");
10
+ // TODO: ED-23356 - Adopt shared logic with `editor-plugin-highlight` which
11
+ // uses the new `removeMark` command from `editor-common/mark`
10
12
  var removeColor = exports.removeColor = function removeColor() {
11
13
  return function (state, dispatch) {
12
14
  var schema = state.schema,
13
15
  selection = state.selection;
14
16
  var textColor = schema.marks.textColor;
15
17
  var tr = state.tr;
16
- if (selection instanceof _state.TextSelection) {
17
- var from = selection.from,
18
- to = selection.to,
19
- $cursor = selection.$cursor;
20
- if ($cursor) {
21
- tr = state.tr.removeStoredMark(textColor);
22
- } else {
23
- tr = state.tr.removeMark(from, to, textColor);
24
- }
25
- }
26
18
  if (selection instanceof _cellSelection.CellSelection) {
27
19
  /**
28
20
  * This is a slight abstraction from `src/utils/commands.ts`
@@ -48,6 +40,12 @@ var removeColor = exports.removeColor = function removeColor() {
48
40
  return true;
49
41
  });
50
42
  });
43
+ } else if (selection instanceof _state.TextSelection && selection.$cursor) {
44
+ tr = state.tr.removeStoredMark(textColor);
45
+ } else {
46
+ var from = selection.from,
47
+ to = selection.to;
48
+ tr = state.tr.removeMark(from, to, textColor);
51
49
  }
52
50
  if (dispatch) {
53
51
  dispatch(tr.setMeta(_main.pluginKey, {
@@ -1,6 +1,9 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
4
+
5
+ // TODO: ED-23356 - Adopt shared logic with `editor-plugin-highlight` which
6
+ // uses the new `removeMark` command from `editor-common/mark`
4
7
  export const removeColor = () => (state, dispatch) => {
5
8
  const {
6
9
  schema,
@@ -10,18 +13,6 @@ export const removeColor = () => (state, dispatch) => {
10
13
  textColor
11
14
  } = schema.marks;
12
15
  let tr = state.tr;
13
- if (selection instanceof TextSelection) {
14
- const {
15
- from,
16
- to,
17
- $cursor
18
- } = selection;
19
- if ($cursor) {
20
- tr = state.tr.removeStoredMark(textColor);
21
- } else {
22
- tr = state.tr.removeMark(from, to, textColor);
23
- }
24
- }
25
16
  if (selection instanceof CellSelection) {
26
17
  /**
27
18
  * This is a slight abstraction from `src/utils/commands.ts`
@@ -47,6 +38,14 @@ export const removeColor = () => (state, dispatch) => {
47
38
  return true;
48
39
  });
49
40
  });
41
+ } else if (selection instanceof TextSelection && selection.$cursor) {
42
+ tr = state.tr.removeStoredMark(textColor);
43
+ } else {
44
+ const {
45
+ from,
46
+ to
47
+ } = selection;
48
+ tr = state.tr.removeMark(from, to, textColor);
50
49
  }
51
50
  if (dispatch) {
52
51
  dispatch(tr.setMeta(pluginKey, {
@@ -1,22 +1,15 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
4
+
5
+ // TODO: ED-23356 - Adopt shared logic with `editor-plugin-highlight` which
6
+ // uses the new `removeMark` command from `editor-common/mark`
4
7
  export var removeColor = function removeColor() {
5
8
  return function (state, dispatch) {
6
9
  var schema = state.schema,
7
10
  selection = state.selection;
8
11
  var textColor = schema.marks.textColor;
9
12
  var tr = state.tr;
10
- if (selection instanceof TextSelection) {
11
- var from = selection.from,
12
- to = selection.to,
13
- $cursor = selection.$cursor;
14
- if ($cursor) {
15
- tr = state.tr.removeStoredMark(textColor);
16
- } else {
17
- tr = state.tr.removeMark(from, to, textColor);
18
- }
19
- }
20
13
  if (selection instanceof CellSelection) {
21
14
  /**
22
15
  * This is a slight abstraction from `src/utils/commands.ts`
@@ -42,6 +35,12 @@ export var removeColor = function removeColor() {
42
35
  return true;
43
36
  });
44
37
  });
38
+ } else if (selection instanceof TextSelection && selection.$cursor) {
39
+ tr = state.tr.removeStoredMark(textColor);
40
+ } else {
41
+ var from = selection.from,
42
+ to = selection.to;
43
+ tr = state.tr.removeMark(from, to, textColor);
45
44
  }
46
45
  if (dispatch) {
47
46
  dispatch(tr.setMeta(pluginKey, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,11 +33,11 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/adf-schema": "^36.3.0",
37
- "@atlaskit/editor-common": "^80.1.0",
36
+ "@atlaskit/adf-schema": "^36.8.0",
37
+ "@atlaskit/editor-common": "^80.4.0",
38
38
  "@atlaskit/editor-palette": "1.6.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
40
- "@atlaskit/editor-plugin-highlight": "^1.2.0",
40
+ "@atlaskit/editor-plugin-highlight": "^1.4.0",
41
41
  "@atlaskit/editor-prosemirror": "4.0.1",
42
42
  "@atlaskit/editor-shared-styles": "^2.11.0",
43
43
  "@atlaskit/editor-tables": "^2.7.0",