@atlaskit/editor-plugin-selection-toolbar 1.7.0 → 1.8.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,18 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#113466](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113466)
8
+ [`756bb7e35a24d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/756bb7e35a24d) -
9
+ Add new FloatingToolbarOverflowDropdown item to floating toolbar config to support new editor
10
+ controls, add config in selection-toolbar plugin to add new button to text selection
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 1.7.0
4
17
 
5
18
  ### Minor Changes
@@ -14,6 +14,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
15
  var _commands = require("./pm-plugins/commands");
16
16
  var _pluginKey = require("./pm-plugins/plugin-key");
17
+ var _overflowToolbarConfig = require("./ui/overflow-toolbar-config");
17
18
  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; }
18
19
  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
20
  var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selectionToolbarPlugin(options) {
@@ -166,6 +167,9 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
166
167
  }
167
168
  }
168
169
  }
170
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
171
+ items.push.apply(items, (0, _toConsumableArray2.default)(_overflowToolbarConfig.overflowToolbarConfig));
172
+ }
169
173
  var calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? _utils.calculateToolbarPositionAboveSelection : _utils.calculateToolbarPositionTrackHead;
170
174
  var toolbarTitle = 'Selection toolbar';
171
175
  var onPositionCalculated = calcToolbarPosition(toolbarTitle);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ContextualToolbarIcon = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var ContextualToolbarIcon = exports.ContextualToolbarIcon = function ContextualToolbarIcon(props) {
10
+ var primaryColor = props.primaryColor,
11
+ label = props.label;
12
+ return /*#__PURE__*/_react.default.createElement("svg", {
13
+ width: "16",
14
+ height: "16",
15
+ viewBox: "0 0 16 16",
16
+ style: {
17
+ color: primaryColor,
18
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
19
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
20
+ },
21
+ "aria-label": label || undefined,
22
+ role: label ? 'img' : 'presentation'
23
+ }, /*#__PURE__*/_react.default.createElement("path", {
24
+ "fill-rule": "evenodd",
25
+ "clip-rule": "evenodd",
26
+ d: "M14 8.75H2V7.25H14V8.75Z",
27
+ fill: "currentColor"
28
+ }));
29
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.FixedToolbarIcon = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var FixedToolbarIcon = exports.FixedToolbarIcon = function FixedToolbarIcon(props) {
10
+ var primaryColor = props.primaryColor,
11
+ label = props.label;
12
+ return /*#__PURE__*/_react.default.createElement("svg", {
13
+ width: "16",
14
+ height: "16",
15
+ viewBox: "0 0 16 16",
16
+ style: {
17
+ color: primaryColor,
18
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
19
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
20
+ },
21
+ "aria-label": label || undefined,
22
+ role: label ? 'img' : 'presentation'
23
+ }, /*#__PURE__*/_react.default.createElement("rect", {
24
+ x: "0.75",
25
+ y: "1.00586",
26
+ width: "14.5",
27
+ height: "13.9879",
28
+ rx: "2.25",
29
+ stroke: "currentColor",
30
+ "stroke-width": "1.5"
31
+ }), /*#__PURE__*/_react.default.createElement("rect", {
32
+ x: "4",
33
+ y: "3.75586",
34
+ width: "8",
35
+ height: "1.5",
36
+ fill: "currentColor"
37
+ }));
38
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.overflowToolbarConfig = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _ContextualToolbarIcon = require("./icons/ContextualToolbarIcon");
10
+ var _FixedToolbarIcon = require("./icons/FixedToolbarIcon");
11
+ // New editor controls
12
+ var overflowToolbarConfig = exports.overflowToolbarConfig = [{
13
+ type: 'separator'
14
+ }, {
15
+ type: 'overflow-dropdown',
16
+ options: [{
17
+ type: 'separator'
18
+ }, {
19
+ type: 'overflow-dropdown-heading',
20
+ title: 'Toolbar position'
21
+ }, {
22
+ title: 'Contextual',
23
+ onClick: function onClick() {
24
+ return true;
25
+ },
26
+ icon: /*#__PURE__*/_react.default.createElement(_ContextualToolbarIcon.ContextualToolbarIcon, {
27
+ label: "Contextual toolbar"
28
+ })
29
+ }, {
30
+ title: 'Fixed at top',
31
+ onClick: function onClick() {
32
+ return true;
33
+ },
34
+ icon: /*#__PURE__*/_react.default.createElement(_FixedToolbarIcon.FixedToolbarIcon, {
35
+ label: "Fixed toolbar"
36
+ })
37
+ }]
38
+ }];
@@ -5,6 +5,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { toggleToolbar } from './pm-plugins/commands';
7
7
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
8
+ import { overflowToolbarConfig } from './ui/overflow-toolbar-config';
8
9
  export const selectionToolbarPlugin = options => {
9
10
  const __selectionToolbarHandlers = [];
10
11
  return {
@@ -155,6 +156,9 @@ export const selectionToolbarPlugin = options => {
155
156
  }
156
157
  }
157
158
  }
159
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
160
+ items.push(...overflowToolbarConfig);
161
+ }
158
162
  const calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
159
163
  const toolbarTitle = 'Selection toolbar';
160
164
  const onPositionCalculated = calcToolbarPosition(toolbarTitle);
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ export const ContextualToolbarIcon = props => {
3
+ const {
4
+ primaryColor,
5
+ label
6
+ } = props;
7
+ return /*#__PURE__*/React.createElement("svg", {
8
+ width: "16",
9
+ height: "16",
10
+ viewBox: "0 0 16 16",
11
+ style: {
12
+ color: primaryColor,
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
14
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
15
+ },
16
+ "aria-label": label || undefined,
17
+ role: label ? 'img' : 'presentation'
18
+ }, /*#__PURE__*/React.createElement("path", {
19
+ "fill-rule": "evenodd",
20
+ "clip-rule": "evenodd",
21
+ d: "M14 8.75H2V7.25H14V8.75Z",
22
+ fill: "currentColor"
23
+ }));
24
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ export const FixedToolbarIcon = props => {
3
+ const {
4
+ primaryColor,
5
+ label
6
+ } = props;
7
+ return /*#__PURE__*/React.createElement("svg", {
8
+ width: "16",
9
+ height: "16",
10
+ viewBox: "0 0 16 16",
11
+ style: {
12
+ color: primaryColor,
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
14
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
15
+ },
16
+ "aria-label": label || undefined,
17
+ role: label ? 'img' : 'presentation'
18
+ }, /*#__PURE__*/React.createElement("rect", {
19
+ x: "0.75",
20
+ y: "1.00586",
21
+ width: "14.5",
22
+ height: "13.9879",
23
+ rx: "2.25",
24
+ stroke: "currentColor",
25
+ "stroke-width": "1.5"
26
+ }), /*#__PURE__*/React.createElement("rect", {
27
+ x: "4",
28
+ y: "3.75586",
29
+ width: "8",
30
+ height: "1.5",
31
+ fill: "currentColor"
32
+ }));
33
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { ContextualToolbarIcon } from './icons/ContextualToolbarIcon';
3
+ import { FixedToolbarIcon } from './icons/FixedToolbarIcon';
4
+
5
+ // New editor controls
6
+ export const overflowToolbarConfig = [{
7
+ type: 'separator'
8
+ }, {
9
+ type: 'overflow-dropdown',
10
+ options: [{
11
+ type: 'separator'
12
+ }, {
13
+ type: 'overflow-dropdown-heading',
14
+ title: 'Toolbar position'
15
+ }, {
16
+ title: 'Contextual',
17
+ onClick: () => {
18
+ return true;
19
+ },
20
+ icon: /*#__PURE__*/React.createElement(ContextualToolbarIcon, {
21
+ label: "Contextual toolbar"
22
+ })
23
+ }, {
24
+ title: 'Fixed at top',
25
+ onClick: () => {
26
+ return true;
27
+ },
28
+ icon: /*#__PURE__*/React.createElement(FixedToolbarIcon, {
29
+ label: "Fixed toolbar"
30
+ })
31
+ }]
32
+ }];
@@ -9,6 +9,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
10
  import { toggleToolbar } from './pm-plugins/commands';
11
11
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
12
+ import { overflowToolbarConfig } from './ui/overflow-toolbar-config';
12
13
  export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
13
14
  var __selectionToolbarHandlers = [];
14
15
  return {
@@ -159,6 +160,9 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
159
160
  }
160
161
  }
161
162
  }
163
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
164
+ items.push.apply(items, _toConsumableArray(overflowToolbarConfig));
165
+ }
162
166
  var calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
163
167
  var toolbarTitle = 'Selection toolbar';
164
168
  var onPositionCalculated = calcToolbarPosition(toolbarTitle);
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export var ContextualToolbarIcon = function ContextualToolbarIcon(props) {
3
+ var primaryColor = props.primaryColor,
4
+ label = props.label;
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ style: {
10
+ color: primaryColor,
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
12
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
13
+ },
14
+ "aria-label": label || undefined,
15
+ role: label ? 'img' : 'presentation'
16
+ }, /*#__PURE__*/React.createElement("path", {
17
+ "fill-rule": "evenodd",
18
+ "clip-rule": "evenodd",
19
+ d: "M14 8.75H2V7.25H14V8.75Z",
20
+ fill: "currentColor"
21
+ }));
22
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ export var FixedToolbarIcon = function FixedToolbarIcon(props) {
3
+ var primaryColor = props.primaryColor,
4
+ label = props.label;
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ style: {
10
+ color: primaryColor,
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
12
+ fill: "var(--ds-background-neutral-subtle, #00000000)"
13
+ },
14
+ "aria-label": label || undefined,
15
+ role: label ? 'img' : 'presentation'
16
+ }, /*#__PURE__*/React.createElement("rect", {
17
+ x: "0.75",
18
+ y: "1.00586",
19
+ width: "14.5",
20
+ height: "13.9879",
21
+ rx: "2.25",
22
+ stroke: "currentColor",
23
+ "stroke-width": "1.5"
24
+ }), /*#__PURE__*/React.createElement("rect", {
25
+ x: "4",
26
+ y: "3.75586",
27
+ width: "8",
28
+ height: "1.5",
29
+ fill: "currentColor"
30
+ }));
31
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { ContextualToolbarIcon } from './icons/ContextualToolbarIcon';
3
+ import { FixedToolbarIcon } from './icons/FixedToolbarIcon';
4
+
5
+ // New editor controls
6
+ export var overflowToolbarConfig = [{
7
+ type: 'separator'
8
+ }, {
9
+ type: 'overflow-dropdown',
10
+ options: [{
11
+ type: 'separator'
12
+ }, {
13
+ type: 'overflow-dropdown-heading',
14
+ title: 'Toolbar position'
15
+ }, {
16
+ title: 'Contextual',
17
+ onClick: function onClick() {
18
+ return true;
19
+ },
20
+ icon: /*#__PURE__*/React.createElement(ContextualToolbarIcon, {
21
+ label: "Contextual toolbar"
22
+ })
23
+ }, {
24
+ title: 'Fixed at top',
25
+ onClick: function onClick() {
26
+ return true;
27
+ },
28
+ icon: /*#__PURE__*/React.createElement(FixedToolbarIcon, {
29
+ label: "Fixed toolbar"
30
+ })
31
+ }]
32
+ }];
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SVGProps } from '@atlaskit/icon/types';
3
+ export declare const ContextualToolbarIcon: (props: SVGProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SVGProps } from '@atlaskit/icon/types';
3
+ export declare const FixedToolbarIcon: (props: SVGProps) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
+ export declare const overflowToolbarConfig: FloatingToolbarItem<Command>[];
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SVGProps } from '@atlaskit/icon/types';
3
+ export declare const ContextualToolbarIcon: (props: SVGProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SVGProps } from '@atlaskit/icon/types';
3
+ export declare const FixedToolbarIcon: (props: SVGProps) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
+ export declare const overflowToolbarConfig: FloatingToolbarItem<Command>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,11 +31,11 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^99.10.0",
34
+ "@atlaskit/editor-common": "^99.15.0",
35
35
  "@atlaskit/editor-plugin-editor-viewmode": "^2.2.0",
36
36
  "@atlaskit/editor-prosemirror": "7.0.0",
37
37
  "@atlaskit/platform-feature-flags": "^1.0.0",
38
- "@atlaskit/tmp-editor-statsig": "^2.43.0",
38
+ "@atlaskit/tmp-editor-statsig": "^2.46.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "bind-event-listener": "^3.0.0"
41
41
  },