@atlaskit/editor-plugin-highlight 11.0.0 → 11.0.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 +15 -0
- package/dist/cjs/editor-commands/change-color.js +11 -0
- package/dist/cjs/highlightPlugin.js +14 -1
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/es2019/editor-commands/change-color.js +14 -1
- package/dist/es2019/highlightPlugin.js +12 -1
- package/dist/es2019/pm-plugins/main.js +1 -0
- package/dist/esm/editor-commands/change-color.js +12 -1
- package/dist/esm/highlightPlugin.js +14 -1
- package/dist/esm/pm-plugins/main.js +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-highlight
|
|
2
2
|
|
|
3
|
+
## 11.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 11.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`64a45bf9306e9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64a45bf9306e9) -
|
|
14
|
+
[ux] [EDITOR-7024] update the ADF schema behind platform_editor_lovability_text_bg_color
|
|
15
|
+
experiment such that textColor and backgroundColor can coexist
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 11.0.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ exports.changeColor = void 0;
|
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
9
9
|
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
10
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
11
|
var _main = require("../pm-plugins/main");
|
|
11
12
|
var _color = require("./color");
|
|
12
13
|
var changeColor = exports.changeColor = function changeColor(editorAnalyticsAPI) {
|
|
@@ -30,6 +31,16 @@ var changeColor = exports.changeColor = function changeColor(editorAnalyticsAPI)
|
|
|
30
31
|
type: _main.HighlightPluginAction.CHANGE_COLOR,
|
|
31
32
|
color: color
|
|
32
33
|
});
|
|
34
|
+
var marks = tr.doc.type.schema.marks;
|
|
35
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
36
|
+
_main.overrideMarks.forEach(function (mark) {
|
|
37
|
+
if (marks[mark]) {
|
|
38
|
+
(0, _mark.removeMark)(marks[mark])({
|
|
39
|
+
tr: tr
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
33
44
|
(0, _mark.toggleMark)(backgroundColor, {
|
|
34
45
|
color: color
|
|
35
46
|
})({
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.highlightPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
14
|
var _changeColor = require("./editor-commands/change-color");
|
|
13
15
|
var _highlightPadding = require("./pm-plugins/highlight-padding");
|
|
@@ -16,6 +18,8 @@ var _main = require("./pm-plugins/main");
|
|
|
16
18
|
var _FloatingToolbarHighlightColor = require("./ui/FloatingToolbarHighlightColor");
|
|
17
19
|
var _PrimaryToolbarHighlightColor = require("./ui/PrimaryToolbarHighlightColor");
|
|
18
20
|
var _toolbarComponent = require("./ui/toolbar-component");
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
19
23
|
var highlightPlugin = exports.highlightPlugin = function highlightPlugin(_ref) {
|
|
20
24
|
var _api$analytics;
|
|
21
25
|
var api = _ref.api;
|
|
@@ -54,9 +58,18 @@ var highlightPlugin = exports.highlightPlugin = function highlightPlugin(_ref) {
|
|
|
54
58
|
return {
|
|
55
59
|
name: 'highlight',
|
|
56
60
|
marks: function marks() {
|
|
61
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
62
|
+
return [{
|
|
63
|
+
name: 'backgroundColor',
|
|
64
|
+
mark: _adfSchema.backgroundColor
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
// color is defined in platform/packages/editor/adf-schema/src/next-schema/marks/color.ts
|
|
57
68
|
return [{
|
|
58
69
|
name: 'backgroundColor',
|
|
59
|
-
mark: _adfSchema.backgroundColor
|
|
70
|
+
mark: _objectSpread(_objectSpread({}, _adfSchema.backgroundColor), {}, {
|
|
71
|
+
excludes: 'color'
|
|
72
|
+
})
|
|
60
73
|
}];
|
|
61
74
|
},
|
|
62
75
|
commands: {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.highlightPluginKey = exports.createPlugin = exports.HighlightPluginAction = void 0;
|
|
7
|
+
exports.overrideMarks = exports.highlightPluginKey = exports.createPlugin = exports.HighlightPluginAction = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -18,6 +18,7 @@ var HighlightPluginAction = exports.HighlightPluginAction = /*#__PURE__*/functio
|
|
|
18
18
|
HighlightPluginAction[HighlightPluginAction["SET_PALETTE"] = 1] = "SET_PALETTE";
|
|
19
19
|
return HighlightPluginAction;
|
|
20
20
|
}({});
|
|
21
|
+
var overrideMarks = exports.overrideMarks = ['textColor'];
|
|
21
22
|
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
22
23
|
var api = _ref.api;
|
|
23
24
|
return new _safePlugin.SafePlugin({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
3
3
|
import { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
4
|
-
import {
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
+
import { HighlightPluginAction, highlightPluginKey, overrideMarks } from '../pm-plugins/main';
|
|
5
6
|
import { getActiveColor } from './color';
|
|
6
7
|
export const changeColor = editorAnalyticsAPI => ({
|
|
7
8
|
color,
|
|
@@ -26,6 +27,18 @@ export const changeColor = editorAnalyticsAPI => ({
|
|
|
26
27
|
type: HighlightPluginAction.CHANGE_COLOR,
|
|
27
28
|
color
|
|
28
29
|
});
|
|
30
|
+
const {
|
|
31
|
+
marks
|
|
32
|
+
} = tr.doc.type.schema;
|
|
33
|
+
if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
34
|
+
overrideMarks.forEach(mark => {
|
|
35
|
+
if (marks[mark]) {
|
|
36
|
+
removeMark(marks[mark])({
|
|
37
|
+
tr
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
29
42
|
toggleMark(backgroundColor, {
|
|
30
43
|
color
|
|
31
44
|
})({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { backgroundColor } from '@atlaskit/adf-schema';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { changeColor } from './editor-commands/change-color';
|
|
6
7
|
import { createHighlightPaddingPlugin } from './pm-plugins/highlight-padding';
|
|
@@ -49,9 +50,19 @@ export const highlightPlugin = ({
|
|
|
49
50
|
return {
|
|
50
51
|
name: 'highlight',
|
|
51
52
|
marks() {
|
|
53
|
+
if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
54
|
+
return [{
|
|
55
|
+
name: 'backgroundColor',
|
|
56
|
+
mark: backgroundColor
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
// color is defined in platform/packages/editor/adf-schema/src/next-schema/marks/color.ts
|
|
52
60
|
return [{
|
|
53
61
|
name: 'backgroundColor',
|
|
54
|
-
mark:
|
|
62
|
+
mark: {
|
|
63
|
+
...backgroundColor,
|
|
64
|
+
excludes: 'color'
|
|
65
|
+
}
|
|
55
66
|
}];
|
|
56
67
|
},
|
|
57
68
|
commands: {
|
|
@@ -8,6 +8,7 @@ export let HighlightPluginAction = /*#__PURE__*/function (HighlightPluginAction)
|
|
|
8
8
|
HighlightPluginAction[HighlightPluginAction["SET_PALETTE"] = 1] = "SET_PALETTE";
|
|
9
9
|
return HighlightPluginAction;
|
|
10
10
|
}({});
|
|
11
|
+
export const overrideMarks = ['textColor'];
|
|
11
12
|
export const createPlugin = ({
|
|
12
13
|
api
|
|
13
14
|
}) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
3
3
|
import { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
4
|
-
import {
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
+
import { HighlightPluginAction, highlightPluginKey, overrideMarks } from '../pm-plugins/main';
|
|
5
6
|
import { getActiveColor } from './color';
|
|
6
7
|
export var changeColor = function changeColor(editorAnalyticsAPI) {
|
|
7
8
|
return function (_ref) {
|
|
@@ -24,6 +25,16 @@ export var changeColor = function changeColor(editorAnalyticsAPI) {
|
|
|
24
25
|
type: HighlightPluginAction.CHANGE_COLOR,
|
|
25
26
|
color: color
|
|
26
27
|
});
|
|
28
|
+
var marks = tr.doc.type.schema.marks;
|
|
29
|
+
if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
30
|
+
overrideMarks.forEach(function (mark) {
|
|
31
|
+
if (marks[mark]) {
|
|
32
|
+
removeMark(marks[mark])({
|
|
33
|
+
tr: tr
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
27
38
|
toggleMark(backgroundColor, {
|
|
28
39
|
color: color
|
|
29
40
|
})({
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { backgroundColor } from '@atlaskit/adf-schema';
|
|
3
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
9
|
import { changeColor } from './editor-commands/change-color';
|
|
6
10
|
import { createHighlightPaddingPlugin } from './pm-plugins/highlight-padding';
|
|
@@ -47,9 +51,18 @@ export var highlightPlugin = function highlightPlugin(_ref) {
|
|
|
47
51
|
return {
|
|
48
52
|
name: 'highlight',
|
|
49
53
|
marks: function marks() {
|
|
54
|
+
if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
|
|
55
|
+
return [{
|
|
56
|
+
name: 'backgroundColor',
|
|
57
|
+
mark: backgroundColor
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
60
|
+
// color is defined in platform/packages/editor/adf-schema/src/next-schema/marks/color.ts
|
|
50
61
|
return [{
|
|
51
62
|
name: 'backgroundColor',
|
|
52
|
-
mark: backgroundColor
|
|
63
|
+
mark: _objectSpread(_objectSpread({}, backgroundColor), {}, {
|
|
64
|
+
excludes: 'color'
|
|
65
|
+
})
|
|
53
66
|
}];
|
|
54
67
|
},
|
|
55
68
|
commands: {
|
|
@@ -11,6 +11,7 @@ export var HighlightPluginAction = /*#__PURE__*/function (HighlightPluginAction)
|
|
|
11
11
|
HighlightPluginAction[HighlightPluginAction["SET_PALETTE"] = 1] = "SET_PALETTE";
|
|
12
12
|
return HighlightPluginAction;
|
|
13
13
|
}({});
|
|
14
|
+
export var overrideMarks = ['textColor'];
|
|
14
15
|
export var createPlugin = function createPlugin(_ref) {
|
|
15
16
|
var api = _ref.api;
|
|
16
17
|
return new SafePlugin({
|
|
@@ -12,6 +12,7 @@ export declare enum HighlightPluginAction {
|
|
|
12
12
|
CHANGE_COLOR = 0,
|
|
13
13
|
SET_PALETTE = 1
|
|
14
14
|
}
|
|
15
|
+
export declare const overrideMarks: string[];
|
|
15
16
|
export declare const createPlugin: ({ api, }: {
|
|
16
17
|
api: ExtractInjectionAPI<HighlightPlugin> | undefined;
|
|
17
18
|
}) => SafePlugin<HighlightPluginState>;
|
|
@@ -12,6 +12,7 @@ export declare enum HighlightPluginAction {
|
|
|
12
12
|
CHANGE_COLOR = 0,
|
|
13
13
|
SET_PALETTE = 1
|
|
14
14
|
}
|
|
15
|
+
export declare const overrideMarks: string[];
|
|
15
16
|
export declare const createPlugin: ({ api, }: {
|
|
16
17
|
api: ExtractInjectionAPI<HighlightPlugin> | undefined;
|
|
17
18
|
}) => SafePlugin<HighlightPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-highlight",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "Highlight plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"atlaskit:src": "src/index.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^52.
|
|
35
|
+
"@atlaskit/adf-schema": "^52.16.0",
|
|
36
36
|
"@atlaskit/css": "^0.19.0",
|
|
37
37
|
"@atlaskit/editor-palette": "^2.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^11.0.0",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
46
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
46
|
+
"@atlaskit/editor-toolbar": "^1.10.0",
|
|
47
47
|
"@atlaskit/editor-toolbar-model": "^0.5.0",
|
|
48
48
|
"@atlaskit/heading": "^5.4.0",
|
|
49
|
-
"@atlaskit/icon": "^35.
|
|
49
|
+
"@atlaskit/icon": "^35.4.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
51
|
"@atlaskit/primitives": "^19.0.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^89.0.0",
|
|
53
53
|
"@atlaskit/tokens": "^13.1.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^115.
|
|
58
|
+
"@atlaskit/editor-common": "^115.2.0",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
61
61
|
},
|