@atlaskit/editor-plugin-media 0.2.0 → 0.3.1
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 +17 -0
- package/dist/cjs/commands/captions.js +59 -0
- package/dist/cjs/commands/helpers.js +127 -0
- package/dist/cjs/commands/index.js +24 -0
- package/dist/cjs/commands/linking.js +181 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/media-plugin-options.js +5 -0
- package/dist/cjs/next-plugin-type.js +5 -0
- package/dist/cjs/nodeviews/mediaGroup.js +376 -0
- package/dist/cjs/nodeviews/mediaInline.js +288 -0
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +739 -0
- package/dist/cjs/nodeviews/mediaNodeView/index.js +177 -0
- package/dist/cjs/nodeviews/mediaNodeView/media.js +242 -0
- package/dist/cjs/nodeviews/mediaSingle.js +629 -0
- package/dist/cjs/nodeviews/messages.js +14 -0
- package/dist/cjs/nodeviews/styles.js +46 -0
- package/dist/cjs/nodeviews/types.js +5 -0
- package/dist/cjs/picker-facade.js +192 -0
- package/dist/cjs/plugin.js +293 -0
- package/dist/cjs/pm-plugins/alt-text/actions.js +5 -0
- package/dist/cjs/pm-plugins/alt-text/commands.js +59 -0
- package/dist/cjs/pm-plugins/alt-text/index.js +36 -0
- package/dist/cjs/pm-plugins/alt-text/keymap.js +15 -0
- package/dist/cjs/pm-plugins/alt-text/messages.js +44 -0
- package/dist/cjs/pm-plugins/alt-text/reducer.js +32 -0
- package/dist/cjs/pm-plugins/alt-text/types.js +5 -0
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +209 -0
- package/dist/cjs/pm-plugins/keymap-media-single.js +163 -0
- package/dist/cjs/pm-plugins/keymap.js +88 -0
- package/dist/cjs/pm-plugins/linking/actions.js +13 -0
- package/dist/cjs/pm-plugins/linking/index.js +65 -0
- package/dist/cjs/pm-plugins/linking/keymap.js +14 -0
- package/dist/cjs/pm-plugins/linking/reducer.js +43 -0
- package/dist/cjs/pm-plugins/linking/types.js +5 -0
- package/dist/cjs/pm-plugins/main.js +813 -0
- package/dist/cjs/pm-plugins/media-editor-plugin-factory.js +8 -0
- package/dist/cjs/pm-plugins/mediaTaskManager.js +101 -0
- package/dist/cjs/pm-plugins/plugin-key.js +8 -0
- package/dist/cjs/pm-plugins/types.js +5 -0
- package/dist/cjs/toolbar/alt-text.js +80 -0
- package/dist/cjs/toolbar/commands.js +236 -0
- package/dist/cjs/toolbar/filePreviewItem.js +66 -0
- package/dist/cjs/toolbar/imageBorder.js +20 -0
- package/dist/cjs/toolbar/index.js +523 -0
- package/dist/cjs/toolbar/linking-toolbar-appearance.js +100 -0
- package/dist/cjs/toolbar/linking.js +96 -0
- package/dist/cjs/toolbar/utils.js +110 -0
- package/dist/cjs/ui/CaptionPlaceholder/index.js +27 -0
- package/dist/cjs/ui/CaptionPlaceholder/messages.js +14 -0
- package/dist/cjs/ui/ImageBorder/index.js +226 -0
- package/dist/cjs/ui/ImageBorder/messages.js +49 -0
- package/dist/cjs/ui/ImageBorder/styles.js +52 -0
- package/dist/cjs/ui/Media/DropPlaceholder.js +38 -0
- package/dist/cjs/ui/Media/drop-placeholder-messages.js +14 -0
- package/dist/cjs/ui/MediaLinkingToolbar.js +196 -0
- package/dist/cjs/ui/MediaPicker/BrowserWrapper.js +40 -0
- package/dist/cjs/ui/MediaPicker/ClipboardWrapper.js +39 -0
- package/dist/cjs/ui/MediaPicker/DropzoneWrapper.js +51 -0
- package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +151 -0
- package/dist/cjs/ui/MediaPicker/index.js +103 -0
- package/dist/cjs/ui/PixelEntry/constants.js +7 -0
- package/dist/cjs/ui/PixelEntry/index.js +185 -0
- package/dist/cjs/ui/PixelEntry/messages.js +54 -0
- package/dist/cjs/ui/PixelEntry/styles.js +19 -0
- package/dist/cjs/ui/PixelEntry/types.js +5 -0
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +16 -0
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +541 -0
- package/dist/cjs/ui/ResizableMediaSingle/index.js +422 -0
- package/dist/cjs/ui/ResizableMediaSingle/styled.js +14 -0
- package/dist/cjs/ui/ResizableMediaSingle/styles.js +17 -0
- package/dist/cjs/ui/ResizableMediaSingle/types.js +5 -0
- package/dist/cjs/ui/ToolbarMedia/index.js +42 -0
- package/dist/cjs/ui/ToolbarMedia/toolbar-media-messages.js +14 -0
- package/dist/cjs/ui/media-linking-toolbar-messages.js +14 -0
- package/dist/cjs/utils/analytics.js +53 -0
- package/dist/cjs/utils/check-media-type.js +56 -0
- package/dist/cjs/utils/current-media-node.js +41 -0
- package/dist/cjs/utils/is-image.js +9 -0
- package/dist/cjs/utils/media-common.js +181 -0
- package/dist/cjs/utils/media-files.js +297 -0
- package/dist/cjs/utils/media-single.js +181 -0
- package/dist/es2019/commands/captions.js +47 -0
- package/dist/es2019/commands/helpers.js +113 -0
- package/dist/es2019/commands/index.js +1 -0
- package/dist/es2019/commands/linking.js +169 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/media-plugin-options.js +1 -0
- package/dist/es2019/next-plugin-type.js +1 -0
- package/dist/es2019/nodeviews/mediaGroup.js +314 -0
- package/dist/es2019/nodeviews/mediaInline.js +201 -0
- package/dist/es2019/nodeviews/mediaNodeUpdater.js +384 -0
- package/dist/es2019/nodeviews/mediaNodeView/index.js +149 -0
- package/dist/es2019/nodeviews/mediaNodeView/media.js +182 -0
- package/dist/es2019/nodeviews/mediaSingle.js +511 -0
- package/dist/es2019/nodeviews/messages.js +8 -0
- package/dist/es2019/nodeviews/styles.js +46 -0
- package/dist/es2019/nodeviews/types.js +1 -0
- package/dist/es2019/picker-facade.js +146 -0
- package/dist/es2019/plugin.js +284 -0
- package/dist/es2019/pm-plugins/alt-text/actions.js +1 -0
- package/dist/es2019/pm-plugins/alt-text/commands.js +42 -0
- package/dist/es2019/pm-plugins/alt-text/index.js +33 -0
- package/dist/es2019/pm-plugins/alt-text/keymap.js +9 -0
- package/dist/es2019/pm-plugins/alt-text/messages.js +38 -0
- package/dist/es2019/pm-plugins/alt-text/reducer.js +26 -0
- package/dist/es2019/pm-plugins/alt-text/types.js +1 -0
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +228 -0
- package/dist/es2019/pm-plugins/keymap-media-single.js +172 -0
- package/dist/es2019/pm-plugins/keymap.js +84 -0
- package/dist/es2019/pm-plugins/linking/actions.js +7 -0
- package/dist/es2019/pm-plugins/linking/index.js +56 -0
- package/dist/es2019/pm-plugins/linking/keymap.js +8 -0
- package/dist/es2019/pm-plugins/linking/reducer.js +37 -0
- package/dist/es2019/pm-plugins/linking/types.js +1 -0
- package/dist/es2019/pm-plugins/main.js +695 -0
- package/dist/es2019/pm-plugins/media-editor-plugin-factory.js +2 -0
- package/dist/es2019/pm-plugins/mediaTaskManager.js +64 -0
- package/dist/es2019/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/types.js +1 -0
- package/dist/es2019/toolbar/alt-text.js +72 -0
- package/dist/es2019/toolbar/commands.js +212 -0
- package/dist/es2019/toolbar/filePreviewItem.js +54 -0
- package/dist/es2019/toolbar/imageBorder.js +15 -0
- package/dist/es2019/toolbar/index.js +538 -0
- package/dist/es2019/toolbar/linking-toolbar-appearance.js +90 -0
- package/dist/es2019/toolbar/linking.js +98 -0
- package/dist/es2019/toolbar/utils.js +86 -0
- package/dist/es2019/ui/CaptionPlaceholder/index.js +25 -0
- package/dist/es2019/ui/CaptionPlaceholder/messages.js +8 -0
- package/dist/es2019/ui/ImageBorder/index.js +213 -0
- package/dist/es2019/ui/ImageBorder/messages.js +43 -0
- package/dist/es2019/ui/ImageBorder/styles.js +126 -0
- package/dist/es2019/ui/Media/DropPlaceholder.js +47 -0
- package/dist/es2019/ui/Media/drop-placeholder-messages.js +8 -0
- package/dist/es2019/ui/MediaLinkingToolbar.js +190 -0
- package/dist/es2019/ui/MediaPicker/BrowserWrapper.js +31 -0
- package/dist/es2019/ui/MediaPicker/ClipboardWrapper.js +32 -0
- package/dist/es2019/ui/MediaPicker/DropzoneWrapper.js +42 -0
- package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +85 -0
- package/dist/es2019/ui/MediaPicker/index.js +82 -0
- package/dist/es2019/ui/PixelEntry/constants.js +1 -0
- package/dist/es2019/ui/PixelEntry/index.js +170 -0
- package/dist/es2019/ui/PixelEntry/messages.js +48 -0
- package/dist/es2019/ui/PixelEntry/styles.js +51 -0
- package/dist/es2019/ui/PixelEntry/types.js +1 -0
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +9 -0
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +454 -0
- package/dist/es2019/ui/ResizableMediaSingle/index.js +344 -0
- package/dist/es2019/ui/ResizableMediaSingle/styled.js +9 -0
- package/dist/es2019/ui/ResizableMediaSingle/styles.js +14 -0
- package/dist/es2019/ui/ResizableMediaSingle/types.js +1 -0
- package/dist/es2019/ui/ToolbarMedia/index.js +37 -0
- package/dist/es2019/ui/ToolbarMedia/toolbar-media-messages.js +8 -0
- package/dist/es2019/ui/media-linking-toolbar-messages.js +8 -0
- package/dist/es2019/utils/analytics.js +51 -0
- package/dist/es2019/utils/check-media-type.js +19 -0
- package/dist/es2019/utils/current-media-node.js +35 -0
- package/dist/es2019/utils/is-image.js +3 -0
- package/dist/es2019/utils/media-common.js +189 -0
- package/dist/es2019/utils/media-files.js +321 -0
- package/dist/es2019/utils/media-single.js +176 -0
- package/dist/esm/commands/captions.js +53 -0
- package/dist/esm/commands/helpers.js +120 -0
- package/dist/esm/commands/index.js +1 -0
- package/dist/esm/commands/linking.js +174 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/media-plugin-options.js +1 -0
- package/dist/esm/next-plugin-type.js +1 -0
- package/dist/esm/nodeviews/mediaGroup.js +369 -0
- package/dist/esm/nodeviews/mediaInline.js +278 -0
- package/dist/esm/nodeviews/mediaNodeUpdater.js +732 -0
- package/dist/esm/nodeviews/mediaNodeView/index.js +170 -0
- package/dist/esm/nodeviews/mediaNodeView/media.js +233 -0
- package/dist/esm/nodeviews/mediaSingle.js +622 -0
- package/dist/esm/nodeviews/messages.js +8 -0
- package/dist/esm/nodeviews/styles.js +39 -0
- package/dist/esm/nodeviews/types.js +1 -0
- package/dist/esm/picker-facade.js +186 -0
- package/dist/esm/plugin.js +282 -0
- package/dist/esm/pm-plugins/alt-text/actions.js +1 -0
- package/dist/esm/pm-plugins/alt-text/commands.js +52 -0
- package/dist/esm/pm-plugins/alt-text/index.js +31 -0
- package/dist/esm/pm-plugins/alt-text/keymap.js +9 -0
- package/dist/esm/pm-plugins/alt-text/messages.js +38 -0
- package/dist/esm/pm-plugins/alt-text/reducer.js +25 -0
- package/dist/esm/pm-plugins/alt-text/types.js +1 -0
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +206 -0
- package/dist/esm/pm-plugins/keymap-media-single.js +158 -0
- package/dist/esm/pm-plugins/keymap.js +81 -0
- package/dist/esm/pm-plugins/linking/actions.js +7 -0
- package/dist/esm/pm-plugins/linking/index.js +59 -0
- package/dist/esm/pm-plugins/linking/keymap.js +8 -0
- package/dist/esm/pm-plugins/linking/reducer.js +36 -0
- package/dist/esm/pm-plugins/linking/types.js +1 -0
- package/dist/esm/pm-plugins/main.js +798 -0
- package/dist/esm/pm-plugins/media-editor-plugin-factory.js +2 -0
- package/dist/esm/pm-plugins/mediaTaskManager.js +94 -0
- package/dist/esm/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/types.js +1 -0
- package/dist/esm/toolbar/alt-text.js +70 -0
- package/dist/esm/toolbar/commands.js +229 -0
- package/dist/esm/toolbar/filePreviewItem.js +56 -0
- package/dist/esm/toolbar/imageBorder.js +14 -0
- package/dist/esm/toolbar/index.js +513 -0
- package/dist/esm/toolbar/linking-toolbar-appearance.js +91 -0
- package/dist/esm/toolbar/linking.js +88 -0
- package/dist/esm/toolbar/utils.js +103 -0
- package/dist/esm/ui/CaptionPlaceholder/index.js +20 -0
- package/dist/esm/ui/CaptionPlaceholder/messages.js +8 -0
- package/dist/esm/ui/ImageBorder/index.js +218 -0
- package/dist/esm/ui/ImageBorder/messages.js +43 -0
- package/dist/esm/ui/ImageBorder/styles.js +42 -0
- package/dist/esm/ui/Media/DropPlaceholder.js +31 -0
- package/dist/esm/ui/Media/drop-placeholder-messages.js +8 -0
- package/dist/esm/ui/MediaLinkingToolbar.js +188 -0
- package/dist/esm/ui/MediaPicker/BrowserWrapper.js +33 -0
- package/dist/esm/ui/MediaPicker/ClipboardWrapper.js +32 -0
- package/dist/esm/ui/MediaPicker/DropzoneWrapper.js +44 -0
- package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +145 -0
- package/dist/esm/ui/MediaPicker/index.js +96 -0
- package/dist/esm/ui/PixelEntry/constants.js +1 -0
- package/dist/esm/ui/PixelEntry/index.js +174 -0
- package/dist/esm/ui/PixelEntry/messages.js +48 -0
- package/dist/esm/ui/PixelEntry/styles.js +12 -0
- package/dist/esm/ui/PixelEntry/types.js +1 -0
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +9 -0
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +535 -0
- package/dist/esm/ui/ResizableMediaSingle/index.js +417 -0
- package/dist/esm/ui/ResizableMediaSingle/styled.js +7 -0
- package/dist/esm/ui/ResizableMediaSingle/styles.js +7 -0
- package/dist/esm/ui/ResizableMediaSingle/types.js +1 -0
- package/dist/esm/ui/ToolbarMedia/index.js +35 -0
- package/dist/esm/ui/ToolbarMedia/toolbar-media-messages.js +8 -0
- package/dist/esm/ui/media-linking-toolbar-messages.js +8 -0
- package/dist/esm/utils/analytics.js +47 -0
- package/dist/esm/utils/check-media-type.js +49 -0
- package/dist/esm/utils/current-media-node.js +35 -0
- package/dist/esm/utils/is-image.js +3 -0
- package/dist/esm/utils/media-common.js +175 -0
- package/dist/esm/utils/media-files.js +291 -0
- package/dist/esm/utils/media-single.js +172 -0
- package/dist/types/commands/captions.d.ts +5 -0
- package/dist/types/commands/helpers.d.ts +15 -0
- package/dist/types/commands/index.d.ts +1 -0
- package/dist/types/commands/linking.d.ts +9 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/media-plugin-options.d.ts +17 -0
- package/dist/types/next-plugin-type.d.ts +33 -0
- package/dist/types/nodeviews/__mocks__/mediaNodeUpdater.d.ts +24 -0
- package/dist/types/nodeviews/mediaGroup.d.ts +33 -0
- package/dist/types/nodeviews/mediaInline.d.ts +50 -0
- package/dist/types/nodeviews/mediaNodeUpdater.d.ts +45 -0
- package/dist/types/nodeviews/mediaNodeView/index.d.ts +28 -0
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +44 -0
- package/dist/types/nodeviews/mediaSingle.d.ts +62 -0
- package/dist/types/nodeviews/messages.d.ts +7 -0
- package/dist/types/nodeviews/styles.d.ts +16 -0
- package/dist/types/nodeviews/types.d.ts +42 -0
- package/dist/types/picker-facade.d.ts +44 -0
- package/dist/types/plugin.d.ts +7 -0
- package/dist/types/pm-plugins/alt-text/actions.d.ts +10 -0
- package/dist/types/pm-plugins/alt-text/commands.d.ts +4 -0
- package/dist/types/pm-plugins/alt-text/index.d.ts +7 -0
- package/dist/types/pm-plugins/alt-text/keymap.d.ts +4 -0
- package/dist/types/pm-plugins/alt-text/messages.d.ts +37 -0
- package/dist/types/pm-plugins/alt-text/reducer.d.ts +4 -0
- package/dist/types/pm-plugins/alt-text/types.d.ts +3 -0
- package/dist/types/pm-plugins/alt-text/ui/AltTextEdit.d.ts +41 -0
- package/dist/types/pm-plugins/keymap-media-single.d.ts +3 -0
- package/dist/types/pm-plugins/keymap.d.ts +6 -0
- package/dist/types/pm-plugins/linking/actions.d.ts +20 -0
- package/dist/types/pm-plugins/linking/index.d.ts +10 -0
- package/dist/types/pm-plugins/linking/keymap.d.ts +3 -0
- package/dist/types/pm-plugins/linking/reducer.d.ts +4 -0
- package/dist/types/pm-plugins/linking/types.d.ts +12 -0
- package/dist/types/pm-plugins/main.d.ts +120 -0
- package/dist/types/pm-plugins/media-editor-plugin-factory.d.ts +3 -0
- package/dist/types/pm-plugins/mediaTaskManager.d.ts +9 -0
- package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/types.d.ts +65 -0
- package/dist/types/toolbar/alt-text.d.ts +13 -0
- package/dist/types/toolbar/commands.d.ts +12 -0
- package/dist/types/toolbar/filePreviewItem.d.ts +9 -0
- package/dist/types/toolbar/imageBorder.d.ts +2 -0
- package/dist/types/toolbar/index.d.ts +6 -0
- package/dist/types/toolbar/linking-toolbar-appearance.d.ts +14 -0
- package/dist/types/toolbar/linking.d.ts +10 -0
- package/dist/types/toolbar/utils.d.ts +11 -0
- package/dist/types/types.d.ts +2 -1
- package/dist/types/ui/CaptionPlaceholder/index.d.ts +6 -0
- package/dist/types/ui/CaptionPlaceholder/messages.d.ts +7 -0
- package/dist/types/ui/ImageBorder/index.d.ts +11 -0
- package/dist/types/ui/ImageBorder/messages.d.ts +42 -0
- package/dist/types/ui/ImageBorder/styles.d.ts +15 -0
- package/dist/types/ui/Media/DropPlaceholder.d.ts +8 -0
- package/dist/types/ui/Media/drop-placeholder-messages.d.ts +7 -0
- package/dist/types/ui/MediaLinkingToolbar.d.ts +35 -0
- package/dist/types/ui/MediaPicker/BrowserWrapper.d.ts +11 -0
- package/dist/types/ui/MediaPicker/ClipboardWrapper.d.ts +10 -0
- package/dist/types/ui/MediaPicker/DropzoneWrapper.d.ts +13 -0
- package/dist/types/ui/MediaPicker/PickerFacadeProvider.d.ts +28 -0
- package/dist/types/ui/MediaPicker/index.d.ts +23 -0
- package/dist/types/ui/PixelEntry/constants.d.ts +1 -0
- package/dist/types/ui/PixelEntry/index.d.ts +8 -0
- package/dist/types/ui/PixelEntry/messages.d.ts +47 -0
- package/dist/types/ui/PixelEntry/styles.d.ts +8 -0
- package/dist/types/ui/PixelEntry/types.d.ts +58 -0
- package/dist/types/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +3 -0
- package/dist/types/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +59 -0
- package/dist/types/ui/ResizableMediaSingle/index.d.ts +45 -0
- package/dist/types/ui/ResizableMediaSingle/styled.d.ts +2 -0
- package/dist/types/ui/ResizableMediaSingle/styles.d.ts +1 -0
- package/dist/types/ui/ResizableMediaSingle/types.d.ts +27 -0
- package/dist/types/ui/ToolbarMedia/index.d.ts +13 -0
- package/dist/types/ui/ToolbarMedia/toolbar-media-messages.d.ts +7 -0
- package/dist/types/ui/media-linking-toolbar-messages.d.ts +7 -0
- package/dist/types/utils/analytics.d.ts +3 -0
- package/dist/types/utils/check-media-type.d.ts +4 -0
- package/dist/types/utils/current-media-node.d.ts +9 -0
- package/dist/types/utils/is-image.d.ts +1 -0
- package/dist/types/utils/media-common.d.ts +20 -0
- package/dist/types/utils/media-files.d.ts +30 -0
- package/dist/types/utils/media-single.d.ts +20 -0
- package/package.json +32 -20
- package/report.api.md +430 -0
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -118
- package/tmp/api-report-tmp.d.ts +0 -9
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
9
|
+
var _templateObject, _templateObject2;
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
import React, { Fragment } from 'react';
|
|
14
|
+
import { css, jsx } from '@emotion/react';
|
|
15
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import { container, containerWithProvider, inputWrapper, RecentSearch } from '@atlaskit/editor-common/link';
|
|
17
|
+
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
18
|
+
import { ErrorMessage } from '@atlaskit/editor-common/ui';
|
|
19
|
+
// Common Translations will live here
|
|
20
|
+
import { PanelTextInput } from '@atlaskit/editor-common/ui';
|
|
21
|
+
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
22
|
+
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
23
|
+
import ChevronLeftLargeIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
24
|
+
import EditorUnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
25
|
+
import { R400 } from '@atlaskit/theme/colors';
|
|
26
|
+
import { mediaLinkToolbarMessages } from './media-linking-toolbar-messages';
|
|
27
|
+
var validationWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 0;\n padding: ", " ", "\n ", " 0;\n margin: 0 ", " 0 ", ";\n border-top: 1px solid ", ";\n align-items: start;\n display: flex;\n flex-direction: column;\n"])), "var(--ds-space-150, 12px)", "var(--ds-space-300, 24px)", "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-400, 32px)", "var(--ds-border-danger, ".concat(R400, ")"));
|
|
28
|
+
var buttonWrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", " ", "\n ", " 0px;\n"])), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-space-050, 4px)");
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
31
|
+
export var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
32
|
+
_inherits(LinkAddToolbar, _React$PureComponent);
|
|
33
|
+
var _super = _createSuper(LinkAddToolbar);
|
|
34
|
+
function LinkAddToolbar() {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, LinkAddToolbar);
|
|
37
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
args[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
42
|
+
validationErrors: []
|
|
43
|
+
});
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "handleSubmit", function (_ref) {
|
|
45
|
+
var url = _ref.url,
|
|
46
|
+
inputMethod = _ref.inputMethod;
|
|
47
|
+
_this.props.onSubmit(url, {
|
|
48
|
+
inputMethod: inputMethod
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "handleOnBack", function (_ref2) {
|
|
52
|
+
var url = _ref2.url,
|
|
53
|
+
inputMethod = _ref2.inputMethod;
|
|
54
|
+
var onBack = _this.props.onBack;
|
|
55
|
+
if (onBack) {
|
|
56
|
+
onBack(url, {
|
|
57
|
+
inputMethod: inputMethod
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "handleCancel", function () {
|
|
62
|
+
var onCancel = _this.props.onCancel;
|
|
63
|
+
if (onCancel) {
|
|
64
|
+
onCancel();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "handleUnlink", function () {
|
|
68
|
+
var onUnlink = _this.props.onUnlink;
|
|
69
|
+
if (onUnlink) {
|
|
70
|
+
onUnlink();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
_defineProperty(_assertThisInitialized(_this), "handleOnBlur", function (options) {
|
|
74
|
+
_this.props.onBlur(options.url);
|
|
75
|
+
});
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "renderContainer", function (_ref3) {
|
|
77
|
+
var activityProvider = _ref3.activityProvider,
|
|
78
|
+
_ref3$inputProps = _ref3.inputProps,
|
|
79
|
+
_onChange = _ref3$inputProps.onChange,
|
|
80
|
+
onKeyDown = _ref3$inputProps.onKeyDown,
|
|
81
|
+
_onSubmit = _ref3$inputProps.onSubmit,
|
|
82
|
+
value = _ref3$inputProps.value,
|
|
83
|
+
currentInputMethod = _ref3.currentInputMethod,
|
|
84
|
+
renderRecentList = _ref3.renderRecentList;
|
|
85
|
+
var _this$props = _this.props,
|
|
86
|
+
formatMessage = _this$props.intl.formatMessage,
|
|
87
|
+
displayUrl = _this$props.displayUrl;
|
|
88
|
+
var getPlaceholder = function getPlaceholder(hasActivityProvider) {
|
|
89
|
+
return formatMessage(hasActivityProvider ? linkToolbarMessages.placeholder : linkToolbarMessages.linkPlaceholder);
|
|
90
|
+
};
|
|
91
|
+
var formatLinkAddressText = formatMessage(mediaLinkToolbarMessages.backLink);
|
|
92
|
+
var formatUnlinkText = formatMessage(linkToolbarMessages.unlink);
|
|
93
|
+
var errorsList = _this.state.validationErrors.map(function (error, index) {
|
|
94
|
+
return jsx(ErrorMessage, {
|
|
95
|
+
key: index
|
|
96
|
+
}, error);
|
|
97
|
+
});
|
|
98
|
+
return jsx("div", {
|
|
99
|
+
className: "recent-list"
|
|
100
|
+
}, jsx("div", {
|
|
101
|
+
css: [container, !!activityProvider && containerWithProvider]
|
|
102
|
+
}, jsx("div", {
|
|
103
|
+
css: inputWrapper
|
|
104
|
+
}, jsx("span", {
|
|
105
|
+
css: buttonWrapper
|
|
106
|
+
}, jsx(Button, {
|
|
107
|
+
title: formatLinkAddressText,
|
|
108
|
+
icon: jsx(ChevronLeftLargeIcon, {
|
|
109
|
+
label: formatLinkAddressText
|
|
110
|
+
}),
|
|
111
|
+
onClick: function onClick() {
|
|
112
|
+
return _this.handleOnBack({
|
|
113
|
+
url: value,
|
|
114
|
+
inputMethod: currentInputMethod
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
})), jsx(PanelTextInput, {
|
|
118
|
+
testId: "media-link-input",
|
|
119
|
+
placeholder: getPlaceholder(!!activityProvider),
|
|
120
|
+
autoFocus: true,
|
|
121
|
+
onCancel: _this.handleCancel,
|
|
122
|
+
defaultValue: value,
|
|
123
|
+
onSubmit: function onSubmit(inputValue) {
|
|
124
|
+
var validationErrors = _this.getValidationErrors(inputValue, currentInputMethod);
|
|
125
|
+
_this.setState({
|
|
126
|
+
validationErrors: validationErrors
|
|
127
|
+
});
|
|
128
|
+
if (!validationErrors.length) {
|
|
129
|
+
_onSubmit();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
onChange: function onChange(value) {
|
|
133
|
+
_this.setState({
|
|
134
|
+
validationErrors: []
|
|
135
|
+
});
|
|
136
|
+
_onChange(value);
|
|
137
|
+
},
|
|
138
|
+
onKeyDown: onKeyDown
|
|
139
|
+
}), normalizeUrl(displayUrl) && jsx(Fragment, null, jsx(Separator, null), jsx(Button, {
|
|
140
|
+
title: formatUnlinkText,
|
|
141
|
+
icon: jsx(EditorUnlinkIcon, {
|
|
142
|
+
label: formatUnlinkText
|
|
143
|
+
}),
|
|
144
|
+
onClick: _this.handleUnlink
|
|
145
|
+
}))), !!errorsList.length && jsx("section", {
|
|
146
|
+
css: validationWrapper
|
|
147
|
+
}, errorsList), renderRecentList()));
|
|
148
|
+
});
|
|
149
|
+
return _this;
|
|
150
|
+
}
|
|
151
|
+
_createClass(LinkAddToolbar, [{
|
|
152
|
+
key: "getValidationErrors",
|
|
153
|
+
value: function getValidationErrors(value, inputMethod) {
|
|
154
|
+
var formatMessage = this.props.intl.formatMessage;
|
|
155
|
+
|
|
156
|
+
// dont show validation errors if input method is typeahed, which means user selects from search list
|
|
157
|
+
if (inputMethod === INPUT_METHOD.TYPEAHEAD) {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
if (!value) {
|
|
161
|
+
return [formatMessage(linkToolbarMessages.emptyLink)];
|
|
162
|
+
}
|
|
163
|
+
// if url can be normalized - we consider it is a valid url
|
|
164
|
+
// also don't show validaition errors for empty values
|
|
165
|
+
if (normalizeUrl(value)) {
|
|
166
|
+
return [];
|
|
167
|
+
} else {
|
|
168
|
+
return [formatMessage(linkToolbarMessages.invalidLink)];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "render",
|
|
173
|
+
value: function render() {
|
|
174
|
+
var _this$props2 = this.props,
|
|
175
|
+
providerFactory = _this$props2.providerFactory,
|
|
176
|
+
displayUrl = _this$props2.displayUrl;
|
|
177
|
+
return jsx(RecentSearch, {
|
|
178
|
+
defaultUrl: normalizeUrl(displayUrl),
|
|
179
|
+
providerFactory: providerFactory,
|
|
180
|
+
onSubmit: this.handleSubmit,
|
|
181
|
+
onBlur: this.handleOnBlur,
|
|
182
|
+
render: this.renderContainer
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}]);
|
|
186
|
+
return LinkAddToolbar;
|
|
187
|
+
}(React.PureComponent);
|
|
188
|
+
export default LinkAddToolbar;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Browser } from '@atlaskit/media-picker';
|
|
6
|
+
import PickerFacadeProvider from './PickerFacadeProvider';
|
|
7
|
+
export var BrowserWrapper = function BrowserWrapper(_ref) {
|
|
8
|
+
var mediaState = _ref.mediaState,
|
|
9
|
+
isOpen = _ref.isOpen,
|
|
10
|
+
onBrowseFn = _ref.onBrowseFn,
|
|
11
|
+
featureFlags = _ref.featureFlags;
|
|
12
|
+
return /*#__PURE__*/React.createElement(PickerFacadeProvider, {
|
|
13
|
+
mediaState: mediaState,
|
|
14
|
+
analyticsName: "browser"
|
|
15
|
+
}, function (_ref2) {
|
|
16
|
+
var mediaClientConfig = _ref2.mediaClientConfig,
|
|
17
|
+
config = _ref2.config,
|
|
18
|
+
pickerFacadeInstance = _ref2.pickerFacadeInstance;
|
|
19
|
+
var browserConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
20
|
+
multiple: true
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/React.createElement(Browser, {
|
|
23
|
+
onBrowseFn: onBrowseFn,
|
|
24
|
+
isOpen: isOpen,
|
|
25
|
+
config: browserConfig,
|
|
26
|
+
mediaClientConfig: mediaClientConfig,
|
|
27
|
+
onEnd: pickerFacadeInstance.handleReady,
|
|
28
|
+
onError: pickerFacadeInstance.handleUploadError,
|
|
29
|
+
onPreviewUpdate: pickerFacadeInstance.handleUploadPreviewUpdate,
|
|
30
|
+
featureFlags: featureFlags
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Clipboard } from '@atlaskit/media-picker';
|
|
3
|
+
import PickerFacadeProvider from './PickerFacadeProvider';
|
|
4
|
+
export var ClipboardWrapper = function ClipboardWrapper(_ref) {
|
|
5
|
+
var mediaState = _ref.mediaState,
|
|
6
|
+
featureFlags = _ref.featureFlags,
|
|
7
|
+
container = _ref.container;
|
|
8
|
+
return /*#__PURE__*/React.createElement(PickerFacadeProvider, {
|
|
9
|
+
mediaState: mediaState,
|
|
10
|
+
analyticsName: "clipboard"
|
|
11
|
+
}, function (_ref2) {
|
|
12
|
+
var mediaClientConfig = _ref2.mediaClientConfig,
|
|
13
|
+
config = _ref2.config,
|
|
14
|
+
pickerFacadeInstance = _ref2.pickerFacadeInstance;
|
|
15
|
+
var clipboardConfig = Object.assign({}, config);
|
|
16
|
+
if ((featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.securedClipboard) === true) {
|
|
17
|
+
clipboardConfig.container = container;
|
|
18
|
+
clipboardConfig.onPaste = function (event) {
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement(Clipboard, {
|
|
24
|
+
mediaClientConfig: mediaClientConfig,
|
|
25
|
+
config: clipboardConfig,
|
|
26
|
+
onError: pickerFacadeInstance.handleUploadError,
|
|
27
|
+
onPreviewUpdate: pickerFacadeInstance.handleUploadPreviewUpdate,
|
|
28
|
+
onEnd: pickerFacadeInstance.handleReady,
|
|
29
|
+
featureFlags: featureFlags
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
6
|
+
import { Dropzone } from '@atlaskit/media-picker';
|
|
7
|
+
import PickerFacadeProvider from './PickerFacadeProvider';
|
|
8
|
+
export var DropzoneWrapper = function DropzoneWrapper(_ref) {
|
|
9
|
+
var mediaState = _ref.mediaState,
|
|
10
|
+
isActive = _ref.isActive,
|
|
11
|
+
featureFlags = _ref.featureFlags,
|
|
12
|
+
editorDomElement = _ref.editorDomElement,
|
|
13
|
+
appearance = _ref.appearance;
|
|
14
|
+
return /*#__PURE__*/React.createElement(PickerFacadeProvider, {
|
|
15
|
+
mediaState: mediaState,
|
|
16
|
+
analyticsName: "dropzone"
|
|
17
|
+
}, function (_ref2) {
|
|
18
|
+
var mediaClientConfig = _ref2.mediaClientConfig,
|
|
19
|
+
config = _ref2.config,
|
|
20
|
+
pickerFacadeInstance = _ref2.pickerFacadeInstance;
|
|
21
|
+
var customDropzoneContainer = mediaState.options.customDropzoneContainer,
|
|
22
|
+
handleDrag = mediaState.handleDrag;
|
|
23
|
+
var editorHtmlElement = editorDomElement;
|
|
24
|
+
var scrollParent = appearance === 'full-page' && findOverflowScrollParent(editorHtmlElement);
|
|
25
|
+
var container = customDropzoneContainer || (scrollParent ? scrollParent : editorHtmlElement);
|
|
26
|
+
var dropzoneConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
27
|
+
container: container
|
|
28
|
+
});
|
|
29
|
+
return isActive ? /*#__PURE__*/React.createElement(Dropzone, {
|
|
30
|
+
mediaClientConfig: mediaClientConfig,
|
|
31
|
+
config: dropzoneConfig,
|
|
32
|
+
onError: pickerFacadeInstance.handleUploadError,
|
|
33
|
+
onPreviewUpdate: pickerFacadeInstance.handleUploadPreviewUpdate,
|
|
34
|
+
onEnd: pickerFacadeInstance.handleReady,
|
|
35
|
+
onDragEnter: function onDragEnter() {
|
|
36
|
+
return handleDrag('enter');
|
|
37
|
+
},
|
|
38
|
+
onDragLeave: function onDragLeave() {
|
|
39
|
+
return handleDrag('leave');
|
|
40
|
+
},
|
|
41
|
+
featureFlags: featureFlags
|
|
42
|
+
}) : null;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
14
|
+
import PickerFacade from '../../picker-facade';
|
|
15
|
+
var dummyMediaPickerObject = {
|
|
16
|
+
on: function on() {},
|
|
17
|
+
removeAllListeners: function removeAllListeners() {},
|
|
18
|
+
emit: function emit() {},
|
|
19
|
+
destroy: function destroy() {},
|
|
20
|
+
setUploadParams: function setUploadParams() {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
24
|
+
var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
|
|
25
|
+
_inherits(PickerFacadeProvider, _React$Component);
|
|
26
|
+
var _super = _createSuper(PickerFacadeProvider);
|
|
27
|
+
function PickerFacadeProvider() {
|
|
28
|
+
var _this;
|
|
29
|
+
_classCallCheck(this, PickerFacadeProvider);
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "state", {});
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "handleMediaProvider", /*#__PURE__*/function () {
|
|
36
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, provider) {
|
|
37
|
+
var _this$props, mediaState, analyticsName, mediaProvider, resolvedMediaClientConfig, pickerFacadeConfig, pickerFacadeInstance, config;
|
|
38
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
_this$props = _this.props, mediaState = _this$props.mediaState, analyticsName = _this$props.analyticsName;
|
|
42
|
+
_context.next = 3;
|
|
43
|
+
return provider;
|
|
44
|
+
case 3:
|
|
45
|
+
mediaProvider = _context.sent;
|
|
46
|
+
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
47
|
+
_context.next = 6;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return _context.abrupt("return");
|
|
51
|
+
case 6:
|
|
52
|
+
_context.next = 8;
|
|
53
|
+
return mediaProvider.uploadMediaClientConfig;
|
|
54
|
+
case 8:
|
|
55
|
+
_context.t0 = _context.sent;
|
|
56
|
+
if (_context.t0) {
|
|
57
|
+
_context.next = 13;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
_context.next = 12;
|
|
61
|
+
return mediaProvider.viewMediaClientConfig;
|
|
62
|
+
case 12:
|
|
63
|
+
_context.t0 = _context.sent;
|
|
64
|
+
case 13:
|
|
65
|
+
resolvedMediaClientConfig = _context.t0;
|
|
66
|
+
if (resolvedMediaClientConfig) {
|
|
67
|
+
_context.next = 16;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return _context.abrupt("return");
|
|
71
|
+
case 16:
|
|
72
|
+
pickerFacadeConfig = {
|
|
73
|
+
mediaClientConfig: resolvedMediaClientConfig,
|
|
74
|
+
errorReporter: mediaState.options.errorReporter || new ErrorReporter(),
|
|
75
|
+
featureFlags: mediaState.mediaOptions && mediaState.mediaOptions.featureFlags
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* As the first MediaPicker component to be migrated to React, we want to scope the amount of changes logic changed/moved on Editor side.
|
|
79
|
+
* To achieve this we agreed on using `PickerFacade` 'customMediaPicker' type, since we only need this instance to reuse the logic when we subscribe
|
|
80
|
+
* for all the different events in MediaPicker (onPreviewUpdate, onError, onProcessing, etc).
|
|
81
|
+
* The `dummyMediaPickerObject` provided here serves as a workaround for the old picker api that `PickerFacade` will try to use.
|
|
82
|
+
* But we don't want this to do anything since it's all part of the new React component (`Clipboard` component in this case).
|
|
83
|
+
* Eventually PickerFacade will be removed and replaced with a new abstraction explained here https://product-fabric.atlassian.net/browse/MS-1937
|
|
84
|
+
*/
|
|
85
|
+
_context.next = 19;
|
|
86
|
+
return new PickerFacade('customMediaPicker', pickerFacadeConfig, dummyMediaPickerObject, analyticsName).init();
|
|
87
|
+
case 19:
|
|
88
|
+
pickerFacadeInstance = _context.sent;
|
|
89
|
+
/**
|
|
90
|
+
* Based on the `initPickers` method in `MediaPluginState` we need these 2 `onNewMedia` subscriptions.
|
|
91
|
+
* First one in order to trigger the entire process of uploading a file for when `onPreviewUpdate` is called
|
|
92
|
+
* Second one in order to track all analytics as before.
|
|
93
|
+
*/
|
|
94
|
+
pickerFacadeInstance.onNewMedia(mediaState.insertFile);
|
|
95
|
+
pickerFacadeInstance.setUploadParams(mediaProvider.uploadParams);
|
|
96
|
+
config = {
|
|
97
|
+
uploadParams: mediaProvider.uploadParams
|
|
98
|
+
};
|
|
99
|
+
_this.setState({
|
|
100
|
+
pickerFacadeInstance: pickerFacadeInstance,
|
|
101
|
+
config: config,
|
|
102
|
+
mediaClientConfig: resolvedMediaClientConfig
|
|
103
|
+
});
|
|
104
|
+
case 24:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee);
|
|
109
|
+
}));
|
|
110
|
+
return function (_x, _x2) {
|
|
111
|
+
return _ref.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}());
|
|
114
|
+
return _this;
|
|
115
|
+
}
|
|
116
|
+
_createClass(PickerFacadeProvider, [{
|
|
117
|
+
key: "componentDidMount",
|
|
118
|
+
value: function componentDidMount() {
|
|
119
|
+
this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "componentWillUnmount",
|
|
123
|
+
value: function componentWillUnmount() {
|
|
124
|
+
this.props.mediaState.options.providerFactory.unsubscribe('mediaProvider', this.handleMediaProvider);
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "render",
|
|
128
|
+
value: function render() {
|
|
129
|
+
var _this$state = this.state,
|
|
130
|
+
mediaClientConfig = _this$state.mediaClientConfig,
|
|
131
|
+
config = _this$state.config,
|
|
132
|
+
pickerFacadeInstance = _this$state.pickerFacadeInstance;
|
|
133
|
+
if (!mediaClientConfig || !config || !pickerFacadeInstance) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return this.props.children({
|
|
137
|
+
mediaClientConfig: mediaClientConfig,
|
|
138
|
+
config: config,
|
|
139
|
+
pickerFacadeInstance: pickerFacadeInstance
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}]);
|
|
143
|
+
return PickerFacadeProvider;
|
|
144
|
+
}(React.Component);
|
|
145
|
+
export { PickerFacadeProvider as default };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
12
|
+
import { BrowserWrapper } from './BrowserWrapper';
|
|
13
|
+
import { ClipboardWrapper } from './ClipboardWrapper';
|
|
14
|
+
import { DropzoneWrapper } from './DropzoneWrapper';
|
|
15
|
+
var MediaPicker = function MediaPicker(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
isPopupOpened = _ref.isPopupOpened,
|
|
18
|
+
appearance = _ref.appearance,
|
|
19
|
+
mediaState = _ref.mediaState,
|
|
20
|
+
onBrowseFn = _ref.onBrowseFn,
|
|
21
|
+
editorDomElement = _ref.editorDomElement;
|
|
22
|
+
var _useSharedPluginState = useSharedPluginState(api, ['focus']),
|
|
23
|
+
focusState = _useSharedPluginState.focusState;
|
|
24
|
+
var featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
25
|
+
var container = editorDomElement;
|
|
26
|
+
var clipboard = focusState !== null && focusState !== void 0 && focusState.hasFocus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
27
|
+
mediaState: mediaState,
|
|
28
|
+
featureFlags: featureFlags,
|
|
29
|
+
container: container
|
|
30
|
+
}) : null;
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, clipboard, /*#__PURE__*/React.createElement(DropzoneWrapper, {
|
|
32
|
+
mediaState: mediaState,
|
|
33
|
+
isActive: !isPopupOpened,
|
|
34
|
+
featureFlags: featureFlags,
|
|
35
|
+
editorDomElement: editorDomElement,
|
|
36
|
+
appearance: appearance
|
|
37
|
+
}), /*#__PURE__*/React.createElement(BrowserWrapper, {
|
|
38
|
+
onBrowseFn: onBrowseFn,
|
|
39
|
+
mediaState: mediaState,
|
|
40
|
+
featureFlags: featureFlags
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
45
|
+
export var MediaPickerComponents = /*#__PURE__*/function (_React$Component) {
|
|
46
|
+
_inherits(MediaPickerComponents, _React$Component);
|
|
47
|
+
var _super = _createSuper(MediaPickerComponents);
|
|
48
|
+
function MediaPickerComponents() {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, MediaPickerComponents);
|
|
51
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
|
+
args[_key] = arguments[_key];
|
|
53
|
+
}
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
56
|
+
isPopupOpened: false
|
|
57
|
+
});
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "onBrowseFn", function (nativeBrowseFn) {
|
|
59
|
+
var mediaState = _this.props.mediaState;
|
|
60
|
+
mediaState && mediaState.setBrowseFn(nativeBrowseFn);
|
|
61
|
+
});
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
_createClass(MediaPickerComponents, [{
|
|
65
|
+
key: "componentDidMount",
|
|
66
|
+
value: function componentDidMount() {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
var mediaState = this.props.mediaState;
|
|
69
|
+
mediaState.onPopupToggle(function (isPopupOpened) {
|
|
70
|
+
_this2.setState({
|
|
71
|
+
isPopupOpened: isPopupOpened
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render() {
|
|
78
|
+
var _this$props = this.props,
|
|
79
|
+
api = _this$props.api,
|
|
80
|
+
mediaState = _this$props.mediaState,
|
|
81
|
+
editorDomElement = _this$props.editorDomElement,
|
|
82
|
+
appearance = _this$props.appearance;
|
|
83
|
+
var isPopupOpened = this.state.isPopupOpened;
|
|
84
|
+
return /*#__PURE__*/React.createElement(MediaPicker, {
|
|
85
|
+
mediaState: mediaState,
|
|
86
|
+
editorDomElement: editorDomElement,
|
|
87
|
+
appearance: appearance,
|
|
88
|
+
isPopupOpened: isPopupOpened,
|
|
89
|
+
onBrowseFn: this.onBrowseFn,
|
|
90
|
+
api: api
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}]);
|
|
94
|
+
return MediaPickerComponents;
|
|
95
|
+
}(React.Component);
|
|
96
|
+
_defineProperty(MediaPickerComponents, "displayName", 'MediaPickerComponents');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var PIXELENTRY_MIGRATION_BUTTON_TESTID = 'pixel-entry-convert-pixels-btn';
|