@atlaskit/editor-plugin-text-color 12.3.4 → 12.3.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 +8 -0
- package/dist/cjs/editor-commands/change-color.js +10 -0
- package/dist/cjs/pm-plugins/commands/remove-color.js +5 -0
- package/dist/cjs/pm-plugins/commands/toggle-color.js +4 -0
- package/dist/es2019/editor-commands/change-color.js +9 -0
- package/dist/es2019/pm-plugins/commands/remove-color.js +5 -0
- package/dist/es2019/pm-plugins/commands/toggle-color.js +4 -0
- package/dist/esm/editor-commands/change-color.js +9 -0
- package/dist/esm/pm-plugins/commands/remove-color.js +5 -0
- package/dist/esm/pm-plugins/commands/toggle-color.js +4 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-color
|
|
2
2
|
|
|
3
|
+
## 12.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`283c55290e6cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/283c55290e6cc) -
|
|
8
|
+
Preserve visual selection after applying text color or highlight
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 12.3.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -5,9 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.changeColor = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
10
|
var _color = require("../pm-plugins/utils/color");
|
|
9
11
|
var _removeColor = require("./remove-color");
|
|
10
12
|
var _toggleColor = require("./toggle-color");
|
|
13
|
+
var maybeSyncSelectionAfterFormat = function maybeSyncSelectionAfterFormat(tr) {
|
|
14
|
+
if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
15
|
+
tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
/**
|
|
12
20
|
* Helper to create an analytics payload
|
|
13
21
|
* @param newColor - Color to be change in hex code
|
|
@@ -58,12 +66,14 @@ var changeColor = exports.changeColor = function changeColor(color, api, inputMe
|
|
|
58
66
|
(0, _removeColor.removeColor)({
|
|
59
67
|
tr: tr
|
|
60
68
|
});
|
|
69
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
61
70
|
return tr;
|
|
62
71
|
}
|
|
63
72
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
|
|
64
73
|
(0, _toggleColor.toggleColor)(color)({
|
|
65
74
|
tr: tr
|
|
66
75
|
});
|
|
76
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
67
77
|
return tr;
|
|
68
78
|
};
|
|
69
79
|
};
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.removeColor = void 0;
|
|
7
7
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
10
|
var _main = require("../main");
|
|
9
11
|
var removeColor = exports.removeColor = function removeColor() {
|
|
10
12
|
return function (state, dispatch) {
|
|
@@ -15,6 +17,9 @@ var removeColor = exports.removeColor = function removeColor() {
|
|
|
15
17
|
tr: tr
|
|
16
18
|
});
|
|
17
19
|
if (dispatch) {
|
|
20
|
+
if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
21
|
+
tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
|
|
22
|
+
}
|
|
18
23
|
dispatch(tr.setMeta(_main.pluginKey, {
|
|
19
24
|
action: _main.ACTIONS.RESET_COLOR
|
|
20
25
|
}));
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.toggleColor = void 0;
|
|
7
7
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
10
|
var _main = require("../main");
|
|
10
11
|
var _constants = require("../utils/constants");
|
|
@@ -38,6 +39,9 @@ var toggleColor = exports.toggleColor = function toggleColor(color) {
|
|
|
38
39
|
})({
|
|
39
40
|
tr: tr
|
|
40
41
|
});
|
|
42
|
+
if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
43
|
+
tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
|
|
44
|
+
}
|
|
41
45
|
dispatch(tr);
|
|
42
46
|
}
|
|
43
47
|
return true;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
4
|
import { getActiveColorNew } from '../pm-plugins/utils/color';
|
|
3
5
|
import { removeColor } from './remove-color';
|
|
4
6
|
import { toggleColor } from './toggle-color';
|
|
7
|
+
const maybeSyncSelectionAfterFormat = tr => {
|
|
8
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
9
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* Helper to create an analytics payload
|
|
@@ -53,11 +60,13 @@ export const changeColor = (color, api, inputMethod) => ({
|
|
|
53
60
|
removeColor({
|
|
54
61
|
tr
|
|
55
62
|
});
|
|
63
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
56
64
|
return tr;
|
|
57
65
|
}
|
|
58
66
|
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
|
|
59
67
|
toggleColor(color)({
|
|
60
68
|
tr
|
|
61
69
|
});
|
|
70
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
62
71
|
return tr;
|
|
63
72
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { removeMark } from '@atlaskit/editor-common/mark';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
4
|
import { ACTIONS, pluginKey } from '../main';
|
|
3
5
|
export const removeColor = () => (state, dispatch) => {
|
|
4
6
|
const {
|
|
@@ -12,6 +14,9 @@ export const removeColor = () => (state, dispatch) => {
|
|
|
12
14
|
tr
|
|
13
15
|
});
|
|
14
16
|
if (dispatch) {
|
|
17
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
18
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
19
|
+
}
|
|
15
20
|
dispatch(tr.setMeta(pluginKey, {
|
|
16
21
|
action: ACTIONS.RESET_COLOR
|
|
17
22
|
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { ACTIONS, pluginKey } from '../main';
|
|
4
5
|
import { overrideMarks } from '../utils/constants';
|
|
@@ -35,6 +36,9 @@ export const toggleColor = color => (state, dispatch) => {
|
|
|
35
36
|
})({
|
|
36
37
|
tr
|
|
37
38
|
});
|
|
39
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
40
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
41
|
+
}
|
|
38
42
|
dispatch(tr);
|
|
39
43
|
}
|
|
40
44
|
return true;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
4
|
import { getActiveColorNew } from '../pm-plugins/utils/color';
|
|
3
5
|
import { removeColor } from './remove-color';
|
|
4
6
|
import { toggleColor } from './toggle-color';
|
|
7
|
+
var maybeSyncSelectionAfterFormat = function maybeSyncSelectionAfterFormat(tr) {
|
|
8
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
9
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* Helper to create an analytics payload
|
|
@@ -53,12 +60,14 @@ export var changeColor = function changeColor(color, api, inputMethod) {
|
|
|
53
60
|
removeColor({
|
|
54
61
|
tr: tr
|
|
55
62
|
});
|
|
63
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
56
64
|
return tr;
|
|
57
65
|
}
|
|
58
66
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
|
|
59
67
|
toggleColor(color)({
|
|
60
68
|
tr: tr
|
|
61
69
|
});
|
|
70
|
+
maybeSyncSelectionAfterFormat(tr);
|
|
62
71
|
return tr;
|
|
63
72
|
};
|
|
64
73
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { removeMark } from '@atlaskit/editor-common/mark';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
4
|
import { ACTIONS, pluginKey } from '../main';
|
|
3
5
|
export var removeColor = function removeColor() {
|
|
4
6
|
return function (state, dispatch) {
|
|
@@ -9,6 +11,9 @@ export var removeColor = function removeColor() {
|
|
|
9
11
|
tr: tr
|
|
10
12
|
});
|
|
11
13
|
if (dispatch) {
|
|
14
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
15
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
16
|
+
}
|
|
12
17
|
dispatch(tr.setMeta(pluginKey, {
|
|
13
18
|
action: ACTIONS.RESET_COLOR
|
|
14
19
|
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
2
|
+
import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { ACTIONS, pluginKey } from '../main';
|
|
4
5
|
import { overrideMarks } from '../utils/constants';
|
|
@@ -32,6 +33,9 @@ export var toggleColor = function toggleColor(color) {
|
|
|
32
33
|
})({
|
|
33
34
|
tr: tr
|
|
34
35
|
});
|
|
36
|
+
if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
|
|
37
|
+
tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
|
|
38
|
+
}
|
|
35
39
|
dispatch(tr);
|
|
36
40
|
}
|
|
37
41
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-color",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.5",
|
|
4
4
|
"description": "Text color plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/adf-schema": "^56.0.0",
|
|
25
|
-
"@atlaskit/button": "^24.
|
|
25
|
+
"@atlaskit/button": "^24.3.0",
|
|
26
26
|
"@atlaskit/css": "^1.0.0",
|
|
27
27
|
"@atlaskit/editor-palette": "^3.1.0",
|
|
28
28
|
"@atlaskit/editor-plugin-analytics": "^12.0.0",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-toolbar": "^9.0.0",
|
|
34
34
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
35
35
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
36
|
-
"@atlaskit/editor-toolbar": "^2.
|
|
37
|
-
"@atlaskit/editor-toolbar-model": "^1.
|
|
38
|
-
"@atlaskit/heading": "^6.
|
|
39
|
-
"@atlaskit/icon": "^36.
|
|
40
|
-
"@atlaskit/icon-lab": "^7.
|
|
36
|
+
"@atlaskit/editor-toolbar": "^2.1.0",
|
|
37
|
+
"@atlaskit/editor-toolbar-model": "^1.1.0",
|
|
38
|
+
"@atlaskit/heading": "^6.1.0",
|
|
39
|
+
"@atlaskit/icon": "^36.1.0",
|
|
40
|
+
"@atlaskit/icon-lab": "^7.2.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
42
|
-
"@atlaskit/platform-feature-flags-react": "^1.
|
|
43
|
-
"@atlaskit/primitives": "^20.
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^114.
|
|
45
|
-
"@atlaskit/tokens": "^15.
|
|
42
|
+
"@atlaskit/platform-feature-flags-react": "^1.1.0",
|
|
43
|
+
"@atlaskit/primitives": "^20.2.0",
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^114.6.0",
|
|
45
|
+
"@atlaskit/tokens": "^15.2.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"@emotion/react": "^11.7.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^116.
|
|
50
|
+
"@atlaskit/editor-common": "^116.17.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0",
|
|
53
53
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|