@atlaskit/editor-plugin-toolbar 0.2.3 → 0.3.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 +19 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-dev-agents/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-passionfruit/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/afm-rovo-extension/tsconfig.json +3 -0
- package/afm-townsquare/tsconfig.json +3 -0
- package/dist/cjs/toolbarPlugin.js +8 -3
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/ui/SelectionToolbar/index.js +4 -1
- package/dist/es2019/toolbarPlugin.js +9 -3
- package/dist/es2019/types/index.js +0 -0
- package/dist/es2019/ui/SelectionToolbar/index.js +4 -1
- package/dist/esm/toolbarPlugin.js +8 -3
- package/dist/esm/types/index.js +0 -0
- package/dist/esm/ui/SelectionToolbar/index.js +4 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/toolbarPluginType.d.ts +5 -1
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/toolbarPluginType.d.ts +5 -1
- package/dist/types-ts4.5/types/index.d.ts +3 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`44b183a57537a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/44b183a57537a) -
|
|
8
|
+
Introduce a new plugin config option for editor-plugin-toolbar to disable the selection toolbar
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 0.2.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`03b0204b5eb82`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/03b0204b5eb82) -
|
|
19
|
+
ED=28738 Disable toolbar when editor is offline
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 0.2.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -10,7 +10,12 @@ var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
|
|
|
10
10
|
var _SelectionToolbar = require("./ui/SelectionToolbar");
|
|
11
11
|
var _toolbarComponents = require("./ui/toolbar-components");
|
|
12
12
|
var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
13
|
-
var api = _ref.api
|
|
13
|
+
var api = _ref.api,
|
|
14
|
+
_ref$config = _ref.config,
|
|
15
|
+
config = _ref$config === void 0 ? {
|
|
16
|
+
disableSelectionToolbar: false
|
|
17
|
+
} : _ref$config;
|
|
18
|
+
var disableSelectionToolbar = config.disableSelectionToolbar;
|
|
14
19
|
var registry = (0, _editorToolbarModel.createComponentRegistry)();
|
|
15
20
|
registry.register((0, _toolbarComponents.getToolbarComponents)(api));
|
|
16
21
|
return {
|
|
@@ -23,7 +28,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
23
28
|
return registry.components;
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
|
-
contentComponent: function
|
|
31
|
+
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
27
32
|
var editorView = _ref2.editorView,
|
|
28
33
|
popupsMountPoint = _ref2.popupsMountPoint;
|
|
29
34
|
return /*#__PURE__*/_react.default.createElement(_SelectionToolbar.SelectionToolbar, {
|
|
@@ -31,6 +36,6 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
31
36
|
editorView: editorView,
|
|
32
37
|
mountPoint: popupsMountPoint
|
|
33
38
|
});
|
|
34
|
-
}
|
|
39
|
+
} : undefined
|
|
35
40
|
};
|
|
36
41
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -29,6 +29,8 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
29
29
|
return isToolbarComponent(component);
|
|
30
30
|
});
|
|
31
31
|
var currentUserIntent = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userIntent.currentUserIntent');
|
|
32
|
+
var connectivityStateMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
|
|
33
|
+
var isOffline = connectivityStateMode === 'offline';
|
|
32
34
|
// TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
|
|
33
35
|
// @ts-expect-error
|
|
34
36
|
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
@@ -50,7 +52,8 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
50
52
|
}, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
|
|
51
53
|
editorView: editorView
|
|
52
54
|
}, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarUIProvider, {
|
|
53
|
-
api: api
|
|
55
|
+
api: api,
|
|
56
|
+
isDisabled: isOffline
|
|
54
57
|
}, /*#__PURE__*/_react.default.createElement(_editorToolbarModel.ToolbarModelRenderer, {
|
|
55
58
|
toolbar: toolbar,
|
|
56
59
|
components: components,
|
|
@@ -3,8 +3,14 @@ import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
|
3
3
|
import { SelectionToolbar } from './ui/SelectionToolbar';
|
|
4
4
|
import { getToolbarComponents } from './ui/toolbar-components';
|
|
5
5
|
export const toolbarPlugin = ({
|
|
6
|
-
api
|
|
6
|
+
api,
|
|
7
|
+
config = {
|
|
8
|
+
disableSelectionToolbar: false
|
|
9
|
+
}
|
|
7
10
|
}) => {
|
|
11
|
+
const {
|
|
12
|
+
disableSelectionToolbar
|
|
13
|
+
} = config;
|
|
8
14
|
const registry = createComponentRegistry();
|
|
9
15
|
registry.register(getToolbarComponents(api));
|
|
10
16
|
return {
|
|
@@ -17,7 +23,7 @@ export const toolbarPlugin = ({
|
|
|
17
23
|
return registry.components;
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
|
-
contentComponent: ({
|
|
26
|
+
contentComponent: !disableSelectionToolbar ? ({
|
|
21
27
|
editorView,
|
|
22
28
|
popupsMountPoint
|
|
23
29
|
}) => {
|
|
@@ -26,6 +32,6 @@ export const toolbarPlugin = ({
|
|
|
26
32
|
editorView: editorView,
|
|
27
33
|
mountPoint: popupsMountPoint
|
|
28
34
|
});
|
|
29
|
-
}
|
|
35
|
+
} : undefined
|
|
30
36
|
};
|
|
31
37
|
};
|
|
File without changes
|
|
@@ -21,6 +21,8 @@ export const SelectionToolbar = ({
|
|
|
21
21
|
const components = api === null || api === void 0 ? void 0 : api.toolbar.actions.getComponents();
|
|
22
22
|
const toolbar = components === null || components === void 0 ? void 0 : components.find(component => isToolbarComponent(component));
|
|
23
23
|
const currentUserIntent = useSharedPluginStateSelector(api, 'userIntent.currentUserIntent');
|
|
24
|
+
const connectivityStateMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
25
|
+
const isOffline = connectivityStateMode === 'offline';
|
|
24
26
|
// TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
|
|
25
27
|
// @ts-expect-error
|
|
26
28
|
const selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
@@ -40,7 +42,8 @@ export const SelectionToolbar = ({
|
|
|
40
42
|
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
41
43
|
editorView: editorView
|
|
42
44
|
}, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
|
|
43
|
-
api: api
|
|
45
|
+
api: api,
|
|
46
|
+
isDisabled: isOffline
|
|
44
47
|
}, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
|
|
45
48
|
toolbar: toolbar,
|
|
46
49
|
components: components,
|
|
@@ -3,7 +3,12 @@ import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
|
|
|
3
3
|
import { SelectionToolbar } from './ui/SelectionToolbar';
|
|
4
4
|
import { getToolbarComponents } from './ui/toolbar-components';
|
|
5
5
|
export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
6
|
-
var api = _ref.api
|
|
6
|
+
var api = _ref.api,
|
|
7
|
+
_ref$config = _ref.config,
|
|
8
|
+
config = _ref$config === void 0 ? {
|
|
9
|
+
disableSelectionToolbar: false
|
|
10
|
+
} : _ref$config;
|
|
11
|
+
var disableSelectionToolbar = config.disableSelectionToolbar;
|
|
7
12
|
var registry = createComponentRegistry();
|
|
8
13
|
registry.register(getToolbarComponents(api));
|
|
9
14
|
return {
|
|
@@ -16,7 +21,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
16
21
|
return registry.components;
|
|
17
22
|
}
|
|
18
23
|
},
|
|
19
|
-
contentComponent: function
|
|
24
|
+
contentComponent: !disableSelectionToolbar ? function (_ref2) {
|
|
20
25
|
var editorView = _ref2.editorView,
|
|
21
26
|
popupsMountPoint = _ref2.popupsMountPoint;
|
|
22
27
|
return /*#__PURE__*/React.createElement(SelectionToolbar, {
|
|
@@ -24,6 +29,6 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
24
29
|
editorView: editorView,
|
|
25
30
|
mountPoint: popupsMountPoint
|
|
26
31
|
});
|
|
27
|
-
}
|
|
32
|
+
} : undefined
|
|
28
33
|
};
|
|
29
34
|
};
|
|
File without changes
|
|
@@ -22,6 +22,8 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
22
22
|
return isToolbarComponent(component);
|
|
23
23
|
});
|
|
24
24
|
var currentUserIntent = useSharedPluginStateSelector(api, 'userIntent.currentUserIntent');
|
|
25
|
+
var connectivityStateMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
26
|
+
var isOffline = connectivityStateMode === 'offline';
|
|
25
27
|
// TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
|
|
26
28
|
// @ts-expect-error
|
|
27
29
|
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
@@ -43,7 +45,8 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
43
45
|
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
44
46
|
editorView: editorView
|
|
45
47
|
}, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
|
|
46
|
-
api: api
|
|
48
|
+
api: api,
|
|
49
|
+
isDisabled: isOffline
|
|
47
50
|
}, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
|
|
48
51
|
toolbar: toolbar,
|
|
49
52
|
components: components,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
2
3
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
4
5
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
6
7
|
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
8
|
+
import type { ToolbarPluginOptions } from './types';
|
|
7
9
|
export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
|
|
10
|
+
pluginConfiguration?: ToolbarPluginOptions;
|
|
8
11
|
dependencies: [
|
|
9
12
|
OptionalPlugin<UserIntentPlugin>,
|
|
10
13
|
OptionalPlugin<SelectionPlugin>,
|
|
11
14
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
12
|
-
OptionalPlugin<EditorViewModePlugin
|
|
15
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
16
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
13
17
|
];
|
|
14
18
|
actions: {
|
|
15
19
|
registerComponents: (toolbarComponents: Array<RegisterComponent>) => void;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
2
3
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
4
5
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
6
7
|
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
8
|
+
import type { ToolbarPluginOptions } from './types';
|
|
7
9
|
export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
|
|
10
|
+
pluginConfiguration?: ToolbarPluginOptions;
|
|
8
11
|
dependencies: [
|
|
9
12
|
OptionalPlugin<UserIntentPlugin>,
|
|
10
13
|
OptionalPlugin<SelectionPlugin>,
|
|
11
14
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
12
|
-
OptionalPlugin<EditorViewModePlugin
|
|
15
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
16
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
13
17
|
];
|
|
14
18
|
actions: {
|
|
15
19
|
registerComponents: (toolbarComponents: Array<RegisterComponent>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,19 +31,20 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@atlaskit/editor-plugin-connectivity": "^3.1.0",
|
|
34
35
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
35
|
-
"@atlaskit/editor-plugin-selection": "^3.
|
|
36
|
+
"@atlaskit/editor-plugin-selection": "^3.1.0",
|
|
36
37
|
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
37
38
|
"@atlaskit/editor-plugin-user-preferences": "^1.2.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
40
|
"@atlaskit/editor-toolbar": "^0.3.0",
|
|
40
41
|
"@atlaskit/editor-toolbar-model": "^0.1.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^11.3.0",
|
|
42
43
|
"@babel/runtime": "^7.0.0",
|
|
43
44
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
|
-
"@atlaskit/editor-common": "^107.
|
|
47
|
+
"@atlaskit/editor-common": "^107.26.0",
|
|
47
48
|
"react": "^18.2.0"
|
|
48
49
|
},
|
|
49
50
|
"techstack": {
|