@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
|
@@ -4,7 +4,7 @@ import ReactDOM from 'react-dom';
|
|
|
4
4
|
import { NodeSelection, Plugin } from 'prosemirror-state';
|
|
5
5
|
import { insertPoint } from 'prosemirror-transform';
|
|
6
6
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
7
|
-
import { ErrorReporter } from '@atlaskit/editor-common';
|
|
7
|
+
import { ErrorReporter, browser } from '@atlaskit/editor-common';
|
|
8
8
|
import assert from 'assert';
|
|
9
9
|
import { findDomRefAtPos, isNodeSelection } from 'prosemirror-utils';
|
|
10
10
|
import { insertMediaSingleNode, isMediaSingle } from '../utils/media-single';
|
|
@@ -18,6 +18,9 @@ import PickerFacade from '../picker-facade';
|
|
|
18
18
|
import { INPUT_METHOD } from '../../analytics/types';
|
|
19
19
|
import { isImage } from '../utils/is-image';
|
|
20
20
|
import { isInEmptyLine } from '../../../utils/document';
|
|
21
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
22
|
+
import { isInListItem } from '../../../utils';
|
|
23
|
+
import { CAPTION_PLACEHOLDER_ID } from '../ui/CaptionPlaceholder';
|
|
21
24
|
export { stateKey } from './plugin-key';
|
|
22
25
|
|
|
23
26
|
const createDropPlaceholder = allowDropLine => {
|
|
@@ -157,7 +160,7 @@ export class MediaPluginStateImplementation {
|
|
|
157
160
|
media
|
|
158
161
|
} = this.view.state.schema.nodes;
|
|
159
162
|
|
|
160
|
-
if ((_this$mediaOptions = this.mediaOptions)
|
|
163
|
+
if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions = this.mediaOptions) === null || _this$mediaOptions === void 0 ? void 0 : _this$mediaOptions.featureFlags)) {
|
|
161
164
|
return type === mediaSingle || type === media || type === mediaInline;
|
|
162
165
|
}
|
|
163
166
|
|
|
@@ -194,7 +197,7 @@ export class MediaPluginStateImplementation {
|
|
|
194
197
|
|
|
195
198
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
196
199
|
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert);
|
|
197
|
-
} else if ((_this$mediaOptions2 = this.mediaOptions)
|
|
200
|
+
} else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
|
|
198
201
|
insertMediaInlineNode(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
199
202
|
} else {
|
|
200
203
|
insertMediaGroupNode(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
@@ -491,8 +494,6 @@ export class MediaPluginStateImplementation {
|
|
|
491
494
|
}
|
|
492
495
|
|
|
493
496
|
getDomElement(domAtPos) {
|
|
494
|
-
var _this$mediaOptions3;
|
|
495
|
-
|
|
496
497
|
const {
|
|
497
498
|
selection
|
|
498
499
|
} = this.view.state;
|
|
@@ -505,16 +506,14 @@ export class MediaPluginStateImplementation {
|
|
|
505
506
|
return;
|
|
506
507
|
}
|
|
507
508
|
|
|
508
|
-
const
|
|
509
|
-
const node = findDomRefAtPos(position, domAtPos);
|
|
509
|
+
const node = findDomRefAtPos(selection.from, domAtPos);
|
|
510
510
|
|
|
511
511
|
if (node) {
|
|
512
512
|
if (!node.childNodes.length) {
|
|
513
513
|
return node.parentNode;
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
|
|
517
|
-
return target;
|
|
516
|
+
return node;
|
|
518
517
|
}
|
|
519
518
|
|
|
520
519
|
return;
|
|
@@ -648,13 +647,21 @@ export const createPlugin = (_schema, options, reactContext, dispatch, mediaOpti
|
|
|
648
647
|
|
|
649
648
|
},
|
|
650
649
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
650
|
+
appendTransaction(transactions, _oldState, newState) {
|
|
651
|
+
for (const transaction of transactions) {
|
|
652
|
+
const isSelectionOnMediaInsideMediaSingle = transaction.selectionSet && 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
|
|
653
|
+
// through clicking on it with the cursor.
|
|
654
|
+
|
|
655
|
+
if (isSelectionOnMediaInsideMediaSingle) {
|
|
656
|
+
// If a selection has been placed on a media inside a media single,
|
|
657
|
+
// we shift it to the media single parent as other code is opinionated about
|
|
658
|
+
// the selection landing there. In particular the caption insertion and selection
|
|
659
|
+
// action.
|
|
660
|
+
return newState.tr.setSelection(NodeSelection.create(newState.doc, transaction.selection.$from.pos - 1));
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return;
|
|
658
665
|
},
|
|
659
666
|
|
|
660
667
|
key: stateKey,
|
|
@@ -716,8 +723,16 @@ export const createPlugin = (_schema, options, reactContext, dispatch, mediaOpti
|
|
|
716
723
|
handleTextInput(view) {
|
|
717
724
|
getMediaPluginState(view.state).splitMediaGroup();
|
|
718
725
|
return false;
|
|
719
|
-
}
|
|
726
|
+
},
|
|
720
727
|
|
|
728
|
+
handleClick: (_editorView, _pos, event) => {
|
|
729
|
+
var _parentElement;
|
|
730
|
+
|
|
731
|
+
// Workaround for Chrome given a regression introduced in prosemirror-view@1.18.6
|
|
732
|
+
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
733
|
+
// @see https://github.com/ProseMirror/prosemirror-view/compare/1.18.5...1.18.6
|
|
734
|
+
return Boolean((browser.chrome || browser.safari) && event.target && CAPTION_PLACEHOLDER_ID === ((_parentElement = event.target.parentElement) === null || _parentElement === void 0 ? void 0 : _parentElement.dataset.id));
|
|
735
|
+
}
|
|
721
736
|
}
|
|
722
737
|
});
|
|
723
738
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
2
|
+
import { isNodeSelection, removeSelectedNode, safeInsert } from 'prosemirror-utils';
|
|
3
|
+
export const changeInlineToMediaCard = (state, dispatch) => {
|
|
4
|
+
const {
|
|
5
|
+
media,
|
|
6
|
+
mediaInline,
|
|
7
|
+
mediaGroup
|
|
8
|
+
} = state.schema.nodes;
|
|
9
|
+
const selectedNode = state.selection instanceof NodeSelection && state.selection.node.type === mediaInline && state.selection.node;
|
|
10
|
+
|
|
11
|
+
if (!selectedNode) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
id,
|
|
17
|
+
type,
|
|
18
|
+
collection
|
|
19
|
+
} = selectedNode.attrs;
|
|
20
|
+
const mediaNode = media.createChecked({
|
|
21
|
+
id,
|
|
22
|
+
type,
|
|
23
|
+
collection
|
|
24
|
+
});
|
|
25
|
+
const group = mediaGroup.createChecked({}, mediaNode);
|
|
26
|
+
const nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
27
|
+
let tr = state.tr;
|
|
28
|
+
tr = removeSelectedNode(tr);
|
|
29
|
+
tr = safeInsert(group, nodePos, true)(tr);
|
|
30
|
+
|
|
31
|
+
if (dispatch) {
|
|
32
|
+
dispatch(tr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
export const removeInlineCard = (state, dispatch) => {
|
|
38
|
+
if (isNodeSelection(state.selection)) {
|
|
39
|
+
if (dispatch) {
|
|
40
|
+
dispatch(removeSelectedNode(state.tr));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
4
|
+
import { messages } from '@atlaskit/media-ui';
|
|
4
5
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
5
6
|
import ToolbarButton from '../../floating-toolbar/ui/Button';
|
|
6
7
|
import { getSelectedMediaContainerNodeAttrs } from './utils';
|
|
7
8
|
export const FilePreviewItem = ({
|
|
8
|
-
mediaPluginState
|
|
9
|
+
mediaPluginState,
|
|
10
|
+
intl
|
|
9
11
|
}) => {
|
|
10
12
|
const [isMediaViewerVisible, setMediaViewerVisible] = useState(false);
|
|
11
13
|
|
|
@@ -48,12 +50,14 @@ export const FilePreviewItem = ({
|
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
const mediaViewer = renderMediaViewer();
|
|
53
|
+
const tooltipContent = intl.formatMessage(messages.preview);
|
|
51
54
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
52
55
|
testId: "file-preview-toolbar-button",
|
|
53
56
|
key: "editor.media.card.preview",
|
|
54
57
|
onClick: openMediaViewer,
|
|
55
58
|
icon: /*#__PURE__*/React.createElement(FilePreviewIcon, {
|
|
56
59
|
label: "file preview"
|
|
57
|
-
})
|
|
60
|
+
}),
|
|
61
|
+
tooltipContent: tooltipContent
|
|
58
62
|
}), mediaViewer);
|
|
59
63
|
};
|
|
@@ -21,6 +21,8 @@ import { messages as cardMessages } from '../../card/messages';
|
|
|
21
21
|
import { FilePreviewItem } from './filePreviewItem';
|
|
22
22
|
import { downloadMedia, removeMediaGroupNode } from './utils';
|
|
23
23
|
import { Fragment } from 'prosemirror-model';
|
|
24
|
+
import { changeInlineToMediaCard, removeInlineCard } from './commands';
|
|
25
|
+
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
24
26
|
|
|
25
27
|
const remove = (state, dispatch) => {
|
|
26
28
|
if (dispatch) {
|
|
@@ -75,6 +77,7 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
75
77
|
mediaGroup
|
|
76
78
|
} = state.schema.nodes;
|
|
77
79
|
const items = [{
|
|
80
|
+
id: 'editor.media.view.switcher',
|
|
78
81
|
type: 'dropdown',
|
|
79
82
|
title: intl.formatMessage(messages.displayThumbnail),
|
|
80
83
|
options: [{
|
|
@@ -98,7 +101,8 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
98
101
|
render: () => {
|
|
99
102
|
return /*#__PURE__*/React.createElement(FilePreviewItem, {
|
|
100
103
|
key: "editor.media.card.preview",
|
|
101
|
-
mediaPluginState: mediaPluginState
|
|
104
|
+
mediaPluginState: mediaPluginState,
|
|
105
|
+
intl: intl
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
}, {
|
|
@@ -130,6 +134,68 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
130
134
|
return items;
|
|
131
135
|
};
|
|
132
136
|
|
|
137
|
+
const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
138
|
+
const {
|
|
139
|
+
mediaInline
|
|
140
|
+
} = state.schema.nodes;
|
|
141
|
+
const items = [{
|
|
142
|
+
id: 'editor.media.view.switcher',
|
|
143
|
+
type: 'dropdown',
|
|
144
|
+
title: intl.formatMessage(cardMessages.inline),
|
|
145
|
+
options: [{
|
|
146
|
+
title: intl.formatMessage(cardMessages.inline),
|
|
147
|
+
selected: true,
|
|
148
|
+
onClick: () => {
|
|
149
|
+
return true;
|
|
150
|
+
},
|
|
151
|
+
testId: 'inline-appearance'
|
|
152
|
+
}, {
|
|
153
|
+
title: intl.formatMessage(messages.displayThumbnail),
|
|
154
|
+
selected: false,
|
|
155
|
+
onClick: changeInlineToMediaCard,
|
|
156
|
+
testId: 'thumbnail-appearance'
|
|
157
|
+
}]
|
|
158
|
+
}, {
|
|
159
|
+
type: 'separator'
|
|
160
|
+
}, {
|
|
161
|
+
type: 'custom',
|
|
162
|
+
fallback: [],
|
|
163
|
+
render: () => {
|
|
164
|
+
return /*#__PURE__*/React.createElement(FilePreviewItem, {
|
|
165
|
+
key: "editor.media.card.preview",
|
|
166
|
+
mediaPluginState: mediaPluginState,
|
|
167
|
+
intl: intl
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
type: 'separator'
|
|
172
|
+
}, {
|
|
173
|
+
id: 'editor.media.card.download',
|
|
174
|
+
type: 'button',
|
|
175
|
+
icon: DownloadIcon,
|
|
176
|
+
onClick: () => {
|
|
177
|
+
downloadMedia(mediaPluginState);
|
|
178
|
+
return true;
|
|
179
|
+
},
|
|
180
|
+
title: intl.formatMessage(messages.download)
|
|
181
|
+
}, {
|
|
182
|
+
type: 'separator'
|
|
183
|
+
}, {
|
|
184
|
+
id: 'editor.media.delete',
|
|
185
|
+
type: 'button',
|
|
186
|
+
appearance: 'danger',
|
|
187
|
+
icon: RemoveIcon,
|
|
188
|
+
onMouseEnter: hoverDecoration(mediaInline, true),
|
|
189
|
+
onMouseLeave: hoverDecoration(mediaInline, false),
|
|
190
|
+
onFocus: hoverDecoration(mediaInline, true),
|
|
191
|
+
onBlur: hoverDecoration(mediaInline, false),
|
|
192
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
193
|
+
onClick: removeInlineCard,
|
|
194
|
+
testId: 'media-toolbar-remove-button'
|
|
195
|
+
}];
|
|
196
|
+
return items;
|
|
197
|
+
};
|
|
198
|
+
|
|
133
199
|
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState) => {
|
|
134
200
|
const {
|
|
135
201
|
mediaSingle
|
|
@@ -282,9 +348,14 @@ export const floatingToolbar = (state, intl, options = {}) => {
|
|
|
282
348
|
}
|
|
283
349
|
|
|
284
350
|
let items = [];
|
|
285
|
-
const
|
|
351
|
+
const parentMediaGroupNode = findParentNodeOfType(mediaGroup)(state.selection);
|
|
352
|
+
let selectedNodeType;
|
|
353
|
+
|
|
354
|
+
if (state.selection instanceof NodeSelection) {
|
|
355
|
+
selectedNodeType = state.selection.node.type;
|
|
356
|
+
}
|
|
286
357
|
|
|
287
|
-
if (allowMediaInline &&
|
|
358
|
+
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
288
359
|
const mediaOffset = state.selection.$from.parentOffset + 1;
|
|
289
360
|
|
|
290
361
|
baseToolbar.getDomRef = () => {
|
|
@@ -295,7 +366,23 @@ export const floatingToolbar = (state, intl, options = {}) => {
|
|
|
295
366
|
};
|
|
296
367
|
|
|
297
368
|
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
|
|
369
|
+
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
370
|
+
baseToolbar.getDomRef = () => {
|
|
371
|
+
var _mediaPluginState$ele2;
|
|
372
|
+
|
|
373
|
+
const element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(`.${MediaInlineNodeSelector}`);
|
|
374
|
+
return element || mediaPluginState.element;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
|
|
298
378
|
} else {
|
|
379
|
+
baseToolbar.getDomRef = () => {
|
|
380
|
+
var _mediaPluginState$ele3;
|
|
381
|
+
|
|
382
|
+
const element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(`.${MediaSingleNodeSelector}`);
|
|
383
|
+
return element || mediaPluginState.element;
|
|
384
|
+
};
|
|
385
|
+
|
|
299
386
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState);
|
|
300
387
|
}
|
|
301
388
|
|
|
@@ -343,7 +343,13 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
343
343
|
return columResizingPluginState ? !columResizingPluginState.dragging : true;
|
|
344
344
|
},
|
|
345
345
|
nodeType: "media",
|
|
346
|
-
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent
|
|
346
|
+
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent // when cursor is located below a media with caption,
|
|
347
|
+
// press “Up“ key will result cursor focus on an invalid position, (on the resize handler)
|
|
348
|
+
// This workaround adds an empty div inside the resize handler to prevent the issue.
|
|
349
|
+
,
|
|
350
|
+
handleComponentFunc: () => /*#__PURE__*/React.createElement("div", {
|
|
351
|
+
contentEditable: false
|
|
352
|
+
})
|
|
347
353
|
}), children));
|
|
348
354
|
}
|
|
349
355
|
|
|
@@ -296,7 +296,7 @@ export const unwrapNestedMediaElements = html => {
|
|
|
296
296
|
// ProseMirror should handle this case properly.
|
|
297
297
|
|
|
298
298
|
|
|
299
|
-
if (mediaParent instanceof HTMLDivElement) {
|
|
299
|
+
if (mediaParent instanceof HTMLDivElement || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
300
300
|
return;
|
|
301
301
|
} // Find the top most element that the parent has a valid container for the image.
|
|
302
302
|
// Stop just before found the wrapper
|
|
@@ -111,7 +111,12 @@ export const insertMediaInlineNode = (view, mediaState, collection, inputMethod)
|
|
|
111
111
|
collection
|
|
112
112
|
});
|
|
113
113
|
const space = state.schema.text(' ');
|
|
114
|
-
|
|
114
|
+
let pos = state.selection.$to.pos; // If the selection is inside an empty list item set pos inside paragraph
|
|
115
|
+
|
|
116
|
+
if (isInListItem(state) && isInsidePotentialEmptyParagraph(state)) {
|
|
117
|
+
pos = pos + 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
115
120
|
let content = Fragment.from([mediaInlineNode, space]); // Delete the selection if a selection is made
|
|
116
121
|
|
|
117
122
|
const deleteRange = findDeleteRange(state);
|
|
@@ -36,7 +36,7 @@ export const removePanel = () => (state, dispatch) => {
|
|
|
36
36
|
|
|
37
37
|
return true;
|
|
38
38
|
};
|
|
39
|
-
export const changePanelType = (panelType, panelOptions = {},
|
|
39
|
+
export const changePanelType = (panelType, panelOptions = {}, allowCustomPanel = false) => (state, dispatch) => {
|
|
40
40
|
const {
|
|
41
41
|
schema: {
|
|
42
42
|
nodes
|
|
@@ -53,7 +53,7 @@ export const changePanelType = (panelType, panelOptions = {}, UNSAFE_allowCustom
|
|
|
53
53
|
let previousType = panelNode.node.attrs.panelType;
|
|
54
54
|
let newTr;
|
|
55
55
|
|
|
56
|
-
if (
|
|
56
|
+
if (allowCustomPanel) {
|
|
57
57
|
let previousColor = panelNode.node.attrs.panelColor || getPanelTypeBackground(previousType);
|
|
58
58
|
let previousIcon = panelNode.node.attrs.panelIcon;
|
|
59
59
|
let newPanelOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { panel, PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { createPlugin } from './pm-plugins/main';
|
|
4
4
|
import { getToolbarConfig } from './toolbar';
|
|
5
5
|
import keymap from './pm-plugins/keymaps';
|
|
@@ -7,7 +7,7 @@ import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD,
|
|
|
7
7
|
import { IconPanel, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanelError } from '../quick-insert/assets';
|
|
8
8
|
import { messages } from '../block-type/messages';
|
|
9
9
|
import IconCustomPanel from '../quick-insert/assets/custom-panel';
|
|
10
|
-
import {
|
|
10
|
+
import { T50 } from '@atlaskit/theme/colors';
|
|
11
11
|
|
|
12
12
|
const insertPanelTypeWithAnalytics = (panelAttributes, state, insert) => {
|
|
13
13
|
const tr = insert(insertPanelType(panelAttributes, state));
|
|
@@ -34,7 +34,7 @@ const panelPlugin = (options = {}) => ({
|
|
|
34
34
|
name: 'panel',
|
|
35
35
|
|
|
36
36
|
nodes() {
|
|
37
|
-
const panelNode =
|
|
37
|
+
const panelNode = panel(!!options.allowCustomPanel);
|
|
38
38
|
return [{
|
|
39
39
|
name: 'panel',
|
|
40
40
|
node: panelNode
|
|
@@ -127,7 +127,7 @@ const panelPlugin = (options = {}) => ({
|
|
|
127
127
|
|
|
128
128
|
}];
|
|
129
129
|
|
|
130
|
-
if (options.
|
|
130
|
+
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
131
131
|
quickInsertOptions.push({
|
|
132
132
|
id: 'custompanel',
|
|
133
133
|
title: formatMessage(messages.customPanel),
|
|
@@ -139,7 +139,7 @@ const panelPlugin = (options = {}) => ({
|
|
|
139
139
|
return insertPanelTypeWithAnalytics({
|
|
140
140
|
panelType: PanelType.CUSTOM,
|
|
141
141
|
panelIcon: ':rainbow:',
|
|
142
|
-
panelColor:
|
|
142
|
+
panelColor: T50
|
|
143
143
|
}, state, insert);
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -56,7 +56,7 @@ class PanelNodeView {
|
|
|
56
56
|
const {
|
|
57
57
|
dom,
|
|
58
58
|
contentDOM
|
|
59
|
-
} = DOMSerializer.renderSpec(document, panelAttrsToDom(node.attrs, pluginOptions.
|
|
59
|
+
} = DOMSerializer.renderSpec(document, panelAttrsToDom(node.attrs, pluginOptions.allowCustomPanel || false));
|
|
60
60
|
this.getPos = getPos;
|
|
61
61
|
this.dom = dom;
|
|
62
62
|
this.contentDOM = contentDOM;
|
|
@@ -69,7 +69,7 @@ class PanelNodeView {
|
|
|
69
69
|
|
|
70
70
|
this.icon.contentEditable = 'false';
|
|
71
71
|
ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
|
|
72
|
-
allowCustomPanel: pluginOptions.
|
|
72
|
+
allowCustomPanel: pluginOptions.allowCustomPanel,
|
|
73
73
|
panelAttributes: node.attrs,
|
|
74
74
|
providerFactory: this.providerFactory
|
|
75
75
|
}), this.icon);
|
|
@@ -4,7 +4,7 @@ import NoteIcon from '@atlaskit/icon/glyph/editor/note';
|
|
|
4
4
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
5
5
|
import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
6
6
|
import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
|
|
7
|
-
import RemoveEmojiIcon from '
|
|
7
|
+
import RemoveEmojiIcon from '@atlaskit/icon/glyph/editor/remove-emoji';
|
|
8
8
|
import commonMessages from '../../messages';
|
|
9
9
|
import { removePanel, changePanelType } from './actions';
|
|
10
10
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
@@ -20,8 +20,8 @@ export const panelIconMap = {
|
|
|
20
20
|
[PanelType.INFO]: ':info:',
|
|
21
21
|
[PanelType.NOTE]: ':note:',
|
|
22
22
|
[PanelType.WARNING]: ':warning:',
|
|
23
|
-
[PanelType.ERROR]: ':
|
|
24
|
-
[PanelType.SUCCESS]: ':
|
|
23
|
+
[PanelType.ERROR]: ':cross_mark:',
|
|
24
|
+
[PanelType.SUCCESS]: ':check_mark:',
|
|
25
25
|
[PanelType.TIP]: ':tip:'
|
|
26
26
|
};
|
|
27
27
|
export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) => {
|
|
@@ -228,9 +228,14 @@ export const getToolbarConfig = (state, intl, options = {}, providerFactory) =>
|
|
|
228
228
|
panelType,
|
|
229
229
|
panelColor,
|
|
230
230
|
panelIcon
|
|
231
|
-
} = panelObject.node.attrs;
|
|
231
|
+
} = panelObject.node.attrs;
|
|
232
232
|
|
|
233
|
-
const
|
|
233
|
+
const isStandardPanel = panelType => {
|
|
234
|
+
return panelType !== PanelType.CUSTOM ? panelType : undefined;
|
|
235
|
+
}; // force toolbar to be turned on
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
const items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined);
|
|
234
239
|
|
|
235
240
|
const getDomRef = editorView => {
|
|
236
241
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -16,11 +16,18 @@ export const panelAttrsToDom = (attrs, allowCustomPanel) => {
|
|
|
16
16
|
const isCustomPanel = panelType === PanelType.CUSTOM && allowCustomPanel;
|
|
17
17
|
const style = panelColor && isCustomPanel ? `background-color: ${panelColor}` : '';
|
|
18
18
|
const hasIcon = !isCustomPanel || !!panelIcon;
|
|
19
|
-
|
|
19
|
+
let panelAttrs = {
|
|
20
20
|
class: PanelSharedCssClassName.prefix,
|
|
21
21
|
'data-panel-type': panelType || PanelType.INFO,
|
|
22
22
|
style
|
|
23
23
|
};
|
|
24
|
+
|
|
25
|
+
if (panelColor && isCustomPanel) {
|
|
26
|
+
panelAttrs = { ...panelAttrs,
|
|
27
|
+
'data-panel-color': panelColor
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
const iconDiv = ['div', {
|
|
25
32
|
class: PanelSharedCssClassName.icon
|
|
26
33
|
}];
|
|
@@ -6,9 +6,10 @@ export default {
|
|
|
6
6
|
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
|
|
7
7
|
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', // selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
8
8
|
// left/right arrows
|
|
9
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'inlineCode'],
|
|
9
|
+
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
10
10
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
11
|
-
marks: [//
|
|
11
|
+
marks: [// Fragment mark is both for inline and block elements
|
|
12
|
+
'fragment', // Inline marks
|
|
12
13
|
'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery', // Block marks
|
|
13
14
|
'alignment', 'breakout', 'indentation', 'annotation', //Unsupported mark
|
|
14
15
|
'unsupportedMark', 'unsupportedNodeAttribute']
|
|
@@ -8,6 +8,25 @@ export const getInitialState = state => ({
|
|
|
8
8
|
decorationSet: getDecorations(state.tr),
|
|
9
9
|
selection: state.selection
|
|
10
10
|
});
|
|
11
|
+
|
|
12
|
+
const toggleContentEditable = (node, root = false) => {
|
|
13
|
+
if (root || node.getAttribute('contenteditable') === 'true') {
|
|
14
|
+
const wasTrue = node.getAttribute('contenteditable') === 'true';
|
|
15
|
+
node.setAttribute('contenteditable', 'false');
|
|
16
|
+
requestAnimationFrame(() => {
|
|
17
|
+
if (wasTrue) {
|
|
18
|
+
node.setAttribute('contenteditable', 'true');
|
|
19
|
+
} else {
|
|
20
|
+
node.removeAttribute('contenteditable');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} // any children with contenteditable = true block selection from proceeding
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const children = Array.from(node.children);
|
|
27
|
+
children.forEach(child => toggleContentEditable(child));
|
|
28
|
+
};
|
|
29
|
+
|
|
11
30
|
export const createPlugin = (dispatch, dispatchAnalyticsEvent, options = {}) => {
|
|
12
31
|
return new Plugin({
|
|
13
32
|
key: selectionPluginKey,
|
|
@@ -95,10 +114,13 @@ export const createPlugin = (dispatch, dispatchAnalyticsEvent, options = {}) =>
|
|
|
95
114
|
return false;
|
|
96
115
|
},
|
|
97
116
|
keydown: (editorView, event) => {
|
|
98
|
-
|
|
117
|
+
const {
|
|
118
|
+
state
|
|
119
|
+
} = editorView; // Firefox bugfix to bypass issue with editing text adjacent to a DOM node with
|
|
99
120
|
// contenteditable="false". (See https://product-fabric.atlassian.net/browse/ED-9452)
|
|
100
121
|
// On keypress, if the head of cursor selection touches a node with contenteditable="false",
|
|
101
122
|
// we temporarily remove the attribute, wait one tick, then restore it with its original value.
|
|
123
|
+
|
|
102
124
|
if (browser.gecko) {
|
|
103
125
|
const node = editorView.nodeDOM(editorView.state.selection.head);
|
|
104
126
|
|
|
@@ -108,6 +130,31 @@ export const createPlugin = (dispatch, dispatchAnalyticsEvent, options = {}) =>
|
|
|
108
130
|
node.setAttribute('contenteditable', 'false');
|
|
109
131
|
});
|
|
110
132
|
}
|
|
133
|
+
} // Bugfix for block ReactNodeViews like table and extension
|
|
134
|
+
// They could not be selected with Shift + ArrowDown/ArrowUp
|
|
135
|
+
// Fixed when contenteditable = false, but then you couldn't edit their contents
|
|
136
|
+
// Therefore, briefly set contenteditable=false to allow the selection through, then set it back to true
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if (event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
140
|
+
let pos;
|
|
141
|
+
|
|
142
|
+
if (event.key === 'ArrowDown') {
|
|
143
|
+
pos = state.selection.$head.after();
|
|
144
|
+
} else {
|
|
145
|
+
pos = state.selection.$head.before() - 1; // block extensions only take up one position, dont need to get before()
|
|
146
|
+
|
|
147
|
+
if (!editorView.nodeDOM(pos)) {
|
|
148
|
+
pos = state.doc.resolve(pos).before();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const node = editorView.nodeDOM(pos);
|
|
153
|
+
|
|
154
|
+
if (node instanceof HTMLDivElement && node.className.includes('View-content-wrap') // class added by ReactNodeView
|
|
155
|
+
) {
|
|
156
|
+
toggleContentEditable(node, true);
|
|
157
|
+
}
|
|
111
158
|
}
|
|
112
159
|
|
|
113
160
|
return false;
|
|
@@ -203,7 +203,8 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
|
|
|
203
203
|
} = this.props;
|
|
204
204
|
const {
|
|
205
205
|
color,
|
|
206
|
-
text
|
|
206
|
+
text,
|
|
207
|
+
localId
|
|
207
208
|
} = this.state;
|
|
208
209
|
return target && /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
209
210
|
target: target,
|
|
@@ -221,7 +222,8 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
|
|
|
221
222
|
onColorClick: this.onColorClick,
|
|
222
223
|
onColorHover: this.onColorHover,
|
|
223
224
|
onTextChanged: this.onTextChanged,
|
|
224
|
-
onEnter: this.onEnter
|
|
225
|
+
onEnter: this.onEnter,
|
|
226
|
+
localId: localId
|
|
225
227
|
})));
|
|
226
228
|
}
|
|
227
229
|
|
|
@@ -22,7 +22,7 @@ function addColumnAtCustomStep(column) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function addColumnAt(column, allowAddColumnCustomStep = false, view) {
|
|
25
|
+
export function addColumnAt(column, allowAddColumnCustomStep = false, view) {
|
|
26
26
|
return tr => {
|
|
27
27
|
let updatedTr = tr;
|
|
28
28
|
|
|
@@ -44,7 +44,6 @@ function addColumnAt(column, allowAddColumnCustomStep = false, view) {
|
|
|
44
44
|
} // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
45
45
|
// Command to add a column before the column with the selection.
|
|
46
46
|
|
|
47
|
-
|
|
48
47
|
export const addColumnBefore = (state, dispatch, view) => {
|
|
49
48
|
const table = findTable(state.selection);
|
|
50
49
|
|
|
@@ -49,6 +49,7 @@ const tablesPlugin = options => ({
|
|
|
49
49
|
return [{
|
|
50
50
|
name: 'table',
|
|
51
51
|
plugin: ({
|
|
52
|
+
dispatchAnalyticsEvent,
|
|
52
53
|
dispatch,
|
|
53
54
|
portalProviderAPI,
|
|
54
55
|
eventDispatcher
|
|
@@ -60,7 +61,7 @@ const tablesPlugin = options => ({
|
|
|
60
61
|
breakoutEnabled,
|
|
61
62
|
tableOptions
|
|
62
63
|
} = options || {};
|
|
63
|
-
return createPlugin(dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), breakoutEnabled && dynamicSizingEnabled, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled);
|
|
64
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), breakoutEnabled && dynamicSizingEnabled, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled);
|
|
64
65
|
}
|
|
65
66
|
}, {
|
|
66
67
|
name: 'tablePMColResizing',
|