@atlaskit/editor-plugin-text-color 1.4.0 → 1.5.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.
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toggleColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
- var _preset = require("@atlaskit/editor-common/preset");
9
8
  var _main = require("../pm-plugins/main");
9
+ var _constants = require("../utils/constants");
10
10
  var _disabled = require("../utils/disabled");
11
11
  var toggleColor = exports.toggleColor = function toggleColor(color) {
12
12
  return function (state, dispatch) {
@@ -22,14 +22,20 @@ var toggleColor = exports.toggleColor = function toggleColor(color) {
22
22
  return false;
23
23
  }
24
24
  if (dispatch) {
25
- state.tr.setMeta(_main.pluginKey, {
26
- action: _main.ACTIONS.SET_COLOR,
27
- color: color
25
+ _constants.overrideMarks.forEach(function (mark) {
26
+ var marks = tr.doc.type.schema.marks;
27
+ if (marks[mark]) {
28
+ (0, _mark.removeMark)(marks[mark])({
29
+ tr: tr
30
+ });
31
+ }
28
32
  });
29
- state.tr.scrollIntoView();
30
- (0, _preset.editorCommandToPMCommand)((0, _mark.toggleMark)(textColor, {
33
+ (0, _mark.toggleMark)(textColor, {
31
34
  color: color
32
- }))(state, dispatch);
35
+ })({
36
+ tr: tr
37
+ });
38
+ dispatch(tr);
33
39
  }
34
40
  return true;
35
41
  };
@@ -8,7 +8,7 @@ exports.ACTIONS = void 0;
8
8
  Object.defineProperty(exports, "DEFAULT_COLOR", {
9
9
  enumerable: true,
10
10
  get: function get() {
11
- return _color.DEFAULT_COLOR;
11
+ return _constants.DEFAULT_COLOR;
12
12
  }
13
13
  });
14
14
  exports.createPlugin = createPlugin;
@@ -19,11 +19,12 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
19
19
  var _uiColor = require("@atlaskit/editor-common/ui-color");
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _color = require("../utils/color");
22
+ var _constants = require("../utils/constants");
22
23
  var _disabled = require("../utils/disabled");
23
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
26
  function createInitialPluginState(editorState, pluginConfig) {
26
- var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || _color.DEFAULT_COLOR;
27
+ var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || _constants.DEFAULT_COLOR;
27
28
  var palette = [{
28
29
  value: defaultColor.color,
29
30
  label: defaultColor.label,
@@ -3,14 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getActiveColor = exports.DEFAULT_COLOR = void 0;
7
- var _colors = require("@atlaskit/theme/colors");
8
- var DEFAULT_COLOR = exports.DEFAULT_COLOR = {
9
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
10
- /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
11
- color: _colors.N800.toLowerCase(),
12
- label: 'Dark gray'
13
- };
6
+ exports.getActiveColor = void 0;
7
+ var _constants = require("./constants");
14
8
  var getActiveColor = exports.getActiveColor = function getActiveColor(state) {
15
9
  var _ref = state.selection,
16
10
  $from = _ref.$from,
@@ -50,5 +44,5 @@ var getActiveColor = exports.getActiveColor = function getActiveColor(state) {
50
44
  if (marksWithColor.length > 1 || marksWithColor.length === 1 && marks.length > 1) {
51
45
  return null;
52
46
  }
53
- return marksWithColor.length ? marksWithColor[0].attrs.color : DEFAULT_COLOR.color;
47
+ return marksWithColor.length ? marksWithColor[0].attrs.color : _constants.DEFAULT_COLOR.color;
54
48
  };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.overrideMarks = exports.DEFAULT_COLOR = void 0;
7
+ var _colors = require("@atlaskit/theme/colors");
8
+ var overrideMarks = exports.overrideMarks = ['backgroundColor'];
9
+ var DEFAULT_COLOR = exports.DEFAULT_COLOR = {
10
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
11
+ /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
12
+ color: _colors.N800.toLowerCase(),
13
+ label: 'Dark gray'
14
+ };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getDisabledState = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _constants = require("./constants");
8
9
  var hasLinkMark = function hasLinkMark($pos) {
9
10
  var linkMarkType = $pos.doc.type.schema.marks.link,
10
11
  pos = $pos.pos;
@@ -13,39 +14,24 @@ var hasLinkMark = function hasLinkMark($pos) {
13
14
  }
14
15
  return $pos.doc.rangeHasMark(pos, Math.min(pos + 1, $pos.doc.content.size), linkMarkType);
15
16
  };
16
- var hasHighlightMark = function hasHighlightMark($pos) {
17
- var highlightMarkType = $pos.doc.type.schema.marks.backgroundColor;
18
- if (!highlightMarkType) {
19
- return false;
20
- }
21
- var node = $pos.nodeBefore;
22
- if (!node) {
23
- return false;
24
- }
25
- return !!highlightMarkType.isInSet(node.marks);
26
- };
27
- var hasHighlightMarkInRange = function hasHighlightMarkInRange($from, $to) {
28
- var highlightMarkType = $from.doc.type.schema.marks.backgroundColor,
29
- pos = $from.pos,
30
- doc = $from.doc;
31
- if (!highlightMarkType) {
32
- return false;
33
- }
34
- return (0, _mark.entireSelectionContainsMark)(highlightMarkType, doc, pos, $to.pos);
35
- };
36
17
  var getDisabledState = exports.getDisabledState = function getDisabledState(state) {
37
18
  var textColor = state.schema.marks.textColor;
38
19
  if (textColor) {
20
+ var _state$storedMarks;
39
21
  var _ref = state.selection,
40
22
  empty = _ref.empty,
41
23
  ranges = _ref.ranges,
42
- $cursor = _ref.$cursor,
43
- $from = _ref.$from,
44
- $to = _ref.$to;
45
- if (empty && !$cursor || $cursor && hasLinkMark($cursor) || $cursor && hasHighlightMark($cursor) || !$cursor && $from && $to && hasHighlightMarkInRange($from, $to) || (0, _mark.isMarkAllowedInRange)(state.doc, ranges, textColor) === false) {
24
+ $cursor = _ref.$cursor;
25
+ if (empty && !$cursor || $cursor && hasLinkMark($cursor) || (0, _mark.isMarkAllowedInRange)(state.doc, ranges, textColor) === false) {
46
26
  return true;
47
27
  }
48
- if ((0, _mark.isMarkExcluded)(textColor, state.storedMarks || $cursor && $cursor.marks())) {
28
+
29
+ // Allow "excluded" marks that can be overridden
30
+ // These marks are explicitly removed before applying the new mark (see toggleColor command)
31
+ var omitOverrides = function omitOverrides(mark) {
32
+ return !_constants.overrideMarks.includes(mark.type.name);
33
+ };
34
+ if ((0, _mark.isMarkExcluded)(textColor, ((_state$storedMarks = state.storedMarks) === null || _state$storedMarks === void 0 ? void 0 : _state$storedMarks.filter(omitOverrides)) || $cursor && $cursor.marks().filter(omitOverrides))) {
49
35
  return true;
50
36
  }
51
37
  return false;
@@ -1,6 +1,6 @@
1
- import { toggleMark } from '@atlaskit/editor-common/mark';
2
- import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
1
+ import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
3
2
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
+ import { overrideMarks } from '../utils/constants';
4
4
  import { getDisabledState } from '../utils/disabled';
5
5
  export const toggleColor = color => (state, dispatch) => {
6
6
  const {
@@ -17,14 +17,22 @@ export const toggleColor = color => (state, dispatch) => {
17
17
  return false;
18
18
  }
19
19
  if (dispatch) {
20
- state.tr.setMeta(pluginKey, {
21
- action: ACTIONS.SET_COLOR,
22
- color
20
+ overrideMarks.forEach(mark => {
21
+ const {
22
+ marks
23
+ } = tr.doc.type.schema;
24
+ if (marks[mark]) {
25
+ removeMark(marks[mark])({
26
+ tr
27
+ });
28
+ }
23
29
  });
24
- state.tr.scrollIntoView();
25
- editorCommandToPMCommand(toggleMark(textColor, {
30
+ toggleMark(textColor, {
26
31
  color
27
- }))(state, dispatch);
32
+ })({
33
+ tr
34
+ });
35
+ dispatch(tr);
28
36
  }
29
37
  return true;
30
38
  };
@@ -1,9 +1,10 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { DEFAULT_BORDER_COLOR, textColorPalette } from '@atlaskit/editor-common/ui-color';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import { DEFAULT_COLOR, getActiveColor } from '../utils/color';
4
+ import { getActiveColor } from '../utils/color';
5
+ import { DEFAULT_COLOR } from '../utils/constants';
5
6
  import { getDisabledState } from '../utils/disabled';
6
- export { DEFAULT_COLOR } from '../utils/color';
7
+ export { DEFAULT_COLOR } from '../utils/constants';
7
8
  function createInitialPluginState(editorState, pluginConfig) {
8
9
  const defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
9
10
  const palette = [{
@@ -1,10 +1,4 @@
1
- import { N800 } from '@atlaskit/theme/colors';
2
- export const DEFAULT_COLOR = {
3
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
4
- /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
5
- color: N800.toLowerCase(),
6
- label: 'Dark gray'
7
- };
1
+ import { DEFAULT_COLOR } from './constants';
8
2
  export const getActiveColor = state => {
9
3
  const {
10
4
  $from,
@@ -0,0 +1,8 @@
1
+ import { N800 } from '@atlaskit/theme/colors';
2
+ export const overrideMarks = ['backgroundColor'];
3
+ export const DEFAULT_COLOR = {
4
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
5
+ /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
6
+ color: N800.toLowerCase(),
7
+ label: 'Dark gray'
8
+ };
@@ -1,4 +1,5 @@
1
- import { entireSelectionContainsMark, isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
1
+ import { isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
2
+ import { overrideMarks } from './constants';
2
3
  const hasLinkMark = $pos => {
3
4
  const {
4
5
  doc: {
@@ -17,62 +18,27 @@ const hasLinkMark = $pos => {
17
18
  }
18
19
  return $pos.doc.rangeHasMark(pos, Math.min(pos + 1, $pos.doc.content.size), linkMarkType);
19
20
  };
20
- const hasHighlightMark = $pos => {
21
- const {
22
- doc: {
23
- type: {
24
- schema: {
25
- marks: {
26
- backgroundColor: highlightMarkType
27
- }
28
- }
29
- }
30
- }
31
- } = $pos;
32
- if (!highlightMarkType) {
33
- return false;
34
- }
35
- const node = $pos.nodeBefore;
36
- if (!node) {
37
- return false;
38
- }
39
- return !!highlightMarkType.isInSet(node.marks);
40
- };
41
- const hasHighlightMarkInRange = ($from, $to) => {
42
- const {
43
- doc: {
44
- type: {
45
- schema: {
46
- marks: {
47
- backgroundColor: highlightMarkType
48
- }
49
- }
50
- }
51
- },
52
- pos,
53
- doc
54
- } = $from;
55
- if (!highlightMarkType) {
56
- return false;
57
- }
58
- return entireSelectionContainsMark(highlightMarkType, doc, pos, $to.pos);
59
- };
60
21
  export const getDisabledState = state => {
61
22
  const {
62
23
  textColor
63
24
  } = state.schema.marks;
64
25
  if (textColor) {
26
+ var _state$storedMarks;
65
27
  const {
66
28
  empty,
67
29
  ranges,
68
- $cursor,
69
- $from,
70
- $to
30
+ $cursor
71
31
  } = state.selection;
72
- if (empty && !$cursor || $cursor && hasLinkMark($cursor) || $cursor && hasHighlightMark($cursor) || !$cursor && $from && $to && hasHighlightMarkInRange($from, $to) || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
32
+ if (empty && !$cursor || $cursor && hasLinkMark($cursor) || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
73
33
  return true;
74
34
  }
75
- if (isMarkExcluded(textColor, state.storedMarks || $cursor && $cursor.marks())) {
35
+
36
+ // Allow "excluded" marks that can be overridden
37
+ // These marks are explicitly removed before applying the new mark (see toggleColor command)
38
+ const omitOverrides = mark => {
39
+ return !overrideMarks.includes(mark.type.name);
40
+ };
41
+ if (isMarkExcluded(textColor, ((_state$storedMarks = state.storedMarks) === null || _state$storedMarks === void 0 ? void 0 : _state$storedMarks.filter(omitOverrides)) || $cursor && $cursor.marks().filter(omitOverrides))) {
76
42
  return true;
77
43
  }
78
44
  return false;
@@ -1,6 +1,6 @@
1
- import { toggleMark } from '@atlaskit/editor-common/mark';
2
- import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
1
+ import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
3
2
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
+ import { overrideMarks } from '../utils/constants';
4
4
  import { getDisabledState } from '../utils/disabled';
5
5
  export var toggleColor = function toggleColor(color) {
6
6
  return function (state, dispatch) {
@@ -16,14 +16,20 @@ export var toggleColor = function toggleColor(color) {
16
16
  return false;
17
17
  }
18
18
  if (dispatch) {
19
- state.tr.setMeta(pluginKey, {
20
- action: ACTIONS.SET_COLOR,
21
- color: color
19
+ overrideMarks.forEach(function (mark) {
20
+ var marks = tr.doc.type.schema.marks;
21
+ if (marks[mark]) {
22
+ removeMark(marks[mark])({
23
+ tr: tr
24
+ });
25
+ }
22
26
  });
23
- state.tr.scrollIntoView();
24
- editorCommandToPMCommand(toggleMark(textColor, {
27
+ toggleMark(textColor, {
25
28
  color: color
26
- }))(state, dispatch);
29
+ })({
30
+ tr: tr
31
+ });
32
+ dispatch(tr);
27
33
  }
28
34
  return true;
29
35
  };
@@ -5,9 +5,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { DEFAULT_BORDER_COLOR, textColorPalette } from '@atlaskit/editor-common/ui-color';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
- import { DEFAULT_COLOR, getActiveColor } from '../utils/color';
8
+ import { getActiveColor } from '../utils/color';
9
+ import { DEFAULT_COLOR } from '../utils/constants';
9
10
  import { getDisabledState } from '../utils/disabled';
10
- export { DEFAULT_COLOR } from '../utils/color';
11
+ export { DEFAULT_COLOR } from '../utils/constants';
11
12
  function createInitialPluginState(editorState, pluginConfig) {
12
13
  var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
13
14
  var palette = [{
@@ -1,10 +1,4 @@
1
- import { N800 } from '@atlaskit/theme/colors';
2
- export var DEFAULT_COLOR = {
3
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
4
- /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
5
- color: N800.toLowerCase(),
6
- label: 'Dark gray'
7
- };
1
+ import { DEFAULT_COLOR } from './constants';
8
2
  export var getActiveColor = function getActiveColor(state) {
9
3
  var _ref = state.selection,
10
4
  $from = _ref.$from,
@@ -0,0 +1,8 @@
1
+ import { N800 } from '@atlaskit/theme/colors';
2
+ export var overrideMarks = ['backgroundColor'];
3
+ export var DEFAULT_COLOR = {
4
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4137
5
+ /* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
6
+ color: N800.toLowerCase(),
7
+ label: 'Dark gray'
8
+ };
@@ -1,4 +1,5 @@
1
- import { entireSelectionContainsMark, isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
1
+ import { isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
2
+ import { overrideMarks } from './constants';
2
3
  var hasLinkMark = function hasLinkMark($pos) {
3
4
  var linkMarkType = $pos.doc.type.schema.marks.link,
4
5
  pos = $pos.pos;
@@ -7,39 +8,24 @@ var hasLinkMark = function hasLinkMark($pos) {
7
8
  }
8
9
  return $pos.doc.rangeHasMark(pos, Math.min(pos + 1, $pos.doc.content.size), linkMarkType);
9
10
  };
10
- var hasHighlightMark = function hasHighlightMark($pos) {
11
- var highlightMarkType = $pos.doc.type.schema.marks.backgroundColor;
12
- if (!highlightMarkType) {
13
- return false;
14
- }
15
- var node = $pos.nodeBefore;
16
- if (!node) {
17
- return false;
18
- }
19
- return !!highlightMarkType.isInSet(node.marks);
20
- };
21
- var hasHighlightMarkInRange = function hasHighlightMarkInRange($from, $to) {
22
- var highlightMarkType = $from.doc.type.schema.marks.backgroundColor,
23
- pos = $from.pos,
24
- doc = $from.doc;
25
- if (!highlightMarkType) {
26
- return false;
27
- }
28
- return entireSelectionContainsMark(highlightMarkType, doc, pos, $to.pos);
29
- };
30
11
  export var getDisabledState = function getDisabledState(state) {
31
12
  var textColor = state.schema.marks.textColor;
32
13
  if (textColor) {
14
+ var _state$storedMarks;
33
15
  var _ref = state.selection,
34
16
  empty = _ref.empty,
35
17
  ranges = _ref.ranges,
36
- $cursor = _ref.$cursor,
37
- $from = _ref.$from,
38
- $to = _ref.$to;
39
- if (empty && !$cursor || $cursor && hasLinkMark($cursor) || $cursor && hasHighlightMark($cursor) || !$cursor && $from && $to && hasHighlightMarkInRange($from, $to) || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
18
+ $cursor = _ref.$cursor;
19
+ if (empty && !$cursor || $cursor && hasLinkMark($cursor) || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
40
20
  return true;
41
21
  }
42
- if (isMarkExcluded(textColor, state.storedMarks || $cursor && $cursor.marks())) {
22
+
23
+ // Allow "excluded" marks that can be overridden
24
+ // These marks are explicitly removed before applying the new mark (see toggleColor command)
25
+ var omitOverrides = function omitOverrides(mark) {
26
+ return !overrideMarks.includes(mark.type.name);
27
+ };
28
+ if (isMarkExcluded(textColor, ((_state$storedMarks = state.storedMarks) === null || _state$storedMarks === void 0 ? void 0 : _state$storedMarks.filter(omitOverrides)) || $cursor && $cursor.marks().filter(omitOverrides))) {
43
29
  return true;
44
30
  }
45
31
  return false;
@@ -1,3 +1,3 @@
1
1
  export { textColorPlugin } from './plugin';
2
2
  export type { TextColorPlugin } from './types';
3
- export type { TextColorPluginState, TextColorPluginConfig, } from './pm-plugins/main';
3
+ export type { TextColorPluginState, TextColorPluginConfig } from './pm-plugins/main';
@@ -2,7 +2,7 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- export { DEFAULT_COLOR } from '../utils/color';
5
+ export { DEFAULT_COLOR } from '../utils/constants';
6
6
  export type TextColorPluginState = {
7
7
  palette: Array<PaletteColor>;
8
8
  defaultColor: string;
@@ -5,10 +5,7 @@ import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/m
5
5
  type Config = TextColorPluginConfig | boolean;
6
6
  export type TextColorPlugin = NextEditorPlugin<'textColor', {
7
7
  pluginConfiguration: Config | undefined;
8
- dependencies: [
9
- OptionalPlugin<AnalyticsPlugin>,
10
- OptionalPlugin<PrimaryToolbarPlugin>
11
- ];
8
+ dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<PrimaryToolbarPlugin>];
12
9
  actions: {
13
10
  changeColor: (color: string) => Command;
14
11
  };
@@ -1,6 +1,2 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- export declare const DEFAULT_COLOR: {
3
- color: string;
4
- label: string;
5
- };
6
2
  export declare const getActiveColor: (state: EditorState) => string | null;
@@ -0,0 +1,5 @@
1
+ export declare const overrideMarks: string[];
2
+ export declare const DEFAULT_COLOR: {
3
+ color: string;
4
+ label: string;
5
+ };
@@ -1,3 +1,3 @@
1
1
  export { textColorPlugin } from './plugin';
2
2
  export type { TextColorPlugin } from './types';
3
- export type { TextColorPluginState, TextColorPluginConfig, } from './pm-plugins/main';
3
+ export type { TextColorPluginState, TextColorPluginConfig } from './pm-plugins/main';
@@ -2,7 +2,7 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- export { DEFAULT_COLOR } from '../utils/color';
5
+ export { DEFAULT_COLOR } from '../utils/constants';
6
6
  export type TextColorPluginState = {
7
7
  palette: Array<PaletteColor>;
8
8
  defaultColor: string;
@@ -1,6 +1,2 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- export declare const DEFAULT_COLOR: {
3
- color: string;
4
- label: string;
5
- };
6
2
  export declare const getActiveColor: (state: EditorState) => string | null;
@@ -0,0 +1,5 @@
1
+ export declare const overrideMarks: string[];
2
+ export declare const DEFAULT_COLOR: {
3
+ color: string;
4
+ label: string;
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^36.10.7",
37
- "@atlaskit/editor-common": "^81.0.0",
37
+ "@atlaskit/editor-common": "^82.1.0",
38
38
  "@atlaskit/editor-palette": "1.6.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
40
40
  "@atlaskit/editor-plugin-primary-toolbar": "^1.1.0",
41
41
  "@atlaskit/editor-prosemirror": "4.0.1",
42
- "@atlaskit/editor-shared-styles": "^2.11.0",
42
+ "@atlaskit/editor-shared-styles": "^2.12.0",
43
43
  "@atlaskit/editor-tables": "^2.7.0",
44
44
  "@atlaskit/icon": "^22.3.0",
45
- "@atlaskit/theme": "^12.8.0",
45
+ "@atlaskit/theme": "^12.9.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"
48
48
  },
@@ -54,7 +54,6 @@
54
54
  "@af/visual-regression": "*",
55
55
  "@atlaskit/ssr": "*",
56
56
  "@atlaskit/visual-regression": "*",
57
- "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
58
57
  "@testing-library/react": "^12.1.5",
59
58
  "react-dom": "^16.8.0",
60
59
  "typescript": "~5.4.2",
@@ -92,6 +91,5 @@
92
91
  "import-no-extraneous-disable-for-examples-and-docs"
93
92
  ]
94
93
  }
95
- },
96
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
94
+ }
97
95
  }
package/report.api.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## API Report File for "@atlaskit/editor-plugin-text-color"
4
4
 
5
- > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using
6
+ > [API Extractor](https://api-extractor.com/).
6
7
  > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
8
 
8
9
  ### Table of contents
@@ -26,21 +27,21 @@ type Config = TextColorPluginConfig | boolean;
26
27
 
27
28
  // @public (undocumented)
28
29
  type TextColorDefaultColor = {
29
- color: string;
30
- label: string;
30
+ color: string;
31
+ label: string;
31
32
  };
32
33
 
33
34
  // @public (undocumented)
34
35
  export type TextColorPlugin = NextEditorPlugin<
35
- 'textColor',
36
- {
37
- pluginConfiguration: Config | undefined;
38
- dependencies: TextColorPluginDependencies;
39
- actions: {
40
- changeColor: (color: string) => Command;
41
- };
42
- sharedState: TextColorPluginState | undefined;
43
- }
36
+ 'textColor',
37
+ {
38
+ pluginConfiguration: Config | undefined;
39
+ dependencies: TextColorPluginDependencies;
40
+ actions: {
41
+ changeColor: (color: string) => Command;
42
+ };
43
+ sharedState: TextColorPluginState | undefined;
44
+ }
44
45
  >;
45
46
 
46
47
  // @public (undocumented)
@@ -48,8 +49,8 @@ export const textColorPlugin: TextColorPlugin;
48
49
 
49
50
  // @public (undocumented)
50
51
  export interface TextColorPluginConfig {
51
- // (undocumented)
52
- defaultColor?: TextColorDefaultColor;
52
+ // (undocumented)
53
+ defaultColor?: TextColorDefaultColor;
53
54
  }
54
55
 
55
56
  // @public (undocumented)
@@ -57,10 +58,10 @@ type TextColorPluginDependencies = [OptionalPlugin<AnalyticsPlugin>];
57
58
 
58
59
  // @public (undocumented)
59
60
  export type TextColorPluginState = {
60
- palette: Array<PaletteColor>;
61
- defaultColor: string;
62
- disabled?: boolean;
63
- color: null | string;
61
+ palette: Array<PaletteColor>;
62
+ defaultColor: string;
63
+ disabled?: boolean;
64
+ color: null | string;
64
65
  };
65
66
 
66
67
  // (No @packageDocumentation comment for this package)
@@ -74,8 +75,8 @@ export type TextColorPluginState = {
74
75
 
75
76
  ```json
76
77
  {
77
- "react": "^16.8.0",
78
- "react-intl-next": "npm:react-intl@^5.18.1"
78
+ "react": "^16.8.0",
79
+ "react-intl-next": "npm:react-intl@^5.18.1"
79
80
  }
80
81
  ```
81
82