@atlaskit/editor-plugin-copy-button 1.1.2 → 1.1.4

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,21 @@
1
1
  # @atlaskit/editor-plugin-copy-button
2
2
 
3
+ ## 1.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#99954](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99954)
14
+ [`0d119c672ce2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d119c672ce2) -
15
+ [ED-23345] Clean up showCopyButton check which enabled the copy button only if the copy button
16
+ plugin was enabled. This is now in the universal and default presets so will always be enabled.
17
+ - Updated dependencies
18
+
3
19
  ## 1.1.2
4
20
 
5
21
  ### Patch Changes
@@ -63,21 +63,9 @@ function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi) {
63
63
  // problem already exist with delete as well
64
64
  });
65
65
  }
66
- var showCopyButton = function showCopyButton(state) {
67
- return state &&
68
- // Check if the Copy button plugin is enabled
69
- // @ts-ignore copyButtonPluginKey.key
70
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
- state.plugins.find(function (p) {
72
- return p.key === _pluginKey.copyButtonPluginKey.key;
73
- });
74
- };
75
66
 
76
67
  /**
77
68
  * Process floatingToolbar items for copyButton
78
- *
79
- * If copy button plugin not enabled, remove copy button item from toolbar items
80
- * else process copy button to standard floatingtoobarbutton
81
69
  */
82
70
  var processCopyButtonItems = exports.processCopyButtonItems = function processCopyButtonItems(editorAnalyticsApi) {
83
71
  return function (state) {
@@ -85,7 +73,7 @@ var processCopyButtonItems = exports.processCopyButtonItems = function processCo
85
73
  return items.flatMap(function (item) {
86
74
  switch (item.type) {
87
75
  case 'copy-button':
88
- if (item !== null && item !== void 0 && item.hidden || !showCopyButton(state)) {
76
+ if (item !== null && item !== void 0 && item.hidden) {
89
77
  return [];
90
78
  }
91
79
  return item === null || item === void 0 ? void 0 : item.items.map(function (copyButtonItem) {
@@ -55,25 +55,15 @@ export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi
55
55
  // problem already exist with delete as well
56
56
  };
57
57
  }
58
- const showCopyButton = state => {
59
- return state &&
60
- // Check if the Copy button plugin is enabled
61
- // @ts-ignore copyButtonPluginKey.key
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- state.plugins.find(p => p.key === copyButtonPluginKey.key);
64
- };
65
58
 
66
59
  /**
67
60
  * Process floatingToolbar items for copyButton
68
- *
69
- * If copy button plugin not enabled, remove copy button item from toolbar items
70
- * else process copy button to standard floatingtoobarbutton
71
61
  */
72
62
  export const processCopyButtonItems = editorAnalyticsApi => state => {
73
63
  return (items, hoverDecoration) => items.flatMap(item => {
74
64
  switch (item.type) {
75
65
  case 'copy-button':
76
- if (item !== null && item !== void 0 && item.hidden || !showCopyButton(state)) {
66
+ if (item !== null && item !== void 0 && item.hidden) {
77
67
  return [];
78
68
  }
79
69
  return item === null || item === void 0 ? void 0 : item.items.map(copyButtonItem => isSeparator(copyButtonItem) ? copyButtonItem : getCopyButtonConfig(copyButtonItem, hoverDecoration, editorAnalyticsApi));
@@ -56,21 +56,9 @@ export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi
56
56
  // problem already exist with delete as well
57
57
  });
58
58
  }
59
- var showCopyButton = function showCopyButton(state) {
60
- return state &&
61
- // Check if the Copy button plugin is enabled
62
- // @ts-ignore copyButtonPluginKey.key
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- state.plugins.find(function (p) {
65
- return p.key === copyButtonPluginKey.key;
66
- });
67
- };
68
59
 
69
60
  /**
70
61
  * Process floatingToolbar items for copyButton
71
- *
72
- * If copy button plugin not enabled, remove copy button item from toolbar items
73
- * else process copy button to standard floatingtoobarbutton
74
62
  */
75
63
  export var processCopyButtonItems = function processCopyButtonItems(editorAnalyticsApi) {
76
64
  return function (state) {
@@ -78,7 +66,7 @@ export var processCopyButtonItems = function processCopyButtonItems(editorAnalyt
78
66
  return items.flatMap(function (item) {
79
67
  switch (item.type) {
80
68
  case 'copy-button':
81
- if (item !== null && item !== void 0 && item.hidden || !showCopyButton(state)) {
69
+ if (item !== null && item !== void 0 && item.hidden) {
82
70
  return [];
83
71
  }
84
72
  return item === null || item === void 0 ? void 0 : item.items.map(function (copyButtonItem) {
@@ -5,8 +5,5 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): FloatingToolbarButton<Command>;
6
6
  /**
7
7
  * Process floatingToolbar items for copyButton
8
- *
9
- * If copy button plugin not enabled, remove copy button item from toolbar items
10
- * else process copy button to standard floatingtoobarbutton
11
8
  */
12
9
  export declare const processCopyButtonItems: (editorAnalyticsApi?: EditorAnalyticsAPI | undefined) => (state: EditorState) => (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
@@ -5,8 +5,5 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): FloatingToolbarButton<Command>;
6
6
  /**
7
7
  * Process floatingToolbar items for copyButton
8
- *
9
- * If copy button plugin not enabled, remove copy button item from toolbar items
10
- * else process copy button to standard floatingtoobarbutton
11
8
  */
12
9
  export declare const processCopyButtonItems: (editorAnalyticsApi?: EditorAnalyticsAPI | undefined) => (state: EditorState) => (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-copy-button",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "editor-plugin-copy-button for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/editor-common": "^79.1.0",
35
+ "@atlaskit/editor-common": "^80.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
37
37
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
38
38
  "@atlaskit/editor-prosemirror": "4.0.1",