@atlaskit/native-embeds-common 0.1.1 → 0.1.2

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,11 @@
1
1
  # @atlaskit/native-embeds-common
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ### Patch Changes
@@ -11,6 +11,7 @@ var NATIVE_EMBED_PARAMETER_DEFAULTS = exports.NATIVE_EMBED_PARAMETER_DEFAULTS =
11
11
  url: undefined,
12
12
  alwaysShowTitle: false,
13
13
  alignment: DEFAULT_ALIGNMENT,
14
+ displayText: undefined,
14
15
  height: 600,
15
16
  width: undefined
16
17
  };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -3,5 +3,7 @@ export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLB
3
3
 
4
4
  // Re-export types
5
5
 
6
+ // Plugin actions types
7
+
6
8
  // Re-export utilities
7
9
  export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters } from './utils/utils';
@@ -5,6 +5,7 @@ export const NATIVE_EMBED_PARAMETER_DEFAULTS = {
5
5
  url: undefined,
6
6
  alwaysShowTitle: false,
7
7
  alignment: DEFAULT_ALIGNMENT,
8
+ displayText: undefined,
8
9
  height: 600,
9
10
  width: undefined
10
11
  };
@@ -0,0 +1 @@
1
+ export {};
package/dist/esm/index.js CHANGED
@@ -3,5 +3,7 @@ export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLB
3
3
 
4
4
  // Re-export types
5
5
 
6
+ // Plugin actions types
7
+
6
8
  // Re-export utilities
7
9
  export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters } from './utils/utils';
@@ -5,6 +5,7 @@ export var NATIVE_EMBED_PARAMETER_DEFAULTS = {
5
5
  url: undefined,
6
6
  alwaysShowTitle: false,
7
7
  alignment: DEFAULT_ALIGNMENT,
8
+ displayText: undefined,
8
9
  height: 600,
9
10
  width: undefined
10
11
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS, } from './utils/constants';
2
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';
3
4
  export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters, } from './utils/utils';
