@atlaskit/editor-plugin-selection-extension 3.2.1 → 3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-selection-extension
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#191056](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/191056)
8
+ [`ecf381c9ee85c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ecf381c9ee85c) -
9
+ Update isDisabled prop as boolean type in dynamic configuration
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 3.2.1
4
16
 
5
17
  ### Patch Changes
@@ -181,14 +181,15 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
181
181
  };
182
182
  var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenuItem(extension, rank) {
183
183
  var _extension$isDisabled;
184
+ var disabled = (extension === null || extension === void 0 ? void 0 : extension.isDisabled) instanceof Function ? extension === null || extension === void 0 || (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
185
+ selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
186
+ }) : extension === null || extension === void 0 ? void 0 : extension.isDisabled;
184
187
  return {
185
188
  title: extension.name,
186
189
  icon: extension.icon ? /*#__PURE__*/_react.default.createElement(extension.icon, {
187
190
  label: ''
188
191
  }) : undefined,
189
- disabled: extension === null || extension === void 0 || (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
190
- selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
191
- }),
192
+ disabled: disabled,
192
193
  rank: rank,
193
194
  onClick: function onClick() {
194
195
  editorViewRef.current && handleOnExtensionClick(editorViewRef.current)(extension);
@@ -180,14 +180,15 @@ export const selectionExtensionPlugin = ({
180
180
  };
181
181
  const convertExtensionToDropdownMenuItem = (extension, rank) => {
182
182
  var _extension$isDisabled;
183
+ const disabled = (extension === null || extension === void 0 ? void 0 : extension.isDisabled) instanceof Function ? extension === null || extension === void 0 ? void 0 : (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
184
+ selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
185
+ }) : extension === null || extension === void 0 ? void 0 : extension.isDisabled;
183
186
  return {
184
187
  title: extension.name,
185
188
  icon: extension.icon ? /*#__PURE__*/React.createElement(extension.icon, {
186
189
  label: ''
187
190
  }) : undefined,
188
- disabled: extension === null || extension === void 0 ? void 0 : (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
189
- selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
190
- }),
191
+ disabled,
191
192
  rank,
192
193
  onClick: () => {
193
194
  editorViewRef.current && handleOnExtensionClick(editorViewRef.current)(extension);
@@ -174,14 +174,15 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
174
174
  };
175
175
  var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenuItem(extension, rank) {
176
176
  var _extension$isDisabled;
177
+ var disabled = (extension === null || extension === void 0 ? void 0 : extension.isDisabled) instanceof Function ? extension === null || extension === void 0 || (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
178
+ selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
179
+ }) : extension === null || extension === void 0 ? void 0 : extension.isDisabled;
177
180
  return {
178
181
  title: extension.name,
179
182
  icon: extension.icon ? /*#__PURE__*/React.createElement(extension.icon, {
180
183
  label: ''
181
184
  }) : undefined,
182
- disabled: extension === null || extension === void 0 || (_extension$isDisabled = extension.isDisabled) === null || _extension$isDisabled === void 0 ? void 0 : _extension$isDisabled.call(extension, {
183
- selection: editorViewRef.current ? getSelection(editorViewRef.current) : undefined
184
- }),
185
+ disabled: disabled,
185
186
  rank: rank,
186
187
  onClick: function onClick() {
187
188
  editorViewRef.current && handleOnExtensionClick(editorViewRef.current)(extension);
@@ -1,3 +1,3 @@
1
1
  export { selectionExtensionPlugin } from './selectionExtensionPlugin';
2
2
  export type { SelectionExtensionPlugin } from './selectionExtensionPluginType';
3
- export type { SelectionExtensionComponentProps, SelectionExtensionPluginOptions, SelectionExtension, LinkInsertionOption, SelectionExtensionPluginState, SelectionExtensionSelectionInfo, } from './types';
3
+ export type { SelectionExtensionComponentProps, SelectionExtensionPluginOptions, SelectionExtension, LinkInsertionOption, SelectionExtensionPluginState, SelectionExtensionSelectionInfo, DynamicSelectionExtension, } from './types';
@@ -3,7 +3,7 @@ import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
5
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
6
- import type { LinkInsertionOption, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
6
+ import type { DynamicSelectionExtension, LinkInsertionOption, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
7
7
  export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
8
8
  pluginConfiguration: SelectionExtensionPluginOptions | undefined;
9
9
  dependencies: [
@@ -14,7 +14,7 @@ export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
14
14
  sharedState: SelectionExtensionPluginState | null;
15
15
  commands: {
16
16
  setActiveExtension: ({ extension, selection, }: {
17
- extension: SelectionExtension;
17
+ extension: SelectionExtension | DynamicSelectionExtension;
18
18
  selection: SelectionExtensionSelectionInfo;
19
19
  }) => EditorCommand;
20
20
  clearActiveExtension: () => EditorCommand;
@@ -36,6 +36,9 @@ export type SelectionExtension = {
36
36
  onClick?: (params: SelectionExtensionCallbackOptions) => void;
37
37
  component?: React.ComponentType<SelectionExtensionComponentProps>;
38
38
  };
39
+ export type DynamicSelectionExtension = Omit<SelectionExtension, 'isDisabled'> & {
40
+ isDisabled?: boolean;
41
+ };
39
42
  export type SelectionPointer = {
40
43
  pointer: string;
41
44
  position?: number;
@@ -48,7 +51,7 @@ export type SelectionExtensionFnOptions = {
48
51
  selectedNodeAdf: ADFEntity;
49
52
  selectionRanges: SelectionRange[];
50
53
  };
51
- export type SelectionExtensionFn = ({ selectedNodeAdf, selectionRanges, }: SelectionExtensionFnOptions) => SelectionExtension;
54
+ export type SelectionExtensionFn = ({ selectedNodeAdf, selectionRanges, }: SelectionExtensionFnOptions) => DynamicSelectionExtension;
52
55
  export type SelectionExtensionConfig = SelectionExtension | SelectionExtensionFn;
53
56
  export type SelectionExtensions = {
54
57
  firstParty?: SelectionExtensionConfig[];
@@ -1,3 +1,3 @@
1
1
  export { selectionExtensionPlugin } from './selectionExtensionPlugin';
2
2
  export type { SelectionExtensionPlugin } from './selectionExtensionPluginType';
3
- export type { SelectionExtensionComponentProps, SelectionExtensionPluginOptions, SelectionExtension, LinkInsertionOption, SelectionExtensionPluginState, SelectionExtensionSelectionInfo, } from './types';
3
+ export type { SelectionExtensionComponentProps, SelectionExtensionPluginOptions, SelectionExtension, LinkInsertionOption, SelectionExtensionPluginState, SelectionExtensionSelectionInfo, DynamicSelectionExtension, } from './types';
@@ -3,7 +3,7 @@ import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
5
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
6
- import type { LinkInsertionOption, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
6
+ import type { DynamicSelectionExtension, LinkInsertionOption, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
7
7
  export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
8
8
  pluginConfiguration: SelectionExtensionPluginOptions | undefined;
9
9
  dependencies: [
@@ -14,7 +14,7 @@ export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
14
14
  sharedState: SelectionExtensionPluginState | null;
15
15
  commands: {
16
16
  setActiveExtension: ({ extension, selection, }: {
17
- extension: SelectionExtension;
17
+ extension: SelectionExtension | DynamicSelectionExtension;
18
18
  selection: SelectionExtensionSelectionInfo;
19
19
  }) => EditorCommand;
20
20
  clearActiveExtension: () => EditorCommand;
@@ -36,6 +36,9 @@ export type SelectionExtension = {
36
36
  onClick?: (params: SelectionExtensionCallbackOptions) => void;
37
37
  component?: React.ComponentType<SelectionExtensionComponentProps>;
38
38
  };
39
+ export type DynamicSelectionExtension = Omit<SelectionExtension, 'isDisabled'> & {
40
+ isDisabled?: boolean;
41
+ };
39
42
  export type SelectionPointer = {
40
43
  pointer: string;
41
44
  position?: number;
@@ -48,7 +51,7 @@ export type SelectionExtensionFnOptions = {
48
51
  selectedNodeAdf: ADFEntity;
49
52
  selectionRanges: SelectionRange[];
50
53
  };
51
- export type SelectionExtensionFn = ({ selectedNodeAdf, selectionRanges, }: SelectionExtensionFnOptions) => SelectionExtension;
54
+ export type SelectionExtensionFn = ({ selectedNodeAdf, selectionRanges, }: SelectionExtensionFnOptions) => DynamicSelectionExtension;
52
55
  export type SelectionExtensionConfig = SelectionExtension | SelectionExtensionFn;
53
56
  export type SelectionExtensions = {
54
57
  firstParty?: SelectionExtensionConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,17 +42,17 @@
42
42
  "@atlaskit/editor-plugin-selection-toolbar": "^4.2.0",
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
44
44
  "@atlaskit/editor-tables": "^2.9.0",
45
- "@atlaskit/icon": "^27.5.0",
45
+ "@atlaskit/icon": "^27.6.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/primitives": "^14.10.0",
48
- "@atlaskit/tmp-editor-statsig": "^9.9.0",
48
+ "@atlaskit/tmp-editor-statsig": "^9.12.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "lodash": "^4.17.21",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1",
52
52
  "uuid": "^3.1.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@atlaskit/editor-common": "^107.9.0",
55
+ "@atlaskit/editor-common": "^107.12.0",
56
56
  "react": "^18.2.0"
57
57
  },
58
58
  "devDependencies": {