@atlaskit/editor-plugin-selection-extension 5.0.0 → 5.0.2
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 +12 -0
- package/dist/cjs/selectionExtensionPlugin.js +4 -1
- package/dist/cjs/ui/toolbar-components/ToolbarButton.js +23 -2
- package/dist/cjs/ui/toolbar-components/ToolbarMenu.js +20 -2
- package/dist/es2019/selectionExtensionPlugin.js +4 -1
- package/dist/es2019/ui/toolbar-components/ToolbarButton.js +23 -2
- package/dist/es2019/ui/toolbar-components/ToolbarMenu.js +20 -2
- package/dist/esm/selectionExtensionPlugin.js +4 -1
- package/dist/esm/ui/toolbar-components/ToolbarButton.js +23 -2
- package/dist/esm/ui/toolbar-components/ToolbarMenu.js +20 -2
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -151,6 +151,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
151
151
|
contentComponent: function contentComponent(_ref7) {
|
|
152
152
|
var _api$analytics;
|
|
153
153
|
var editorView = _ref7.editorView;
|
|
154
|
+
if (!editorView) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
154
157
|
return /*#__PURE__*/_react.default.createElement(_SelectionExtensionComponentWrapper.SelectionExtensionComponentWrapper, {
|
|
155
158
|
editorView: editorView,
|
|
156
159
|
api: api,
|
|
@@ -173,7 +176,7 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
173
176
|
|
|
174
177
|
// Content Mode Validation
|
|
175
178
|
// Check if pageModes is provided and matches against current content mode
|
|
176
|
-
// This will
|
|
179
|
+
// This will eventually transition from mode to contentMode
|
|
177
180
|
var editorContentMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
|
|
178
181
|
if (pageModes) {
|
|
179
182
|
// Early Exit: consumer has set pageModes but editorContentMode is undefined
|
|
@@ -6,13 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.ToolbarButton = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
9
10
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
11
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
+
/**
|
|
15
|
+
* !! When removing platform_editor_toolbar_aifc_patch_3 also remove package dependency on `@atlaskit/editor-plugin-view-mode`.
|
|
16
|
+
*/
|
|
17
|
+
var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
18
|
+
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
19
|
+
}, function (api) {
|
|
20
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
21
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference;
|
|
22
|
+
return {
|
|
23
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
24
|
+
};
|
|
25
|
+
}, function (api) {
|
|
26
|
+
var editorToolbarDockingPreference = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
27
|
+
return {
|
|
28
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
29
|
+
};
|
|
30
|
+
});
|
|
11
31
|
var ToolbarButton = exports.ToolbarButton = function ToolbarButton(_ref) {
|
|
12
32
|
var api = _ref.api,
|
|
13
33
|
config = _ref.config;
|
|
14
|
-
var
|
|
15
|
-
|
|
34
|
+
var _usePluginState = usePluginState(api),
|
|
35
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference;
|
|
36
|
+
var isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
16
37
|
if (isDockedAtTop) {
|
|
17
38
|
return null;
|
|
18
39
|
}
|
|
@@ -6,14 +6,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.ToolbarMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
9
10
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
11
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
+
var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
15
|
+
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
16
|
+
}, function (api) {
|
|
17
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
18
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference;
|
|
19
|
+
return {
|
|
20
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
21
|
+
};
|
|
22
|
+
}, function (api) {
|
|
23
|
+
var editorToolbarDockingPreference = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
24
|
+
return {
|
|
25
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
26
|
+
};
|
|
27
|
+
});
|
|
11
28
|
var ToolbarMenu = exports.ToolbarMenu = function ToolbarMenu(_ref) {
|
|
12
29
|
var api = _ref.api,
|
|
13
30
|
config = _ref.config,
|
|
14
31
|
children = _ref.children;
|
|
15
|
-
var
|
|
16
|
-
|
|
32
|
+
var _usePluginState = usePluginState(api),
|
|
33
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference;
|
|
34
|
+
var isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
17
35
|
if (isDockedAtTop) {
|
|
18
36
|
return null;
|
|
19
37
|
}
|
|
@@ -148,6 +148,9 @@ export const selectionExtensionPlugin = ({
|
|
|
148
148
|
editorView
|
|
149
149
|
}) => {
|
|
150
150
|
var _api$analytics;
|
|
151
|
+
if (!editorView) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
151
154
|
return /*#__PURE__*/React.createElement(SelectionExtensionComponentWrapper, {
|
|
152
155
|
editorView: editorView,
|
|
153
156
|
api: api,
|
|
@@ -172,7 +175,7 @@ export const selectionExtensionPlugin = ({
|
|
|
172
175
|
|
|
173
176
|
// Content Mode Validation
|
|
174
177
|
// Check if pageModes is provided and matches against current content mode
|
|
175
|
-
// This will
|
|
178
|
+
// This will eventually transition from mode to contentMode
|
|
176
179
|
const editorContentMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode;
|
|
177
180
|
if (pageModes) {
|
|
178
181
|
// Early Exit: consumer has set pageModes but editorContentMode is undefined
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
2
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { ToolbarTooltip, ToolbarButton as BaseToolbarButton } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
/**
|
|
8
|
+
* !! When removing platform_editor_toolbar_aifc_patch_3 also remove package dependency on `@atlaskit/editor-plugin-view-mode`.
|
|
9
|
+
*/
|
|
10
|
+
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), api => {
|
|
11
|
+
const {
|
|
12
|
+
editorToolbarDockingPreference
|
|
13
|
+
} = useEditorToolbar();
|
|
14
|
+
return {
|
|
15
|
+
editorToolbarDockingPreference
|
|
16
|
+
};
|
|
17
|
+
}, api => {
|
|
18
|
+
const editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
19
|
+
return {
|
|
20
|
+
editorToolbarDockingPreference
|
|
21
|
+
};
|
|
22
|
+
});
|
|
4
23
|
export const ToolbarButton = ({
|
|
5
24
|
api,
|
|
6
25
|
config
|
|
7
26
|
}) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
27
|
+
const {
|
|
28
|
+
editorToolbarDockingPreference
|
|
29
|
+
} = usePluginState(api);
|
|
30
|
+
const isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
10
31
|
if (isDockedAtTop) {
|
|
11
32
|
return null;
|
|
12
33
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
2
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { ToolbarTooltip, ToolbarDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), api => {
|
|
8
|
+
const {
|
|
9
|
+
editorToolbarDockingPreference
|
|
10
|
+
} = useEditorToolbar();
|
|
11
|
+
return {
|
|
12
|
+
editorToolbarDockingPreference
|
|
13
|
+
};
|
|
14
|
+
}, api => {
|
|
15
|
+
const editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
16
|
+
return {
|
|
17
|
+
editorToolbarDockingPreference
|
|
18
|
+
};
|
|
19
|
+
});
|
|
4
20
|
export const ToolbarMenu = ({
|
|
5
21
|
api,
|
|
6
22
|
config,
|
|
7
23
|
children
|
|
8
24
|
}) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
25
|
+
const {
|
|
26
|
+
editorToolbarDockingPreference
|
|
27
|
+
} = usePluginState(api);
|
|
28
|
+
const isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
11
29
|
if (isDockedAtTop) {
|
|
12
30
|
return null;
|
|
13
31
|
}
|
|
@@ -144,6 +144,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
144
144
|
contentComponent: function contentComponent(_ref7) {
|
|
145
145
|
var _api$analytics;
|
|
146
146
|
var editorView = _ref7.editorView;
|
|
147
|
+
if (!editorView) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
147
150
|
return /*#__PURE__*/React.createElement(SelectionExtensionComponentWrapper, {
|
|
148
151
|
editorView: editorView,
|
|
149
152
|
api: api,
|
|
@@ -166,7 +169,7 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
166
169
|
|
|
167
170
|
// Content Mode Validation
|
|
168
171
|
// Check if pageModes is provided and matches against current content mode
|
|
169
|
-
// This will
|
|
172
|
+
// This will eventually transition from mode to contentMode
|
|
170
173
|
var editorContentMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
|
|
171
174
|
if (pageModes) {
|
|
172
175
|
// Early Exit: consumer has set pageModes but editorContentMode is undefined
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
2
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { ToolbarTooltip, ToolbarButton as BaseToolbarButton } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
/**
|
|
8
|
+
* !! When removing platform_editor_toolbar_aifc_patch_3 also remove package dependency on `@atlaskit/editor-plugin-view-mode`.
|
|
9
|
+
*/
|
|
10
|
+
var usePluginState = conditionalHooksFactory(function () {
|
|
11
|
+
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
12
|
+
}, function (api) {
|
|
13
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
14
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference;
|
|
15
|
+
return {
|
|
16
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
17
|
+
};
|
|
18
|
+
}, function (api) {
|
|
19
|
+
var editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
20
|
+
return {
|
|
21
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
22
|
+
};
|
|
23
|
+
});
|
|
4
24
|
export var ToolbarButton = function ToolbarButton(_ref) {
|
|
5
25
|
var api = _ref.api,
|
|
6
26
|
config = _ref.config;
|
|
7
|
-
var
|
|
8
|
-
|
|
27
|
+
var _usePluginState = usePluginState(api),
|
|
28
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference;
|
|
29
|
+
var isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
9
30
|
if (isDockedAtTop) {
|
|
10
31
|
return null;
|
|
11
32
|
}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
2
3
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { ToolbarTooltip, ToolbarDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
var usePluginState = conditionalHooksFactory(function () {
|
|
8
|
+
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
9
|
+
}, function (api) {
|
|
10
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
11
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference;
|
|
12
|
+
return {
|
|
13
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
14
|
+
};
|
|
15
|
+
}, function (api) {
|
|
16
|
+
var editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
17
|
+
return {
|
|
18
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
19
|
+
};
|
|
20
|
+
});
|
|
4
21
|
export var ToolbarMenu = function ToolbarMenu(_ref) {
|
|
5
22
|
var api = _ref.api,
|
|
6
23
|
config = _ref.config,
|
|
7
24
|
children = _ref.children;
|
|
8
|
-
var
|
|
9
|
-
|
|
25
|
+
var _usePluginState = usePluginState(api),
|
|
26
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference;
|
|
27
|
+
var isDockedAtTop = editorToolbarDockingPreference === 'top';
|
|
10
28
|
if (isDockedAtTop) {
|
|
11
29
|
return null;
|
|
12
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,30 +32,31 @@
|
|
|
32
32
|
],
|
|
33
33
|
"atlaskit:src": "src/index.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-utils": "^19.
|
|
36
|
-
"@atlaskit/editor-json-transformer": "^8.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^5.
|
|
38
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
35
|
+
"@atlaskit/adf-utils": "^19.23.0",
|
|
36
|
+
"@atlaskit/editor-json-transformer": "^8.29.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^5.2.0",
|
|
38
|
+
"@atlaskit/editor-plugin-block-menu": "^3.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^7.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^6.0.0",
|
|
41
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^6.
|
|
42
|
-
"@atlaskit/editor-plugin-toolbar": "^2.
|
|
41
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^6.1.0",
|
|
42
|
+
"@atlaskit/editor-plugin-toolbar": "^2.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-user-preferences": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
47
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
47
|
+
"@atlaskit/editor-toolbar": "^0.9.0",
|
|
48
48
|
"@atlaskit/icon": "^28.1.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
|
+
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
50
51
|
"@atlaskit/primitives": "^14.14.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^12.21.0",
|
|
52
53
|
"@babel/runtime": "^7.0.0",
|
|
53
54
|
"lodash": "^4.17.21",
|
|
54
55
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
55
56
|
"uuid": "^3.1.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^109.
|
|
59
|
+
"@atlaskit/editor-common": "^109.6.0",
|
|
59
60
|
"react": "^18.2.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|