@atlaskit/editor-plugin-toolbar 0.4.0 → 0.4.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 +8 -0
- package/dist/cjs/toolbarPlugin.js +1 -1
- package/dist/cjs/ui/Section.js +7 -3
- package/dist/cjs/ui/toolbar-components.js +2 -1
- package/dist/es2019/toolbarPlugin.js +1 -1
- package/dist/es2019/ui/Section.js +7 -3
- package/dist/es2019/ui/toolbar-components.js +2 -1
- package/dist/esm/toolbarPlugin.js +1 -1
- package/dist/esm/ui/Section.js +7 -3
- package/dist/esm/ui/toolbar-components.js +2 -1
- package/dist/types/ui/Section.d.ts +2 -1
- package/dist/types/ui/toolbar-components.d.ts +1 -1
- package/dist/types-ts4.5/ui/Section.d.ts +2 -1
- package/dist/types-ts4.5/ui/toolbar-components.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`187540cdffa74`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/187540cdffa74) -
|
|
8
|
+
[ux] ED-29035 show text formatting option in comment toolbar regardless of pinning settings
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 0.4.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -25,7 +25,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
25
25
|
} : _ref$config;
|
|
26
26
|
var disableSelectionToolbar = config.disableSelectionToolbar;
|
|
27
27
|
var registry = (0, _editorToolbarModel.createComponentRegistry)();
|
|
28
|
-
registry.register((0, _toolbarComponents.getToolbarComponents)(api));
|
|
28
|
+
registry.register((0, _toolbarComponents.getToolbarComponents)(api, disableSelectionToolbar));
|
|
29
29
|
return {
|
|
30
30
|
name: 'toolbar',
|
|
31
31
|
actions: {
|
package/dist/cjs/ui/Section.js
CHANGED
|
@@ -9,10 +9,13 @@ 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 shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking) {
|
|
12
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar) {
|
|
13
13
|
if (editMode === 'view') {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
+
if (disableSelectionToolbar) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
16
19
|
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
17
20
|
return true;
|
|
18
21
|
}
|
|
@@ -28,7 +31,8 @@ var Section = exports.Section = function Section(_ref) {
|
|
|
28
31
|
testId = _ref.testId,
|
|
29
32
|
showSeparatorInFullPagePrimaryToolbar = _ref.showSeparatorInFullPagePrimaryToolbar,
|
|
30
33
|
_ref$isSharedSection = _ref.isSharedSection,
|
|
31
|
-
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection
|
|
34
|
+
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection,
|
|
35
|
+
disableSelectionToolbar = _ref.disableSelectionToolbar;
|
|
32
36
|
var editMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
33
37
|
var toolbarDocking = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
34
38
|
var toolbar = parents.find(function (parent) {
|
|
@@ -36,7 +40,7 @@ var Section = exports.Section = function Section(_ref) {
|
|
|
36
40
|
});
|
|
37
41
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
38
42
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
39
|
-
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
43
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar)) {
|
|
40
44
|
return null;
|
|
41
45
|
}
|
|
42
46
|
var isFullPage = editorAppearance === 'full-page';
|
|
@@ -11,7 +11,7 @@ var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
|
11
11
|
var _consts = require("./consts");
|
|
12
12
|
var _OverflowMenu = require("./OverflowMenu");
|
|
13
13
|
var _Section = require("./Section");
|
|
14
|
-
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api) {
|
|
14
|
+
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
|
|
15
15
|
return [{
|
|
16
16
|
type: 'toolbar',
|
|
17
17
|
key: _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
@@ -48,6 +48,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_Section.Section, {
|
|
49
49
|
parents: parents,
|
|
50
50
|
api: api,
|
|
51
|
+
disableSelectionToolbar: disableSelectionToolbar,
|
|
51
52
|
testId: "text-section"
|
|
52
53
|
}, children);
|
|
53
54
|
}
|
|
@@ -17,7 +17,7 @@ export const toolbarPlugin = ({
|
|
|
17
17
|
disableSelectionToolbar
|
|
18
18
|
} = config;
|
|
19
19
|
const registry = createComponentRegistry();
|
|
20
|
-
registry.register(getToolbarComponents(api));
|
|
20
|
+
registry.register(getToolbarComponents(api, disableSelectionToolbar));
|
|
21
21
|
return {
|
|
22
22
|
name: 'toolbar',
|
|
23
23
|
actions: {
|
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
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 shouldShowSection = (editMode, toolbar, toolbarDocking) => {
|
|
5
|
+
const shouldShowSection = (editMode, toolbar, toolbarDocking, disableSelectionToolbar) => {
|
|
6
6
|
if (editMode === 'view') {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
|
+
if (disableSelectionToolbar) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
9
12
|
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
10
13
|
return true;
|
|
11
14
|
}
|
|
@@ -20,7 +23,8 @@ export const Section = ({
|
|
|
20
23
|
api,
|
|
21
24
|
testId,
|
|
22
25
|
showSeparatorInFullPagePrimaryToolbar,
|
|
23
|
-
isSharedSection = true
|
|
26
|
+
isSharedSection = true,
|
|
27
|
+
disableSelectionToolbar
|
|
24
28
|
}) => {
|
|
25
29
|
const editMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
26
30
|
const toolbarDocking = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
@@ -28,7 +32,7 @@ export const Section = ({
|
|
|
28
32
|
const {
|
|
29
33
|
editorAppearance
|
|
30
34
|
} = useEditorToolbar();
|
|
31
|
-
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
35
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar)) {
|
|
32
36
|
return null;
|
|
33
37
|
}
|
|
34
38
|
const isFullPage = editorAppearance === 'full-page';
|
|
@@ -4,7 +4,7 @@ import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
|
|
|
4
4
|
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
5
5
|
import { OverflowMenu } from './OverflowMenu';
|
|
6
6
|
import { Section } from './Section';
|
|
7
|
-
export const getToolbarComponents = api => {
|
|
7
|
+
export const getToolbarComponents = (api, disableSelectionToolbar) => {
|
|
8
8
|
return [{
|
|
9
9
|
type: 'toolbar',
|
|
10
10
|
key: TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
@@ -42,6 +42,7 @@ export const getToolbarComponents = api => {
|
|
|
42
42
|
return /*#__PURE__*/React.createElement(Section, {
|
|
43
43
|
parents: parents,
|
|
44
44
|
api: api,
|
|
45
|
+
disableSelectionToolbar: disableSelectionToolbar,
|
|
45
46
|
testId: "text-section"
|
|
46
47
|
}, children);
|
|
47
48
|
}
|
|
@@ -18,7 +18,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
18
18
|
} : _ref$config;
|
|
19
19
|
var disableSelectionToolbar = config.disableSelectionToolbar;
|
|
20
20
|
var registry = createComponentRegistry();
|
|
21
|
-
registry.register(getToolbarComponents(api));
|
|
21
|
+
registry.register(getToolbarComponents(api, disableSelectionToolbar));
|
|
22
22
|
return {
|
|
23
23
|
name: 'toolbar',
|
|
24
24
|
actions: {
|
package/dist/esm/ui/Section.js
CHANGED
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
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 shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking) {
|
|
5
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar) {
|
|
6
6
|
if (editMode === 'view') {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
|
+
if (disableSelectionToolbar) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
9
12
|
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
10
13
|
return true;
|
|
11
14
|
}
|
|
@@ -21,7 +24,8 @@ export var Section = function Section(_ref) {
|
|
|
21
24
|
testId = _ref.testId,
|
|
22
25
|
showSeparatorInFullPagePrimaryToolbar = _ref.showSeparatorInFullPagePrimaryToolbar,
|
|
23
26
|
_ref$isSharedSection = _ref.isSharedSection,
|
|
24
|
-
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection
|
|
27
|
+
isSharedSection = _ref$isSharedSection === void 0 ? true : _ref$isSharedSection,
|
|
28
|
+
disableSelectionToolbar = _ref.disableSelectionToolbar;
|
|
25
29
|
var editMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
26
30
|
var toolbarDocking = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
27
31
|
var toolbar = parents.find(function (parent) {
|
|
@@ -29,7 +33,7 @@ export var Section = function Section(_ref) {
|
|
|
29
33
|
});
|
|
30
34
|
var _useEditorToolbar = useEditorToolbar(),
|
|
31
35
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
32
|
-
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking)) {
|
|
36
|
+
if (isSharedSection && !shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar)) {
|
|
33
37
|
return null;
|
|
34
38
|
}
|
|
35
39
|
var isFullPage = editorAppearance === 'full-page';
|
|
@@ -4,7 +4,7 @@ import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
|
|
|
4
4
|
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
5
5
|
import { OverflowMenu } from './OverflowMenu';
|
|
6
6
|
import { Section } from './Section';
|
|
7
|
-
export var getToolbarComponents = function getToolbarComponents(api) {
|
|
7
|
+
export var getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
|
|
8
8
|
return [{
|
|
9
9
|
type: 'toolbar',
|
|
10
10
|
key: TOOLBARS.INLINE_TEXT_TOOLBAR,
|
|
@@ -41,6 +41,7 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
41
41
|
return /*#__PURE__*/React.createElement(Section, {
|
|
42
42
|
parents: parents,
|
|
43
43
|
api: api,
|
|
44
|
+
disableSelectionToolbar: disableSelectionToolbar,
|
|
44
45
|
testId: "text-section"
|
|
45
46
|
}, children);
|
|
46
47
|
}
|
|
@@ -9,6 +9,7 @@ type SectionProps = {
|
|
|
9
9
|
testId?: string;
|
|
10
10
|
showSeparatorInFullPagePrimaryToolbar?: boolean;
|
|
11
11
|
isSharedSection?: boolean;
|
|
12
|
+
disableSelectionToolbar?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, }: SectionProps) => React.JSX.Element | null;
|
|
14
|
+
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, disableSelectionToolbar, }: SectionProps) => React.JSX.Element | null;
|
|
14
15
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
3
3
|
import type { ToolbarPlugin } from '../toolbarPluginType';
|
|
4
|
-
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<ToolbarPlugin
|
|
4
|
+
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<ToolbarPlugin>, disableSelectionToolbar?: boolean) => RegisterComponent[];
|
|
@@ -9,6 +9,7 @@ type SectionProps = {
|
|
|
9
9
|
testId?: string;
|
|
10
10
|
showSeparatorInFullPagePrimaryToolbar?: boolean;
|
|
11
11
|
isSharedSection?: boolean;
|
|
12
|
+
disableSelectionToolbar?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, }: SectionProps) => React.JSX.Element | null;
|
|
14
|
+
export declare const Section: ({ children, parents, api, testId, showSeparatorInFullPagePrimaryToolbar, isSharedSection, disableSelectionToolbar, }: SectionProps) => React.JSX.Element | null;
|
|
14
15
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
3
3
|
import type { ToolbarPlugin } from '../toolbarPluginType';
|
|
4
|
-
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<ToolbarPlugin
|
|
4
|
+
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<ToolbarPlugin>, disableSelectionToolbar?: boolean) => RegisterComponent[];
|