@atlaskit/editor-core 189.0.10 → 189.0.11
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 +7 -0
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/package.json +3 -2
- package/report.api.md +1 -12
- package/tmp/api-report-tmp.d.ts +1 -12
- package/dist/cjs/plugins/text-color/commands/change-color.js +0 -61
- package/dist/cjs/plugins/text-color/commands/remove-color.js +0 -59
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +0 -36
- package/dist/cjs/plugins/text-color/index.js +0 -75
- package/dist/cjs/plugins/text-color/pm-plugins/main.js +0 -88
- package/dist/cjs/plugins/text-color/types.js +0 -5
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/icon.js +0 -29
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +0 -285
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/styles.js +0 -38
- package/dist/cjs/plugins/text-color/utils/color.js +0 -54
- package/dist/cjs/plugins/text-color/utils/disabled.js +0 -32
- package/dist/es2019/plugins/text-color/commands/change-color.js +0 -54
- package/dist/es2019/plugins/text-color/commands/remove-color.js +0 -57
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +0 -30
- package/dist/es2019/plugins/text-color/index.js +0 -63
- package/dist/es2019/plugins/text-color/pm-plugins/main.js +0 -75
- package/dist/es2019/plugins/text-color/types.js +0 -1
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/icon.js +0 -20
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +0 -265
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/styles.js +0 -48
- package/dist/es2019/plugins/text-color/utils/color.js +0 -48
- package/dist/es2019/plugins/text-color/utils/disabled.js +0 -39
- package/dist/esm/plugins/text-color/commands/change-color.js +0 -56
- package/dist/esm/plugins/text-color/commands/remove-color.js +0 -53
- package/dist/esm/plugins/text-color/commands/toggle-color.js +0 -30
- package/dist/esm/plugins/text-color/index.js +0 -63
- package/dist/esm/plugins/text-color/pm-plugins/main.js +0 -75
- package/dist/esm/plugins/text-color/types.js +0 -1
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/icon.js +0 -22
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +0 -282
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/styles.js +0 -28
- package/dist/esm/plugins/text-color/utils/color.js +0 -48
- package/dist/esm/plugins/text-color/utils/disabled.js +0 -26
- package/dist/types/plugins/text-color/commands/change-color.d.ts +0 -3
- package/dist/types/plugins/text-color/commands/remove-color.d.ts +0 -2
- package/dist/types/plugins/text-color/commands/toggle-color.d.ts +0 -2
- package/dist/types/plugins/text-color/index.d.ts +0 -7
- package/dist/types/plugins/text-color/pm-plugins/main.d.ts +0 -25
- package/dist/types/plugins/text-color/types.d.ts +0 -10
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/icon.d.ts +0 -2
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -53
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/styles.d.ts +0 -3
- package/dist/types/plugins/text-color/utils/color.d.ts +0 -6
- package/dist/types/plugins/text-color/utils/disabled.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-color/commands/change-color.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-color/commands/remove-color.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-color/commands/toggle-color.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-color/index.d.ts +0 -7
- package/dist/types-ts4.5/plugins/text-color/pm-plugins/main.d.ts +0 -25
- package/dist/types-ts4.5/plugins/text-color/types.d.ts +0 -12
- package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/icon.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -53
- package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/styles.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-color/utils/color.d.ts +0 -6
- package/dist/types-ts4.5/plugins/text-color/utils/disabled.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42153](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42153) [`56e9ac7f76d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56e9ac7f76d) - Extract text-color plugin from editor-core into @atlaskit/editor-plugin-text-color.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 189.0.10
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -191,12 +191,6 @@ Object.defineProperty(exports, "tasksAndDecisionsPlugin", {
|
|
|
191
191
|
return _tasksAndDecisions.default;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
-
Object.defineProperty(exports, "textColorPlugin", {
|
|
195
|
-
enumerable: true,
|
|
196
|
-
get: function get() {
|
|
197
|
-
return _textColor.default;
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
194
|
Object.defineProperty(exports, "toolbarListsIndentationPlugin", {
|
|
201
195
|
enumerable: true,
|
|
202
196
|
get: function get() {
|
|
@@ -230,7 +224,6 @@ var _panel = _interopRequireDefault(require("./panel"));
|
|
|
230
224
|
var _paste = _interopRequireDefault(require("./paste"));
|
|
231
225
|
var _placeholderText = require("./placeholder-text");
|
|
232
226
|
var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
|
|
233
|
-
var _textColor = _interopRequireDefault(require("./text-color"));
|
|
234
227
|
var _breakout = _interopRequireDefault(require("./breakout"));
|
|
235
228
|
var _alignment = _interopRequireDefault(require("./alignment"));
|
|
236
229
|
var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
|
|
@@ -8,6 +8,7 @@ exports.default = createUniversalPreset;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _plugins = require("../plugins");
|
|
11
|
+
var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
|
|
11
12
|
var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
|
|
12
13
|
var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
|
|
13
14
|
var _editorPluginDate = require("@atlaskit/editor-plugin-date");
|
|
@@ -78,7 +79,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
78
79
|
return builder.add(plugin);
|
|
79
80
|
}
|
|
80
81
|
return builder;
|
|
81
|
-
}).maybeAdd(
|
|
82
|
+
}).maybeAdd(_editorPluginTextColor.textColorPlugin, function (plugin, builder) {
|
|
82
83
|
if (props.allowTextColor) {
|
|
83
84
|
return builder.add([plugin, props.allowTextColor]);
|
|
84
85
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "189.0.
|
|
8
|
+
var version = exports.version = "189.0.11";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -13,7 +13,6 @@ export { default as panelPlugin } from './panel';
|
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { placeholderTextPlugin } from './placeholder-text';
|
|
15
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
16
|
-
export { default as textColorPlugin } from './text-color';
|
|
17
16
|
export { default as breakoutPlugin } from './breakout';
|
|
18
17
|
export { default as alignmentPlugin } from './alignment';
|
|
19
18
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin,
|
|
1
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
|
|
2
|
+
import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
|
|
2
3
|
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
3
4
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
4
5
|
import { datePlugin } from '@atlaskit/editor-plugin-date';
|
|
@@ -13,7 +13,6 @@ export { default as panelPlugin } from './panel';
|
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { placeholderTextPlugin } from './placeholder-text';
|
|
15
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
16
|
-
export { default as textColorPlugin } from './text-color';
|
|
17
16
|
export { default as breakoutPlugin } from './breakout';
|
|
18
17
|
export { default as alignmentPlugin } from './alignment';
|
|
19
18
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
@@ -2,7 +2,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin,
|
|
5
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
|
|
6
|
+
import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
|
|
6
7
|
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
7
8
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
8
9
|
import { datePlugin } from '@atlaskit/editor-plugin-date';
|
|
@@ -13,7 +13,6 @@ export { default as panelPlugin } from './panel';
|
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { placeholderTextPlugin } from './placeholder-text';
|
|
15
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
16
|
-
export { default as textColorPlugin } from './text-color';
|
|
17
16
|
export { default as breakoutPlugin } from './breakout';
|
|
18
17
|
export { default as alignmentPlugin } from './alignment';
|
|
19
18
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
@@ -23,7 +23,7 @@ import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/typ
|
|
|
23
23
|
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
24
24
|
import type { PanelPluginConfig } from '../plugins/panel/types';
|
|
25
25
|
import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
|
|
26
|
-
import type { TextColorPluginConfig } from '
|
|
26
|
+
import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
|
|
27
27
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
28
28
|
import type { EditorAppearance } from './editor-appearance';
|
|
29
29
|
import type { EditorOnChangeHandler } from './editor-onchange';
|
|
@@ -13,7 +13,6 @@ export { default as panelPlugin } from './panel';
|
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { placeholderTextPlugin } from './placeholder-text';
|
|
15
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
16
|
-
export { default as textColorPlugin } from './text-color';
|
|
17
16
|
export { default as breakoutPlugin } from './breakout';
|
|
18
17
|
export { default as alignmentPlugin } from './alignment';
|
|
19
18
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
@@ -23,7 +23,7 @@ import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/typ
|
|
|
23
23
|
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
24
24
|
import type { PanelPluginConfig } from '../plugins/panel/types';
|
|
25
25
|
import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
|
|
26
|
-
import type { TextColorPluginConfig } from '
|
|
26
|
+
import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
|
|
27
27
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
28
28
|
import type { EditorAppearance } from './editor-appearance';
|
|
29
29
|
import type { EditorOnChangeHandler } from './editor-onchange';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.0.
|
|
3
|
+
"version": "189.0.11",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
61
61
|
"@atlaskit/editor-plugin-base": "^0.2.0",
|
|
62
62
|
"@atlaskit/editor-plugin-better-type-history": "^0.1.0",
|
|
63
|
-
"@atlaskit/editor-plugin-block-type": "^
|
|
63
|
+
"@atlaskit/editor-plugin-block-type": "^3.0.0",
|
|
64
64
|
"@atlaskit/editor-plugin-border": "^0.1.0",
|
|
65
65
|
"@atlaskit/editor-plugin-caption": "^0.2.0",
|
|
66
66
|
"@atlaskit/editor-plugin-card": "^0.10.0",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"@atlaskit/editor-plugin-status": "^0.1.0",
|
|
99
99
|
"@atlaskit/editor-plugin-submit-editor": "^0.1.0",
|
|
100
100
|
"@atlaskit/editor-plugin-table": "^5.3.0",
|
|
101
|
+
"@atlaskit/editor-plugin-text-color": "^0.1.0",
|
|
101
102
|
"@atlaskit/editor-plugin-text-formatting": "^0.4.0",
|
|
102
103
|
"@atlaskit/editor-plugin-type-ahead": "^0.7.0",
|
|
103
104
|
"@atlaskit/editor-plugin-unsupported-content": "^0.2.0",
|
package/report.api.md
CHANGED
|
@@ -82,6 +82,7 @@ import type { SearchProvider } from '@atlaskit/editor-common/provider-factory';
|
|
|
82
82
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
83
83
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision';
|
|
84
84
|
import { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
85
|
+
import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
|
|
85
86
|
import type { TextFormattingOptions } from '@atlaskit/editor-common/types';
|
|
86
87
|
import { ToolbarUIComponentFactory } from '@atlaskit/editor-common/types';
|
|
87
88
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -757,18 +758,6 @@ interface State {}
|
|
|
757
758
|
|
|
758
759
|
export { TeamMentionResource };
|
|
759
760
|
|
|
760
|
-
// @public (undocumented)
|
|
761
|
-
type TextColorDefaultColor = {
|
|
762
|
-
color: string;
|
|
763
|
-
label: string;
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
// @public (undocumented)
|
|
767
|
-
interface TextColorPluginConfig {
|
|
768
|
-
// (undocumented)
|
|
769
|
-
defaultColor?: TextColorDefaultColor;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
761
|
// @public (undocumented)
|
|
773
762
|
export function ToolbarFeedback(props: Props_3): jsx.JSX.Element;
|
|
774
763
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ import type { SearchProvider } from '@atlaskit/editor-common/provider-factory';
|
|
|
71
71
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
72
72
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision';
|
|
73
73
|
import { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
74
|
+
import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color';
|
|
74
75
|
import type { TextFormattingOptions } from '@atlaskit/editor-common/types';
|
|
75
76
|
import { ToolbarUIComponentFactory } from '@atlaskit/editor-common/types';
|
|
76
77
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -704,18 +705,6 @@ interface State {
|
|
|
704
705
|
|
|
705
706
|
export { TeamMentionResource }
|
|
706
707
|
|
|
707
|
-
// @public (undocumented)
|
|
708
|
-
type TextColorDefaultColor = {
|
|
709
|
-
color: string;
|
|
710
|
-
label: string;
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
// @public (undocumented)
|
|
714
|
-
interface TextColorPluginConfig {
|
|
715
|
-
// (undocumented)
|
|
716
|
-
defaultColor?: TextColorDefaultColor;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
708
|
// @public (undocumented)
|
|
720
709
|
export function ToolbarFeedback(props: Props_3): jsx.JSX.Element;
|
|
721
710
|
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.changeColor = void 0;
|
|
7
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
-
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
9
|
-
var _main = require("../pm-plugins/main");
|
|
10
|
-
var _color = require("../utils/color");
|
|
11
|
-
var _removeColor = require("./remove-color");
|
|
12
|
-
var _toggleColor = require("./toggle-color");
|
|
13
|
-
/**
|
|
14
|
-
* Helper to create a higher order analytics command
|
|
15
|
-
* @param newColor - Color to be change in hex code
|
|
16
|
-
* @param previousColor - Active color in hex code
|
|
17
|
-
* @param palette - Current palette of colors
|
|
18
|
-
* @return Higher order command with analytics logic inside.
|
|
19
|
-
*/
|
|
20
|
-
function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi) {
|
|
21
|
-
var newColorFromPalette = palette.find(function (_ref) {
|
|
22
|
-
var value = _ref.value;
|
|
23
|
-
return value === newColor;
|
|
24
|
-
});
|
|
25
|
-
var previousColorFromPalette = palette.find(function (_ref2) {
|
|
26
|
-
var value = _ref2.value;
|
|
27
|
-
return value === previousColor;
|
|
28
|
-
});
|
|
29
|
-
var newColorLabel = newColorFromPalette ? newColorFromPalette.label : newColor;
|
|
30
|
-
var previousColorLabel = previousColorFromPalette ? previousColorFromPalette.label : previousColor || '';
|
|
31
|
-
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
|
|
32
|
-
action: _analytics.ACTION.FORMATTED,
|
|
33
|
-
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
34
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_COLOR,
|
|
35
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
36
|
-
attributes: {
|
|
37
|
-
newColor: newColorLabel.toLowerCase(),
|
|
38
|
-
previousColor: previousColorLabel.toLowerCase()
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
var changeColor = exports.changeColor = function changeColor(color, editorAnalyticsApi) {
|
|
43
|
-
return function (state, dispatch) {
|
|
44
|
-
var textColor = state.schema.marks.textColor;
|
|
45
|
-
if (textColor) {
|
|
46
|
-
var pluginState = _main.pluginKey.getState(state);
|
|
47
|
-
var activeColor = (0, _color.getActiveColor)(state);
|
|
48
|
-
var withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || [], editorAnalyticsApi);
|
|
49
|
-
if (pluginState !== null && pluginState !== void 0 && pluginState.disabled) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if (color === (pluginState === null || pluginState === void 0 ? void 0 : pluginState.defaultColor)) {
|
|
53
|
-
withColorAnalytics((0, _removeColor.removeColor)())(state, dispatch);
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
withColorAnalytics((0, _toggleColor.toggleColor)(color))(state, dispatch);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeColor = void 0;
|
|
7
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
9
|
-
var _main = require("../pm-plugins/main");
|
|
10
|
-
var removeColor = exports.removeColor = function removeColor() {
|
|
11
|
-
return function (state, dispatch) {
|
|
12
|
-
var schema = state.schema,
|
|
13
|
-
selection = state.selection;
|
|
14
|
-
var textColor = schema.marks.textColor;
|
|
15
|
-
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
|
-
if (selection instanceof _cellSelection.CellSelection) {
|
|
27
|
-
/**
|
|
28
|
-
* This is a slight abstraction from `src/utils/commands.ts`
|
|
29
|
-
* The main difference is we can't toggle the default from another (since they are different marks),
|
|
30
|
-
* we want to remove all text color marks on the selection, so we slightly modify the cell selection
|
|
31
|
-
* part here.
|
|
32
|
-
*/
|
|
33
|
-
selection.forEachCell(function (cell, cellPos) {
|
|
34
|
-
var from = cellPos;
|
|
35
|
-
var to = cellPos + cell.nodeSize;
|
|
36
|
-
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), function (node, pos) {
|
|
37
|
-
if (!node.isText) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// This is an issue when the user selects some text.
|
|
42
|
-
// We need to check if the current node position is less than the range selection from.
|
|
43
|
-
// If it’s true, that means we should apply the mark using the range selection,
|
|
44
|
-
// not the current node position.
|
|
45
|
-
var nodeBetweenFrom = Math.max(pos, tr.mapping.map(from));
|
|
46
|
-
var nodeBetweenTo = Math.min(pos + node.nodeSize, tr.mapping.map(to));
|
|
47
|
-
tr.removeMark(nodeBetweenFrom, nodeBetweenTo, textColor);
|
|
48
|
-
return true;
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (dispatch) {
|
|
53
|
-
dispatch(tr.setMeta(_main.pluginKey, {
|
|
54
|
-
action: _main.ACTIONS.RESET_COLOR
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toggleColor = void 0;
|
|
7
|
-
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
|
-
var _preset = require("@atlaskit/editor-common/preset");
|
|
9
|
-
var _main = require("../pm-plugins/main");
|
|
10
|
-
var _disabled = require("../utils/disabled");
|
|
11
|
-
var toggleColor = exports.toggleColor = function toggleColor(color) {
|
|
12
|
-
return function (state, dispatch) {
|
|
13
|
-
var textColor = state.schema.marks.textColor;
|
|
14
|
-
var tr = state.tr;
|
|
15
|
-
var disabledState = (0, _disabled.getDisabledState)(state);
|
|
16
|
-
if (disabledState) {
|
|
17
|
-
if (dispatch) {
|
|
18
|
-
dispatch(tr.setMeta(_main.pluginKey, {
|
|
19
|
-
action: _main.ACTIONS.DISABLE
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (dispatch) {
|
|
25
|
-
state.tr.setMeta(_main.pluginKey, {
|
|
26
|
-
action: _main.ACTIONS.SET_COLOR,
|
|
27
|
-
color: color
|
|
28
|
-
});
|
|
29
|
-
state.tr.scrollIntoView();
|
|
30
|
-
(0, _preset.editorCommandToPMCommand)((0, _mark.toggleMark)(textColor, {
|
|
31
|
-
color: color
|
|
32
|
-
}))(state, dispatch);
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
Object.defineProperty(exports, "textColorPluginKey", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _main.pluginKey;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
17
|
-
var _main = require("./pm-plugins/main");
|
|
18
|
-
var _ToolbarTextColor = _interopRequireDefault(require("./ui/ToolbarTextColor"));
|
|
19
|
-
var pluginConfig = function pluginConfig(textColorConfig) {
|
|
20
|
-
if (!textColorConfig || typeof textColorConfig === 'boolean') {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
return textColorConfig;
|
|
24
|
-
};
|
|
25
|
-
var textColorPlugin = function textColorPlugin(_ref) {
|
|
26
|
-
var textColorConfig = _ref.config,
|
|
27
|
-
api = _ref.api;
|
|
28
|
-
return {
|
|
29
|
-
name: 'textColor',
|
|
30
|
-
marks: function marks() {
|
|
31
|
-
return [{
|
|
32
|
-
name: 'textColor',
|
|
33
|
-
mark: _adfSchema.textColor
|
|
34
|
-
}];
|
|
35
|
-
},
|
|
36
|
-
pmPlugins: function pmPlugins() {
|
|
37
|
-
return [{
|
|
38
|
-
name: 'textColor',
|
|
39
|
-
plugin: function plugin(_ref2) {
|
|
40
|
-
var dispatch = _ref2.dispatch;
|
|
41
|
-
return (0, _main.createPlugin)(dispatch, pluginConfig(textColorConfig));
|
|
42
|
-
}
|
|
43
|
-
}];
|
|
44
|
-
},
|
|
45
|
-
primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
|
|
46
|
-
var editorView = _ref3.editorView,
|
|
47
|
-
popupsMountPoint = _ref3.popupsMountPoint,
|
|
48
|
-
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
49
|
-
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
50
|
-
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing,
|
|
51
|
-
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
52
|
-
disabled = _ref3.disabled;
|
|
53
|
-
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
54
|
-
plugins: {
|
|
55
|
-
textColor: _main.pluginKey
|
|
56
|
-
},
|
|
57
|
-
render: function render(_ref4) {
|
|
58
|
-
var textColor = _ref4.textColor;
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default, {
|
|
60
|
-
pluginState: textColor,
|
|
61
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
62
|
-
editorView: editorView,
|
|
63
|
-
popupsMountPoint: popupsMountPoint,
|
|
64
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
65
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
66
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
67
|
-
disabled: disabled,
|
|
68
|
-
pluginInjectionApi: api
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
var _default = exports.default = textColorPlugin;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ACTIONS = void 0;
|
|
8
|
-
Object.defineProperty(exports, "DEFAULT_COLOR", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _color.DEFAULT_COLOR;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
exports.createPlugin = createPlugin;
|
|
15
|
-
exports.pluginKey = void 0;
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
18
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
19
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
20
|
-
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
21
|
-
var _color = require("../utils/color");
|
|
22
|
-
var _disabled = require("../utils/disabled");
|
|
23
|
-
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
|
-
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
|
-
function createInitialPluginState(editorState, pluginConfig) {
|
|
26
|
-
var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || _color.DEFAULT_COLOR;
|
|
27
|
-
var palette = [{
|
|
28
|
-
value: defaultColor.color,
|
|
29
|
-
label: defaultColor.label,
|
|
30
|
-
border: _uiColor.DEFAULT_BORDER_COLOR
|
|
31
|
-
}].concat((0, _toConsumableArray2.default)(_uiColor.textColorPalette));
|
|
32
|
-
var state = {
|
|
33
|
-
color: (0, _color.getActiveColor)(editorState),
|
|
34
|
-
disabled: (0, _disabled.getDisabledState)(editorState),
|
|
35
|
-
palette: palette,
|
|
36
|
-
defaultColor: defaultColor.color
|
|
37
|
-
};
|
|
38
|
-
return state;
|
|
39
|
-
}
|
|
40
|
-
var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
41
|
-
ACTIONS[ACTIONS["RESET_COLOR"] = 0] = "RESET_COLOR";
|
|
42
|
-
ACTIONS[ACTIONS["SET_COLOR"] = 1] = "SET_COLOR";
|
|
43
|
-
ACTIONS[ACTIONS["DISABLE"] = 2] = "DISABLE";
|
|
44
|
-
return ACTIONS;
|
|
45
|
-
}({});
|
|
46
|
-
var pluginKey = exports.pluginKey = new _state.PluginKey('textColorPlugin');
|
|
47
|
-
function createPlugin(dispatch, pluginConfig) {
|
|
48
|
-
return new _safePlugin.SafePlugin({
|
|
49
|
-
key: pluginKey,
|
|
50
|
-
state: {
|
|
51
|
-
init: function init(_config, editorState) {
|
|
52
|
-
return createInitialPluginState(editorState, pluginConfig);
|
|
53
|
-
},
|
|
54
|
-
apply: function apply(tr, pluginState, _, newState) {
|
|
55
|
-
var meta = tr.getMeta(pluginKey) || {};
|
|
56
|
-
var nextState;
|
|
57
|
-
switch (meta.action) {
|
|
58
|
-
case ACTIONS.RESET_COLOR:
|
|
59
|
-
nextState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
60
|
-
color: pluginState.defaultColor
|
|
61
|
-
});
|
|
62
|
-
break;
|
|
63
|
-
case ACTIONS.SET_COLOR:
|
|
64
|
-
nextState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
65
|
-
color: meta.color,
|
|
66
|
-
disabled: false
|
|
67
|
-
});
|
|
68
|
-
break;
|
|
69
|
-
case ACTIONS.DISABLE:
|
|
70
|
-
nextState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
71
|
-
disabled: true
|
|
72
|
-
});
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
nextState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
76
|
-
color: (0, _color.getActiveColor)(newState),
|
|
77
|
-
disabled: (0, _disabled.getDisabledState)(newState)
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (pluginState && pluginState.color !== nextState.color || pluginState && pluginState.disabled !== nextState.disabled) {
|
|
81
|
-
dispatch(pluginKey, nextState);
|
|
82
|
-
return nextState;
|
|
83
|
-
}
|
|
84
|
-
return pluginState;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.EditorTextColorIcon = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _base = _interopRequireDefault(require("@atlaskit/icon/base"));
|
|
11
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
12
|
-
|
|
13
|
-
var textColorGlyph = function textColorGlyph(props) {
|
|
14
|
-
return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({}, props, {
|
|
15
|
-
width: "24",
|
|
16
|
-
height: "24",
|
|
17
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
19
|
-
d: "M14 12.5h-4l-.874 2.186A.5.5 0 0 1 8.66 15H7.273a.5.5 0 0 1-.456-.705l4.05-9A.5.5 0 0 1 11.323 5h1.354a.5.5 0 0 1 .456.295l4.05 9a.5.5 0 0 1-.456.705h-1.388a.5.5 0 0 1-.465-.314L14 12.5zm-.6-1.5L12 7.5 10.6 11h2.8z",
|
|
20
|
-
fill: "currentColor",
|
|
21
|
-
fillRule: "evenodd"
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
var EditorTextColorIcon = exports.EditorTextColorIcon = function EditorTextColorIcon() {
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement(_base.default, {
|
|
26
|
-
glyph: textColorGlyph,
|
|
27
|
-
label: ""
|
|
28
|
-
});
|
|
29
|
-
};
|