@atlaskit/editor-plugin-copy-button 7.1.4 → 7.1.5
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 +8 -0
- package/dist/cjs/copyButtonPlugin.js +4 -1
- package/dist/cjs/ui/toolbar.js +16 -22
- package/dist/es2019/copyButtonPlugin.js +3 -2
- package/dist/es2019/ui/toolbar.js +9 -18
- package/dist/esm/copyButtonPlugin.js +5 -2
- package/dist/esm/ui/toolbar.js +15 -22
- package/dist/types/copyButtonPluginType.d.ts +1 -0
- package/dist/types/ui/toolbar.d.ts +6 -0
- package/dist/types-ts4.5/copyButtonPluginType.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar.d.ts +6 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-copy-button
|
|
2
2
|
|
|
3
|
+
## 7.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`abdf6c5320b01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/abdf6c5320b01) -
|
|
8
|
+
[EDITOR-5370] Support Unsupported Content: handle copy content from nodes like mention
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 7.1.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -21,7 +21,10 @@ var copyButtonPlugin = exports.copyButtonPlugin = function copyButtonPlugin(_ref
|
|
|
21
21
|
}];
|
|
22
22
|
},
|
|
23
23
|
actions: {
|
|
24
|
-
processCopyButtonItems: (0, _toolbar.processCopyButtonItems)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)
|
|
24
|
+
processCopyButtonItems: (0, _toolbar.processCopyButtonItems)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api),
|
|
25
|
+
afterCopy: function afterCopy(message) {
|
|
26
|
+
return (0, _toolbar.afterCopy)(api)(message);
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
};
|
|
27
30
|
};
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.afterCopy = void 0;
|
|
7
8
|
exports.getCopyButtonConfig = getCopyButtonConfig;
|
|
8
9
|
exports.processCopyButtonItems = void 0;
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -26,22 +27,20 @@ function isNodeOptions(options) {
|
|
|
26
27
|
* - Sets the copied state in the editor state
|
|
27
28
|
* - Announces the copied message to the user
|
|
28
29
|
*/
|
|
29
|
-
function afterCopy(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
}
|
|
30
|
+
var afterCopy = exports.afterCopy = function afterCopy(api) {
|
|
31
|
+
return function (message) {
|
|
32
|
+
var _api$accessibilityUti;
|
|
33
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
34
|
+
var tr = _ref.tr;
|
|
35
|
+
return tr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
36
|
+
copied: true
|
|
37
|
+
}).setMeta('scrollIntoView', false);
|
|
38
|
+
});
|
|
39
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
40
|
+
priority: 'important'
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
};
|
|
45
44
|
function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi, api) {
|
|
46
45
|
var state = options.state,
|
|
47
46
|
formatMessage = options.formatMessage,
|
|
@@ -67,12 +66,7 @@ function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi, api)
|
|
|
67
66
|
if (onClick) {
|
|
68
67
|
buttonActionHandlers.onClick = function (editorState, dispatch, editorView) {
|
|
69
68
|
if (onClick(editorState, dispatch, editorView)) {
|
|
70
|
-
afterCopy(
|
|
71
|
-
api: api,
|
|
72
|
-
dispatch: dispatch,
|
|
73
|
-
editorState: editorState,
|
|
74
|
-
message: formatMessage(_messages.default.copiedToClipboard)
|
|
75
|
-
});
|
|
69
|
+
afterCopy(api)(formatMessage(_messages.default.copiedToClipboard));
|
|
76
70
|
return true;
|
|
77
71
|
}
|
|
78
72
|
return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import createPlugin from './pm-plugins/main';
|
|
2
|
-
import { processCopyButtonItems } from './ui/toolbar';
|
|
2
|
+
import { processCopyButtonItems, afterCopy } from './ui/toolbar';
|
|
3
3
|
export const copyButtonPlugin = ({
|
|
4
4
|
api
|
|
5
5
|
}) => {
|
|
@@ -13,7 +13,8 @@ export const copyButtonPlugin = ({
|
|
|
13
13
|
}];
|
|
14
14
|
},
|
|
15
15
|
actions: {
|
|
16
|
-
processCopyButtonItems: processCopyButtonItems(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)
|
|
16
|
+
processCopyButtonItems: processCopyButtonItems(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api),
|
|
17
|
+
afterCopy: message => afterCopy(api)(message)
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
};
|
|
@@ -16,23 +16,19 @@ function isNodeOptions(options) {
|
|
|
16
16
|
* - Sets the copied state in the editor state
|
|
17
17
|
* - Announces the copied message to the user
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
api,
|
|
21
|
-
dispatch,
|
|
22
|
-
editorState,
|
|
23
|
-
message
|
|
24
|
-
}) {
|
|
19
|
+
export const afterCopy = api => message => {
|
|
25
20
|
var _api$accessibilityUti;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
22
|
+
tr
|
|
23
|
+
}) => {
|
|
24
|
+
return tr.setMeta(copyButtonPluginKey, {
|
|
25
|
+
copied: true
|
|
26
|
+
}).setMeta('scrollIntoView', false);
|
|
29
27
|
});
|
|
30
|
-
copyToClipboardTr.setMeta('scrollIntoView', false);
|
|
31
|
-
dispatch === null || dispatch === void 0 ? void 0 : dispatch(copyToClipboardTr);
|
|
32
28
|
api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(message, {
|
|
33
29
|
priority: 'important'
|
|
34
30
|
});
|
|
35
|
-
}
|
|
31
|
+
};
|
|
36
32
|
export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi, api) {
|
|
37
33
|
const {
|
|
38
34
|
state,
|
|
@@ -62,12 +58,7 @@ export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi
|
|
|
62
58
|
if (onClick) {
|
|
63
59
|
buttonActionHandlers.onClick = (editorState, dispatch, editorView) => {
|
|
64
60
|
if (onClick(editorState, dispatch, editorView)) {
|
|
65
|
-
afterCopy(
|
|
66
|
-
api,
|
|
67
|
-
dispatch,
|
|
68
|
-
editorState,
|
|
69
|
-
message: formatMessage(commonMessages.copiedToClipboard)
|
|
70
|
-
});
|
|
61
|
+
afterCopy(api)(formatMessage(commonMessages.copiedToClipboard));
|
|
71
62
|
return true;
|
|
72
63
|
}
|
|
73
64
|
return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import createPlugin from './pm-plugins/main';
|
|
2
|
-
import { processCopyButtonItems } from './ui/toolbar';
|
|
2
|
+
import { processCopyButtonItems, afterCopy as _afterCopy } from './ui/toolbar';
|
|
3
3
|
export var copyButtonPlugin = function copyButtonPlugin(_ref) {
|
|
4
4
|
var _api$analytics;
|
|
5
5
|
var api = _ref.api;
|
|
@@ -14,7 +14,10 @@ export var copyButtonPlugin = function copyButtonPlugin(_ref) {
|
|
|
14
14
|
}];
|
|
15
15
|
},
|
|
16
16
|
actions: {
|
|
17
|
-
processCopyButtonItems: processCopyButtonItems(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)
|
|
17
|
+
processCopyButtonItems: processCopyButtonItems(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api),
|
|
18
|
+
afterCopy: function afterCopy(message) {
|
|
19
|
+
return _afterCopy(api)(message);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
};
|
|
20
23
|
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -19,22 +19,20 @@ function isNodeOptions(options) {
|
|
|
19
19
|
* - Sets the copied state in the editor state
|
|
20
20
|
* - Announces the copied message to the user
|
|
21
21
|
*/
|
|
22
|
-
function afterCopy(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
}
|
|
22
|
+
export var afterCopy = function afterCopy(api) {
|
|
23
|
+
return function (message) {
|
|
24
|
+
var _api$accessibilityUti;
|
|
25
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
26
|
+
var tr = _ref.tr;
|
|
27
|
+
return tr.setMeta(copyButtonPluginKey, {
|
|
28
|
+
copied: true
|
|
29
|
+
}).setMeta('scrollIntoView', false);
|
|
30
|
+
});
|
|
31
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
32
|
+
priority: 'important'
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
};
|
|
38
36
|
export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi, api) {
|
|
39
37
|
var state = options.state,
|
|
40
38
|
formatMessage = options.formatMessage,
|
|
@@ -60,12 +58,7 @@ export function getCopyButtonConfig(options, hoverDecoration, editorAnalyticsApi
|
|
|
60
58
|
if (onClick) {
|
|
61
59
|
buttonActionHandlers.onClick = function (editorState, dispatch, editorView) {
|
|
62
60
|
if (onClick(editorState, dispatch, editorView)) {
|
|
63
|
-
afterCopy(
|
|
64
|
-
api: api,
|
|
65
|
-
dispatch: dispatch,
|
|
66
|
-
editorState: editorState,
|
|
67
|
-
message: formatMessage(commonMessages.copiedToClipboard)
|
|
68
|
-
});
|
|
61
|
+
afterCopy(api)(formatMessage(commonMessages.copiedToClipboard));
|
|
69
62
|
return true;
|
|
70
63
|
}
|
|
71
64
|
return false;
|
|
@@ -5,6 +5,7 @@ import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
declare const processCopyButtonItemsWithAnalytics: (state: import("prosemirror-state").EditorState) => (items: Array<import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>>, hoverDecoration: import("@atlaskit/editor-plugin-decorations").HoverDecorationHandler | undefined) => Array<import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>>;
|
|
6
6
|
export type CopyButtonPlugin = NextEditorPlugin<'copyButton', {
|
|
7
7
|
actions: {
|
|
8
|
+
afterCopy: (message: string) => void;
|
|
8
9
|
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
9
10
|
};
|
|
10
11
|
dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<AccessibilityUtilsPlugin>];
|
|
@@ -3,6 +3,12 @@ import type { ExtractInjectionAPI, Command, FloatingToolbarButton, FloatingToolb
|
|
|
3
3
|
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { CopyButtonPlugin } from '../copyButtonPluginType';
|
|
6
|
+
/**
|
|
7
|
+
* Performs the actions after a copy operation.
|
|
8
|
+
* - Sets the copied state in the editor state
|
|
9
|
+
* - Announces the copied message to the user
|
|
10
|
+
*/
|
|
11
|
+
export declare const afterCopy: (api?: ExtractInjectionAPI<CopyButtonPlugin>) => (message: string) => void;
|
|
6
12
|
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined, api?: ExtractInjectionAPI<CopyButtonPlugin>): FloatingToolbarButton<Command>;
|
|
7
13
|
/**
|
|
8
14
|
* Process floatingToolbar items for copyButton
|
|
@@ -5,6 +5,7 @@ import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
declare const processCopyButtonItemsWithAnalytics: (state: import("prosemirror-state").EditorState) => (items: Array<import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>>, hoverDecoration: import("@atlaskit/editor-plugin-decorations").HoverDecorationHandler | undefined) => Array<import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>>;
|
|
6
6
|
export type CopyButtonPlugin = NextEditorPlugin<'copyButton', {
|
|
7
7
|
actions: {
|
|
8
|
+
afterCopy: (message: string) => void;
|
|
8
9
|
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
9
10
|
};
|
|
10
11
|
dependencies: [
|
|
@@ -3,6 +3,12 @@ import type { ExtractInjectionAPI, Command, FloatingToolbarButton, FloatingToolb
|
|
|
3
3
|
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { CopyButtonPlugin } from '../copyButtonPluginType';
|
|
6
|
+
/**
|
|
7
|
+
* Performs the actions after a copy operation.
|
|
8
|
+
* - Sets the copied state in the editor state
|
|
9
|
+
* - Announces the copied message to the user
|
|
10
|
+
*/
|
|
11
|
+
export declare const afterCopy: (api?: ExtractInjectionAPI<CopyButtonPlugin>) => (message: string) => void;
|
|
6
12
|
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined, api?: ExtractInjectionAPI<CopyButtonPlugin>): FloatingToolbarButton<Command>;
|
|
7
13
|
/**
|
|
8
14
|
* Process floatingToolbar items for copyButton
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-copy-button",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.5",
|
|
4
4
|
"description": "editor-plugin-copy-button for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"@atlaskit/editor-plugin-decorations": "^7.0.0",
|
|
33
33
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
34
34
|
"@atlaskit/icon": "^31.0.0",
|
|
35
|
-
"@atlaskit/tmp-editor-statsig": "^29.
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^29.1.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^111.
|
|
39
|
+
"@atlaskit/editor-common": "^111.17.0",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0"
|
|
42
42
|
},
|