@atlaskit/editor-plugin-selection-toolbar 0.1.5 → 0.2.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 +6 -0
- package/dist/cjs/plugin.js +5 -1
- package/dist/es2019/plugin.js +5 -1
- package/dist/esm/plugin.js +5 -1
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types-ts4.5/plugin.d.ts +5 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#68277](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68277) [`fe0abf4abc01`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fe0abf4abc01) - Enable the selection toolbar to work with live pages view mode
|
|
8
|
+
|
|
3
9
|
## 0.1.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -45,11 +45,15 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
45
45
|
var unbind = (0, _bindEventListener.bind)(_view.root, {
|
|
46
46
|
type: 'mouseup',
|
|
47
47
|
listener: function listener() {
|
|
48
|
+
var _options$api;
|
|
48
49
|
// We only want to set selectionStable to true if the editor has focus
|
|
49
50
|
// to prevent the toolbar from showing when the editor is blurred
|
|
50
51
|
// due to a click outside the editor.
|
|
52
|
+
|
|
53
|
+
var editorViewModePlugin = (_options$api = options.api) === null || _options$api === void 0 || (_options$api = _options$api.editorViewMode) === null || _options$api === void 0 ? void 0 : _options$api.sharedState.currentState();
|
|
54
|
+
var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
51
55
|
_view.dispatch(_view.state.tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
|
|
52
|
-
selectionStable: _view.hasFocus()
|
|
56
|
+
selectionStable: !isViewModeEnabled ? _view.hasFocus() : true
|
|
53
57
|
}));
|
|
54
58
|
}
|
|
55
59
|
});
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -37,11 +37,15 @@ export const selectionToolbarPlugin = options => {
|
|
|
37
37
|
const unbind = bind(view.root, {
|
|
38
38
|
type: 'mouseup',
|
|
39
39
|
listener: () => {
|
|
40
|
+
var _options$api, _options$api$editorVi;
|
|
40
41
|
// We only want to set selectionStable to true if the editor has focus
|
|
41
42
|
// to prevent the toolbar from showing when the editor is blurred
|
|
42
43
|
// due to a click outside the editor.
|
|
44
|
+
|
|
45
|
+
const editorViewModePlugin = (_options$api = options.api) === null || _options$api === void 0 ? void 0 : (_options$api$editorVi = _options$api.editorViewMode) === null || _options$api$editorVi === void 0 ? void 0 : _options$api$editorVi.sharedState.currentState();
|
|
46
|
+
const isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
43
47
|
view.dispatch(view.state.tr.setMeta(selectionToolbarPluginKey, {
|
|
44
|
-
selectionStable: view.hasFocus()
|
|
48
|
+
selectionStable: !isViewModeEnabled ? view.hasFocus() : true
|
|
45
49
|
}));
|
|
46
50
|
}
|
|
47
51
|
});
|
package/dist/esm/plugin.js
CHANGED
|
@@ -38,11 +38,15 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
|
|
|
38
38
|
var unbind = bind(_view.root, {
|
|
39
39
|
type: 'mouseup',
|
|
40
40
|
listener: function listener() {
|
|
41
|
+
var _options$api;
|
|
41
42
|
// We only want to set selectionStable to true if the editor has focus
|
|
42
43
|
// to prevent the toolbar from showing when the editor is blurred
|
|
43
44
|
// due to a click outside the editor.
|
|
45
|
+
|
|
46
|
+
var editorViewModePlugin = (_options$api = options.api) === null || _options$api === void 0 || (_options$api = _options$api.editorViewMode) === null || _options$api === void 0 ? void 0 : _options$api.sharedState.currentState();
|
|
47
|
+
var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
44
48
|
_view.dispatch(_view.state.tr.setMeta(selectionToolbarPluginKey, {
|
|
45
|
-
selectionStable: _view.hasFocus()
|
|
49
|
+
selectionStable: !isViewModeEnabled ? _view.hasFocus() : true
|
|
46
50
|
}));
|
|
47
51
|
}
|
|
48
52
|
});
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
2
3
|
export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar', {
|
|
3
4
|
pluginConfiguration: {
|
|
4
5
|
/**
|
|
@@ -6,5 +7,6 @@ export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar'
|
|
|
6
7
|
*/
|
|
7
8
|
preferenceToolbarAboveSelection?: boolean;
|
|
8
9
|
};
|
|
10
|
+
dependencies: [OptionalPlugin<EditorViewModePlugin>];
|
|
9
11
|
}>;
|
|
10
12
|
export type SelectionToolbarPlugin = typeof selectionToolbarPlugin;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
2
3
|
export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar', {
|
|
3
4
|
pluginConfiguration: {
|
|
4
5
|
/**
|
|
@@ -6,5 +7,8 @@ export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar'
|
|
|
6
7
|
*/
|
|
7
8
|
preferenceToolbarAboveSelection?: boolean;
|
|
8
9
|
};
|
|
10
|
+
dependencies: [
|
|
11
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
12
|
+
];
|
|
9
13
|
}>;
|
|
10
14
|
export type SelectionToolbarPlugin = typeof selectionToolbarPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/editor-common": "^77.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^0.1.0",
|
|
37
38
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
38
39
|
"@babel/runtime": "^7.0.0",
|
|
39
40
|
"bind-event-listener": "^2.1.1"
|