@atlaskit/editor-plugin-toolbar 0.3.0 → 0.3.1
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 +13 -0
- package/dist/cjs/ui/{TextSection.js → Section.js} +14 -6
- package/dist/cjs/ui/SelectionToolbar/index.js +1 -1
- package/dist/cjs/ui/consts.js +2 -2
- package/dist/cjs/ui/toolbar-components.js +49 -7
- package/dist/es2019/ui/{TextSection.js → Section.js} +14 -6
- package/dist/es2019/ui/SelectionToolbar/index.js +2 -2
- package/dist/es2019/ui/consts.js +1 -1
- package/dist/es2019/ui/toolbar-components.js +47 -7
- package/dist/esm/ui/{TextSection.js → Section.js} +14 -6
- package/dist/esm/ui/SelectionToolbar/index.js +2 -2
- package/dist/esm/ui/consts.js +1 -1
- package/dist/esm/ui/toolbar-components.js +51 -9
- package/dist/{types-ts4.5/ui/TextSection.d.ts → types/ui/Section.d.ts} +5 -2
- package/dist/types/ui/consts.d.ts +1 -1
- package/dist/{types/ui/TextSection.d.ts → types-ts4.5/ui/Section.d.ts} +5 -2
- package/dist/types-ts4.5/ui/consts.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`286abb4d35eba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/286abb4d35eba) -
|
|
8
|
+
[ux] [ED-28960] Finish full page primary toolbar migration
|
|
9
|
+
|
|
10
|
+
- Align with design update (separator, gap, height, icon size)
|
|
11
|
+
- Add keyboard shortcut to focus toolbar and arrow key navigation
|
|
12
|
+
- Address accessibility
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.3.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.Section = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
10
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
11
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var
|
|
12
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking) {
|
|
13
13
|
if (editMode === 'view') {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
@@ -21,19 +21,27 @@ var shouldShowTextSection = function shouldShowTextSection(editMode, toolbar, to
|
|
|
21
21
|
}
|
|
22
22
|
return false;
|
|
23
23
|
};
|
|
24
|
-
var
|
|
24
|
+
var Section = exports.Section = function Section(_ref) {
|
|
25
25
|
var children = _ref.children,
|
|
26
26
|
parents = _ref.parents,
|
|
27
|
-
api = _ref.api
|
|
27
|
+
api = _ref.api,
|
|
28
|
+
testId = _ref.testId,
|
|
29
|
+
showSeparatorInFullPagePrimaryToolbar = _ref.showSeparatorInFullPagePrimaryToolbar,
|
|
30
|
+
_ref$isSharedSection = _ref.isSharedSection,
|
|
31
|
+
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection;
|
|
28
32
|
var editMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
29
33
|
var toolbarDocking = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
30
34
|
var toolbar = parents.find(function (parent) {
|
|
31
35
|
return parent.type === 'toolbar';
|
|
32
36
|
});
|
|
33
|
-
|
|
37
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
38
|
+
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
39
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
34
40
|
return null;
|
|
35
41
|
}
|
|
42
|
+
var isFullPage = editorAppearance === 'full-page';
|
|
36
43
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarSection, {
|
|
37
|
-
testId:
|
|
44
|
+
testId: testId,
|
|
45
|
+
hasSeparator: showSeparatorInFullPagePrimaryToolbar && isFullPage
|
|
38
46
|
}, children);
|
|
39
47
|
};
|
|
@@ -46,7 +46,7 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
46
46
|
offset: [0, 10],
|
|
47
47
|
target: getDomRefFromSelection(editorView),
|
|
48
48
|
onPositionCalculated: function onPositionCalculated(position) {
|
|
49
|
-
return (0, _utils.calculateToolbarPositionTrackHead)(_consts.
|
|
49
|
+
return (0, _utils.calculateToolbarPositionTrackHead)(_consts.SELECTION_TOOLBAR_LABEL)(editorView, position);
|
|
50
50
|
},
|
|
51
51
|
mountTo: mountPoint
|
|
52
52
|
}, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.SELECTION_TOOLBAR_LABEL = void 0;
|
|
7
|
+
var SELECTION_TOOLBAR_LABEL = exports.SELECTION_TOOLBAR_LABEL = 'Selection toolbar';
|
|
@@ -10,7 +10,7 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
|
10
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
11
|
var _consts = require("./consts");
|
|
12
12
|
var _OverflowMenu = require("./OverflowMenu");
|
|
13
|
-
var
|
|
13
|
+
var _Section = require("./Section");
|
|
14
14
|
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api) {
|
|
15
15
|
return [{
|
|
16
16
|
type: 'toolbar',
|
|
@@ -18,7 +18,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
18
18
|
component: function component(_ref) {
|
|
19
19
|
var children = _ref.children;
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.Toolbar, {
|
|
21
|
-
label: _consts.
|
|
21
|
+
label: _consts.SELECTION_TOOLBAR_LABEL
|
|
22
22
|
}, children);
|
|
23
23
|
}
|
|
24
24
|
}, {
|
|
@@ -27,7 +27,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
27
27
|
component: function component(_ref2) {
|
|
28
28
|
var children = _ref2.children;
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.PrimaryToolbar, {
|
|
30
|
-
label:
|
|
30
|
+
label: 'Primary Toolbar'
|
|
31
31
|
}, children);
|
|
32
32
|
}
|
|
33
33
|
}, {
|
|
@@ -45,9 +45,51 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
45
45
|
component: function component(_ref3) {
|
|
46
46
|
var children = _ref3.children,
|
|
47
47
|
parents = _ref3.parents;
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_Section.Section, {
|
|
49
49
|
parents: parents,
|
|
50
|
-
api: api
|
|
50
|
+
api: api,
|
|
51
|
+
testId: "text-section"
|
|
52
|
+
}, children);
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
type: _toolbar.INSERT_BLOCK_SECTION.type,
|
|
56
|
+
key: _toolbar.INSERT_BLOCK_SECTION.key,
|
|
57
|
+
parents: [{
|
|
58
|
+
type: 'toolbar',
|
|
59
|
+
key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
|
|
60
|
+
rank: _toolbar.TOOLBAR_RANK[_toolbar.INSERT_BLOCK_SECTION.key]
|
|
61
|
+
}],
|
|
62
|
+
component: function component(_ref4) {
|
|
63
|
+
var children = _ref4.children,
|
|
64
|
+
parents = _ref4.parents;
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(_Section.Section, {
|
|
66
|
+
testId: "insert-block-section",
|
|
67
|
+
parents: parents,
|
|
68
|
+
api: api,
|
|
69
|
+
showSeparatorInFullPagePrimaryToolbar: true,
|
|
70
|
+
isSharedSection: false
|
|
71
|
+
}, children);
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
type: _toolbar.LINKING_SECTION.type,
|
|
75
|
+
key: _toolbar.LINKING_SECTION.key,
|
|
76
|
+
parents: [{
|
|
77
|
+
type: 'toolbar',
|
|
78
|
+
key: _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
79
|
+
rank: _toolbar.TOOLBAR_RANK[_toolbar.LINKING_SECTION.key]
|
|
80
|
+
}, {
|
|
81
|
+
type: 'toolbar',
|
|
82
|
+
key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
|
|
83
|
+
rank: _toolbar.TOOLBAR_RANK[_toolbar.LINKING_SECTION.key]
|
|
84
|
+
}],
|
|
85
|
+
component: function component(_ref5) {
|
|
86
|
+
var children = _ref5.children,
|
|
87
|
+
parents = _ref5.parents;
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_Section.Section, {
|
|
89
|
+
testId: "link-section",
|
|
90
|
+
parents: parents,
|
|
91
|
+
api: api,
|
|
92
|
+
showSeparatorInFullPagePrimaryToolbar: true
|
|
51
93
|
}, children);
|
|
52
94
|
}
|
|
53
95
|
}, {
|
|
@@ -74,8 +116,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
74
116
|
key: _toolbar.OVERFLOW_GROUP.key,
|
|
75
117
|
rank: _toolbar.OVERFLOW_GROUP_RANK[_toolbar.OVERFLOW_MENU.key]
|
|
76
118
|
}],
|
|
77
|
-
component: function component(
|
|
78
|
-
var children =
|
|
119
|
+
component: function component(_ref6) {
|
|
120
|
+
var children = _ref6.children;
|
|
79
121
|
return /*#__PURE__*/_react.default.createElement(_OverflowMenu.OverflowMenu, null, children);
|
|
80
122
|
}
|
|
81
123
|
}];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { TOOLBARS, useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
4
|
import { ToolbarSection } from '@atlaskit/editor-toolbar';
|
|
5
|
-
const
|
|
5
|
+
const shouldShowSection = (editMode, toolbar, toolbarDocking) => {
|
|
6
6
|
if (editMode === 'view') {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
@@ -14,18 +14,26 @@ const shouldShowTextSection = (editMode, toolbar, toolbarDocking) => {
|
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
};
|
|
17
|
-
export const
|
|
17
|
+
export const Section = ({
|
|
18
18
|
children,
|
|
19
19
|
parents,
|
|
20
|
-
api
|
|
20
|
+
api,
|
|
21
|
+
testId,
|
|
22
|
+
showSeparatorInFullPagePrimaryToolbar,
|
|
23
|
+
isSharedSection = true
|
|
21
24
|
}) => {
|
|
22
25
|
const editMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
23
26
|
const toolbarDocking = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
24
27
|
const toolbar = parents.find(parent => parent.type === 'toolbar');
|
|
25
|
-
|
|
28
|
+
const {
|
|
29
|
+
editorAppearance
|
|
30
|
+
} = useEditorToolbar();
|
|
31
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
26
32
|
return null;
|
|
27
33
|
}
|
|
34
|
+
const isFullPage = editorAppearance === 'full-page';
|
|
28
35
|
return /*#__PURE__*/React.createElement(ToolbarSection, {
|
|
29
|
-
testId:
|
|
36
|
+
testId: testId,
|
|
37
|
+
hasSeparator: showSeparatorInFullPagePrimaryToolbar && isFullPage
|
|
30
38
|
}, children);
|
|
31
39
|
};
|
|
@@ -9,7 +9,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
9
9
|
import { ToolbarSection, ToolbarButtonGroup, ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
|
|
11
11
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
|
-
import {
|
|
12
|
+
import { SELECTION_TOOLBAR_LABEL } from '../consts';
|
|
13
13
|
const isToolbarComponent = component => {
|
|
14
14
|
return component.type === 'toolbar' && component.key === 'inline-text-toolbar';
|
|
15
15
|
};
|
|
@@ -37,7 +37,7 @@ export const SelectionToolbar = ({
|
|
|
37
37
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
38
38
|
offset: [0, 10],
|
|
39
39
|
target: getDomRefFromSelection(editorView),
|
|
40
|
-
onPositionCalculated: position => calculateToolbarPositionTrackHead(
|
|
40
|
+
onPositionCalculated: position => calculateToolbarPositionTrackHead(SELECTION_TOOLBAR_LABEL)(editorView, position),
|
|
41
41
|
mountTo: mountPoint
|
|
42
42
|
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
43
43
|
editorView: editorView
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const SELECTION_TOOLBAR_LABEL = 'Selection toolbar';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
|
|
4
|
-
import {
|
|
4
|
+
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
5
5
|
import { OverflowMenu } from './OverflowMenu';
|
|
6
|
-
import {
|
|
6
|
+
import { Section } from './Section';
|
|
7
7
|
export const getToolbarComponents = api => {
|
|
8
8
|
return [{
|
|
9
9
|
type: 'toolbar',
|
|
@@ -12,7 +12,7 @@ export const getToolbarComponents = api => {
|
|
|
12
12
|
children
|
|
13
13
|
}) => {
|
|
14
14
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
15
|
-
label:
|
|
15
|
+
label: SELECTION_TOOLBAR_LABEL
|
|
16
16
|
}, children);
|
|
17
17
|
}
|
|
18
18
|
}, {
|
|
@@ -21,7 +21,7 @@ export const getToolbarComponents = api => {
|
|
|
21
21
|
component: ({
|
|
22
22
|
children
|
|
23
23
|
}) => /*#__PURE__*/React.createElement(PrimaryToolbar, {
|
|
24
|
-
label:
|
|
24
|
+
label: 'Primary Toolbar'
|
|
25
25
|
}, children)
|
|
26
26
|
}, {
|
|
27
27
|
type: TEXT_SECTION.type,
|
|
@@ -39,11 +39,51 @@ export const getToolbarComponents = api => {
|
|
|
39
39
|
children,
|
|
40
40
|
parents
|
|
41
41
|
}) => {
|
|
42
|
-
return /*#__PURE__*/React.createElement(
|
|
42
|
+
return /*#__PURE__*/React.createElement(Section, {
|
|
43
43
|
parents: parents,
|
|
44
|
-
api: api
|
|
44
|
+
api: api,
|
|
45
|
+
testId: "text-section"
|
|
45
46
|
}, children);
|
|
46
47
|
}
|
|
48
|
+
}, {
|
|
49
|
+
type: INSERT_BLOCK_SECTION.type,
|
|
50
|
+
key: INSERT_BLOCK_SECTION.key,
|
|
51
|
+
parents: [{
|
|
52
|
+
type: 'toolbar',
|
|
53
|
+
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
54
|
+
rank: TOOLBAR_RANK[INSERT_BLOCK_SECTION.key]
|
|
55
|
+
}],
|
|
56
|
+
component: ({
|
|
57
|
+
children,
|
|
58
|
+
parents
|
|
59
|
+
}) => /*#__PURE__*/React.createElement(Section, {
|
|
60
|
+
testId: "insert-block-section",
|
|
61
|
+
parents: parents,
|
|
62
|
+
api: api,
|
|
63
|
+
showSeparatorInFullPagePrimaryToolbar: true,
|
|
64
|
+
isSharedSection: false
|
|
65
|
+
}, children)
|
|
66
|
+
}, {
|
|
67
|
+
type: LINKING_SECTION.type,
|
|
68
|
+
key: LINKING_SECTION.key,
|
|
69
|
+
parents: [{
|
|
70
|
+
type: 'toolbar',
|
|
71
|
+
key: TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
72
|
+
rank: TOOLBAR_RANK[LINKING_SECTION.key]
|
|
73
|
+
}, {
|
|
74
|
+
type: 'toolbar',
|
|
75
|
+
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
76
|
+
rank: TOOLBAR_RANK[LINKING_SECTION.key]
|
|
77
|
+
}],
|
|
78
|
+
component: ({
|
|
79
|
+
children,
|
|
80
|
+
parents
|
|
81
|
+
}) => /*#__PURE__*/React.createElement(Section, {
|
|
82
|
+
testId: "link-section",
|
|
83
|
+
parents: parents,
|
|
84
|
+
api: api,
|
|
85
|
+
showSeparatorInFullPagePrimaryToolbar: true
|
|
86
|
+
}, children)
|
|
47
87
|
}, {
|
|
48
88
|
type: OVERFLOW_SECTION.type,
|
|
49
89
|
key: OVERFLOW_SECTION.key,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { TOOLBARS, useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
4
|
import { ToolbarSection } from '@atlaskit/editor-toolbar';
|
|
5
|
-
var
|
|
5
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking) {
|
|
6
6
|
if (editMode === 'view') {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
@@ -14,19 +14,27 @@ var shouldShowTextSection = function shouldShowTextSection(editMode, toolbar, to
|
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
};
|
|
17
|
-
export var
|
|
17
|
+
export var Section = function Section(_ref) {
|
|
18
18
|
var children = _ref.children,
|
|
19
19
|
parents = _ref.parents,
|
|
20
|
-
api = _ref.api
|
|
20
|
+
api = _ref.api,
|
|
21
|
+
testId = _ref.testId,
|
|
22
|
+
showSeparatorInFullPagePrimaryToolbar = _ref.showSeparatorInFullPagePrimaryToolbar,
|
|
23
|
+
_ref$isSharedSection = _ref.isSharedSection,
|
|
24
|
+
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection;
|
|
21
25
|
var editMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
22
26
|
var toolbarDocking = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
23
27
|
var toolbar = parents.find(function (parent) {
|
|
24
28
|
return parent.type === 'toolbar';
|
|
25
29
|
});
|
|
26
|
-
|
|
30
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
31
|
+
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
32
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
27
33
|
return null;
|
|
28
34
|
}
|
|
35
|
+
var isFullPage = editorAppearance === 'full-page';
|
|
29
36
|
return /*#__PURE__*/React.createElement(ToolbarSection, {
|
|
30
|
-
testId:
|
|
37
|
+
testId: testId,
|
|
38
|
+
hasSeparator: showSeparatorInFullPagePrimaryToolbar && isFullPage
|
|
31
39
|
}, children);
|
|
32
40
|
};
|
|
@@ -9,7 +9,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
9
9
|
import { ToolbarSection, ToolbarButtonGroup, ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
|
|
11
11
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
|
-
import {
|
|
12
|
+
import { SELECTION_TOOLBAR_LABEL } from '../consts';
|
|
13
13
|
var isToolbarComponent = function isToolbarComponent(component) {
|
|
14
14
|
return component.type === 'toolbar' && component.key === 'inline-text-toolbar';
|
|
15
15
|
};
|
|
@@ -39,7 +39,7 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
39
39
|
offset: [0, 10],
|
|
40
40
|
target: getDomRefFromSelection(editorView),
|
|
41
41
|
onPositionCalculated: function onPositionCalculated(position) {
|
|
42
|
-
return calculateToolbarPositionTrackHead(
|
|
42
|
+
return calculateToolbarPositionTrackHead(SELECTION_TOOLBAR_LABEL)(editorView, position);
|
|
43
43
|
},
|
|
44
44
|
mountTo: mountPoint
|
|
45
45
|
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var
|
|
1
|
+
export var SELECTION_TOOLBAR_LABEL = 'Selection toolbar';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
|
|
4
|
-
import {
|
|
4
|
+
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
5
5
|
import { OverflowMenu } from './OverflowMenu';
|
|
6
|
-
import {
|
|
6
|
+
import { Section } from './Section';
|
|
7
7
|
export var getToolbarComponents = function getToolbarComponents(api) {
|
|
8
8
|
return [{
|
|
9
9
|
type: 'toolbar',
|
|
@@ -11,7 +11,7 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
11
11
|
component: function component(_ref) {
|
|
12
12
|
var children = _ref.children;
|
|
13
13
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
14
|
-
label:
|
|
14
|
+
label: SELECTION_TOOLBAR_LABEL
|
|
15
15
|
}, children);
|
|
16
16
|
}
|
|
17
17
|
}, {
|
|
@@ -20,7 +20,7 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
20
20
|
component: function component(_ref2) {
|
|
21
21
|
var children = _ref2.children;
|
|
22
22
|
return /*#__PURE__*/React.createElement(PrimaryToolbar, {
|
|
23
|
-
label:
|
|
23
|
+
label: 'Primary Toolbar'
|
|
24
24
|
}, children);
|
|
25
25
|
}
|
|
26
26
|
}, {
|
|
@@ -38,9 +38,51 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
38
38
|
component: function component(_ref3) {
|
|
39
39
|
var children = _ref3.children,
|
|
40
40
|
parents = _ref3.parents;
|
|
41
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement(Section, {
|
|
42
42
|
parents: parents,
|
|
43
|
-
api: api
|
|
43
|
+
api: api,
|
|
44
|
+
testId: "text-section"
|
|
45
|
+
}, children);
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
type: INSERT_BLOCK_SECTION.type,
|
|
49
|
+
key: INSERT_BLOCK_SECTION.key,
|
|
50
|
+
parents: [{
|
|
51
|
+
type: 'toolbar',
|
|
52
|
+
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
53
|
+
rank: TOOLBAR_RANK[INSERT_BLOCK_SECTION.key]
|
|
54
|
+
}],
|
|
55
|
+
component: function component(_ref4) {
|
|
56
|
+
var children = _ref4.children,
|
|
57
|
+
parents = _ref4.parents;
|
|
58
|
+
return /*#__PURE__*/React.createElement(Section, {
|
|
59
|
+
testId: "insert-block-section",
|
|
60
|
+
parents: parents,
|
|
61
|
+
api: api,
|
|
62
|
+
showSeparatorInFullPagePrimaryToolbar: true,
|
|
63
|
+
isSharedSection: false
|
|
64
|
+
}, children);
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
type: LINKING_SECTION.type,
|
|
68
|
+
key: LINKING_SECTION.key,
|
|
69
|
+
parents: [{
|
|
70
|
+
type: 'toolbar',
|
|
71
|
+
key: TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
72
|
+
rank: TOOLBAR_RANK[LINKING_SECTION.key]
|
|
73
|
+
}, {
|
|
74
|
+
type: 'toolbar',
|
|
75
|
+
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
76
|
+
rank: TOOLBAR_RANK[LINKING_SECTION.key]
|
|
77
|
+
}],
|
|
78
|
+
component: function component(_ref5) {
|
|
79
|
+
var children = _ref5.children,
|
|
80
|
+
parents = _ref5.parents;
|
|
81
|
+
return /*#__PURE__*/React.createElement(Section, {
|
|
82
|
+
testId: "link-section",
|
|
83
|
+
parents: parents,
|
|
84
|
+
api: api,
|
|
85
|
+
showSeparatorInFullPagePrimaryToolbar: true
|
|
44
86
|
}, children);
|
|
45
87
|
}
|
|
46
88
|
}, {
|
|
@@ -67,8 +109,8 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
67
109
|
key: OVERFLOW_GROUP.key,
|
|
68
110
|
rank: OVERFLOW_GROUP_RANK[OVERFLOW_MENU.key]
|
|
69
111
|
}],
|
|
70
|
-
component: function component(
|
|
71
|
-
var children =
|
|
112
|
+
component: function component(_ref6) {
|
|
113
|
+
var children = _ref6.children;
|
|
72
114
|
return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
|
|
73
115
|
}
|
|
74
116
|
}];
|
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
|
|
4
4
|
import type { ToolbarPlugin } from '../toolbarPluginType';
|
|
5
|
-
type
|
|
5
|
+
type SectionProps = {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
parents: ToolbarComponentTypes;
|
|
8
8
|
api?: ExtractInjectionAPI<ToolbarPlugin>;
|
|
9
|
+
testId?: string;
|
|
10
|
+
showSeparatorInFullPagePrimaryToolbar?: boolean;
|
|
11
|
+
isSharedSection?: boolean;
|
|
9
12
|
};
|
|
10
|
-
export declare const
|
|
13
|
+
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, }: SectionProps) => React.JSX.Element | null;
|
|
11
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const SELECTION_TOOLBAR_LABEL = "Selection toolbar";
|
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
|
|
4
4
|
import type { ToolbarPlugin } from '../toolbarPluginType';
|
|
5
|
-
type
|
|
5
|
+
type SectionProps = {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
parents: ToolbarComponentTypes;
|
|
8
8
|
api?: ExtractInjectionAPI<ToolbarPlugin>;
|
|
9
|
+
testId?: string;
|
|
10
|
+
showSeparatorInFullPagePrimaryToolbar?: boolean;
|
|
11
|
+
isSharedSection?: boolean;
|
|
9
12
|
};
|
|
10
|
-
export declare const
|
|
13
|
+
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, }: SectionProps) => React.JSX.Element | null;
|
|
11
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const SELECTION_TOOLBAR_LABEL = "Selection toolbar";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-toolbar": "^0.3.0",
|
|
41
41
|
"@atlaskit/editor-toolbar-model": "^0.1.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^11.4.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/editor-common": "^107.
|
|
47
|
+
"@atlaskit/editor-common": "^107.28.0",
|
|
48
48
|
"react": "^18.2.0"
|
|
49
49
|
},
|
|
50
50
|
"techstack": {
|