@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,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getLinkingToolbar = void 0;
|
|
8
|
+
exports.shouldShowMediaLinkToolbar = shouldShowMediaLinkToolbar;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
|
+
var _linking = require("../commands/linking");
|
|
13
|
+
var _linking2 = require("../pm-plugins/linking");
|
|
14
|
+
var _MediaLinkingToolbar = _interopRequireDefault(require("../ui/MediaLinkingToolbar"));
|
|
15
|
+
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; }
|
|
16
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
17
|
+
var FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
|
|
18
|
+
function shouldShowMediaLinkToolbar(editorState) {
|
|
19
|
+
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(editorState);
|
|
20
|
+
if (!mediaLinkingState || mediaLinkingState.mediaPos === null) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
var _editorState$schema = editorState.schema,
|
|
24
|
+
media = _editorState$schema.nodes.media,
|
|
25
|
+
link = _editorState$schema.marks.link;
|
|
26
|
+
var node = editorState.doc.nodeAt(mediaLinkingState.mediaPos);
|
|
27
|
+
if (!node || node.type !== media) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
var _editorState$doc$reso = editorState.doc.resolve(mediaLinkingState.mediaPos),
|
|
31
|
+
parent = _editorState$doc$reso.parent;
|
|
32
|
+
return parent && parent.type.allowsMarkType(link);
|
|
33
|
+
}
|
|
34
|
+
var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory) {
|
|
35
|
+
var link = mediaLinkingState.link,
|
|
36
|
+
visible = mediaLinkingState.visible,
|
|
37
|
+
editing = mediaLinkingState.editable,
|
|
38
|
+
mediaPos = mediaLinkingState.mediaPos;
|
|
39
|
+
if (visible && mediaPos !== null) {
|
|
40
|
+
var node = state.doc.nodeAt(mediaPos);
|
|
41
|
+
if (node) {
|
|
42
|
+
return _objectSpread(_objectSpread({}, toolbarBaseConfig), {}, {
|
|
43
|
+
height: _ui.RECENT_SEARCH_HEIGHT_IN_PX,
|
|
44
|
+
width: _ui.RECENT_SEARCH_WIDTH_IN_PX,
|
|
45
|
+
forcePlacement: true,
|
|
46
|
+
items: [{
|
|
47
|
+
type: 'custom',
|
|
48
|
+
fallback: [],
|
|
49
|
+
disableArrowNavigation: true,
|
|
50
|
+
render: function render(view, idx) {
|
|
51
|
+
if (!view || !providerFactory) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_MediaLinkingToolbar.default, {
|
|
55
|
+
key: idx,
|
|
56
|
+
displayUrl: link,
|
|
57
|
+
providerFactory: providerFactory,
|
|
58
|
+
intl: intl,
|
|
59
|
+
editing: editing,
|
|
60
|
+
onUnlink: function onUnlink() {
|
|
61
|
+
var _pluginInjectionApi$a;
|
|
62
|
+
return (0, _linking.unlink)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch, view);
|
|
63
|
+
},
|
|
64
|
+
onBack: function onBack(href, meta) {
|
|
65
|
+
if (href.trim() && meta.inputMethod) {
|
|
66
|
+
var _pluginInjectionApi$a2;
|
|
67
|
+
(0, _linking.setUrlToMedia)(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(view.state, view.dispatch, view);
|
|
68
|
+
}
|
|
69
|
+
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
70
|
+
},
|
|
71
|
+
onCancel: function onCancel() {
|
|
72
|
+
var _pluginInjectionApi$f;
|
|
73
|
+
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view, true);
|
|
74
|
+
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
75
|
+
* and not close the floating toolbar.
|
|
76
|
+
*/
|
|
77
|
+
var tr = view.state.tr,
|
|
78
|
+
dispatch = view.dispatch;
|
|
79
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 || _pluginInjectionApi$f.forceFocusSelector(FORCE_FOCUS_SELECTOR)(tr);
|
|
80
|
+
dispatch(tr);
|
|
81
|
+
},
|
|
82
|
+
onSubmit: function onSubmit(href, meta) {
|
|
83
|
+
var _pluginInjectionApi$a3;
|
|
84
|
+
(0, _linking.setUrlToMedia)(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(view.state, view.dispatch, view);
|
|
85
|
+
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
86
|
+
},
|
|
87
|
+
onBlur: function onBlur() {
|
|
88
|
+
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getPixelWidthOfElement = exports.getMaxToolbarWidth = exports.downloadMedia = exports.calcNewLayout = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
11
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _mediaClient = require("@atlaskit/media-client");
|
|
14
|
+
var getSelectedMediaContainerNodeAttrs = exports.getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
|
|
15
|
+
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
16
|
+
if (selectedNode && selectedNode.attrs) {
|
|
17
|
+
return selectedNode.attrs;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
var downloadMedia = exports.downloadMedia = /*#__PURE__*/function () {
|
|
22
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(mediaPluginState) {
|
|
23
|
+
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName;
|
|
24
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
_context.prev = 0;
|
|
28
|
+
selectedNodeAttrs = getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
29
|
+
if (!(selectedNodeAttrs && mediaPluginState.mediaClientConfig)) {
|
|
30
|
+
_context.next = 10;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
id = selectedNodeAttrs.id, _selectedNodeAttrs$co = selectedNodeAttrs.collection, collection = _selectedNodeAttrs$co === void 0 ? '' : _selectedNodeAttrs$co;
|
|
34
|
+
mediaClient = (0, _mediaClient.getMediaClient)(mediaPluginState.mediaClientConfig);
|
|
35
|
+
_context.next = 7;
|
|
36
|
+
return mediaClient.file.getCurrentState(id, {
|
|
37
|
+
collectionName: collection
|
|
38
|
+
});
|
|
39
|
+
case 7:
|
|
40
|
+
fileState = _context.sent;
|
|
41
|
+
fileName = fileState.status === 'error' ? undefined : fileState.name;
|
|
42
|
+
mediaClient.file.downloadBinary(id, fileName, collection);
|
|
43
|
+
case 10:
|
|
44
|
+
return _context.abrupt("return", true);
|
|
45
|
+
case 13:
|
|
46
|
+
_context.prev = 13;
|
|
47
|
+
_context.t0 = _context["catch"](0);
|
|
48
|
+
return _context.abrupt("return", false);
|
|
49
|
+
case 16:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee, null, [[0, 13]]);
|
|
54
|
+
}));
|
|
55
|
+
return function downloadMedia(_x) {
|
|
56
|
+
return _ref.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
}();
|
|
59
|
+
var removeMediaGroupNode = exports.removeMediaGroupNode = function removeMediaGroupNode(state) {
|
|
60
|
+
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
61
|
+
var mediaGroupParent = (0, _utils.findParentNodeOfType)(mediaGroup)(state.selection);
|
|
62
|
+
var tr = state.tr;
|
|
63
|
+
// If it is the last media group in filmstrip, remove the entire filmstrip
|
|
64
|
+
if (mediaGroupParent && mediaGroupParent.node.childCount === 1) {
|
|
65
|
+
tr = (0, _utils.removeParentNodeOfType)(mediaGroup)(tr);
|
|
66
|
+
} else {
|
|
67
|
+
tr = (0, _utils.removeSelectedNode)(tr);
|
|
68
|
+
}
|
|
69
|
+
return tr;
|
|
70
|
+
};
|
|
71
|
+
var getSelectedMediaSingle = exports.getSelectedMediaSingle = function getSelectedMediaSingle(state) {
|
|
72
|
+
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
73
|
+
return (0, _utils.findSelectedNodeOfType)(mediaSingle)(state.selection) || (0, _utils.findParentNodeOfType)(mediaSingle)(state.selection);
|
|
74
|
+
};
|
|
75
|
+
var getPixelWidthOfElement = exports.getPixelWidthOfElement = function getPixelWidthOfElement(editorView, pos, mediaWidth) {
|
|
76
|
+
var domNode = editorView.nodeDOM(pos);
|
|
77
|
+
if (domNode instanceof HTMLElement) {
|
|
78
|
+
return domNode.offsetWidth;
|
|
79
|
+
}
|
|
80
|
+
return mediaWidth;
|
|
81
|
+
};
|
|
82
|
+
var calcNewLayout = exports.calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
83
|
+
var fullWidthMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
84
|
+
var isWrappedLayout = _mediaSingle.wrappedLayouts.indexOf(layout) > -1;
|
|
85
|
+
if (width >= _editorSharedStyles.akEditorFullWidthLayoutWidth) {
|
|
86
|
+
// If width is greater than or equal to full editor width
|
|
87
|
+
return 'full-width';
|
|
88
|
+
}
|
|
89
|
+
if (fullWidthMode) {
|
|
90
|
+
// If under editor full width mode
|
|
91
|
+
return isWrappedLayout ? layout : 'center';
|
|
92
|
+
}
|
|
93
|
+
if (width > contentWidth) {
|
|
94
|
+
// If width is greater than content length and not nested
|
|
95
|
+
return 'wide';
|
|
96
|
+
}
|
|
97
|
+
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
98
|
+
};
|
|
99
|
+
var maxToolbarFitWidth = 0;
|
|
100
|
+
var getMaxToolbarWidth = exports.getMaxToolbarWidth = function getMaxToolbarWidth() {
|
|
101
|
+
var toolbar = document.querySelector("div[aria-label=\"Media floating controls\"]");
|
|
102
|
+
var toolbarWidth = toolbar === null || toolbar === void 0 ? void 0 : toolbar.getBoundingClientRect().width;
|
|
103
|
+
if (!toolbar) {
|
|
104
|
+
maxToolbarFitWidth = 0;
|
|
105
|
+
}
|
|
106
|
+
if (toolbarWidth && toolbarWidth > maxToolbarFitWidth) {
|
|
107
|
+
maxToolbarFitWidth = toolbarWidth;
|
|
108
|
+
}
|
|
109
|
+
return maxToolbarFitWidth;
|
|
110
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
13
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
+
var _messages = require("./messages");
|
|
15
|
+
var _templateObject;
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
var placeholder = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n width: 100%;\n text-align: center;\n margin-top: ", " !important;\n display: block;\n"])), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"), "var(--ds-space-100, 8px)");
|
|
18
|
+
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
19
|
+
var onClick = _ref.onClick;
|
|
20
|
+
return (0, _react2.jsx)("span", {
|
|
21
|
+
ref: ref,
|
|
22
|
+
css: placeholder,
|
|
23
|
+
onClick: onClick,
|
|
24
|
+
"data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
|
|
25
|
+
"data-testid": "caption-placeholder"
|
|
26
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.placeholder));
|
|
27
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
placeholder: {
|
|
10
|
+
id: 'fabric.editor.captionPlaceholder',
|
|
11
|
+
defaultMessage: 'Add a caption',
|
|
12
|
+
description: 'Placeholder description for an empty (new) caption in the editor'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
var _icons = require("@atlaskit/editor-common/icons");
|
|
12
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
|
+
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
15
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
16
|
+
var _editorPalette = require("@atlaskit/editor-palette");
|
|
17
|
+
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
18
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
19
|
+
var _messages = require("./messages");
|
|
20
|
+
var _styles2 = require("./styles");
|
|
21
|
+
/** @jsx jsx */
|
|
22
|
+
|
|
23
|
+
var ImageBorder = function ImageBorder(_ref) {
|
|
24
|
+
var formatMessage = _ref.intl.formatMessage,
|
|
25
|
+
toggleBorder = _ref.toggleBorder,
|
|
26
|
+
borderMark = _ref.borderMark,
|
|
27
|
+
setBorder = _ref.setBorder;
|
|
28
|
+
var popupTarget = (0, _react.useRef)(null);
|
|
29
|
+
var enabled = !!borderMark;
|
|
30
|
+
var color = borderMark === null || borderMark === void 0 ? void 0 : borderMark.color;
|
|
31
|
+
var size = borderMark === null || borderMark === void 0 ? void 0 : borderMark.size;
|
|
32
|
+
var _useState = (0, _react.useState)(false),
|
|
33
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
|
+
isOpen = _useState2[0],
|
|
35
|
+
setIsOpen = _useState2[1];
|
|
36
|
+
var _useState3 = (0, _react.useState)(false),
|
|
37
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
38
|
+
isColorSubmenuOpen = _useState4[0],
|
|
39
|
+
setIsColorSubmenuOpen = _useState4[1];
|
|
40
|
+
var _useState5 = (0, _react.useState)(false),
|
|
41
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
42
|
+
isSizeSubmenuOpen = _useState6[0],
|
|
43
|
+
setIsSizeSubmenuOpen = _useState6[1];
|
|
44
|
+
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
45
|
+
if (!ref) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
var rect = ref.getBoundingClientRect();
|
|
49
|
+
if (rect.left + rect.width > window.innerWidth) {
|
|
50
|
+
ref.style.left = "-".concat(rect.width, "px");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var borderSizeOptions = [{
|
|
54
|
+
name: formatMessage(_messages.messages.borderSizeSubtle),
|
|
55
|
+
value: 1
|
|
56
|
+
}, {
|
|
57
|
+
name: formatMessage(_messages.messages.borderSizeMedium),
|
|
58
|
+
value: 2
|
|
59
|
+
}, {
|
|
60
|
+
name: formatMessage(_messages.messages.borderSizeBold),
|
|
61
|
+
value: 3
|
|
62
|
+
}];
|
|
63
|
+
var items = [{
|
|
64
|
+
content: formatMessage(_messages.messages.borderColor),
|
|
65
|
+
value: {
|
|
66
|
+
name: 'color'
|
|
67
|
+
},
|
|
68
|
+
elemAfter: (0, _react2.jsx)("div", {
|
|
69
|
+
className: _styles.DropdownMenuSharedCssClassName.SUBMENU
|
|
70
|
+
}, (0, _react2.jsx)("div", {
|
|
71
|
+
css: (0, _styles2.contextualMenuColorIcon)(color && (0, _editorPalette.hexToEditorBorderPaletteColor)(color))
|
|
72
|
+
}), isColorSubmenuOpen && (0, _react2.jsx)("div", {
|
|
73
|
+
css: (0, _styles2.contextualSubMenu)(0),
|
|
74
|
+
ref: handleSubMenuRef
|
|
75
|
+
}, (0, _react2.jsx)(_uiColor.ColorPalette, {
|
|
76
|
+
onClick: function onClick(color) {
|
|
77
|
+
setBorder({
|
|
78
|
+
color: color
|
|
79
|
+
});
|
|
80
|
+
setIsOpen(!isOpen);
|
|
81
|
+
},
|
|
82
|
+
selectedColor: color !== null && color !== void 0 ? color : null,
|
|
83
|
+
paletteOptions: {
|
|
84
|
+
palette: _uiColor.borderColorPalette,
|
|
85
|
+
paletteColorTooltipMessages: _uiColor.borderPaletteTooltipMessages,
|
|
86
|
+
hexToPaletteColor: _editorPalette.hexToEditorBorderPaletteColor
|
|
87
|
+
}
|
|
88
|
+
})))
|
|
89
|
+
}, {
|
|
90
|
+
content: formatMessage(_messages.messages.borderSize),
|
|
91
|
+
value: {
|
|
92
|
+
name: 'size'
|
|
93
|
+
},
|
|
94
|
+
elemAfter: (0, _react2.jsx)("div", {
|
|
95
|
+
className: _styles.DropdownMenuSharedCssClassName.SUBMENU
|
|
96
|
+
}, (0, _react2.jsx)("div", {
|
|
97
|
+
css: _styles2.contextualMenuArrow
|
|
98
|
+
}), isSizeSubmenuOpen && (0, _react2.jsx)("div", {
|
|
99
|
+
css: (0, _styles2.contextualSubMenu)(1),
|
|
100
|
+
ref: handleSubMenuRef
|
|
101
|
+
}, borderSizeOptions.map(function (_ref2, idx) {
|
|
102
|
+
var name = _ref2.name,
|
|
103
|
+
value = _ref2.value;
|
|
104
|
+
return (0, _react2.jsx)(_tooltip.default, {
|
|
105
|
+
key: idx,
|
|
106
|
+
content: name
|
|
107
|
+
}, (0, _react2.jsx)("span", {
|
|
108
|
+
css: _styles2.buttonWrapperStyle
|
|
109
|
+
}, (0, _react2.jsx)("button", {
|
|
110
|
+
css: (0, _styles2.buttonStyle)(value === size),
|
|
111
|
+
"aria-label": name,
|
|
112
|
+
role: "radio",
|
|
113
|
+
"aria-checked": value === size,
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
setBorder({
|
|
116
|
+
size: value
|
|
117
|
+
});
|
|
118
|
+
setIsOpen(false);
|
|
119
|
+
},
|
|
120
|
+
onMouseDown: function onMouseDown(e) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
}, (0, _react2.jsx)("div", {
|
|
124
|
+
css: (0, _styles2.line)(value, value === size),
|
|
125
|
+
role: "presentation"
|
|
126
|
+
}))));
|
|
127
|
+
})))
|
|
128
|
+
}];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* We want to change direction of our dropdowns a bit early,
|
|
132
|
+
* not exactly when it hits the boundary.
|
|
133
|
+
*/
|
|
134
|
+
var fitTolerance = 10;
|
|
135
|
+
var fitWidth = _styles2.menuItemDimensions.width;
|
|
136
|
+
var fitHeight = items.length * (_styles2.menuItemDimensions.height + _styles2.itemSpacing);
|
|
137
|
+
return (0, _react2.jsx)("div", null, (0, _react2.jsx)("div", {
|
|
138
|
+
css: (0, _styles2.toolbarButtonWrapper)({
|
|
139
|
+
enabled: enabled,
|
|
140
|
+
isOpen: isOpen
|
|
141
|
+
})
|
|
142
|
+
}, (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
143
|
+
className: "image-border-toolbar-btn",
|
|
144
|
+
selected: enabled,
|
|
145
|
+
onClick: toggleBorder,
|
|
146
|
+
spacing: "compact",
|
|
147
|
+
"aria-label": enabled ? formatMessage(_messages.messages.removeBorder) : formatMessage(_messages.messages.addBorder),
|
|
148
|
+
iconBefore: (0, _react2.jsx)(_icons.BorderIcon, {
|
|
149
|
+
label: ""
|
|
150
|
+
}),
|
|
151
|
+
title: enabled ? formatMessage(_messages.messages.removeBorder) : formatMessage(_messages.messages.addBorder)
|
|
152
|
+
}), (0, _react2.jsx)("div", {
|
|
153
|
+
ref: popupTarget
|
|
154
|
+
}, (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
155
|
+
className: "image-border-toolbar-dropdown",
|
|
156
|
+
selected: enabled || isOpen,
|
|
157
|
+
"aria-label": formatMessage(_messages.messages.borderOptions),
|
|
158
|
+
title: formatMessage(_messages.messages.borderOptions),
|
|
159
|
+
spacing: "compact",
|
|
160
|
+
iconBefore: (0, _react2.jsx)(_chevronDown.default, {
|
|
161
|
+
label: ""
|
|
162
|
+
}),
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
setIsOpen(!isOpen);
|
|
165
|
+
}
|
|
166
|
+
}))), (0, _react2.jsx)(_ui.Popup, {
|
|
167
|
+
target: popupTarget.current ? popupTarget.current : undefined,
|
|
168
|
+
fitWidth: fitWidth + fitTolerance,
|
|
169
|
+
fitHeight: fitHeight + fitTolerance,
|
|
170
|
+
forcePlacement: true,
|
|
171
|
+
stick: true
|
|
172
|
+
}, (0, _react2.jsx)("div", {
|
|
173
|
+
onMouseLeave: function onMouseLeave() {
|
|
174
|
+
setIsColorSubmenuOpen(false);
|
|
175
|
+
setIsSizeSubmenuOpen(false);
|
|
176
|
+
}
|
|
177
|
+
}, (0, _react2.jsx)(_uiMenu.DropdownMenu
|
|
178
|
+
//This needs be removed when the a11y is completely handled
|
|
179
|
+
//Disabling key navigation now as it works only partially
|
|
180
|
+
//Same with packages/editor/editor-plugin-table/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx
|
|
181
|
+
, {
|
|
182
|
+
arrowKeyNavigationProviderOptions: {
|
|
183
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
184
|
+
disableArrowKeyNavigation: true
|
|
185
|
+
},
|
|
186
|
+
items: [{
|
|
187
|
+
items: items
|
|
188
|
+
}],
|
|
189
|
+
isOpen: isOpen,
|
|
190
|
+
onOpenChange: function onOpenChange() {
|
|
191
|
+
setIsOpen(false);
|
|
192
|
+
setIsColorSubmenuOpen(false);
|
|
193
|
+
setIsSizeSubmenuOpen(false);
|
|
194
|
+
},
|
|
195
|
+
onItemActivated: function onItemActivated(_ref3) {
|
|
196
|
+
var item = _ref3.item;
|
|
197
|
+
if (item.value.name === 'color') {
|
|
198
|
+
setIsColorSubmenuOpen(!isColorSubmenuOpen);
|
|
199
|
+
}
|
|
200
|
+
if (item.value.name === 'size') {
|
|
201
|
+
setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
onMouseEnter: function onMouseEnter(_ref4) {
|
|
205
|
+
var item = _ref4.item;
|
|
206
|
+
if (item.value.name === 'color') {
|
|
207
|
+
setIsColorSubmenuOpen(true);
|
|
208
|
+
}
|
|
209
|
+
if (item.value.name === 'size') {
|
|
210
|
+
setIsSizeSubmenuOpen(true);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
onMouseLeave: function onMouseLeave(_ref5) {
|
|
214
|
+
var item = _ref5.item;
|
|
215
|
+
if (item.value.name === 'color') {
|
|
216
|
+
setIsColorSubmenuOpen(false);
|
|
217
|
+
}
|
|
218
|
+
if (item.value.name === 'size') {
|
|
219
|
+
setIsSizeSubmenuOpen(false);
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
fitWidth: fitWidth + fitTolerance,
|
|
223
|
+
fitHeight: fitHeight + fitTolerance
|
|
224
|
+
}))));
|
|
225
|
+
};
|
|
226
|
+
var _default = exports.default = ImageBorder;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
borderColor: {
|
|
10
|
+
id: 'fabric.editor.imageBorderColor',
|
|
11
|
+
defaultMessage: 'Color',
|
|
12
|
+
description: 'Change the border color of an image.'
|
|
13
|
+
},
|
|
14
|
+
borderSize: {
|
|
15
|
+
id: 'fabric.editor.imageBorderSize',
|
|
16
|
+
defaultMessage: 'Size',
|
|
17
|
+
description: 'Change the border size of an image.'
|
|
18
|
+
},
|
|
19
|
+
addBorder: {
|
|
20
|
+
id: 'fabric.editor.addImageBorder',
|
|
21
|
+
defaultMessage: 'Add border',
|
|
22
|
+
description: 'Add a border to an image.'
|
|
23
|
+
},
|
|
24
|
+
removeBorder: {
|
|
25
|
+
id: 'fabric.editor.removeImageBorder',
|
|
26
|
+
defaultMessage: 'Remove border',
|
|
27
|
+
description: 'Remove the border of an image.'
|
|
28
|
+
},
|
|
29
|
+
borderOptions: {
|
|
30
|
+
id: 'fabric.editor.imageBorderOptions',
|
|
31
|
+
defaultMessage: 'Border options',
|
|
32
|
+
description: 'Display options available for customizing the border of an image.'
|
|
33
|
+
},
|
|
34
|
+
borderSizeSubtle: {
|
|
35
|
+
id: 'fabric.editor.imageBorderSubtle',
|
|
36
|
+
defaultMessage: 'Subtle',
|
|
37
|
+
description: 'Name of a border size.'
|
|
38
|
+
},
|
|
39
|
+
borderSizeMedium: {
|
|
40
|
+
id: 'fabric.editor.imageBorderMedium',
|
|
41
|
+
defaultMessage: 'Medium',
|
|
42
|
+
description: 'Name of a border size.'
|
|
43
|
+
},
|
|
44
|
+
borderSizeBold: {
|
|
45
|
+
id: 'fabric.editor.imageBorderBold',
|
|
46
|
+
defaultMessage: 'Bold',
|
|
47
|
+
description: 'Name of a border size.'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.toolbarButtonWrapper = exports.menuItemDimensions = exports.line = exports.itemSpacing = exports.contextualSubMenu = exports.contextualMenuColorIcon = exports.contextualMenuArrow = exports.buttonWrapperStyle = exports.buttonStyle = void 0;
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
+
var _react = require("@emotion/react");
|
|
11
|
+
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
12
|
+
var _colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
13
|
+
var colors = _colors;
|
|
14
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
15
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7; // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
// menuItemDimensions and itemSpacing are copied from
|
|
19
|
+
// packages/editor/editor-core/src/plugins/floating-toolbar/ui/DropdownMenu.tsx
|
|
20
|
+
|
|
21
|
+
var menuItemDimensions = exports.menuItemDimensions = {
|
|
22
|
+
width: 175,
|
|
23
|
+
height: 32
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// TODO: Migrate away from gridSize
|
|
27
|
+
// Recommendation: Replace directly with 4 due to itemSpacing being used in calculations
|
|
28
|
+
var itemSpacing = exports.itemSpacing = (0, _constants.gridSize)() / 2;
|
|
29
|
+
var contextualMenuArrow = exports.contextualMenuArrow = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n"])), "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
30
|
+
var contextualMenuColorIcon = exports.contextualMenuColorIcon = function contextualMenuColorIcon(color) {
|
|
31
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 20px;\n height: 20px;\n ", "\n }\n"])), contextualMenuArrow, _uiColor.DEFAULT_BORDER_COLOR, "var(--ds-border-radius-100, 3px)", color && "background: ".concat(color));
|
|
32
|
+
};
|
|
33
|
+
var contextualSubMenu = exports.contextualSubMenu = function contextualSubMenu(index) {
|
|
34
|
+
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: flex;\n position: absolute;\n top: ", "px;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n"])), "var(--ds-border-radius-100, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), index * (menuItemDimensions.height + itemSpacing * 2), menuItemDimensions.width, "var(--ds-space-100, 8px)");
|
|
35
|
+
};
|
|
36
|
+
var buttonStyle = exports.buttonStyle = function buttonStyle(selected) {
|
|
37
|
+
return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n height: 26px;\n width: 26px;\n padding: 0;\n border-radius: 4px;\n background-color: ", ";\n border: 1px solid ", ";\n cursor: pointer;\n display: block;\n"])), selected ? "var(--ds-text, ".concat(_colors.N800, ")") : "var(--ds-background-neutral, ".concat(_colors.N20A, ")"), _uiColor.DEFAULT_BORDER_COLOR);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
41
|
+
var buttonWrapperStyle = exports.buttonWrapperStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid transparent;\n margin: 1px;\n font-size: 0;\n display: flex;\n align-items: center;\n padding: 1px;\n border-radius: 6px;\n &:focus-within,\n &:focus,\n &:hover {\n border-color: ", " !important;\n }\n"])), _colors.N50);
|
|
42
|
+
var line = exports.line = function line(size, selected) {
|
|
43
|
+
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n &:before {\n content: '';\n display: block;\n position: absolute;\n top: 50%;\n left: 50%;\n width: 12px;\n height: ", "px;\n background-color: ", ";\n border-radius: 90px;\n transform: translate(-50%, -50%) rotate(135deg);\n }\n"])), size, selected ? "var(--ds-icon-inverse, ".concat(_colors.N0, ")") : "var(--ds-icon, #44546F)");
|
|
44
|
+
};
|
|
45
|
+
var getHoverStyles = function getHoverStyles(selector) {
|
|
46
|
+
return "&:hover ".concat(selector, " {\n background: ", "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N20A, ")"), ";\n\n &:hover {\n background: ", "var(--ds-background-neutral-hovered, ".concat(colors.N30A, ")"), ";\n } \n }");
|
|
47
|
+
};
|
|
48
|
+
var toolbarButtonWrapper = exports.toolbarButtonWrapper = function toolbarButtonWrapper(_ref) {
|
|
49
|
+
var enabled = _ref.enabled,
|
|
50
|
+
isOpen = _ref.isOpen;
|
|
51
|
+
return (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n .image-border-toolbar-btn {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n padding: 0;\n & > span {\n margin: 0;\n }\n }\n .image-border-toolbar-dropdown {\n padding: 0;\n & > span {\n margin: 0;\n }\n width: 16px !important;\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n margin-left: 1px;\n }\n\n ", "\n ", "\n"])), !enabled && getHoverStyles('.image-border-toolbar-btn'), !isOpen && !enabled && getHoverStyles('.image-border-toolbar-dropdown'));
|
|
52
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
|
+
var _documentFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/document-filled"));
|
|
13
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
15
|
+
var _media = require("../../nodeviews/mediaNodeView/media");
|
|
16
|
+
var _dropPlaceholderMessages = require("./drop-placeholder-messages");
|
|
17
|
+
var _templateObject, _templateObject2;
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
var iconWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n background: ", ";\n border-radius: ", "px;\n margin: 5px 3px 25px;\n width: ", "px;\n min-height: ", "px;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), "var(--ds-icon-accent-blue, ".concat((0, _adfSchema.hexToRgba)(_colors.B400, 0.4) || _colors.B400, ")"), "var(--ds-background-accent-blue-subtle, ".concat((0, _adfSchema.hexToRgba)(_colors.B300, 0.6) || _colors.B300, ")"), (0, _constants.borderRadius)(), _media.FILE_WIDTH, _media.MEDIA_HEIGHT);
|
|
20
|
+
var dropLine = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border-radius: ", "px;\n margin: ", " 0;\n width: 100%;\n height: 2px;\n"])), "var(--ds-border-focused, ".concat(_colors.B200, ")"), (0, _constants.borderRadius)(), "var(--ds-space-025, 2px)");
|
|
21
|
+
var IconWrapperComponent = function IconWrapperComponent(props) {
|
|
22
|
+
var intl = props.intl;
|
|
23
|
+
var dropPlaceholderLabel = _dropPlaceholderMessages.dropPlaceholderMessages.dropPlaceholderLabel;
|
|
24
|
+
return (0, _react.jsx)("div", {
|
|
25
|
+
css: iconWrapper
|
|
26
|
+
}, (0, _react.jsx)(_documentFilled.default, {
|
|
27
|
+
label: intl.formatMessage(dropPlaceholderLabel),
|
|
28
|
+
size: "medium"
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
var IntlIconWrapper = (0, _reactIntlNext.injectIntl)(IconWrapperComponent);
|
|
32
|
+
var _default = exports.default = function _default(_ref) {
|
|
33
|
+
var _ref$type = _ref.type,
|
|
34
|
+
type = _ref$type === void 0 ? 'group' : _ref$type;
|
|
35
|
+
return type === 'single' ? (0, _react.jsx)("div", {
|
|
36
|
+
css: dropLine
|
|
37
|
+
}) : (0, _react.jsx)(IntlIconWrapper, null);
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dropPlaceholderMessages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var dropPlaceholderMessages = exports.dropPlaceholderMessages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
dropPlaceholderLabel: {
|
|
10
|
+
id: 'fabric.editor.dropPlaceholderLabel',
|
|
11
|
+
defaultMessage: 'Document',
|
|
12
|
+
description: 'document label for an media icon'
|
|
13
|
+
}
|
|
14
|
+
});
|