@atlaskit/editor-core 151.3.0 → 152.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/dist/cjs/create-editor/ReactEditorView.js +22 -8
- package/dist/cjs/create-editor/create-plugins-list.js +25 -9
- package/dist/cjs/labs/next/presets/cxhtml.js +1 -2
- package/dist/cjs/nodeviews/ReactNodeView.js +2 -2
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +6 -0
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/annotation/utils.js +19 -8
- package/dist/cjs/plugins/avatar-group/index.js +2 -1
- package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
- package/dist/cjs/plugins/before-primaryToolbar/index.js +26 -0
- package/dist/cjs/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +28 -0
- package/dist/cjs/plugins/extension/extension-api.js +10 -2
- package/dist/cjs/plugins/extension/ui/styles.js +1 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +172 -0
- package/dist/cjs/plugins/find-replace/index.js +14 -137
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -4
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -1
- package/dist/cjs/plugins/fragment/index.js +34 -0
- package/dist/cjs/plugins/fragment/plugin-key.js +11 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/index.js +16 -0
- package/dist/cjs/plugins/list/actions/conversions.js +39 -71
- package/dist/cjs/plugins/list/transforms.js +7 -1
- package/dist/cjs/plugins/media/index.js +2 -3
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +3 -1
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +12 -5
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +6 -4
- package/dist/cjs/plugins/media/nodeviews/styles.js +6 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +49 -15
- package/dist/cjs/plugins/media/toolbar/commands.js +59 -0
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +7 -2
- package/dist/cjs/plugins/media/toolbar/index.js +90 -3
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
- package/dist/cjs/plugins/media/utils/media-common.js +1 -1
- package/dist/cjs/plugins/media/utils/media-files.js +5 -1
- package/dist/cjs/plugins/panel/actions.js +2 -2
- package/dist/cjs/plugins/panel/index.js +3 -3
- package/dist/cjs/plugins/panel/nodeviews/panel.js +2 -2
- package/dist/cjs/plugins/panel/toolbar.js +10 -5
- package/dist/cjs/plugins/panel/utils.js +15 -0
- package/dist/cjs/plugins/rank.js +3 -2
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +49 -1
- package/dist/cjs/plugins/status/ui/statusPicker.js +4 -2
- package/dist/cjs/plugins/table/commands/insert.js +1 -0
- package/dist/cjs/plugins/table/index.js +3 -2
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/main.js +26 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
- package/dist/cjs/plugins/table/transforms/column-width.js +14 -5
- package/dist/cjs/plugins/table/transforms/fix-tables.js +43 -6
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/cjs/plugins/table/ui/common-styles.css.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +1 -1
- package/dist/cjs/plugins/table/ui/messages.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
- package/dist/cjs/plugins/text-formatting/index.js +2 -1
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +1 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +77 -26
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +32 -9
- package/dist/cjs/ui/ColorPalette/Color/index.js +8 -18
- package/dist/cjs/ui/ColorPalette/index.js +7 -4
- package/dist/cjs/ui/ColorPickerButton/index.js +1 -1
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +114 -61
- package/dist/cjs/ui/ConfigPanel/FormContent.js +39 -26
- package/dist/cjs/ui/ConfigPanel/transformers.js +490 -248
- package/dist/cjs/ui/ConfigPanel/utils.js +2 -10
- package/dist/cjs/ui/DropdownMenu/index.js +3 -1
- package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +1 -1
- package/dist/cjs/ui/Resizer/index.js +9 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +19 -8
- package/dist/es2019/create-editor/create-plugins-list.js +26 -10
- package/dist/es2019/labs/next/presets/cxhtml.js +1 -2
- package/dist/es2019/nodeviews/ReactNodeView.js +1 -1
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +11 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/annotation/utils.js +18 -7
- package/dist/es2019/plugins/avatar-group/index.js +2 -1
- package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +3 -2
- package/dist/es2019/plugins/before-primaryToolbar/index.js +15 -0
- package/dist/es2019/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
- package/dist/es2019/plugins/extension/extension-api.js +9 -2
- package/dist/es2019/plugins/extension/ui/styles.js +6 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +152 -0
- package/dist/es2019/plugins/find-replace/index.js +15 -128
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
- package/dist/es2019/plugins/fragment/index.js +22 -0
- package/dist/es2019/plugins/fragment/plugin-key.js +2 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
- package/dist/es2019/plugins/index.js +2 -0
- package/dist/es2019/plugins/list/actions/conversions.js +38 -69
- package/dist/es2019/plugins/list/transforms.js +5 -1
- package/dist/es2019/plugins/media/index.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -1
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +8 -4
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +7 -5
- package/dist/es2019/plugins/media/nodeviews/styles.js +2 -0
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +32 -17
- package/dist/es2019/plugins/media/toolbar/commands.js +47 -0
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +6 -2
- package/dist/es2019/plugins/media/toolbar/index.js +90 -3
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +7 -1
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/media/utils/media-files.js +6 -1
- package/dist/es2019/plugins/panel/actions.js +2 -2
- package/dist/es2019/plugins/panel/index.js +5 -5
- package/dist/es2019/plugins/panel/nodeviews/panel.js +2 -2
- package/dist/es2019/plugins/panel/toolbar.js +10 -5
- package/dist/es2019/plugins/panel/utils.js +8 -1
- package/dist/es2019/plugins/rank.js +3 -2
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +48 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +4 -2
- package/dist/es2019/plugins/table/commands/insert.js +1 -2
- package/dist/es2019/plugins/table/index.js +2 -1
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/main.js +25 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
- package/dist/es2019/plugins/table/transforms/column-width.js +13 -3
- package/dist/es2019/plugins/table/transforms/fix-tables.js +43 -5
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/es2019/plugins/table/ui/common-styles.css.js +5 -1
- package/dist/es2019/plugins/table/ui/consts.js +2 -2
- package/dist/es2019/plugins/table/ui/messages.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
- package/dist/es2019/plugins/text-formatting/index.js +3 -2
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -1
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +60 -27
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +51 -7
- package/dist/es2019/ui/ColorPalette/Color/index.js +9 -18
- package/dist/es2019/ui/ColorPalette/index.js +7 -4
- package/dist/es2019/ui/ColorPickerButton/index.js +1 -1
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +101 -49
- package/dist/es2019/ui/ConfigPanel/FormContent.js +35 -26
- package/dist/es2019/ui/ConfigPanel/transformers.js +243 -72
- package/dist/es2019/ui/ConfigPanel/utils.js +1 -2
- package/dist/es2019/ui/Dropdown/index.js +2 -1
- package/dist/es2019/ui/DropdownMenu/index.js +7 -3
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
- package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +2 -2
- package/dist/es2019/ui/Resizer/index.js +9 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +22 -8
- package/dist/esm/create-editor/create-plugins-list.js +26 -10
- package/dist/esm/labs/next/presets/cxhtml.js +1 -2
- package/dist/esm/nodeviews/ReactNodeView.js +2 -2
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +7 -0
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/annotation/utils.js +18 -7
- package/dist/esm/plugins/avatar-group/index.js +2 -1
- package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
- package/dist/esm/plugins/before-primaryToolbar/index.js +15 -0
- package/dist/esm/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
- package/dist/esm/plugins/extension/extension-api.js +9 -2
- package/dist/esm/plugins/extension/ui/styles.js +1 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +155 -0
- package/dist/esm/plugins/find-replace/index.js +14 -131
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +9 -4
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
- package/dist/esm/plugins/fragment/index.js +22 -0
- package/dist/esm/plugins/fragment/plugin-key.js +2 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
- package/dist/esm/plugins/index.js +2 -0
- package/dist/esm/plugins/list/actions/conversions.js +38 -71
- package/dist/esm/plugins/list/transforms.js +7 -1
- package/dist/esm/plugins/media/index.js +2 -3
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -1
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +11 -6
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +7 -5
- package/dist/esm/plugins/media/nodeviews/styles.js +2 -0
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +47 -16
- package/dist/esm/plugins/media/toolbar/commands.js +45 -0
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +6 -2
- package/dist/esm/plugins/media/toolbar/index.js +88 -3
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/media/utils/media-files.js +6 -1
- package/dist/esm/plugins/panel/actions.js +2 -2
- package/dist/esm/plugins/panel/index.js +5 -5
- package/dist/esm/plugins/panel/nodeviews/panel.js +2 -2
- package/dist/esm/plugins/panel/toolbar.js +9 -4
- package/dist/esm/plugins/panel/utils.js +13 -0
- package/dist/esm/plugins/rank.js +3 -2
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +50 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +4 -2
- package/dist/esm/plugins/table/commands/insert.js +1 -2
- package/dist/esm/plugins/table/index.js +3 -2
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/main.js +27 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
- package/dist/esm/plugins/table/transforms/column-width.js +13 -3
- package/dist/esm/plugins/table/transforms/fix-tables.js +42 -4
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/esm/plugins/table/ui/common-styles.css.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +2 -2
- package/dist/esm/plugins/table/ui/messages.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
- package/dist/esm/plugins/text-formatting/index.js +3 -2
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -1
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +67 -27
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +20 -7
- package/dist/esm/ui/ColorPalette/Color/index.js +9 -16
- package/dist/esm/ui/ColorPalette/index.js +7 -4
- package/dist/esm/ui/ColorPickerButton/index.js +1 -1
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +113 -62
- package/dist/esm/ui/ConfigPanel/FormContent.js +39 -26
- package/dist/esm/ui/ConfigPanel/transformers.js +488 -248
- package/dist/esm/ui/ConfigPanel/utils.js +1 -6
- package/dist/esm/ui/Dropdown/index.js +2 -1
- package/dist/esm/ui/DropdownMenu/index.js +7 -3
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
- package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +2 -2
- package/dist/esm/ui/Resizer/index.js +9 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/full-page.d.ts +1 -1
- package/dist/types/nodeviews/ReactNodeView.d.ts +1 -1
- package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +1 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +7 -1
- package/dist/types/plugins/annotation/utils.d.ts +1 -1
- package/dist/types/plugins/avatar-group/index.d.ts +1 -0
- package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +1 -0
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +5 -0
- package/dist/types/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +15 -0
- package/dist/types/plugins/find-replace/index.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +1 -1
- package/dist/types/plugins/fragment/index.d.ts +5 -0
- package/dist/types/plugins/fragment/plugin-key.d.ts +2 -0
- package/dist/types/plugins/index.d.ts +2 -0
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +3 -2
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/styles.d.ts +2 -0
- package/dist/types/plugins/media/toolbar/commands.d.ts +3 -0
- package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +2 -0
- package/dist/types/plugins/media/types.d.ts +0 -1
- package/dist/types/plugins/panel/actions.d.ts +1 -1
- package/dist/types/plugins/panel/types.d.ts +8 -2
- package/dist/types/plugins/quick-insert/index.d.ts +2 -1
- package/dist/types/plugins/table/commands/insert.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -0
- package/dist/types/plugins/table/transforms/column-width.d.ts +4 -1
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +3 -2
- package/dist/types/plugins/table/types.d.ts +8 -0
- package/dist/types/plugins/table/ui/consts.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +2 -2
- package/dist/types/types/editor-props.d.ts +11 -1
- package/dist/types/types/feature-flags.d.ts +13 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -2
- package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +10 -1
- package/dist/types/ui/ColorPalette/Color/index.d.ts +8 -5
- package/dist/types/ui/ColorPalette/index.d.ts +1 -0
- package/dist/types/ui/ConfigPanel/transformers.d.ts +7 -1
- package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
- package/dist/types/ui/Resizer/index.d.ts +1 -0
- package/package.json +32 -29
- package/dist/cjs/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -38
- package/dist/es2019/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
- package/dist/esm/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
- package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +0 -1
|
@@ -49,6 +49,8 @@ var _pluginKey = require("../pm-plugins/plugin-key");
|
|
|
49
49
|
|
|
50
50
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
51
51
|
|
|
52
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
53
|
+
|
|
52
54
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
53
55
|
|
|
54
56
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -181,7 +183,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
181
183
|
onClick: function onClick() {
|
|
182
184
|
(0, _utils.setNodeSelection)(_this.props.view, getNodePos());
|
|
183
185
|
}
|
|
184
|
-
}, mediaInlineOptions(mediaOptions.
|
|
186
|
+
}, mediaInlineOptions((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions.featureFlags)));
|
|
185
187
|
});
|
|
186
188
|
|
|
187
189
|
return /*#__PURE__*/_react.default.createElement(_mediaFilmstrip.Filmstrip, {
|
|
@@ -13,6 +13,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
13
13
|
|
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
15
|
|
|
16
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
+
|
|
16
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
19
|
|
|
18
20
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -33,6 +35,8 @@ var _mediaCard = require("@atlaskit/media-card");
|
|
|
33
35
|
|
|
34
36
|
var _editorCommon = require("@atlaskit/editor-common");
|
|
35
37
|
|
|
38
|
+
var _styles = require("./styles");
|
|
39
|
+
|
|
36
40
|
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); }
|
|
37
41
|
|
|
38
42
|
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; }
|
|
@@ -92,6 +96,7 @@ var MediaInline = function MediaInline(props) {
|
|
|
92
96
|
collectionName: collection
|
|
93
97
|
};
|
|
94
98
|
return /*#__PURE__*/_react.default.createElement(_mediaCard.MediaInlineCard, {
|
|
99
|
+
isSelected: props.isSelected,
|
|
95
100
|
identifier: identifier,
|
|
96
101
|
mediaClientConfig: viewMediaClientConfig
|
|
97
102
|
});
|
|
@@ -99,8 +104,8 @@ var MediaInline = function MediaInline(props) {
|
|
|
99
104
|
|
|
100
105
|
exports.MediaInline = MediaInline;
|
|
101
106
|
|
|
102
|
-
var MediaInlineNodeView = /*#__PURE__*/function (
|
|
103
|
-
(0, _inherits2.default)(MediaInlineNodeView,
|
|
107
|
+
var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
108
|
+
(0, _inherits2.default)(MediaInlineNodeView, _SelectionBasedNodeVi);
|
|
104
109
|
|
|
105
110
|
var _super = _createSuper(MediaInlineNodeView);
|
|
106
111
|
|
|
@@ -114,6 +119,7 @@ var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
114
119
|
value: function createDomRef() {
|
|
115
120
|
var domRef = document.createElement('span');
|
|
116
121
|
domRef.contentEditable = 'false';
|
|
122
|
+
domRef.classList.add(_styles.MediaInlineNodeSelector);
|
|
117
123
|
return domRef;
|
|
118
124
|
}
|
|
119
125
|
}, {
|
|
@@ -136,7 +142,7 @@ var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
136
142
|
return true;
|
|
137
143
|
}
|
|
138
144
|
|
|
139
|
-
return
|
|
145
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(MediaInlineNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
|
|
140
146
|
}
|
|
141
147
|
}, {
|
|
142
148
|
key: "render",
|
|
@@ -157,14 +163,15 @@ var MediaInlineNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
157
163
|
return /*#__PURE__*/_react.default.createElement(MediaInline, {
|
|
158
164
|
identifier: _this.node.attrs.id,
|
|
159
165
|
mediaProvider: mediaProvider,
|
|
160
|
-
node: _this.node
|
|
166
|
+
node: _this.node,
|
|
167
|
+
isSelected: _this.nodeInsideSelection()
|
|
161
168
|
});
|
|
162
169
|
}
|
|
163
170
|
});
|
|
164
171
|
}
|
|
165
172
|
}]);
|
|
166
173
|
return MediaInlineNodeView;
|
|
167
|
-
}(_nodeviews.
|
|
174
|
+
}(_nodeviews.SelectionBasedNodeView);
|
|
168
175
|
|
|
169
176
|
exports.MediaInlineNodeView = MediaInlineNodeView;
|
|
170
177
|
|
|
@@ -453,7 +453,9 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
453
453
|
|
|
454
454
|
var shouldShowPlaceholder = (0, _mediaCommon2.getMediaFeatureFlag)('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof _prosemirrorState.NodeSelection;
|
|
455
455
|
|
|
456
|
-
var MediaChildren = /*#__PURE__*/_react.default.createElement(_styles.FigureWrapper,
|
|
456
|
+
var MediaChildren = /*#__PURE__*/_react.default.createElement(_styles.FigureWrapper, {
|
|
457
|
+
className: _styles.MediaSingleNodeSelector
|
|
458
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
457
459
|
ref: this.props.forwardRef
|
|
458
460
|
}), shouldShowPlaceholder && /*#__PURE__*/_react.default.createElement(_CaptionPlaceholder.default, {
|
|
459
461
|
onClick: this.clickPlaceholder
|
|
@@ -570,7 +572,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
570
572
|
}
|
|
571
573
|
}, {
|
|
572
574
|
key: "update",
|
|
573
|
-
value: function update(node, decorations, isValidUpdate) {
|
|
575
|
+
value: function update(node, decorations, _innerDecorations, isValidUpdate) {
|
|
574
576
|
var _this3 = this;
|
|
575
577
|
|
|
576
578
|
if (!isValidUpdate) {
|
|
@@ -579,7 +581,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
579
581
|
};
|
|
580
582
|
}
|
|
581
583
|
|
|
582
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, isValidUpdate);
|
|
584
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, _innerDecorations, isValidUpdate);
|
|
583
585
|
}
|
|
584
586
|
}, {
|
|
585
587
|
key: "render",
|
|
@@ -640,7 +642,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
640
642
|
if (offsetLeft !== this.lastOffsetLeft) {
|
|
641
643
|
this.lastOffsetLeft = offsetLeft;
|
|
642
644
|
this.forceViewUpdate = true;
|
|
643
|
-
this.update(this.node, [], function () {
|
|
645
|
+
this.update(this.node, [], [], function () {
|
|
644
646
|
return true;
|
|
645
647
|
});
|
|
646
648
|
}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.MediaCardWrapper = exports.FigureWrapper = void 0;
|
|
8
|
+
exports.MediaCardWrapper = exports.FigureWrapper = exports.MediaSingleNodeSelector = exports.MediaInlineNodeSelector = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -15,6 +15,11 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
15
15
|
|
|
16
16
|
var _templateObject, _templateObject2, _templateObject3;
|
|
17
17
|
|
|
18
|
+
var MediaInlineNodeSelector = 'media-inline-node';
|
|
19
|
+
exports.MediaInlineNodeSelector = MediaInlineNodeSelector;
|
|
20
|
+
var MediaSingleNodeSelector = 'media-single-node';
|
|
21
|
+
exports.MediaSingleNodeSelector = MediaSingleNodeSelector;
|
|
22
|
+
|
|
18
23
|
var FigureWrapper = _styledComponents.default.figure(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n"])));
|
|
19
24
|
|
|
20
25
|
exports.FigureWrapper = FigureWrapper;
|
|
@@ -207,6 +207,8 @@ var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
207
207
|
onClick: this.closeMediaAltTextMenu
|
|
208
208
|
})), /*#__PURE__*/_react.default.createElement(_PanelTextInput.default, {
|
|
209
209
|
testId: "alt-text-input",
|
|
210
|
+
ariaLabel: formatMessage(_messages.messages.placeholder),
|
|
211
|
+
describedById: "support-text",
|
|
210
212
|
placeholder: formatMessage(_messages.messages.placeholder),
|
|
211
213
|
defaultValue: this.state.lastValue,
|
|
212
214
|
onCancel: this.dispatchCancelEvent,
|
|
@@ -223,7 +225,9 @@ var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
223
225
|
})),
|
|
224
226
|
tooltipContent: formatMessage(_messages.messages.clear),
|
|
225
227
|
onClick: this.handleClearText
|
|
226
|
-
}))), !!errorsList.length && /*#__PURE__*/_react.default.createElement(ValidationWrapper, null, errorsList), /*#__PURE__*/_react.default.createElement(SupportText,
|
|
228
|
+
}))), !!errorsList.length && /*#__PURE__*/_react.default.createElement(ValidationWrapper, null, errorsList), /*#__PURE__*/_react.default.createElement(SupportText, {
|
|
229
|
+
id: "support-text"
|
|
230
|
+
}, formatMessage(_messages.messages.supportText)));
|
|
227
231
|
}
|
|
228
232
|
}, {
|
|
229
233
|
key: "fireAnalytics",
|
|
@@ -61,10 +61,22 @@ var _isImage = require("../utils/is-image");
|
|
|
61
61
|
|
|
62
62
|
var _document = require("../../../utils/document");
|
|
63
63
|
|
|
64
|
+
var _mediaCommon2 = require("@atlaskit/media-common");
|
|
65
|
+
|
|
66
|
+
var _utils = require("../../../utils");
|
|
67
|
+
|
|
68
|
+
var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
|
|
69
|
+
|
|
64
70
|
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); }
|
|
65
71
|
|
|
66
72
|
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; }
|
|
67
73
|
|
|
74
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
75
|
+
|
|
76
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
77
|
+
|
|
78
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
79
|
+
|
|
68
80
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
69
81
|
|
|
70
82
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -265,7 +277,7 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
265
277
|
mediaSingle = _this$view$state$sche.mediaSingle,
|
|
266
278
|
media = _this$view$state$sche.media;
|
|
267
279
|
|
|
268
|
-
if ((_this$mediaOptions = _this.mediaOptions)
|
|
280
|
+
if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions = _this.mediaOptions) === null || _this$mediaOptions === void 0 ? void 0 : _this$mediaOptions.featureFlags)) {
|
|
269
281
|
return type === mediaSingle || type === media || type === mediaInline;
|
|
270
282
|
}
|
|
271
283
|
|
|
@@ -302,7 +314,7 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
302
314
|
|
|
303
315
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
304
316
|
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert);
|
|
305
|
-
} else if ((_this$mediaOptions2 = _this.mediaOptions)
|
|
317
|
+
} else if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !(0, _document.isInEmptyLine)(state) && (!(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state) || (0, _utils.isInListItem)(state)) && (0, _mediaFiles.canInsertMediaInline)(state)) {
|
|
306
318
|
(0, _mediaFiles.insertMediaInlineNode)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
307
319
|
} else {
|
|
308
320
|
(0, _mediaFiles.insertMediaGroupNode)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
@@ -587,8 +599,6 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
587
599
|
}, {
|
|
588
600
|
key: "getDomElement",
|
|
589
601
|
value: function getDomElement(domAtPos) {
|
|
590
|
-
var _this$mediaOptions3;
|
|
591
|
-
|
|
592
602
|
var selection = this.view.state.selection;
|
|
593
603
|
|
|
594
604
|
if (!(selection instanceof _prosemirrorState.NodeSelection)) {
|
|
@@ -599,16 +609,14 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
599
609
|
return;
|
|
600
610
|
}
|
|
601
611
|
|
|
602
|
-
var
|
|
603
|
-
var node = (0, _prosemirrorUtils.findDomRefAtPos)(position, domAtPos);
|
|
612
|
+
var node = (0, _prosemirrorUtils.findDomRefAtPos)(selection.from, domAtPos);
|
|
604
613
|
|
|
605
614
|
if (node) {
|
|
606
615
|
if (!node.childNodes.length) {
|
|
607
616
|
return node.parentNode;
|
|
608
617
|
}
|
|
609
618
|
|
|
610
|
-
|
|
611
|
-
return target;
|
|
619
|
+
return node;
|
|
612
620
|
}
|
|
613
621
|
|
|
614
622
|
return;
|
|
@@ -806,13 +814,31 @@ var createPlugin = function createPlugin(_schema, options, reactContext, dispatc
|
|
|
806
814
|
return pluginState;
|
|
807
815
|
}
|
|
808
816
|
},
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
817
|
+
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
818
|
+
var _iterator = _createForOfIteratorHelper(transactions),
|
|
819
|
+
_step;
|
|
820
|
+
|
|
821
|
+
try {
|
|
822
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
823
|
+
var transaction = _step.value;
|
|
824
|
+
var isSelectionOnMediaInsideMediaSingle = transaction.selectionSet && (0, _prosemirrorUtils.isNodeSelection)(transaction.selection) && transaction.selection.node.type === newState.schema.nodes.media && transaction.selection.$anchor.parent.type === newState.schema.nodes.mediaSingle; // Note: this causes an additional transaction when selecting a media node
|
|
825
|
+
// through clicking on it with the cursor.
|
|
826
|
+
|
|
827
|
+
if (isSelectionOnMediaInsideMediaSingle) {
|
|
828
|
+
// If a selection has been placed on a media inside a media single,
|
|
829
|
+
// we shift it to the media single parent as other code is opinionated about
|
|
830
|
+
// the selection landing there. In particular the caption insertion and selection
|
|
831
|
+
// action.
|
|
832
|
+
return newState.tr.setSelection(_prosemirrorState.NodeSelection.create(newState.doc, transaction.selection.$from.pos - 1));
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
} catch (err) {
|
|
836
|
+
_iterator.e(err);
|
|
837
|
+
} finally {
|
|
838
|
+
_iterator.f();
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return;
|
|
816
842
|
},
|
|
817
843
|
key: _pluginKey.stateKey,
|
|
818
844
|
view: function view(_view) {
|
|
@@ -869,6 +895,14 @@ var createPlugin = function createPlugin(_schema, options, reactContext, dispatc
|
|
|
869
895
|
handleTextInput: function handleTextInput(view) {
|
|
870
896
|
getMediaPluginState(view.state).splitMediaGroup();
|
|
871
897
|
return false;
|
|
898
|
+
},
|
|
899
|
+
handleClick: function handleClick(_editorView, _pos, event) {
|
|
900
|
+
var _parentElement;
|
|
901
|
+
|
|
902
|
+
// Workaround for Chrome given a regression introduced in prosemirror-view@1.18.6
|
|
903
|
+
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
904
|
+
// @see https://github.com/ProseMirror/prosemirror-view/compare/1.18.5...1.18.6
|
|
905
|
+
return Boolean((_editorCommon.browser.chrome || _editorCommon.browser.safari) && event.target && _CaptionPlaceholder.CAPTION_PLACEHOLDER_ID === ((_parentElement = event.target.parentElement) === null || _parentElement === void 0 ? void 0 : _parentElement.dataset.id));
|
|
872
906
|
}
|
|
873
907
|
}
|
|
874
908
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeInlineCard = exports.changeInlineToMediaCard = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
11
|
+
|
|
12
|
+
var changeInlineToMediaCard = function changeInlineToMediaCard(state, dispatch) {
|
|
13
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
14
|
+
media = _state$schema$nodes.media,
|
|
15
|
+
mediaInline = _state$schema$nodes.mediaInline,
|
|
16
|
+
mediaGroup = _state$schema$nodes.mediaGroup;
|
|
17
|
+
var selectedNode = state.selection instanceof _prosemirrorState.NodeSelection && state.selection.node.type === mediaInline && state.selection.node;
|
|
18
|
+
|
|
19
|
+
if (!selectedNode) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var _selectedNode$attrs = selectedNode.attrs,
|
|
24
|
+
id = _selectedNode$attrs.id,
|
|
25
|
+
type = _selectedNode$attrs.type,
|
|
26
|
+
collection = _selectedNode$attrs.collection;
|
|
27
|
+
var mediaNode = media.createChecked({
|
|
28
|
+
id: id,
|
|
29
|
+
type: type,
|
|
30
|
+
collection: collection
|
|
31
|
+
});
|
|
32
|
+
var group = mediaGroup.createChecked({}, mediaNode);
|
|
33
|
+
var nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
34
|
+
var tr = state.tr;
|
|
35
|
+
tr = (0, _prosemirrorUtils.removeSelectedNode)(tr);
|
|
36
|
+
tr = (0, _prosemirrorUtils.safeInsert)(group, nodePos, true)(tr);
|
|
37
|
+
|
|
38
|
+
if (dispatch) {
|
|
39
|
+
dispatch(tr);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.changeInlineToMediaCard = changeInlineToMediaCard;
|
|
46
|
+
|
|
47
|
+
var removeInlineCard = function removeInlineCard(state, dispatch) {
|
|
48
|
+
if ((0, _prosemirrorUtils.isNodeSelection)(state.selection)) {
|
|
49
|
+
if (dispatch) {
|
|
50
|
+
dispatch((0, _prosemirrorUtils.removeSelectedNode)(state.tr));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.removeInlineCard = removeInlineCard;
|
|
@@ -17,6 +17,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
17
17
|
|
|
18
18
|
var _mediaViewer = require("@atlaskit/media-viewer");
|
|
19
19
|
|
|
20
|
+
var _mediaUi = require("@atlaskit/media-ui");
|
|
21
|
+
|
|
20
22
|
var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
|
|
21
23
|
|
|
22
24
|
var _Button = _interopRequireDefault(require("../../floating-toolbar/ui/Button"));
|
|
@@ -28,7 +30,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
28
30
|
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; }
|
|
29
31
|
|
|
30
32
|
var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
31
|
-
var mediaPluginState = _ref.mediaPluginState
|
|
33
|
+
var mediaPluginState = _ref.mediaPluginState,
|
|
34
|
+
intl = _ref.intl;
|
|
32
35
|
|
|
33
36
|
var _useState = (0, _react.useState)(false),
|
|
34
37
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -73,13 +76,15 @@ var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
var mediaViewer = renderMediaViewer();
|
|
79
|
+
var tooltipContent = intl.formatMessage(_mediaUi.messages.preview);
|
|
76
80
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
77
81
|
testId: "file-preview-toolbar-button",
|
|
78
82
|
key: "editor.media.card.preview",
|
|
79
83
|
onClick: openMediaViewer,
|
|
80
84
|
icon: /*#__PURE__*/_react.default.createElement(_filePreview.default, {
|
|
81
85
|
label: "file preview"
|
|
82
|
-
})
|
|
86
|
+
}),
|
|
87
|
+
tooltipContent: tooltipContent
|
|
83
88
|
}), mediaViewer);
|
|
84
89
|
};
|
|
85
90
|
|
|
@@ -57,6 +57,10 @@ var _utils = require("./utils");
|
|
|
57
57
|
|
|
58
58
|
var _prosemirrorModel = require("prosemirror-model");
|
|
59
59
|
|
|
60
|
+
var _commands = require("./commands");
|
|
61
|
+
|
|
62
|
+
var _styles = require("../nodeviews/styles");
|
|
63
|
+
|
|
60
64
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
61
65
|
|
|
62
66
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -113,6 +117,7 @@ var changeMediaCardToInline = function changeMediaCardToInline(state, dispatch)
|
|
|
113
117
|
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState) {
|
|
114
118
|
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
115
119
|
var items = [{
|
|
120
|
+
id: 'editor.media.view.switcher',
|
|
116
121
|
type: 'dropdown',
|
|
117
122
|
title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
|
|
118
123
|
options: [{
|
|
@@ -136,7 +141,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
136
141
|
render: function render() {
|
|
137
142
|
return /*#__PURE__*/_react.default.createElement(_filePreviewItem.FilePreviewItem, {
|
|
138
143
|
key: "editor.media.card.preview",
|
|
139
|
-
mediaPluginState: mediaPluginState
|
|
144
|
+
mediaPluginState: mediaPluginState,
|
|
145
|
+
intl: intl
|
|
140
146
|
});
|
|
141
147
|
}
|
|
142
148
|
}, {
|
|
@@ -168,6 +174,66 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
168
174
|
return items;
|
|
169
175
|
};
|
|
170
176
|
|
|
177
|
+
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState) {
|
|
178
|
+
var mediaInline = state.schema.nodes.mediaInline;
|
|
179
|
+
var items = [{
|
|
180
|
+
id: 'editor.media.view.switcher',
|
|
181
|
+
type: 'dropdown',
|
|
182
|
+
title: intl.formatMessage(_messages2.messages.inline),
|
|
183
|
+
options: [{
|
|
184
|
+
title: intl.formatMessage(_messages2.messages.inline),
|
|
185
|
+
selected: true,
|
|
186
|
+
onClick: function onClick() {
|
|
187
|
+
return true;
|
|
188
|
+
},
|
|
189
|
+
testId: 'inline-appearance'
|
|
190
|
+
}, {
|
|
191
|
+
title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
|
|
192
|
+
selected: false,
|
|
193
|
+
onClick: _commands.changeInlineToMediaCard,
|
|
194
|
+
testId: 'thumbnail-appearance'
|
|
195
|
+
}]
|
|
196
|
+
}, {
|
|
197
|
+
type: 'separator'
|
|
198
|
+
}, {
|
|
199
|
+
type: 'custom',
|
|
200
|
+
fallback: [],
|
|
201
|
+
render: function render() {
|
|
202
|
+
return /*#__PURE__*/_react.default.createElement(_filePreviewItem.FilePreviewItem, {
|
|
203
|
+
key: "editor.media.card.preview",
|
|
204
|
+
mediaPluginState: mediaPluginState,
|
|
205
|
+
intl: intl
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
type: 'separator'
|
|
210
|
+
}, {
|
|
211
|
+
id: 'editor.media.card.download',
|
|
212
|
+
type: 'button',
|
|
213
|
+
icon: _download.default,
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
(0, _utils.downloadMedia)(mediaPluginState);
|
|
216
|
+
return true;
|
|
217
|
+
},
|
|
218
|
+
title: intl.formatMessage(_mediaUi.messages.download)
|
|
219
|
+
}, {
|
|
220
|
+
type: 'separator'
|
|
221
|
+
}, {
|
|
222
|
+
id: 'editor.media.delete',
|
|
223
|
+
type: 'button',
|
|
224
|
+
appearance: 'danger',
|
|
225
|
+
icon: _remove.default,
|
|
226
|
+
onMouseEnter: (0, _decoration.hoverDecoration)(mediaInline, true),
|
|
227
|
+
onMouseLeave: (0, _decoration.hoverDecoration)(mediaInline, false),
|
|
228
|
+
onFocus: (0, _decoration.hoverDecoration)(mediaInline, true),
|
|
229
|
+
onBlur: (0, _decoration.hoverDecoration)(mediaInline, false),
|
|
230
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
231
|
+
onClick: _commands.removeInlineCard,
|
|
232
|
+
testId: 'media-toolbar-remove-button'
|
|
233
|
+
}];
|
|
234
|
+
return items;
|
|
235
|
+
};
|
|
236
|
+
|
|
171
237
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState) {
|
|
172
238
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
173
239
|
var allowResizing = options.allowResizing,
|
|
@@ -314,9 +380,14 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
314
380
|
}
|
|
315
381
|
|
|
316
382
|
var items = [];
|
|
317
|
-
var
|
|
383
|
+
var parentMediaGroupNode = (0, _prosemirrorUtils.findParentNodeOfType)(mediaGroup)(state.selection);
|
|
384
|
+
var selectedNodeType;
|
|
385
|
+
|
|
386
|
+
if (state.selection instanceof _prosemirrorState.NodeSelection) {
|
|
387
|
+
selectedNodeType = state.selection.node.type;
|
|
388
|
+
}
|
|
318
389
|
|
|
319
|
-
if (allowMediaInline &&
|
|
390
|
+
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
320
391
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
321
392
|
|
|
322
393
|
baseToolbar.getDomRef = function () {
|
|
@@ -327,7 +398,23 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
327
398
|
};
|
|
328
399
|
|
|
329
400
|
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
|
|
401
|
+
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
402
|
+
baseToolbar.getDomRef = function () {
|
|
403
|
+
var _mediaPluginState$ele2;
|
|
404
|
+
|
|
405
|
+
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
406
|
+
return element || mediaPluginState.element;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
|
|
330
410
|
} else {
|
|
411
|
+
baseToolbar.getDomRef = function () {
|
|
412
|
+
var _mediaPluginState$ele3;
|
|
413
|
+
|
|
414
|
+
var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(_styles.MediaSingleNodeSelector));
|
|
415
|
+
return element || mediaPluginState.element;
|
|
416
|
+
};
|
|
417
|
+
|
|
331
418
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState);
|
|
332
419
|
}
|
|
333
420
|
|
|
@@ -450,7 +450,15 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
450
450
|
return columResizingPluginState ? !columResizingPluginState.dragging : true;
|
|
451
451
|
},
|
|
452
452
|
nodeType: "media",
|
|
453
|
-
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent
|
|
453
|
+
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent // when cursor is located below a media with caption,
|
|
454
|
+
// press “Up“ key will result cursor focus on an invalid position, (on the resize handler)
|
|
455
|
+
// This workaround adds an empty div inside the resize handler to prevent the issue.
|
|
456
|
+
,
|
|
457
|
+
handleComponentFunc: function handleComponentFunc() {
|
|
458
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
459
|
+
contentEditable: false
|
|
460
|
+
});
|
|
461
|
+
}
|
|
454
462
|
}), children));
|
|
455
463
|
}
|
|
456
464
|
}]);
|
|
@@ -334,7 +334,7 @@ var unwrapNestedMediaElements = function unwrapNestedMediaElements(html) {
|
|
|
334
334
|
// ProseMirror should handle this case properly.
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
if (mediaParent instanceof HTMLDivElement) {
|
|
337
|
+
if (mediaParent instanceof HTMLDivElement || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
338
338
|
return;
|
|
339
339
|
} // Find the top most element that the parent has a valid container for the image.
|
|
340
340
|
// Stop just before found the wrapper
|
|
@@ -111,7 +111,11 @@ var insertMediaInlineNode = function insertMediaInlineNode(view, mediaState, col
|
|
|
111
111
|
collection: collection
|
|
112
112
|
});
|
|
113
113
|
var space = state.schema.text(' ');
|
|
114
|
-
var pos = state.selection.$to.pos;
|
|
114
|
+
var pos = state.selection.$to.pos; // If the selection is inside an empty list item set pos inside paragraph
|
|
115
|
+
|
|
116
|
+
if ((0, _utils.isInListItem)(state) && (0, _mediaCommon.isInsidePotentialEmptyParagraph)(state)) {
|
|
117
|
+
pos = pos + 1;
|
|
118
|
+
}
|
|
115
119
|
|
|
116
120
|
var content = _prosemirrorModel.Fragment.from([mediaInlineNode, space]); // Delete the selection if a selection is made
|
|
117
121
|
|
|
@@ -59,7 +59,7 @@ exports.removePanel = removePanel;
|
|
|
59
59
|
|
|
60
60
|
var changePanelType = function changePanelType(panelType) {
|
|
61
61
|
var panelOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
62
|
-
var
|
|
62
|
+
var allowCustomPanel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
63
63
|
return function (state, dispatch) {
|
|
64
64
|
var nodes = state.schema.nodes,
|
|
65
65
|
tr = state.tr;
|
|
@@ -73,7 +73,7 @@ var changePanelType = function changePanelType(panelType) {
|
|
|
73
73
|
var previousType = panelNode.node.attrs.panelType;
|
|
74
74
|
var newTr;
|
|
75
75
|
|
|
76
|
-
if (
|
|
76
|
+
if (allowCustomPanel) {
|
|
77
77
|
var previousColor = panelNode.node.attrs.panelColor || (0, _editorCommon.getPanelTypeBackground)(previousType);
|
|
78
78
|
var previousIcon = panelNode.node.attrs.panelIcon;
|
|
79
79
|
|
|
@@ -55,7 +55,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
55
55
|
return {
|
|
56
56
|
name: 'panel',
|
|
57
57
|
nodes: function nodes() {
|
|
58
|
-
var panelNode = (0, _adfSchema.
|
|
58
|
+
var panelNode = (0, _adfSchema.panel)(!!options.allowCustomPanel);
|
|
59
59
|
return [{
|
|
60
60
|
name: 'panel',
|
|
61
61
|
node: panelNode
|
|
@@ -148,7 +148,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
148
148
|
}
|
|
149
149
|
}];
|
|
150
150
|
|
|
151
|
-
if (options.
|
|
151
|
+
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
152
152
|
quickInsertOptions.push({
|
|
153
153
|
id: 'custompanel',
|
|
154
154
|
title: formatMessage(_messages.messages.customPanel),
|
|
@@ -161,7 +161,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
161
161
|
return insertPanelTypeWithAnalytics({
|
|
162
162
|
panelType: _adfSchema.PanelType.CUSTOM,
|
|
163
163
|
panelIcon: ':rainbow:',
|
|
164
|
-
panelColor: _colors.
|
|
164
|
+
panelColor: _colors.T50
|
|
165
165
|
}, state, insert);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
@@ -81,7 +81,7 @@ var PanelNodeView = /*#__PURE__*/function () {
|
|
|
81
81
|
this.view = view;
|
|
82
82
|
this.node = node;
|
|
83
83
|
|
|
84
|
-
var _DOMSerializer$render = _prosemirrorModel.DOMSerializer.renderSpec(document, (0, _utils.panelAttrsToDom)(node.attrs, pluginOptions.
|
|
84
|
+
var _DOMSerializer$render = _prosemirrorModel.DOMSerializer.renderSpec(document, (0, _utils.panelAttrsToDom)(node.attrs, pluginOptions.allowCustomPanel || false)),
|
|
85
85
|
dom = _DOMSerializer$render.dom,
|
|
86
86
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
87
87
|
|
|
@@ -98,7 +98,7 @@ var PanelNodeView = /*#__PURE__*/function () {
|
|
|
98
98
|
this.icon.contentEditable = 'false';
|
|
99
99
|
|
|
100
100
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(PanelIcon, {
|
|
101
|
-
allowCustomPanel: pluginOptions.
|
|
101
|
+
allowCustomPanel: pluginOptions.allowCustomPanel,
|
|
102
102
|
panelAttributes: node.attrs,
|
|
103
103
|
providerFactory: this.providerFactory
|
|
104
104
|
}), this.icon);
|