@atlaskit/editor-plugin-media 9.1.1 → 9.3.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/mediaPlugin.js +7 -5
  3. package/dist/cjs/nodeviews/mediaSingleNext.js +46 -0
  4. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  5. package/dist/cjs/pm-plugins/commands.js +7 -1
  6. package/dist/cjs/pm-plugins/utils/media-single.js +103 -4
  7. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +15 -5
  8. package/dist/cjs/ui/ResizableMediaSingle/index.js +6 -0
  9. package/dist/es2019/mediaPlugin.js +8 -6
  10. package/dist/es2019/nodeviews/mediaSingleNext.js +46 -0
  11. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  12. package/dist/es2019/pm-plugins/commands.js +3 -1
  13. package/dist/es2019/pm-plugins/utils/media-single.js +105 -1
  14. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +15 -5
  15. package/dist/es2019/ui/ResizableMediaSingle/index.js +6 -0
  16. package/dist/esm/mediaPlugin.js +8 -6
  17. package/dist/esm/nodeviews/mediaSingleNext.js +46 -0
  18. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  19. package/dist/esm/pm-plugins/commands.js +6 -0
  20. package/dist/esm/pm-plugins/utils/media-single.js +103 -4
  21. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +15 -5
  22. package/dist/esm/ui/ResizableMediaSingle/index.js +6 -0
  23. package/dist/types/mediaPluginType.d.ts +15 -0
  24. package/dist/types/pm-plugins/commands.d.ts +2 -0
  25. package/dist/types/pm-plugins/utils/media-single.d.ts +3 -1
  26. package/dist/types-ts4.5/mediaPluginType.d.ts +15 -0
  27. package/dist/types-ts4.5/pm-plugins/commands.d.ts +2 -0
  28. package/dist/types-ts4.5/pm-plugins/utils/media-single.d.ts +3 -1
  29. package/package.json +9 -6
@@ -1,4 +1,5 @@
1
1
  import type { MediaADFAttrs } from '@atlaskit/adf-schema';
2
+ import type { InputMethodInsertMedia, InsertMediaVia } from '@atlaskit/editor-common/analytics';
2
3
  import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
4
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -48,6 +49,11 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
48
49
  * Callback to be called when there is an error rendering a media node.
49
50
  */
50
51
  handleMediaNodeRenderError: (node: PMNode, reason: string) => void;
52
+ /**
53
+ * @private
54
+ * @deprecated Use the command `insertMediaSingle` instead which is decoupled from EditorView
55
+ * and easier to use.
56
+ */
51
57
  insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
52
58
  /**
53
59
  * Used to update the initial provider passed to the media plugin.
@@ -62,6 +68,15 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
62
68
  };
63
69
  commands: {
64
70
  hideMediaViewer: EditorCommand;
71
+ /**
72
+ * Inserts a media node as a media single.
73
+ * This command creates a media single node from a set of attributes
74
+ *
75
+ * @param attrs - The media node attributes of the node to insert
76
+ * @param inputMethod - The method used to input the media
77
+ * @param insertMediaVia - Optional parameter indicating how the media was inserted
78
+ */
79
+ insertMediaSingle: (attrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => EditorCommand;
65
80
  showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
66
81
  trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
67
82
  };
@@ -1,5 +1,7 @@
1
1
  import type { MediaADFAttrs } from '@atlaskit/adf-schema';
2
+ import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertMediaVia } from '@atlaskit/editor-common/analytics';
2
3
  import type { EditorCommand } from '@atlaskit/editor-common/types';
3
4
  export declare const showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
4
5
  export declare const hideMediaViewer: EditorCommand;
5
6
  export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
7
+ export declare const insertMediaAsMediaSingleCommand: (editorAnalyticsAPI?: EditorAnalyticsAPI, allowPixelResizing?: boolean) => (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => EditorCommand;
@@ -1,12 +1,14 @@
1
+ import type { MediaADFAttrs } from '@atlaskit/adf-schema';
1
2
  import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
2
3
  import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
3
- import type { EditorContainerWidth as WidthPluginState } from '@atlaskit/editor-common/types';
4
+ import type { EditorCommand, EditorContainerWidth as WidthPluginState } from '@atlaskit/editor-common/types';
4
5
  import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import type { MediaState } from '../../types';
7
8
  export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
8
9
  export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
9
10
  export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
11
+ export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => EditorCommand;
10
12
  export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: (id: string, selectionPosition: number) => void, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
11
13
  export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, allowPixelResizing?: boolean) => boolean;
12
14
  export declare const isVideo: import("memoize-one").MemoizedFn<(fileType?: string) => boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "9.1.1",
3
+ "version": "9.3.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/editor-shared-styles": "^3.10.0",
53
53
  "@atlaskit/editor-tables": "^2.9.0",
54
54
  "@atlaskit/form": "^15.2.0",
55
- "@atlaskit/icon": "^29.3.0",
55
+ "@atlaskit/icon": "^29.4.0",
56
56
  "@atlaskit/icon-lab": "^5.13.0",
57
57
  "@atlaskit/media-card": "^79.12.0",
58
58
  "@atlaskit/media-client": "^35.7.0",
@@ -66,9 +66,9 @@
66
66
  "@atlaskit/primitives": "^17.0.0",
67
67
  "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^16.4.0",
70
- "@atlaskit/tokens": "^9.0.0",
71
- "@atlaskit/tooltip": "^20.11.0",
69
+ "@atlaskit/tmp-editor-statsig": "^16.8.0",
70
+ "@atlaskit/tokens": "^9.1.0",
71
+ "@atlaskit/tooltip": "^20.12.0",
72
72
  "@babel/runtime": "^7.0.0",
73
73
  "@emotion/react": "^11.7.1",
74
74
  "bind-event-listener": "^3.0.0",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^111.2.0",
81
+ "@atlaskit/editor-common": "^111.6.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
@@ -133,6 +133,9 @@
133
133
  "platform-visual-refresh-icons": {
134
134
  "type": "boolean"
135
135
  },
136
+ "platform_editor_introduce_insert_media_command": {
137
+ "type": "boolean"
138
+ },
136
139
  "confluence_frontend_media_scroll_fix": {
137
140
  "type": "boolean"
138
141
  },