@@ -0,0 +1,33 @@
1
+ import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ /** Accepted layout values from ADF schema (embedCard) */
5
+ export type NativeEmbedLayout = 'wide' | 'full-width' | 'center' | 'wrap-right' | 'wrap-left' | 'align-end' | 'align-start';
6
+ /** Input attrs for embedCard node (subset used by transform) */
7
+ export interface NativeEmbedTransformAttrs {
8
+ layout?: NativeEmbedLayout;
9
+ originalHeight?: number | null;
10
+ originalWidth?: number | null;
11
+ url: string;
12
+ width?: number;
13
+ }
14
+ /** Type for cardToNativeEmbedNode - converts embed attrs to native embed Node */
15
+ export type CardToNativeEmbedNode = (schema: Schema, attrs: NativeEmbedTransformAttrs) => Node | undefined;
16
+ /** Type for createEmbedCardToNativeEmbedTransform - returns a Command */
17
+ export type CreateCardToNativeEmbedTransform = (options?: CardToNativeEmbedTransformOptions) => Command;
18
+ export interface CardToNativeEmbedTransformOptions {
19
+ /**
20
+ * Called before dispatch to allow the caller to augment the transaction
21
+ * (e.g. datasource stash, analytics, link metadata).
22
+ */
23
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
24
+ }
25
+ /**
26
+ * Minimal plugin type for native embeds action integration.
27
+ */
28
+ export type EditorPluginNativeEmbedsPlugin = NextEditorPlugin<'editorPluginNativeEmbeds', {
29
+ actions: {
30
+ cardToNativeEmbedNode: CardToNativeEmbedNode;
31
+ createCardToNativeEmbedTransform: CreateCardToNativeEmbedTransform;
32
+ };
33
+ }>;
@@ -7,6 +7,7 @@ export type NativeEmbedAppearance = 'url' | 'inline' | 'block' | 'embed';
7
7
  export type NativeEmbedParameterValues = {
8
8
  alignment: AlignmentValue;
9
9
  alwaysShowTitle: boolean;
10
+ displayText?: string;
10
11
  height: number;
11
12
  url?: string;
12
13
  width?: number;
@@ -18,6 +19,7 @@ export type NativeEmbedParameters = {
18
19
  macroParams?: {
19
20
  alignment?: NativeEmbedParameterValue;
20
21
  alwaysShowTitle?: NativeEmbedParameterValue;
22
+ displayText?: NativeEmbedParameterValue;
21
23
  height?: NativeEmbedParameterValue;
22
24
  url?: NativeEmbedParameterValue;
23
25
  width?: NativeEmbedParameterValue;
@@ -1,3 +1,4 @@
1
1
  export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS, } from './utils/constants';
2
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';
3
4
  export { createEditorToolbarActions, getParameter, getParameters, setParameter, setParameters, } from './utils/utils';
@@ -0,0 +1,33 @@
1
+ import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ /** Accepted layout values from ADF schema (embedCard) */
5
+ export type NativeEmbedLayout = 'wide' | 'full-width' | 'center' | 'wrap-right' | 'wrap-left' | 'align-end' | 'align-start';
6
+ /** Input attrs for embedCard node (subset used by transform) */
7
+ export interface NativeEmbedTransformAttrs {
8
+ layout?: NativeEmbedLayout;
9
+ originalHeight?: number | null;
10
+ originalWidth?: number | null;
11
+ url: string;
12
+ width?: number;
13
+ }
14
+ /** Type for cardToNativeEmbedNode - converts embed attrs to native embed Node */
15
+ export type CardToNativeEmbedNode = (schema: Schema, attrs: NativeEmbedTransformAttrs) => Node | undefined;
16
+ /** Type for createEmbedCardToNativeEmbedTransform - returns a Command */
17
+ export type CreateCardToNativeEmbedTransform = (options?: CardToNativeEmbedTransformOptions) => Command;
18
+ export interface CardToNativeEmbedTransformOptions {
19
+ /**
20
+ * Called before dispatch to allow the caller to augment the transaction
21
+ * (e.g. datasource stash, analytics, link metadata).
22
+ */
23
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
24
+ }
25
+ /**
26
+ * Minimal plugin type for native embeds action integration.
27
+ */
28
+ export type EditorPluginNativeEmbedsPlugin = NextEditorPlugin<'editorPluginNativeEmbeds', {
29
+ actions: {
30
+ cardToNativeEmbedNode: CardToNativeEmbedNode;
31
+ createCardToNativeEmbedTransform: CreateCardToNativeEmbedTransform;
32
+ };
33
+ }>;
@@ -7,6 +7,7 @@ export type NativeEmbedAppearance = 'url' | 'inline' | 'block' | 'embed';
7
7
  export type NativeEmbedParameterValues = {
8
8
  alignment: AlignmentValue;
9
9
  alwaysShowTitle: boolean;
10
+ displayText?: string;
10
11
  height: number;
11
12
  url?: string;
12
13
  width?: number;
@@ -18,6 +19,7 @@ export type NativeEmbedParameters = {
18
19
  macroParams?: {
19
20
  alignment?: NativeEmbedParameterValue;
20
21
  alwaysShowTitle?: NativeEmbedParameterValue;
22
+ displayText?: NativeEmbedParameterValue;
21
23
  height?: NativeEmbedParameterValue;
22
24
  url?: NativeEmbedParameterValue;
23
25
  width?: NativeEmbedParameterValue;
package/package.json CHANGED
@@ -24,8 +24,9 @@
24
24
  ],
25
25
  "atlaskit:src": "src/index.ts",
26
26
  "dependencies": {
27
- "@atlaskit/editor-common": "^112.0.0",
28
- "@atlaskit/icon": "^32.0.0",
27
+ "@atlaskit/editor-common": "^112.4.0",
28
+ "@atlaskit/editor-prosemirror": "^7.3.0",
29
+ "@atlaskit/icon": "^33.0.0",
29
30
  "@babel/runtime": "^7.0.0",
30
31
  "@compiled/react": "^0.20.0"
31
32
  },
@@ -78,7 +79,7 @@
78
79
  }
79
80
  },
80
81
  "name": "@atlaskit/native-embeds-common",
81
- "version": "0.1.1",
82
+ "version": "0.1.2",
82
83
  "description": "A shared package for native embeds to be used across experiences and plugin",
83
84
  "author": "Atlassian Pty Ltd",
84
85
  "license": "Apache-2.0",