@atlaskit/native-embeds-common 0.1.2 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/native-embeds-common
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6c3e67fec342f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c3e67fec342f) -
8
+ Add BUILTIN_TOOLBAR_KEYS.COPY for copying native-embed nodes. COPY_LINK is now a deprecated alias
9
+ for COPY. Add onCopyClick handler alongside deprecated onCopyLinkClick alias.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 0.1.2
4
16
 
5
17
  ### Patch Changes
@@ -20,7 +20,7 @@ var NATIVE_EMBED_PARAMETER_DEFAULTS = exports.NATIVE_EMBED_PARAMETER_DEFAULTS =
20
20
  * Built-in keys that can be referenced in the `items` and `moreItems` arrays.
21
21
  *
22
22
  * Toolbar keys: ASK_ROVO, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
23
- * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY_LINK, DELETE
23
+ * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
24
24
  * Shared: SEPARATOR (usable in both)
25
25
  */
26
26
  var BUILTIN_TOOLBAR_KEYS = exports.BUILTIN_TOOLBAR_KEYS = {
@@ -34,8 +34,16 @@ var BUILTIN_TOOLBAR_KEYS = exports.BUILTIN_TOOLBAR_KEYS = {
34
34
  EDIT_URL: 'editUrl',
35
35
  ALWAYS_SHOW_TITLE: 'alwaysShowTitle',
36
36
  SET_EMBED_TYPE: 'setEmbedType',
37
+ /**
38
+ * Copies the native-embed node to the clipboard.
39
+ */
40
+ COPY: 'copy',
41
+ /**
42
+ * @private
43
+ * @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
44
+ */
37
45
  COPY_LINK: 'copyLink',
38
46
  DELETE: 'delete',
39
47
  SEPARATOR: 'separator'
40
48
  };
41
- var EDITOR_TOOLBAR_HANDLER_KEYS = exports.EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onCopyLinkClick', 'onChangeBorderClick', 'onDeleteClick', 'onEditUrlClick', 'onEditClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
49
+ var EDITOR_TOOLBAR_HANDLER_KEYS = exports.EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onChangeBorderClick', 'onCopyClick', 'onCopyLinkClick', 'onDeleteClick', 'onEditClick', 'onEditUrlClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
@@ -14,7 +14,7 @@ export const NATIVE_EMBED_PARAMETER_DEFAULTS = {
14
14
  * Built-in keys that can be referenced in the `items` and `moreItems` arrays.
15
15
  *
16
16
  * Toolbar keys: ASK_ROVO, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
17
- * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY_LINK, DELETE
17
+ * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
18
18
  * Shared: SEPARATOR (usable in both)
19
19
  */
20
20
  export const BUILTIN_TOOLBAR_KEYS = {
@@ -28,8 +28,16 @@ export const BUILTIN_TOOLBAR_KEYS = {
28
28
  EDIT_URL: 'editUrl',
29
29
  ALWAYS_SHOW_TITLE: 'alwaysShowTitle',
30
30
  SET_EMBED_TYPE: 'setEmbedType',
31
+ /**
32
+ * Copies the native-embed node to the clipboard.
33
+ */
34
+ COPY: 'copy',
35
+ /**
36
+ * @private
37
+ * @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
38
+ */
31
39
  COPY_LINK: 'copyLink',
32
40
  DELETE: 'delete',
33
41
  SEPARATOR: 'separator'
34
42
  };
35
- export const EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onCopyLinkClick', 'onChangeBorderClick', 'onDeleteClick', 'onEditUrlClick', 'onEditClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
43
+ export const EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onChangeBorderClick', 'onCopyClick', 'onCopyLinkClick', 'onDeleteClick', 'onEditClick', 'onEditUrlClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
@@ -14,7 +14,7 @@ export var NATIVE_EMBED_PARAMETER_DEFAULTS = {
14
14
  * Built-in keys that can be referenced in the `items` and `moreItems` arrays.
15
15
  *
16
16
  * Toolbar keys: ASK_ROVO, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
17
- * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY_LINK, DELETE
17
+ * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
18
18
  * Shared: SEPARATOR (usable in both)
19
19
  */
20
20
  export var BUILTIN_TOOLBAR_KEYS = {
@@ -28,8 +28,16 @@ export var BUILTIN_TOOLBAR_KEYS = {
28
28
  EDIT_URL: 'editUrl',
29
29
  ALWAYS_SHOW_TITLE: 'alwaysShowTitle',
30
30
  SET_EMBED_TYPE: 'setEmbedType',
31
+ /**
32
+ * Copies the native-embed node to the clipboard.
33
+ */
34
+ COPY: 'copy',
35
+ /**
36
+ * @private
37
+ * @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
38
+ */
31
39
  COPY_LINK: 'copyLink',
32
40
  DELETE: 'delete',
33
41
  SEPARATOR: 'separator'
34
42
  };
35
- export var EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onCopyLinkClick', 'onChangeBorderClick', 'onDeleteClick', 'onEditUrlClick', 'onEditClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
43
+ export var EDITOR_TOOLBAR_HANDLER_KEYS = ['onAlignmentClick', 'onAppearanceClick', 'onAskRovoClick', 'onChangeBorderClick', 'onCopyClick', 'onCopyLinkClick', 'onDeleteClick', 'onEditClick', 'onEditUrlClick', 'onOpenInNewWindowClick', 'onRefreshClick', 'onSetEmbedTypeClick', 'onShowTitleClick'];
@@ -6,7 +6,7 @@ export declare const NATIVE_EMBED_PARAMETER_DEFAULTS: NativeEmbedParameterValues
6
6
  * Built-in keys that can be referenced in the `items` and `moreItems` arrays.
7
7
  *
8
8
  * Toolbar keys: ASK_ROVO, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
9
- * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY_LINK, DELETE
9
+ * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
10
10
  * Shared: SEPARATOR (usable in both)
11
11
  */
12
12
  export declare const BUILTIN_TOOLBAR_KEYS: {
@@ -20,8 +20,16 @@ export declare const BUILTIN_TOOLBAR_KEYS: {
20
20
  readonly EDIT_URL: "editUrl";
21
21
  readonly ALWAYS_SHOW_TITLE: "alwaysShowTitle";
22
22
  readonly SET_EMBED_TYPE: "setEmbedType";
23
+ /**
24
+ * Copies the native-embed node to the clipboard.
25
+ */
26
+ readonly COPY: "copy";
27
+ /**
28
+ * @private
29
+ * @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
30
+ */
23
31
  readonly COPY_LINK: "copyLink";
24
32
  readonly DELETE: "delete";
25
33
  readonly SEPARATOR: "separator";
26
34
  };
27
- export declare const EDITOR_TOOLBAR_HANDLER_KEYS: readonly ["onAlignmentClick", "onAppearanceClick", "onAskRovoClick", "onCopyLinkClick", "onChangeBorderClick", "onDeleteClick", "onEditUrlClick", "onEditClick", "onOpenInNewWindowClick", "onRefreshClick", "onSetEmbedTypeClick", "onShowTitleClick"];
35
+ export declare const EDITOR_TOOLBAR_HANDLER_KEYS: readonly ["onAlignmentClick", "onAppearanceClick", "onAskRovoClick", "onChangeBorderClick", "onCopyClick", "onCopyLinkClick", "onDeleteClick", "onEditClick", "onEditUrlClick", "onOpenInNewWindowClick", "onRefreshClick", "onSetEmbedTypeClick", "onShowTitleClick"];
@@ -1,3 +1,4 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
2
  import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
3
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -21,6 +22,7 @@ export interface CardToNativeEmbedTransformOptions {
21
22
  * (e.g. datasource stash, analytics, link metadata).
22
23
  */
23
24
  augmentTransaction?: (tr: Transaction, state: EditorState) => void;
25
+ editorAnalyticsApi?: EditorAnalyticsAPI;
24
26
  }
25
27
  /**
26
28
  * Minimal plugin type for native embeds action integration.
@@ -80,6 +80,15 @@ export type EditorToolbarHandlers = Partial<{
80
80
  onAppearanceClick: (parameters: NativeEmbedParameterValues, appearance: NativeEmbedAppearance, context?: EditorToolbarHandlerContext) => void;
81
81
  onAskRovoClick: (parameters: NativeEmbedParameterValues, context?: EditorToolbarHandlerContext) => void;
82
82
  onChangeBorderClick: EditorToolbarHandler;
83
+ /**
84
+ * Handler invoked when the Copy action is clicked.
85
+ * Copies the native-embed node to the clipboard.
86
+ */
87
+ onCopyClick: EditorToolbarHandler;
88
+ /**
89
+ * @private
90
+ * @deprecated Use `onCopyClick` instead. This is a deprecated alias and will be removed in a future release.
91
+ */
83
92
  onCopyLinkClick: EditorToolbarHandler;
84
93
  onDeleteClick: EditorToolbarHandler;
85
94
  onEditClick: EditorToolbarHandler;
@@ -12,7 +12,7 @@ export declare const NATIVE_EMBED_PARAMETER_DEFAULTS: NativeEmbedParameterValues
12
12
  * Built-in keys that can be referenced in the `items` and `moreItems` arrays.
13
13
  *
14
14
  * Toolbar keys: ASK_ROVO, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
15
- * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY_LINK, DELETE
15
+ * More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
16
16
  * Shared: SEPARATOR (usable in both)
17
17
  */
18
18
  export declare const BUILTIN_TOOLBAR_KEYS: {
@@ -26,6 +26,14 @@ export declare const BUILTIN_TOOLBAR_KEYS: {
26
26
  readonly EDIT_URL: "editUrl";
27
27
  readonly ALWAYS_SHOW_TITLE: "alwaysShowTitle";
28
28
  readonly SET_EMBED_TYPE: "setEmbedType";
29
+ /**
30
+ * Copies the native-embed node to the clipboard.
31
+ */
32
+ readonly COPY: "copy";
33
+ /**
34
+ * @private
35
+ * @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
36
+ */
29
37
  readonly COPY_LINK: "copyLink";
30
38
  readonly DELETE: "delete";
31
39
  readonly SEPARATOR: "separator";
@@ -34,11 +42,12 @@ export declare const EDITOR_TOOLBAR_HANDLER_KEYS: readonly [
34
42
  "onAlignmentClick",
35
43
  "onAppearanceClick",
36
44
  "onAskRovoClick",
37
- "onCopyLinkClick",
38
45
  "onChangeBorderClick",
46
+ "onCopyClick",
47
+ "onCopyLinkClick",
39
48
  "onDeleteClick",
40
- "onEditUrlClick",
41
49
  "onEditClick",
50
+ "onEditUrlClick",
42
51
  "onOpenInNewWindowClick",
43
52
  "onRefreshClick",
44
53
  "onSetEmbedTypeClick",
@@ -1,3 +1,4 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
2
  import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
3
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -21,6 +22,7 @@ export interface CardToNativeEmbedTransformOptions {
21
22
  * (e.g. datasource stash, analytics, link metadata).
22
23
  */
23
24
  augmentTransaction?: (tr: Transaction, state: EditorState) => void;
25
+ editorAnalyticsApi?: EditorAnalyticsAPI;
24
26
  }
25
27
  /**
26
28
  * Minimal plugin type for native embeds action integration.
@@ -81,6 +81,15 @@ export type EditorToolbarHandlers = Partial<{
81
81
  onAppearanceClick: (parameters: NativeEmbedParameterValues, appearance: NativeEmbedAppearance, context?: EditorToolbarHandlerContext) => void;
82
82
  onAskRovoClick: (parameters: NativeEmbedParameterValues, context?: EditorToolbarHandlerContext) => void;
83
83
  onChangeBorderClick: EditorToolbarHandler;
84
+ /**
85
+ * Handler invoked when the Copy action is clicked.
86
+ * Copies the native-embed node to the clipboard.
87
+ */
88
+ onCopyClick: EditorToolbarHandler;
89
+ /**
90
+ * @private
91
+ * @deprecated Use `onCopyClick` instead. This is a deprecated alias and will be removed in a future release.
92
+ */
84
93
  onCopyLinkClick: EditorToolbarHandler;
85
94
  onDeleteClick: EditorToolbarHandler;
86
95
  onEditClick: EditorToolbarHandler;
package/package.json CHANGED
@@ -24,9 +24,9 @@
24
24
  ],
25
25
  "atlaskit:src": "src/index.ts",
26
26
  "dependencies": {
27
- "@atlaskit/editor-common": "^112.4.0",
27
+ "@atlaskit/editor-common": "^112.13.0",
28
28
  "@atlaskit/editor-prosemirror": "^7.3.0",
29
- "@atlaskit/icon": "^33.0.0",
29
+ "@atlaskit/icon": "^33.1.0",
30
30
  "@babel/runtime": "^7.0.0",
31
31
  "@compiled/react": "^0.20.0"
32
32
  },
@@ -79,7 +79,7 @@
79
79
  }
80
80
  },
81
81
  "name": "@atlaskit/native-embeds-common",
82
- "version": "0.1.2",
82
+ "version": "0.2.0",
83
83
  "description": "A shared package for native embeds to be used across experiences and plugin",
84
84
  "author": "Atlassian Pty Ltd",
85
85
  "license": "Apache-2.0",