@atlaskit/native-embeds-common 1.5.0 → 2.0.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 +26 -0
- package/constants/package.json +1 -8
- package/embed-depth/constants/package.json +1 -8
- package/embed-depth/package.json +1 -8
- package/fallback-ui/package.json +1 -8
- package/package.json +9 -17
- package/plugin-actions/types/package.json +1 -8
- package/types/package.json +1 -8
- package/utils/package.json +1 -8
- package/dist/types-ts4.5/embed-depth.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/constants.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/embed-depth-constants.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/plugin-actions-types.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/utils.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -4
- package/dist/types-ts4.5/ui/index.d.ts +0 -14
- package/dist/types-ts4.5/utils/constants.d.ts +0 -79
- package/dist/types-ts4.5/utils/plugin-actions/types.d.ts +0 -35
- package/dist/types-ts4.5/utils/types.d.ts +0 -167
- package/dist/types-ts4.5/utils/utils.d.ts +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/native-embeds-common
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
8
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
9
|
+
|
|
10
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
11
|
+
|
|
12
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
- "typesVersions": {
|
|
16
|
+
- ">=4.5 <4.9": {
|
|
17
|
+
- "*": [
|
|
18
|
+
- "dist/types-ts4.5/*",
|
|
19
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
20
|
+
- ]
|
|
21
|
+
- }
|
|
22
|
+
- },
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 1.5.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/constants/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/constants.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/constants.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/constants.d.ts"
|
|
17
10
|
}
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../../dist/types/entry-points/embed-depth-constants.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../../dist/types-ts4.5/entry-points/embed-depth-constants.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../../dist/types/entry-points/embed-depth-constants.d.ts"
|
|
17
10
|
}
|
package/embed-depth/package.json
CHANGED
package/fallback-ui/package.json
CHANGED
package/package.json
CHANGED
|
@@ -11,27 +11,19 @@
|
|
|
11
11
|
"module": "dist/esm/index.js",
|
|
12
12
|
"module:es2019": "dist/es2019/index.js",
|
|
13
13
|
"types": "dist/types/index.d.ts",
|
|
14
|
-
"typesVersions": {
|
|
15
|
-
">=4.5 <5.9": {
|
|
16
|
-
"*": [
|
|
17
|
-
"dist/types-ts4.5/*",
|
|
18
|
-
"dist/types-ts4.5/index.d.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
14
|
"sideEffects": [
|
|
23
15
|
"*.compiled.css"
|
|
24
16
|
],
|
|
25
17
|
"atlaskit:src": "src/index.ts",
|
|
26
18
|
"dependencies": {
|
|
27
|
-
"@atlaskit/button": "^
|
|
28
|
-
"@atlaskit/editor-common": "^
|
|
29
|
-
"@atlaskit/editor-plugin-local-id": "^
|
|
30
|
-
"@atlaskit/editor-prosemirror": "^
|
|
31
|
-
"@atlaskit/heading": "^
|
|
32
|
-
"@atlaskit/icon": "^
|
|
33
|
-
"@atlaskit/primitives": "^
|
|
34
|
-
"@atlaskit/tokens": "^
|
|
19
|
+
"@atlaskit/button": "^24.0.0",
|
|
20
|
+
"@atlaskit/editor-common": "^116.0.0",
|
|
21
|
+
"@atlaskit/editor-plugin-local-id": "^10.0.0",
|
|
22
|
+
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
23
|
+
"@atlaskit/heading": "^6.0.0",
|
|
24
|
+
"@atlaskit/icon": "^36.0.0",
|
|
25
|
+
"@atlaskit/primitives": "^20.0.0",
|
|
26
|
+
"@atlaskit/tokens": "^14.0.0",
|
|
35
27
|
"@babel/runtime": "^7.0.0",
|
|
36
28
|
"@compiled/react": "^0.20.0"
|
|
37
29
|
},
|
|
@@ -87,7 +79,7 @@
|
|
|
87
79
|
}
|
|
88
80
|
},
|
|
89
81
|
"name": "@atlaskit/native-embeds-common",
|
|
90
|
-
"version": "
|
|
82
|
+
"version": "2.0.0",
|
|
91
83
|
"description": "A shared package for native embeds to be used across experiences and plugin",
|
|
92
84
|
"author": "Atlassian Pty Ltd",
|
|
93
85
|
"license": "Apache-2.0",
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../../dist/types/entry-points/plugin-actions-types.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../../dist/types-ts4.5/entry-points/plugin-actions-types.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../../dist/types/entry-points/plugin-actions-types.d.ts"
|
|
17
10
|
}
|
package/types/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/types.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/types.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/types.d.ts"
|
|
17
10
|
}
|
package/utils/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/utils.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/utils.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/utils.d.ts"
|
|
17
10
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from './utils/constants';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS, } from '../utils/constants';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from '../utils/constants';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { CardToNativeEmbedNode, CardToNativeEmbedTransformOptions, CreateCardToNativeEmbedTransform, EditorPluginNativeEmbedsPlugin, NativeEmbedLayout, NativeEmbedTransformAttrs, } from '../utils/plugin-actions/types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { AlignmentValue, EditorToolbarButtonAction, EditorToolbarAction, EditorToolbarHandler, EditorToolbarHandlerContext, EditorToolbarHandlerKey, EditorToolbarHandlers, NativeEmbedAppearance, NativeEmbedParameterKey, NativeEmbedParameterValues, NativeEmbedParameterValue, NativeEmbedParameters, BuiltinToolbarKey, ManifestEditorToolbarActions, } from '../utils/types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters, } from '../utils/utils';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS, } from './utils/constants';
|
|
2
|
-
export type { AlignmentValue, EditorToolbarButtonAction, EditorToolbarAction, EditorToolbarHandler, EditorToolbarHandlerContext, EditorToolbarHandlerKey, EditorToolbarHandlers, NativeEmbedAppearance, NativeEmbedParameterKey, NativeEmbedParameterValues, NativeEmbedParameterValue, NativeEmbedParameters, BuiltinToolbarKey, ManifestEditorToolbarActions, } from './utils/types';
|
|
3
|
-
export type { CardToNativeEmbedNode, CardToNativeEmbedTransformOptions, CreateCardToNativeEmbedTransform, EditorPluginNativeEmbedsPlugin, NativeEmbedLayout, NativeEmbedTransformAttrs, } from './utils/plugin-actions/types';
|
|
4
|
-
export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters, } from './utils/utils';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { CorePlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { LocalIdPlugin } from '@atlaskit/editor-plugin-local-id';
|
|
5
|
-
type NativeEmbedsEditorAPI = PublicPluginAPI<[
|
|
6
|
-
CorePlugin,
|
|
7
|
-
LocalIdPlugin
|
|
8
|
-
]>;
|
|
9
|
-
export declare const NativeEmbedFallbackUI: ({ api, localId, url, }: {
|
|
10
|
-
api?: NativeEmbedsEditorAPI;
|
|
11
|
-
localId?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
}) => React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { NativeEmbedParameterValues } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* URL query-parameter key used to track the current embedding depth.
|
|
4
|
-
* Each nested native-embed iframe increments this value by 1.
|
|
5
|
-
*/
|
|
6
|
-
export declare const EMBED_DEPTH_QUERY_PARAM: "nativeEmbedDepth";
|
|
7
|
-
/**
|
|
8
|
-
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
9
|
-
* value **≥** this limit the extension renderer should display a fallback
|
|
10
|
-
* instead of another iframe to prevent infinite recursion.
|
|
11
|
-
*/
|
|
12
|
-
export declare const MAX_EMBED_DEPTH = 2;
|
|
13
|
-
/**
|
|
14
|
-
* Read the current embedding depth from `window.location.search`.
|
|
15
|
-
*
|
|
16
|
-
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
17
|
-
* non-negative integer, which is the expected case for top-level pages.
|
|
18
|
-
*/
|
|
19
|
-
export declare const getCurrentEmbedDepth: () => number;
|
|
20
|
-
export declare const ALIGNMENT_VALUES: readonly [
|
|
21
|
-
"left",
|
|
22
|
-
"center",
|
|
23
|
-
"right",
|
|
24
|
-
"wrap-left",
|
|
25
|
-
"wrap-right"
|
|
26
|
-
];
|
|
27
|
-
export declare const DEFAULT_ALIGNMENT: "center";
|
|
28
|
-
export declare const NATIVE_EMBED_PARAMETER_DEFAULTS: NativeEmbedParameterValues;
|
|
29
|
-
/**
|
|
30
|
-
* Built-in keys that can be referenced in the `items` and `moreItems` arrays.
|
|
31
|
-
*
|
|
32
|
-
* Toolbar keys: ASK_ROVO, SUMMARISE, REFRESH, EDIT, EMBED, BORDER, ALIGNMENT, OPEN_IN_NEW_WINDOW
|
|
33
|
-
* More Options dropdown keys: ALWAYS_SHOW_TITLE, SET_EMBED_TYPE, COPY, COPY_LINK (deprecated), DELETE
|
|
34
|
-
* Shared: SEPARATOR (usable in both)
|
|
35
|
-
*/
|
|
36
|
-
export declare const BUILTIN_TOOLBAR_KEYS: {
|
|
37
|
-
readonly ASK_ROVO: "askRovo";
|
|
38
|
-
readonly REMIX_VARIANT: "remixVariant";
|
|
39
|
-
readonly SUMMARISE: "summarise";
|
|
40
|
-
readonly REFRESH: "refresh";
|
|
41
|
-
readonly EDIT: "edit";
|
|
42
|
-
readonly EMBED: "embed";
|
|
43
|
-
readonly BORDER: "border";
|
|
44
|
-
readonly ALIGNMENT: "alignment";
|
|
45
|
-
readonly OPEN_IN_NEW_WINDOW: "openInNewWindow";
|
|
46
|
-
/** Opens the embed's fullscreen preview dialog. */
|
|
47
|
-
readonly EXPAND: "expand";
|
|
48
|
-
readonly EDIT_URL: "editUrl";
|
|
49
|
-
readonly ALWAYS_SHOW_TITLE: "alwaysShowTitle";
|
|
50
|
-
readonly SET_EMBED_TYPE: "setEmbedType";
|
|
51
|
-
/**
|
|
52
|
-
* Copies the native-embed node to the clipboard.
|
|
53
|
-
*/
|
|
54
|
-
readonly COPY: "copy";
|
|
55
|
-
/**
|
|
56
|
-
* @private
|
|
57
|
-
* @deprecated Use `COPY` instead. `COPY_LINK` is a deprecated alias for `COPY` and will be removed in a future release.
|
|
58
|
-
*/
|
|
59
|
-
readonly COPY_LINK: "copyLink";
|
|
60
|
-
readonly DELETE: "delete";
|
|
61
|
-
readonly SEPARATOR: "separator";
|
|
62
|
-
};
|
|
63
|
-
export declare const EDITOR_TOOLBAR_HANDLER_KEYS: readonly [
|
|
64
|
-
"onAlignmentClick",
|
|
65
|
-
"onAppearanceClick",
|
|
66
|
-
"onAskRovoClick",
|
|
67
|
-
"onSummariseClick",
|
|
68
|
-
"onChangeBorderClick",
|
|
69
|
-
"onCopyClick",
|
|
70
|
-
"onCopyLinkClick",
|
|
71
|
-
"onDeleteClick",
|
|
72
|
-
"onEditClick",
|
|
73
|
-
"onEditUrlClick",
|
|
74
|
-
"onExpandClick",
|
|
75
|
-
"onOpenInNewWindowClick",
|
|
76
|
-
"onRefreshClick",
|
|
77
|
-
"onSetEmbedTypeClick",
|
|
78
|
-
"onShowTitleClick"
|
|
79
|
-
];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
/** Accepted layout values from ADF schema (embedCard) */
|
|
6
|
-
export type NativeEmbedLayout = 'wide' | 'full-width' | 'center' | 'wrap-right' | 'wrap-left' | 'align-end' | 'align-start';
|
|
7
|
-
/** Input attrs for embedCard node (subset used by transform) */
|
|
8
|
-
export interface NativeEmbedTransformAttrs {
|
|
9
|
-
layout?: NativeEmbedLayout;
|
|
10
|
-
originalHeight?: number | null;
|
|
11
|
-
originalWidth?: number | null;
|
|
12
|
-
url: string;
|
|
13
|
-
width?: number;
|
|
14
|
-
}
|
|
15
|
-
/** Type for cardToNativeEmbedNode - converts embed attrs to native embed Node */
|
|
16
|
-
export type CardToNativeEmbedNode = (schema: Schema, attrs: NativeEmbedTransformAttrs) => Node | undefined;
|
|
17
|
-
/** Type for createEmbedCardToNativeEmbedTransform - returns a Command */
|
|
18
|
-
export type CreateCardToNativeEmbedTransform = (options?: CardToNativeEmbedTransformOptions) => Command;
|
|
19
|
-
export interface CardToNativeEmbedTransformOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Called before dispatch to allow the caller to augment the transaction
|
|
22
|
-
* (e.g. datasource stash, analytics, link metadata).
|
|
23
|
-
*/
|
|
24
|
-
augmentTransaction?: (tr: Transaction, state: EditorState) => void;
|
|
25
|
-
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Minimal plugin type for native embeds action integration.
|
|
29
|
-
*/
|
|
30
|
-
export type EditorPluginNativeEmbedsPlugin = NextEditorPlugin<'editorPluginNativeEmbeds', {
|
|
31
|
-
actions: {
|
|
32
|
-
cardToNativeEmbedNode: CardToNativeEmbedNode;
|
|
33
|
-
createCardToNativeEmbedTransform: CreateCardToNativeEmbedTransform;
|
|
34
|
-
};
|
|
35
|
-
}>;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { NewCoreIconProps } from '@atlaskit/icon';
|
|
4
|
-
import type { BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS } from './constants';
|
|
5
|
-
export type AlignmentValue = 'left' | 'center' | 'right' | 'wrap-left' | 'wrap-right';
|
|
6
|
-
export type NativeEmbedAppearance = 'url' | 'inline' | 'block' | 'embed';
|
|
7
|
-
export type NativeEmbedParameterValues = {
|
|
8
|
-
alignment: AlignmentValue;
|
|
9
|
-
alwaysShowTitle: boolean;
|
|
10
|
-
aspectRatio: number;
|
|
11
|
-
/**
|
|
12
|
-
* Border color as a hex string (e.g. '#091E4224'). When present and non-empty the border is shown.
|
|
13
|
-
* Matches the `color` field of `BorderMarkAttributes` used by the image border feature.
|
|
14
|
-
*/
|
|
15
|
-
borderColor?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Border size: 1 = Subtle, 2 = Medium, 3 = Bold.
|
|
18
|
-
* Matches the `size` field of `BorderMarkAttributes` used by the image border feature.
|
|
19
|
-
*/
|
|
20
|
-
borderSize?: number;
|
|
21
|
-
displayText?: string;
|
|
22
|
-
height: number;
|
|
23
|
-
url?: string;
|
|
24
|
-
width?: number;
|
|
25
|
-
};
|
|
26
|
-
export type NativeEmbedParameterValue = {
|
|
27
|
-
value: string;
|
|
28
|
-
};
|
|
29
|
-
export type NativeEmbedParameters = {
|
|
30
|
-
macroParams?: {
|
|
31
|
-
alignment?: NativeEmbedParameterValue;
|
|
32
|
-
alwaysShowTitle?: NativeEmbedParameterValue;
|
|
33
|
-
aspectRatio?: NativeEmbedParameterValue;
|
|
34
|
-
borderColor?: NativeEmbedParameterValue;
|
|
35
|
-
borderSize?: NativeEmbedParameterValue;
|
|
36
|
-
displayText?: NativeEmbedParameterValue;
|
|
37
|
-
height?: NativeEmbedParameterValue;
|
|
38
|
-
url?: NativeEmbedParameterValue;
|
|
39
|
-
width?: NativeEmbedParameterValue;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export type NativeEmbedParameterKey = keyof NonNullable<NativeEmbedParameters['macroParams']>;
|
|
43
|
-
export type EditorToolbarHandlerContext = {
|
|
44
|
-
editorApi?: PublicPluginAPI<[
|
|
45
|
-
]>;
|
|
46
|
-
/**
|
|
47
|
-
* `localId` of the selected native-embed at toolbar click time. Set by
|
|
48
|
-
* the toolbar handler factory; manifest handlers use it to wire per-embed state.
|
|
49
|
-
*/
|
|
50
|
-
selectedNodeLocalId?: string;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* A button action rendered in the editor floating toolbar.
|
|
54
|
-
*/
|
|
55
|
-
export type EditorToolbarButtonAction = {
|
|
56
|
-
/**
|
|
57
|
-
* Whether this action is disabled.
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
disabled?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Handler key that maps to the actionHandlers config in the editor plugin.
|
|
63
|
-
* When clicked, the plugin looks up actionHandlers[handlerKey] and invokes it.
|
|
64
|
-
*/
|
|
65
|
-
handlerKey: string;
|
|
66
|
-
/**
|
|
67
|
-
* Icon component to display.
|
|
68
|
-
*/
|
|
69
|
-
icon: ComponentType<NewCoreIconProps>;
|
|
70
|
-
/**
|
|
71
|
-
* Unique key for this action, used for React keys and test IDs.
|
|
72
|
-
*/
|
|
73
|
-
key: string;
|
|
74
|
-
/**
|
|
75
|
-
* Button label (used for tooltip and accessibility).
|
|
76
|
-
*/
|
|
77
|
-
label: string;
|
|
78
|
-
/**
|
|
79
|
-
* Whether to show the label as text next to the icon.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
showTitle?: boolean;
|
|
83
|
-
type: 'button';
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Union type for editor toolbar actions.
|
|
87
|
-
* Currently only supports buttons; dropdowns and separators can be added later.
|
|
88
|
-
*/
|
|
89
|
-
export type EditorToolbarAction = EditorToolbarButtonAction;
|
|
90
|
-
/**
|
|
91
|
-
* Handlers for built-in native embed floating toolbar actions.
|
|
92
|
-
* Can be defined in the manifest (editorToolbarHandlers) and are invoked
|
|
93
|
-
* by the editor plugin when the corresponding toolbar buttons are clicked.
|
|
94
|
-
* Handlers with context (e.g. onAlignmentClick, onAppearanceClick) receive
|
|
95
|
-
* an optional second parameter for the action-specific value.
|
|
96
|
-
*/
|
|
97
|
-
export type EditorToolbarHandlerKey = (typeof EDITOR_TOOLBAR_HANDLER_KEYS)[number];
|
|
98
|
-
export type EditorToolbarHandlers = Partial<{
|
|
99
|
-
onAlignmentClick: (parameters: NativeEmbedParameterValues, alignment: AlignmentValue, context?: EditorToolbarHandlerContext) => void;
|
|
100
|
-
onAppearanceClick: (parameters: NativeEmbedParameterValues, appearance: NativeEmbedAppearance, context?: EditorToolbarHandlerContext) => void;
|
|
101
|
-
onAskRovoClick: (parameters: NativeEmbedParameterValues, context?: EditorToolbarHandlerContext) => void;
|
|
102
|
-
onChangeBorderClick: EditorToolbarHandler;
|
|
103
|
-
/**
|
|
104
|
-
* Handler invoked when the Copy action is clicked.
|
|
105
|
-
* Copies the native-embed node to the clipboard.
|
|
106
|
-
*/
|
|
107
|
-
onCopyClick: EditorToolbarHandler;
|
|
108
|
-
/**
|
|
109
|
-
* @private
|
|
110
|
-
* @deprecated Use `onCopyClick` instead. This is a deprecated alias and will be removed in a future release.
|
|
111
|
-
*/
|
|
112
|
-
onCopyLinkClick: EditorToolbarHandler;
|
|
113
|
-
onDeleteClick: EditorToolbarHandler;
|
|
114
|
-
onEditClick: EditorToolbarHandler;
|
|
115
|
-
onEditUrlClick: EditorToolbarHandler;
|
|
116
|
-
onExpandClick: EditorToolbarHandler;
|
|
117
|
-
onOpenInNewWindowClick: EditorToolbarHandler;
|
|
118
|
-
onRefreshClick: EditorToolbarHandler;
|
|
119
|
-
onSetEmbedTypeClick: EditorToolbarHandler;
|
|
120
|
-
onShowTitleClick: EditorToolbarHandler;
|
|
121
|
-
onSummariseClick: (parameters: NativeEmbedParameterValues, context?: EditorToolbarHandlerContext) => void;
|
|
122
|
-
}>;
|
|
123
|
-
/** Base handler signature for contexts that don't have action-specific context. */
|
|
124
|
-
export type EditorToolbarHandler = (parameters: NativeEmbedParameterValues, context?: EditorToolbarHandlerContext) => void;
|
|
125
|
-
export type BuiltinToolbarKey = (typeof BUILTIN_TOOLBAR_KEYS)[keyof typeof BUILTIN_TOOLBAR_KEYS];
|
|
126
|
-
/**
|
|
127
|
-
* Configuration for editor toolbar actions in the manifest.
|
|
128
|
-
*
|
|
129
|
-
* Use `customActions` map + `items` array to mix custom and built-in actions.
|
|
130
|
-
*
|
|
131
|
-
* @typeParam TCustomActions - The type of the customActions record. Keys are automatically
|
|
132
|
-
* inferred and used to type-check the `items` array.
|
|
133
|
-
*/
|
|
134
|
-
export type ManifestEditorToolbarActions<TCustomActions extends Record<string, EditorToolbarAction> = Record<string, EditorToolbarAction>> = {
|
|
135
|
-
/**
|
|
136
|
-
* Custom action definitions, keyed by unique identifier.
|
|
137
|
-
* These can be referenced in the `items` array alongside built-in keys.
|
|
138
|
-
*/
|
|
139
|
-
customActions?: TCustomActions;
|
|
140
|
-
/**
|
|
141
|
-
* Handlers for built-in toolbar buttons.
|
|
142
|
-
* When a built-in button (e.g. ASK_ROVO, REFRESH) is clicked, the corresponding
|
|
143
|
-
* handler is invoked by the editor plugin.
|
|
144
|
-
*/
|
|
145
|
-
editorToolbarHandlers?: EditorToolbarHandlers;
|
|
146
|
-
/**
|
|
147
|
-
* Ordered array of keys specifying which toolbar items to show and in what order.
|
|
148
|
-
* The "More Options" dropdown is appended automatically based on `moreItems`.
|
|
149
|
-
*
|
|
150
|
-
* Can include:
|
|
151
|
-
* - Built-in keys: 'refresh', 'embed', 'border', 'alignment', 'openInNewWindow'
|
|
152
|
-
* - 'separator' for visual separators between groups
|
|
153
|
-
* - Custom keys defined in `customActions`
|
|
154
|
-
*/
|
|
155
|
-
items?: (BuiltinToolbarKey | keyof TCustomActions)[];
|
|
156
|
-
/**
|
|
157
|
-
* Ordered array of keys specifying which items appear in the "More Options" dropdown.
|
|
158
|
-
* When provided with at least one item, a separator and the dropdown are automatically
|
|
159
|
-
* appended to the toolbar. When omitted, the default set of dropdown items is used.
|
|
160
|
-
*
|
|
161
|
-
* Can include:
|
|
162
|
-
* - Built-in keys: 'alwaysShowTitle', 'setEmbedType', 'copyLink', 'delete'
|
|
163
|
-
* - 'separator' for visual separators between groups
|
|
164
|
-
* - Custom keys defined in `customActions` (shared with the toolbar)
|
|
165
|
-
*/
|
|
166
|
-
moreItems?: (BuiltinToolbarKey | keyof TCustomActions)[];
|
|
167
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { ManifestEditorToolbarActions, EditorToolbarAction, BuiltinToolbarKey, NativeEmbedParameterKey, NativeEmbedParameterValues, NativeEmbedParameters } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Reads a value from extension parameters.macroParams by key.
|
|
4
|
-
* Supports both wrapped ({ value }) and unwrapped values.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getParameter: <TKey extends NativeEmbedParameterKey>(parameters: NativeEmbedParameters | undefined, key: TKey) => NativeEmbedParameterValues[TKey];
|
|
7
|
-
/**
|
|
8
|
-
* Gets native-embed parameters as resolved values.
|
|
9
|
-
* When key is provided, returns that single resolved value.
|
|
10
|
-
* When key is omitted, returns all resolved parameter values.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getParameters(parameters: NativeEmbedParameters | undefined): NativeEmbedParameterValues;
|
|
13
|
-
export declare function getParameters<TKey extends NativeEmbedParameterKey>(parameters: NativeEmbedParameters | undefined, key: TKey): NativeEmbedParameterValues[TKey];
|
|
14
|
-
/**
|
|
15
|
-
* Sets a single key in parameters.macroParams using wrapped { value } format.
|
|
16
|
-
* Returns a new parameters object.
|
|
17
|
-
*/
|
|
18
|
-
export declare const setParameter: <TKey extends NativeEmbedParameterKey>(parameters: NativeEmbedParameters | undefined, update: Pick<NativeEmbedParameterValues, TKey>) => NativeEmbedParameters;
|
|
19
|
-
/**
|
|
20
|
-
* Sets multiple keys in parameters.macroParams using wrapped { value } format.
|
|
21
|
-
* Returns a new parameters object.
|
|
22
|
-
*/
|
|
23
|
-
export declare const setParameters: (parameters: NativeEmbedParameters | undefined, updates: Partial<NativeEmbedParameterValues>) => NativeEmbedParameters;
|
|
24
|
-
/**
|
|
25
|
-
* Helper function to create a type-safe ManifestEditorToolbarActions config.
|
|
26
|
-
* Automatically infers custom action keys from the customActions object.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const config = createEditorToolbarActions({
|
|
31
|
-
* customActions: {
|
|
32
|
-
* myAction: { type: 'button', key: 'myAction', ... },
|
|
33
|
-
* },
|
|
34
|
-
* items: ['refresh', 'myAction', 'separator'], // 'myAction' is type-checked
|
|
35
|
-
* moreItems: ['copyLink', 'myAction', 'separator', 'delete'], // 'myAction' is type-checked
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* // Or without custom actions:
|
|
39
|
-
* const simpleConfig = createEditorToolbarActions({
|
|
40
|
-
* items: ['alignment', 'separator', 'openInNewWindow', 'editUrl'],
|
|
41
|
-
* moreItems: ['delete'],
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare const createEditorToolbarActions: <const TCustomActions extends Record<string, EditorToolbarAction> = Record<string, EditorToolbarAction>>(config: {
|
|
46
|
-
customActions?: TCustomActions;
|
|
47
|
-
items: (BuiltinToolbarKey | keyof TCustomActions)[];
|
|
48
|
-
moreItems?: (BuiltinToolbarKey | keyof TCustomActions)[];
|
|
49
|
-
}) => ManifestEditorToolbarActions<TCustomActions>;
|