@atlaskit/editor-plugin-copy-button 0.1.0 → 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 +10 -0
- package/dist/cjs/commands.js +172 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/plugin.js +28 -0
- package/dist/cjs/pm-plugins/main.js +104 -0
- package/dist/cjs/pm-plugins/plugin-key.js +9 -0
- package/dist/cjs/toolbar.js +103 -0
- package/dist/cjs/types.js +3 -3
- package/dist/cjs/utils.js +22 -0
- package/dist/es2019/commands.js +158 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugin.js +19 -0
- package/dist/es2019/pm-plugins/main.js +97 -0
- package/dist/es2019/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/toolbar.js +85 -0
- package/dist/es2019/types.js +3 -1
- package/dist/es2019/utils.js +15 -0
- package/dist/esm/commands.js +160 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugin.js +20 -0
- package/dist/esm/pm-plugins/main.js +96 -0
- package/dist/esm/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/toolbar.js +94 -0
- package/dist/esm/types.js +3 -1
- package/dist/esm/utils.js +14 -0
- package/dist/types/commands.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +4 -0
- package/dist/types/pm-plugins/plugin-key.d.ts +2 -0
- package/dist/types/toolbar.d.ts +13 -0
- package/dist/types/types.d.ts +10 -2
- package/dist/types/utils.d.ts +7 -0
- package/dist/types-ts4.5/commands.d.ts +10 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +2 -0
- package/dist/types-ts4.5/toolbar.d.ts +13 -0
- package/dist/types-ts4.5/types.d.ts +12 -2
- package/dist/types-ts4.5/utils.d.ts +7 -0
- package/package.json +9 -3
- package/report.api.md +32 -1
- package/tmp/api-report-tmp.d.ts +18 -1
- package/toolbar/package.json +15 -0
- package/utils/package.json +15 -0
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
3
|
import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
|
|
4
|
+
declare const processCopyButtonItemsWithAnalytics: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
5
|
+
export type CopyButtonPlugin = NextEditorPlugin<'copyButton', {
|
|
6
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
7
|
+
actions: {
|
|
8
|
+
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
4
11
|
export type CopyButtonPluginState = {
|
|
5
12
|
copied: boolean;
|
|
6
13
|
markSelection?: {
|
|
@@ -9,3 +16,4 @@ export type CopyButtonPluginState = {
|
|
|
9
16
|
markType: MarkType;
|
|
10
17
|
};
|
|
11
18
|
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare function getSelectedNodeOrNodeParentByNodeType({ nodeType, selection, }: {
|
|
4
|
+
nodeType: NodeType | Array<NodeType>;
|
|
5
|
+
selection: Transaction['selection'];
|
|
6
|
+
}): import("prosemirror-utils/dist/types").FindResult;
|
|
7
|
+
export declare const toDOM: (node: PMNode, schema: Schema) => Node;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command, CommandDispatch } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
|
+
import type { MarkType, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
export declare function createToolbarCopyCommandForMark(markType: MarkType, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
|
|
7
|
+
export declare function getProvideMarkVisualFeedbackForCopyButtonCommand(markType: MarkType): (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
|
|
8
|
+
export declare function removeMarkVisualFeedbackForCopyButtonCommand(state: EditorState, dispatch: CommandDispatch | undefined): boolean;
|
|
9
|
+
export declare const createToolbarCopyCommandForNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
10
|
+
export declare const resetCopiedState: (nodeType: NodeType | Array<NodeType>, hoverDecoration: HoverDecorationHandler | undefined, onMouseLeave?: Command) => Command;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command, FloatingToolbarButton, FloatingToolbarItem, MarkOptions, NodeOptions } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): FloatingToolbarButton<Command>;
|
|
6
|
+
export declare const showCopyButton: (state?: EditorState) => import("prosemirror-state").Plugin<any> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Process floatingToolbar items for copyButton
|
|
9
|
+
*
|
|
10
|
+
* If copy button plugin not enabled, remove copy button item from toolbar items
|
|
11
|
+
* else process copy button to standard floatingtoobarbutton
|
|
12
|
+
*/
|
|
13
|
+
export declare const processCopyButtonItems: (editorAnalyticsApi?: EditorAnalyticsAPI | undefined) => (state: EditorState) => (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
3
|
import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
|
|
4
|
+
declare const processCopyButtonItemsWithAnalytics: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
5
|
+
export type CopyButtonPlugin = NextEditorPlugin<'copyButton', {
|
|
6
|
+
dependencies: [
|
|
7
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
8
|
+
];
|
|
9
|
+
actions: {
|
|
10
|
+
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
4
13
|
export type CopyButtonPluginState = {
|
|
5
14
|
copied: boolean;
|
|
6
15
|
markSelection?: {
|
|
@@ -9,3 +18,4 @@ export type CopyButtonPluginState = {
|
|
|
9
18
|
markType: MarkType;
|
|
10
19
|
};
|
|
11
20
|
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare function getSelectedNodeOrNodeParentByNodeType({ nodeType, selection, }: {
|
|
4
|
+
nodeType: NodeType | Array<NodeType>;
|
|
5
|
+
selection: Transaction['selection'];
|
|
6
|
+
}): import("prosemirror-utils/dist/types").FindResult;
|
|
7
|
+
export declare const toDOM: (node: PMNode, schema: Schema) => Node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-copy-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "editor-plugin-copy-button for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,17 +28,23 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"af:exports": {
|
|
31
|
-
".": "./src/index.ts"
|
|
31
|
+
".": "./src/index.ts",
|
|
32
|
+
"./toolbar": "./src/toolbar.ts",
|
|
33
|
+
"./utils": "./src/utils.ts"
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^75.0
|
|
36
|
+
"@atlaskit/editor-common": "^75.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
38
|
+
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
35
39
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
40
|
+
"@atlaskit/icon": "^21.12.0",
|
|
36
41
|
"@babel/runtime": "^7.0.0"
|
|
37
42
|
},
|
|
38
43
|
"peerDependencies": {
|
|
39
44
|
"react": "^16.8.0"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {
|
|
47
|
+
"@atlaskit/analytics-next": "^9.1.0",
|
|
42
48
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
43
49
|
"@testing-library/react": "^12.1.5",
|
|
44
50
|
"react-dom": "^16.8.0",
|
package/report.api.md
CHANGED
|
@@ -15,11 +15,28 @@
|
|
|
15
15
|
<!--SECTION START: Main Entry Types-->
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
19
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
20
|
+
import { EditorState } from 'prosemirror-state';
|
|
21
|
+
import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
18
22
|
import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
19
23
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
24
|
+
import { NodeType } from 'prosemirror-model';
|
|
25
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
20
26
|
|
|
21
27
|
// @public (undocumented)
|
|
22
|
-
export type CopyButtonPlugin = NextEditorPlugin<
|
|
28
|
+
export type CopyButtonPlugin = NextEditorPlugin<
|
|
29
|
+
'copyButton',
|
|
30
|
+
{
|
|
31
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
32
|
+
actions: {
|
|
33
|
+
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
// @public (undocumented)
|
|
39
|
+
export const copyButtonPlugin: CopyButtonPlugin;
|
|
23
40
|
|
|
24
41
|
// @public (undocumented)
|
|
25
42
|
export type CopyButtonPluginState = {
|
|
@@ -31,6 +48,20 @@ export type CopyButtonPluginState = {
|
|
|
31
48
|
};
|
|
32
49
|
};
|
|
33
50
|
|
|
51
|
+
// @public (undocumented)
|
|
52
|
+
const processCopyButtonItemsWithAnalytics: (
|
|
53
|
+
state: EditorState,
|
|
54
|
+
) => (
|
|
55
|
+
items: FloatingToolbarItem<Command>[],
|
|
56
|
+
hoverDecoration:
|
|
57
|
+
| ((
|
|
58
|
+
nodeType: NodeType | NodeType[],
|
|
59
|
+
add: boolean,
|
|
60
|
+
className?: string | undefined,
|
|
61
|
+
) => Command)
|
|
62
|
+
| undefined,
|
|
63
|
+
) => FloatingToolbarItem<Command>[];
|
|
64
|
+
|
|
34
65
|
// (No @packageDocumentation comment for this package)
|
|
35
66
|
```
|
|
36
67
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -4,11 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { EditorState } from 'prosemirror-state';
|
|
10
|
+
import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
7
11
|
import type { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
8
12
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
13
|
+
import { NodeType } from 'prosemirror-model';
|
|
14
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
9
15
|
|
|
10
16
|
// @public (undocumented)
|
|
11
|
-
export type CopyButtonPlugin = NextEditorPlugin<'copyButton'
|
|
17
|
+
export type CopyButtonPlugin = NextEditorPlugin<'copyButton', {
|
|
18
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
19
|
+
actions: {
|
|
20
|
+
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
// @public (undocumented)
|
|
25
|
+
export const copyButtonPlugin: CopyButtonPlugin;
|
|
12
26
|
|
|
13
27
|
// @public (undocumented)
|
|
14
28
|
export type CopyButtonPluginState = {
|
|
@@ -20,6 +34,9 @@ export type CopyButtonPluginState = {
|
|
|
20
34
|
};
|
|
21
35
|
};
|
|
22
36
|
|
|
37
|
+
// @public (undocumented)
|
|
38
|
+
const processCopyButtonItemsWithAnalytics: (state: EditorState) => (items: FloatingToolbarItem<Command>[], hoverDecoration: ((nodeType: NodeType | NodeType[], add: boolean, className?: string | undefined) => Command) | undefined) => FloatingToolbarItem<Command>[];
|
|
39
|
+
|
|
23
40
|
// (No @packageDocumentation comment for this package)
|
|
24
41
|
|
|
25
42
|
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-copy-button/toolbar",
|
|
3
|
+
"main": "../dist/cjs/toolbar.js",
|
|
4
|
+
"module": "../dist/esm/toolbar.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/toolbar.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/toolbar.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/toolbar.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-copy-button/utils",
|
|
3
|
+
"main": "../dist/cjs/utils.js",
|
|
4
|
+
"module": "../dist/esm/utils.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/utils.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/utils.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/utils.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|