@atlaskit/editor-plugin-text-color 1.2.2 → 1.3.1

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,28 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#100495](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100495)
8
+ [`dbb78a011fac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dbb78a011fac) -
9
+ [ux] [ED-23150] Added `changeColor` command for editor-plugin-highlight, including new
10
+ `removeMark` command for editor-common. Fixed bug with editor-plugin-text-color which prevented
11
+ color from being removed when user selects all.
12
+ - Updated dependencies
13
+
14
+ ## 1.3.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#99579](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99579)
19
+ [`f222af5687e9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f222af5687e9) -
20
+ Bump adf-schema to 36.3.0 and adf-schema-json to 1.14.0
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+
3
26
  ## 1.2.2
4
27
 
5
28
  ### Patch 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.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/adf-schema": "^36.1.0",
37
- "@atlaskit/editor-common": "^80.0.0",
36
+ "@atlaskit/adf-schema": "^36.3.0",
37
+ "@atlaskit/editor-common": "^80.4.0",
38
38
  "@atlaskit/editor-palette": "1.6.0",
39
- "@atlaskit/editor-plugin-analytics": "^1.1.0",
40
- "@atlaskit/editor-plugin-highlight": "^1.1.0",
39
+ "@atlaskit/editor-plugin-analytics": "^1.2.0",
40
+ "@atlaskit/editor-plugin-highlight": "^1.4.0",
41
41
  "@atlaskit/editor-prosemirror": "4.0.1",
42
- "@atlaskit/editor-shared-styles": "^2.10.0",
42
+ "@atlaskit/editor-shared-styles": "^2.11.0",
43
43
  "@atlaskit/editor-tables": "^2.7.0",
44
- "@atlaskit/icon": "^22.1.0",
44
+ "@atlaskit/icon": "^22.2.0",
45
45
  "@atlaskit/theme": "^12.8.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"