@atlaskit/editor-plugin-rule 30.0.3 → 30.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-rule
2
2
 
3
+ ## 30.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`85d826388ed61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85d826388ed61) -
8
+ [ux] [EDITOR-8341] introduce `Add text` and `Align text` to the divider toolbar controls behind
9
+ `platform_editor_lovability_dividers` and `platform_editor_lovability_dividers_m2`.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 30.0.3
4
16
 
5
17
  ### Patch Changes
package/compass.yml CHANGED
@@ -35,7 +35,7 @@ customFields:
35
35
  value: true
36
36
  - name: Reviewer Selection Mechanism
37
37
  type: text
38
- value: random(2)
38
+ value: randomTZIgnored(2)
39
39
  - name: Required Reviewer Approvals
40
40
  type: number
41
41
  value: 1
@@ -1,4 +1,4 @@
1
- /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.2 */
1
+ /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.4 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -7,21 +7,36 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getToolbarConfig = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ var _alignment = require("@atlaskit/editor-common/alignment");
11
+ var _alignmentIconMap = require("@atlaskit/editor-common/alignment-icon-map");
10
12
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
13
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
11
14
  var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
12
15
  var _rule = require("@atlaskit/editor-common/messages/rule");
16
+ var _Shortcut = require("@atlaskit/editor-common/Shortcut");
13
17
  var _text = require("@atlaskit/editor-palette/text");
14
18
  var _utils = require("@atlaskit/editor-prosemirror/utils");
15
19
  var _constants = require("@atlaskit/editor-shared-styles/constants");
20
+ var _alignTextCenterIcon = require("@atlaskit/editor-toolbar/align-text-center-icon");
21
+ var _alignTextLeftIcon = require("@atlaskit/editor-toolbar/align-text-left-icon");
22
+ var _alignTextRightIcon = require("@atlaskit/editor-toolbar/align-text-right-icon");
23
+ var _fieldTextIcon = require("@atlaskit/editor-toolbar/field-text-icon");
16
24
  var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
17
25
  var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
18
26
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
27
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
19
28
  var _commands = require("../pm-plugins/commands");
20
29
  var _dividerColorPalette = require("./dividerColorPalette");
21
30
  var _dividerColorPaletteMessages = require("./dividerColorPaletteMessages");
22
31
  var _DividerOptions = require("./DividerOptions");
23
32
  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
33
  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; }
34
+ var DividerAlignmentIcon = function DividerAlignmentIcon() {
35
+ return /*#__PURE__*/_react.default.createElement(_alignmentIconMap.AlignmentIconMap, {
36
+ alignment: "center",
37
+ size: "small"
38
+ });
39
+ };
25
40
  var getToolbarItems = function getToolbarItems(formatMessage, ruleNodeType, ruleAttrs, api) {
26
41
  var _api$decorations, _api$analytics4;
27
42
  var hoverDecoration = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration;
@@ -87,6 +102,66 @@ var getToolbarItems = function getToolbarItems(formatMessage, ruleNodeType, rule
87
102
  type: 'separator',
88
103
  fullHeight: true
89
104
  }];
105
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers_m2')) {
106
+ items.push({
107
+ id: 'divider-add-text',
108
+ testId: 'divider-add-text',
109
+ type: 'button',
110
+ showTitle: true,
111
+ title: formatMessage(_rule.ruleMessages.addText),
112
+ ariaLabel: formatMessage(_rule.ruleMessages.addText),
113
+ icon: _fieldTextIcon.FieldTextIcon,
114
+ onClick: function onClick() {
115
+ return false;
116
+ }
117
+ });
118
+ items.push({
119
+ id: 'divider-align-text',
120
+ testId: 'divider-align-text',
121
+ type: 'dropdown',
122
+ title: formatMessage(_rule.ruleMessages.alignText),
123
+ icon: DividerAlignmentIcon,
124
+ showSelected: false,
125
+ options: [{
126
+ id: 'divider-align-left',
127
+ title: formatMessage(_alignment.alignmentMessages.alignLeft),
128
+ icon: /*#__PURE__*/_react.default.createElement(_alignTextLeftIcon.AlignTextLeftIcon, {
129
+ label: "",
130
+ size: "small"
131
+ }),
132
+ elemAfter: /*#__PURE__*/_react.default.createElement(_Shortcut.Shortcut, null, (0, _keymaps.tooltip)(_keymaps.alignLeft)),
133
+ selected: false,
134
+ onClick: function onClick() {
135
+ return false;
136
+ }
137
+ }, {
138
+ id: 'divider-align-center',
139
+ title: formatMessage(_alignment.alignmentMessages.alignCenter),
140
+ icon: /*#__PURE__*/_react.default.createElement(_alignTextCenterIcon.AlignTextCenterIcon, {
141
+ label: "",
142
+ size: "small"
143
+ }),
144
+ elemAfter: /*#__PURE__*/_react.default.createElement(_Shortcut.Shortcut, null, (0, _keymaps.tooltip)(_keymaps.alignCenter)),
145
+ // TODO: EDITOR-8349 - center align is the default until alignment is implemented
146
+ selected: true,
147
+ onClick: function onClick() {
148
+ return false;
149
+ }
150
+ }, {
151
+ id: 'divider-align-right',
152
+ title: formatMessage(_alignment.alignmentMessages.alignRight),
153
+ icon: /*#__PURE__*/_react.default.createElement(_alignTextRightIcon.AlignTextRightIcon, {
154
+ label: "",
155
+ size: "small"
156
+ }),
157
+ elemAfter: /*#__PURE__*/_react.default.createElement(_Shortcut.Shortcut, null, (0, _keymaps.tooltip)(_keymaps.alignRight)),
158
+ selected: false,
159
+ onClick: function onClick() {
160
+ return false;
161
+ }
162
+ }]
163
+ });
164
+ }
90
165
  var overflowMenuItems = [{
91
166
  type: 'overflow-dropdown',
92
167
  options: [_objectSpread({
@@ -1,4 +1,4 @@
1
- /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.2 */
1
+ /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.4 */
2
2
  import "./DividerOptions.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useContext, useRef } from 'react';
@@ -1,17 +1,30 @@
1
1
  import React from 'react';
2
+ import { alignmentMessages } from '@atlaskit/editor-common/alignment';
3
+ import { AlignmentIconMap } from '@atlaskit/editor-common/alignment-icon-map';
2
4
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
5
+ import { alignLeft, alignCenter, alignRight, tooltip } from '@atlaskit/editor-common/keymaps';
3
6
  import commonMessages from '@atlaskit/editor-common/messages';
4
7
  import { ruleMessages } from '@atlaskit/editor-common/messages/rule';
8
+ import { Shortcut } from '@atlaskit/editor-common/Shortcut';
5
9
  import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette/text';
6
10
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
11
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/constants';
12
+ import { AlignTextCenterIcon } from '@atlaskit/editor-toolbar/align-text-center-icon';
13
+ import { AlignTextLeftIcon } from '@atlaskit/editor-toolbar/align-text-left-icon';
14
+ import { AlignTextRightIcon } from '@atlaskit/editor-toolbar/align-text-right-icon';
15
+ import { FieldTextIcon } from '@atlaskit/editor-toolbar/field-text-icon';
8
16
  import CopyIcon from '@atlaskit/icon/core/copy';
9
17
  import CustomizeIcon from '@atlaskit/icon/core/customize';
10
18
  import DeleteIcon from '@atlaskit/icon/core/delete';
19
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
20
  import { removeHorizontalRule, updateHorizontalRuleColor, updateHorizontalRuleStyle, updateHorizontalRuleWeight } from '../pm-plugins/commands';
12
21
  import { dividerColorPalette } from './dividerColorPalette';
13
22
  import { dividerPaletteTooltipMessages } from './dividerColorPaletteMessages';
14
23
  import { DividerOptions } from './DividerOptions';
24
+ const DividerAlignmentIcon = () => /*#__PURE__*/React.createElement(AlignmentIconMap, {
25
+ alignment: "center",
26
+ size: "small"
27
+ });
15
28
  const getToolbarItems = (formatMessage, ruleNodeType, ruleAttrs, api) => {
16
29
  var _api$decorations, _api$analytics4;
17
30
  const hoverDecoration = api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration;
@@ -70,6 +83,58 @@ const getToolbarItems = (formatMessage, ruleNodeType, ruleAttrs, api) => {
70
83
  type: 'separator',
71
84
  fullHeight: true
72
85
  }];
86
+ if (isExperimentEnabled('platform_editor_lovability_dividers_m2')) {
87
+ items.push({
88
+ id: 'divider-add-text',
89
+ testId: 'divider-add-text',
90
+ type: 'button',
91
+ showTitle: true,
92
+ title: formatMessage(ruleMessages.addText),
93
+ ariaLabel: formatMessage(ruleMessages.addText),
94
+ icon: FieldTextIcon,
95
+ onClick: () => false
96
+ });
97
+ items.push({
98
+ id: 'divider-align-text',
99
+ testId: 'divider-align-text',
100
+ type: 'dropdown',
101
+ title: formatMessage(ruleMessages.alignText),
102
+ icon: DividerAlignmentIcon,
103
+ showSelected: false,
104
+ options: [{
105
+ id: 'divider-align-left',
106
+ title: formatMessage(alignmentMessages.alignLeft),
107
+ icon: /*#__PURE__*/React.createElement(AlignTextLeftIcon, {
108
+ label: "",
109
+ size: "small"
110
+ }),
111
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignLeft)),
112
+ selected: false,
113
+ onClick: () => false
114
+ }, {
115
+ id: 'divider-align-center',
116
+ title: formatMessage(alignmentMessages.alignCenter),
117
+ icon: /*#__PURE__*/React.createElement(AlignTextCenterIcon, {
118
+ label: "",
119
+ size: "small"
120
+ }),
121
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignCenter)),
122
+ // TODO: EDITOR-8349 - center align is the default until alignment is implemented
123
+ selected: true,
124
+ onClick: () => false
125
+ }, {
126
+ id: 'divider-align-right',
127
+ title: formatMessage(alignmentMessages.alignRight),
128
+ icon: /*#__PURE__*/React.createElement(AlignTextRightIcon, {
129
+ label: "",
130
+ size: "small"
131
+ }),
132
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignRight)),
133
+ selected: false,
134
+ onClick: () => false
135
+ }]
136
+ });
137
+ }
73
138
  const overflowMenuItems = [{
74
139
  type: 'overflow-dropdown',
75
140
  options: [{
@@ -1,4 +1,4 @@
1
- /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.2 */
1
+ /* DividerOptions.tsx generated by @compiled/babel-plugin v3.0.4 */
2
2
  import "./DividerOptions.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useContext, useRef } from 'react';
@@ -2,19 +2,34 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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; }
4
4
  import React from 'react';
5
+ import { alignmentMessages } from '@atlaskit/editor-common/alignment';
6
+ import { AlignmentIconMap } from '@atlaskit/editor-common/alignment-icon-map';
5
7
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
8
+ import { alignLeft, alignCenter, alignRight, tooltip } from '@atlaskit/editor-common/keymaps';
6
9
  import commonMessages from '@atlaskit/editor-common/messages';
7
10
  import { ruleMessages } from '@atlaskit/editor-common/messages/rule';
11
+ import { Shortcut } from '@atlaskit/editor-common/Shortcut';
8
12
  import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette/text';
9
13
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
10
14
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/constants';
15
+ import { AlignTextCenterIcon } from '@atlaskit/editor-toolbar/align-text-center-icon';
16
+ import { AlignTextLeftIcon } from '@atlaskit/editor-toolbar/align-text-left-icon';
17
+ import { AlignTextRightIcon } from '@atlaskit/editor-toolbar/align-text-right-icon';
18
+ import { FieldTextIcon } from '@atlaskit/editor-toolbar/field-text-icon';
11
19
  import CopyIcon from '@atlaskit/icon/core/copy';
12
20
  import CustomizeIcon from '@atlaskit/icon/core/customize';
13
21
  import DeleteIcon from '@atlaskit/icon/core/delete';
22
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
14
23
  import { removeHorizontalRule, updateHorizontalRuleColor, updateHorizontalRuleStyle, updateHorizontalRuleWeight } from '../pm-plugins/commands';
15
24
  import { dividerColorPalette } from './dividerColorPalette';
16
25
  import { dividerPaletteTooltipMessages } from './dividerColorPaletteMessages';
17
26
  import { DividerOptions } from './DividerOptions';
27
+ var DividerAlignmentIcon = function DividerAlignmentIcon() {
28
+ return /*#__PURE__*/React.createElement(AlignmentIconMap, {
29
+ alignment: "center",
30
+ size: "small"
31
+ });
32
+ };
18
33
  var getToolbarItems = function getToolbarItems(formatMessage, ruleNodeType, ruleAttrs, api) {
19
34
  var _api$decorations, _api$analytics4;
20
35
  var hoverDecoration = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration;
@@ -80,6 +95,66 @@ var getToolbarItems = function getToolbarItems(formatMessage, ruleNodeType, rule
80
95
  type: 'separator',
81
96
  fullHeight: true
82
97
  }];
98
+ if (isExperimentEnabled('platform_editor_lovability_dividers_m2')) {
99
+ items.push({
100
+ id: 'divider-add-text',
101
+ testId: 'divider-add-text',
102
+ type: 'button',
103
+ showTitle: true,
104
+ title: formatMessage(ruleMessages.addText),
105
+ ariaLabel: formatMessage(ruleMessages.addText),
106
+ icon: FieldTextIcon,
107
+ onClick: function onClick() {
108
+ return false;
109
+ }
110
+ });
111
+ items.push({
112
+ id: 'divider-align-text',
113
+ testId: 'divider-align-text',
114
+ type: 'dropdown',
115
+ title: formatMessage(ruleMessages.alignText),
116
+ icon: DividerAlignmentIcon,
117
+ showSelected: false,
118
+ options: [{
119
+ id: 'divider-align-left',
120
+ title: formatMessage(alignmentMessages.alignLeft),
121
+ icon: /*#__PURE__*/React.createElement(AlignTextLeftIcon, {
122
+ label: "",
123
+ size: "small"
124
+ }),
125
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignLeft)),
126
+ selected: false,
127
+ onClick: function onClick() {
128
+ return false;
129
+ }
130
+ }, {
131
+ id: 'divider-align-center',
132
+ title: formatMessage(alignmentMessages.alignCenter),
133
+ icon: /*#__PURE__*/React.createElement(AlignTextCenterIcon, {
134
+ label: "",
135
+ size: "small"
136
+ }),
137
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignCenter)),
138
+ // TODO: EDITOR-8349 - center align is the default until alignment is implemented
139
+ selected: true,
140
+ onClick: function onClick() {
141
+ return false;
142
+ }
143
+ }, {
144
+ id: 'divider-align-right',
145
+ title: formatMessage(alignmentMessages.alignRight),
146
+ icon: /*#__PURE__*/React.createElement(AlignTextRightIcon, {
147
+ label: "",
148
+ size: "small"
149
+ }),
150
+ elemAfter: /*#__PURE__*/React.createElement(Shortcut, null, tooltip(alignRight)),
151
+ selected: false,
152
+ onClick: function onClick() {
153
+ return false;
154
+ }
155
+ }]
156
+ });
157
+ }
83
158
  var overflowMenuItems = [{
84
159
  type: 'overflow-dropdown',
85
160
  options: [_objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-rule",
3
- "version": "30.0.3",
3
+ "version": "30.1.0",
4
4
  "description": "Rule plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "atlaskit:src": "src/index.ts",
21
21
  "dependencies": {
22
22
  "@atlaskit/adf-schema": "^57.7.0",
23
- "@atlaskit/button": "^25.7.0",
23
+ "@atlaskit/button": "^25.8.0",
24
24
  "@atlaskit/css": "^1.1.0",
25
25
  "@atlaskit/docs": "^12.3.0",
26
26
  "@atlaskit/editor-palette": "^3.5.0",
@@ -28,25 +28,26 @@
28
28
  "@atlaskit/editor-plugin-floating-toolbar": "^32.0.0",
29
29
  "@atlaskit/editor-plugin-ui-control-registry": "^24.0.0",
30
30
  "@atlaskit/editor-prosemirror": "^9.0.0",
31
- "@atlaskit/editor-shared-styles": "^5.0.0",
32
- "@atlaskit/icon": "^38.0.0",
31
+ "@atlaskit/editor-shared-styles": "^5.1.0",
32
+ "@atlaskit/editor-toolbar": "^2.11.0",
33
+ "@atlaskit/icon": "^38.1.0",
33
34
  "@atlaskit/platform-feature-experiments": "^0.3.0",
34
35
  "@atlaskit/platform-feature-flags": "^2.2.0",
35
- "@atlaskit/primitives": "^22.6.0",
36
+ "@atlaskit/primitives": "^22.7.0",
36
37
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
37
- "@atlaskit/tokens": "^20.9.0",
38
+ "@atlaskit/tokens": "^20.12.0",
38
39
  "@babel/runtime": "^7.0.0",
39
40
  "@compiled/react": "^1.0.2",
40
41
  "bind-event-listener": "^3.0.0",
41
42
  "react-intl": "^7.0.0"
42
43
  },
43
44
  "peerDependencies": {
44
- "@atlaskit/editor-common": "^134.5.0",
45
+ "@atlaskit/editor-common": "^134.19.0",
45
46
  "react": "^18.2.0 || ^19.2.0",
46
47
  "react-dom": "^18.2.0 || ^19.2.0"
47
48
  },
48
49
  "devDependencies": {
49
- "@atlaskit/editor-common": "^134.5.0",
50
+ "@atlaskit/editor-common": "^134.19.0",
50
51
  "@testing-library/react": "^16.3.0",
51
52
  "react": "^19.2.0",
52
53
  "react-dom": "^19.2.0"