@atlaskit/editor-core 171.0.1 → 172.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 +84 -0
- package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
- package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
- package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +13 -4
- package/dist/cjs/create-editor/create-plugins-list.js +21 -12
- package/dist/cjs/editor.js +8 -23
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/nodeviews/context-adapter.js +2 -2
- package/dist/cjs/plugins/analytics/plugin.js +24 -11
- package/dist/cjs/plugins/base/index.js +3 -3
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
- package/dist/cjs/plugins/card/index.js +1 -1
- package/dist/cjs/plugins/card/toolbar.js +11 -5
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/code-block/actions.js +13 -0
- package/dist/cjs/plugins/code-block/index.js +7 -0
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
- package/dist/cjs/plugins/code-block/styles.js +3 -36
- package/dist/cjs/plugins/code-block/toolbar.js +9 -0
- package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
- package/dist/cjs/plugins/copy-button/commands.js +40 -20
- package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
- package/dist/cjs/plugins/copy-button/utils.js +16 -38
- package/dist/cjs/plugins/expand/toolbar.js +8 -2
- package/dist/cjs/plugins/extension/toolbar.js +5 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
- package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
- package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
- package/dist/cjs/plugins/hyperlink/index.js +4 -4
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
- package/dist/cjs/plugins/indentation/commands/index.js +35 -7
- package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
- package/dist/cjs/plugins/layout/toolbar.js +3 -1
- package/dist/cjs/plugins/media/toolbar/index.js +13 -5
- package/dist/cjs/plugins/mentions/analytics.js +5 -5
- package/dist/cjs/plugins/panel/toolbar.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
- package/dist/cjs/plugins/paste/handlers.js +25 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
- package/dist/cjs/plugins/status/analytics.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
- package/dist/cjs/types/browser.js +6 -0
- package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +1 -3
- package/dist/cjs/ui/DropList/index.js +215 -0
- package/dist/cjs/ui/Dropdown/index.js +2 -5
- package/dist/cjs/ui/DropdownMenu/index.js +140 -86
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
- package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
- package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
- package/dist/cjs/ui/Layer/index.js +245 -0
- package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
- package/dist/cjs/ui/PortalProvider/index.js +7 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +15 -4
- package/dist/es2019/create-editor/create-plugins-list.js +21 -11
- package/dist/es2019/editor.js +9 -23
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/nodeviews/context-adapter.js +2 -2
- package/dist/es2019/plugins/analytics/plugin.js +19 -4
- package/dist/es2019/plugins/base/index.js +3 -3
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
- package/dist/es2019/plugins/card/index.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +10 -5
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/code-block/actions.js +12 -0
- package/dist/es2019/plugins/code-block/index.js +4 -0
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
- package/dist/es2019/plugins/code-block/styles.js +2 -159
- package/dist/es2019/plugins/code-block/toolbar.js +8 -0
- package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
- package/dist/es2019/plugins/copy-button/commands.js +35 -15
- package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
- package/dist/es2019/plugins/copy-button/utils.js +15 -27
- package/dist/es2019/plugins/expand/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
- package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
- package/dist/es2019/plugins/hyperlink/index.js +4 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
- package/dist/es2019/plugins/indentation/commands/index.js +24 -9
- package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/es2019/plugins/layout/toolbar.js +2 -1
- package/dist/es2019/plugins/media/toolbar/index.js +10 -3
- package/dist/es2019/plugins/mentions/analytics.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
- package/dist/es2019/plugins/paste/handlers.js +27 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
- package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
- package/dist/es2019/plugins/status/analytics.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/es2019/types/browser.js +2 -0
- package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +5 -9
- package/dist/es2019/ui/DropList/index.js +186 -0
- package/dist/es2019/ui/Dropdown/index.js +2 -6
- package/dist/es2019/ui/DropdownMenu/index.js +124 -75
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
- package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
- package/dist/es2019/ui/Layer/index.js +195 -0
- package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
- package/dist/es2019/ui/PortalProvider/index.js +5 -23
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +13 -4
- package/dist/esm/create-editor/create-plugins-list.js +21 -12
- package/dist/esm/editor.js +9 -23
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/nodeviews/context-adapter.js +2 -2
- package/dist/esm/plugins/analytics/plugin.js +24 -11
- package/dist/esm/plugins/base/index.js +3 -3
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
- package/dist/esm/plugins/card/index.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +11 -5
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/code-block/actions.js +12 -0
- package/dist/esm/plugins/code-block/index.js +6 -0
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
- package/dist/esm/plugins/code-block/styles.js +4 -32
- package/dist/esm/plugins/code-block/toolbar.js +8 -0
- package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
- package/dist/esm/plugins/copy-button/commands.js +35 -15
- package/dist/esm/plugins/copy-button/toolbar.js +31 -0
- package/dist/esm/plugins/copy-button/utils.js +14 -29
- package/dist/esm/plugins/expand/toolbar.js +6 -2
- package/dist/esm/plugins/extension/toolbar.js +4 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
- package/dist/esm/plugins/hyperlink/index.js +4 -4
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
- package/dist/esm/plugins/indentation/commands/index.js +30 -9
- package/dist/esm/plugins/indentation/commands/utils.js +12 -8
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/esm/plugins/layout/toolbar.js +2 -1
- package/dist/esm/plugins/media/toolbar/index.js +12 -5
- package/dist/esm/plugins/mentions/analytics.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
- package/dist/esm/plugins/paste/handlers.js +23 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
- package/dist/esm/plugins/status/analytics.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/esm/types/browser.js +2 -0
- package/dist/esm/ui/Addon/click-area-helper.js +37 -18
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +2 -4
- package/dist/esm/ui/DropList/index.js +203 -0
- package/dist/esm/ui/Dropdown/index.js +2 -6
- package/dist/esm/ui/DropdownMenu/index.js +134 -88
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
- package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/esm/ui/ElementBrowser/constants.js +1 -4
- package/dist/esm/ui/Layer/index.js +228 -0
- package/dist/esm/ui/Layer/internal/helpers.js +62 -0
- package/dist/esm/ui/PortalProvider/index.js +7 -26
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/plugins/analytics/plugin.d.ts +5 -1
- package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
- package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
- package/dist/types/plugins/card/index.d.ts +2 -7
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +3 -5
- package/dist/types/plugins/card/types.d.ts +2 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
- package/dist/types/plugins/code-block/styles.d.ts +0 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -6
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/index.d.ts +2 -2
- package/dist/types/plugins/hyperlink/types.d.ts +30 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
- package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
- package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
- package/dist/types/plugins/paste/handlers.d.ts +1 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/types/browser.d.ts +10 -0
- package/dist/types/types/editor-props.d.ts +6 -5
- package/dist/types/types/feature-flags.d.ts +29 -24
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/DropList/index.d.ts +22 -0
- package/dist/types/ui/Dropdown/index.d.ts +2 -1
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
- package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
- package/dist/types/ui/Layer/index.d.ts +47 -0
- package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
- package/package.json +23 -18
- package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
- package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
- package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
- package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
- package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
- package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
- package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
|
@@ -10,13 +10,13 @@ import { insertTaskDecisionWithAnalytics } from '../commands';
|
|
|
10
10
|
import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
|
|
11
11
|
import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, subtreeHeight, walkOut, isTable, getTaskItemIndex, isInsideDecision } from './helpers';
|
|
12
12
|
|
|
13
|
-
const indentationAnalytics = (curIndentLevel, direction) => ({
|
|
13
|
+
const indentationAnalytics = (curIndentLevel, direction, inputMethod) => ({
|
|
14
14
|
action: ACTION.FORMATTED,
|
|
15
15
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
16
16
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
17
17
|
eventType: EVENT_TYPE.TRACK,
|
|
18
18
|
attributes: {
|
|
19
|
-
inputMethod
|
|
19
|
+
inputMethod,
|
|
20
20
|
previousIndentationLevel: curIndentLevel,
|
|
21
21
|
newIndentLevel: direction === INDENT_DIRECTION.OUTDENT ? curIndentLevel - 1 : curIndentLevel + 1,
|
|
22
22
|
direction,
|
|
@@ -83,14 +83,14 @@ const joinTaskDecisionFollowing = (state, dispatch) => {
|
|
|
83
83
|
return false;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
export const getUnindentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
87
87
|
const curIndentLevel = getCurrentIndentLevel(state.selection);
|
|
88
88
|
|
|
89
89
|
if (!curIndentLevel || curIndentLevel === 1) {
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
|
|
93
|
+
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT, inputMethod))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
|
|
94
94
|
}); // if selection is decision item or first action item in table cell
|
|
95
95
|
// then dont consume the Tab, as table-keymap should tab to the next cell
|
|
96
96
|
|
|
@@ -110,7 +110,7 @@ const shouldLetTabThroughInTable = state => {
|
|
|
110
110
|
return false;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
const
|
|
113
|
+
export const getIndentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
114
114
|
// limit ui indentation to 6 levels
|
|
115
115
|
const curIndentLevel = getCurrentIndentLevel(state.selection);
|
|
116
116
|
|
|
@@ -132,7 +132,7 @@ const indent = filter(isInsideTask, (state, dispatch) => {
|
|
|
132
132
|
return true;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
135
|
+
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
const backspaceFrom = $from => (state, dispatch) => {
|
|
@@ -150,7 +150,7 @@ const backspaceFrom = $from => (state, dispatch) => {
|
|
|
150
150
|
} = state.schema.nodes;
|
|
151
151
|
|
|
152
152
|
if ($from.node($from.depth - 2).type === taskList) {
|
|
153
|
-
return
|
|
153
|
+
return getUnindentCommand()(state, dispatch);
|
|
154
154
|
} // bottom level, should "unwrap" taskItem contents into paragraph
|
|
155
155
|
// we achieve this by slicing the content out, and replacing
|
|
156
156
|
|
|
@@ -305,7 +305,7 @@ const splitListItem = (state, dispatch) => {
|
|
|
305
305
|
return false;
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(
|
|
308
|
+
const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(getUnindentCommand(), splitListItem)), (state, dispatch) => {
|
|
309
309
|
const {
|
|
310
310
|
selection,
|
|
311
311
|
schema
|
|
@@ -356,8 +356,8 @@ const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTas
|
|
|
356
356
|
}));
|
|
357
357
|
export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
358
358
|
const indentHandlers = {
|
|
359
|
-
'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) =>
|
|
360
|
-
Tab: filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) =>
|
|
359
|
+
'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => getUnindentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs),
|
|
360
|
+
Tab: filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => getIndentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs)
|
|
361
361
|
};
|
|
362
362
|
const defaultHandlers = consumeTabs ? {
|
|
363
363
|
'Shift-Tab': isInsideTaskOrDecisionItem,
|
|
@@ -3,12 +3,27 @@ import ToolbarListsIndentation from './ui';
|
|
|
3
3
|
import WithPluginState from '../../ui/WithPluginState';
|
|
4
4
|
import { ToolbarSize } from '../../ui/Toolbar/types';
|
|
5
5
|
import { pluginKey as listPluginKey } from '../list/pm-plugins/main';
|
|
6
|
+
import { pluginKey as indentationButtonsPluginKey, createPlugin as indentationButtonsPlugin } from './pm-plugins/indentation-buttons';
|
|
6
7
|
|
|
7
8
|
const toolbarListsIndentationPlugin = ({
|
|
8
|
-
showIndentationButtons
|
|
9
|
+
showIndentationButtons,
|
|
10
|
+
allowHeadingAndParagraphIndentation
|
|
9
11
|
}) => ({
|
|
10
12
|
name: 'toolbarListsIndentation',
|
|
11
13
|
|
|
14
|
+
pmPlugins() {
|
|
15
|
+
return [{
|
|
16
|
+
name: 'indentationButtons',
|
|
17
|
+
plugin: ({
|
|
18
|
+
dispatch
|
|
19
|
+
}) => indentationButtonsPlugin({
|
|
20
|
+
dispatch,
|
|
21
|
+
showIndentationButtons,
|
|
22
|
+
allowHeadingAndParagraphIndentation
|
|
23
|
+
})
|
|
24
|
+
}];
|
|
25
|
+
},
|
|
26
|
+
|
|
12
27
|
primaryToolbarComponent({
|
|
13
28
|
editorView,
|
|
14
29
|
popupsMountPoint,
|
|
@@ -21,10 +36,12 @@ const toolbarListsIndentationPlugin = ({
|
|
|
21
36
|
const isSmall = toolbarSize < ToolbarSize.L;
|
|
22
37
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
23
38
|
plugins: {
|
|
24
|
-
listState: listPluginKey
|
|
39
|
+
listState: listPluginKey,
|
|
40
|
+
indentationState: indentationButtonsPluginKey
|
|
25
41
|
},
|
|
26
42
|
render: ({
|
|
27
|
-
listState
|
|
43
|
+
listState,
|
|
44
|
+
indentationState
|
|
28
45
|
}) => {
|
|
29
46
|
if (!listState) {
|
|
30
47
|
return null;
|
|
@@ -42,7 +59,9 @@ const toolbarListsIndentationPlugin = ({
|
|
|
42
59
|
bulletListDisabled: listState.bulletListDisabled,
|
|
43
60
|
orderedListActive: listState.orderedListActive,
|
|
44
61
|
orderedListDisabled: listState.orderedListDisabled,
|
|
45
|
-
showIndentationButtons: !!showIndentationButtons
|
|
62
|
+
showIndentationButtons: !!showIndentationButtons,
|
|
63
|
+
indentDisabled: indentationState.indentDisabled,
|
|
64
|
+
outdentDisabled: indentationState.outdentDisabled
|
|
46
65
|
});
|
|
47
66
|
}
|
|
48
67
|
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { shallowEqual } from '../../../utils';
|
|
5
|
+
import { getListItemAttributes, isInsideListItem } from '../../list/utils/selection';
|
|
6
|
+
import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
|
|
7
|
+
import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
|
|
8
|
+
export const pluginKey = new PluginKey('indentationButtonsPlugin');
|
|
9
|
+
|
|
10
|
+
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
11
|
+
const state = {
|
|
12
|
+
indentDisabled: true,
|
|
13
|
+
outdentDisabled: true,
|
|
14
|
+
node: null
|
|
15
|
+
};
|
|
16
|
+
const {
|
|
17
|
+
selection
|
|
18
|
+
} = editorState;
|
|
19
|
+
const node = selection.$from.node(); // Handle bullet and numbered lists seperately as they do
|
|
20
|
+
// not use the indentation mark.
|
|
21
|
+
// Check for lists before paragraphs and headings in case
|
|
22
|
+
// the selection is in a list nested in a layout column.
|
|
23
|
+
|
|
24
|
+
if (isInsideListItem(editorState)) {
|
|
25
|
+
const {
|
|
26
|
+
indentLevel,
|
|
27
|
+
itemIndex
|
|
28
|
+
} = getListItemAttributes(selection.$head);
|
|
29
|
+
return {
|
|
30
|
+
// List indent levels are zero indexed so we need to subtract 1
|
|
31
|
+
indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL - 1,
|
|
32
|
+
outdentDisabled: false,
|
|
33
|
+
node: 'list'
|
|
34
|
+
};
|
|
35
|
+
} // Handle tasks seperately as they do not use the indentation mark
|
|
36
|
+
// and have different behaviour for outdent compared to lists
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if (isInsideTask(editorState)) {
|
|
40
|
+
const indentLevel = getTaskListIndentLevel(selection) || 0;
|
|
41
|
+
const itemIndex = getTaskItemIndex(editorState);
|
|
42
|
+
return {
|
|
43
|
+
indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
|
|
44
|
+
outdentDisabled: indentLevel <= 1,
|
|
45
|
+
node: 'taskList'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const isTopLevelParagraphOrHeading = selection.$from.depth === 1;
|
|
50
|
+
const isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) && // depth of non-nested paragraphs and headings in layouts will always be 3
|
|
51
|
+
selection.$from.depth === 3;
|
|
52
|
+
|
|
53
|
+
if (allowHeadingAndParagraphIndentation && isIndentationAllowed(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
|
|
54
|
+
const indentationMark = node.marks.find(mark => mark.type === editorState.schema.marks.indentation);
|
|
55
|
+
|
|
56
|
+
if (!indentationMark) {
|
|
57
|
+
return {
|
|
58
|
+
outdentDisabled: true,
|
|
59
|
+
indentDisabled: false,
|
|
60
|
+
node: 'paragraph_heading'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
indentDisabled: indentationMark.attrs.level >= MAX_INDENTATION_LEVEL,
|
|
66
|
+
outdentDisabled: false,
|
|
67
|
+
node: 'paragraph_heading'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return state;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const createPlugin = ({
|
|
75
|
+
dispatch,
|
|
76
|
+
showIndentationButtons,
|
|
77
|
+
allowHeadingAndParagraphIndentation
|
|
78
|
+
}) => new SafePlugin({
|
|
79
|
+
state: {
|
|
80
|
+
init(_config, state) {
|
|
81
|
+
const initialState = {
|
|
82
|
+
indentDisabled: true,
|
|
83
|
+
outdentDisabled: true,
|
|
84
|
+
node: null
|
|
85
|
+
};
|
|
86
|
+
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
apply(_tr, pluginState, _oldState, newState) {
|
|
90
|
+
if (showIndentationButtons) {
|
|
91
|
+
const state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
|
|
92
|
+
|
|
93
|
+
if (!shallowEqual(pluginState, state)) {
|
|
94
|
+
dispatch(pluginKey, state);
|
|
95
|
+
return state;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return pluginState;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
},
|
|
103
|
+
key: pluginKey
|
|
104
|
+
});
|
|
@@ -22,6 +22,8 @@ export function Toolbar(props) {
|
|
|
22
22
|
orderedListActive,
|
|
23
23
|
orderedListDisabled,
|
|
24
24
|
showIndentationButtons,
|
|
25
|
+
indentDisabled,
|
|
26
|
+
outdentDisabled,
|
|
25
27
|
onItemActivated
|
|
26
28
|
} = props;
|
|
27
29
|
const labelUnorderedList = formatMessage(messages.unorderedList);
|
|
@@ -66,24 +68,28 @@ export function Toolbar(props) {
|
|
|
66
68
|
})
|
|
67
69
|
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
68
70
|
buttonId: TOOLBAR_BUTTON.INDENT,
|
|
71
|
+
testId: TOOLBAR_BUTTON.INDENT,
|
|
69
72
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
70
73
|
onClick: handleOnItemActivated('indent'),
|
|
71
74
|
iconBefore: jsx(IndentIcon, {
|
|
72
75
|
label: ""
|
|
73
76
|
}),
|
|
74
|
-
disabled:
|
|
77
|
+
disabled: indentDisabled || disabled,
|
|
78
|
+
"aria-label": formatMessage(indentationMessages.indent),
|
|
75
79
|
title: jsx(ToolTipContent, {
|
|
76
80
|
description: formatMessage(indentationMessages.indent),
|
|
77
81
|
keymap: toggleIndentKeymap
|
|
78
82
|
})
|
|
79
83
|
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
80
84
|
buttonId: TOOLBAR_BUTTON.OUTDENT,
|
|
85
|
+
testId: TOOLBAR_BUTTON.OUTDENT,
|
|
81
86
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
82
87
|
onClick: handleOnItemActivated('outdent'),
|
|
83
88
|
iconBefore: jsx(OutdentIcon, {
|
|
84
89
|
label: ""
|
|
85
90
|
}),
|
|
86
|
-
disabled:
|
|
91
|
+
disabled: outdentDisabled || disabled,
|
|
92
|
+
"aria-label": formatMessage(indentationMessages.outdent),
|
|
87
93
|
title: jsx(ToolTipContent, {
|
|
88
94
|
description: formatMessage(indentationMessages.outdent),
|
|
89
95
|
keymap: toggleOutdentKeymap
|
|
@@ -124,7 +124,7 @@ function useItems(props) {
|
|
|
124
124
|
value: {
|
|
125
125
|
name: 'indent'
|
|
126
126
|
},
|
|
127
|
-
isDisabled:
|
|
127
|
+
isDisabled: props.indentDisabled,
|
|
128
128
|
isActive: false,
|
|
129
129
|
elemAfter: jsx("div", {
|
|
130
130
|
css: shortcutStyle
|
|
@@ -135,7 +135,7 @@ function useItems(props) {
|
|
|
135
135
|
value: {
|
|
136
136
|
name: 'outdent'
|
|
137
137
|
},
|
|
138
|
-
isDisabled:
|
|
138
|
+
isDisabled: props.outdentDisabled,
|
|
139
139
|
isActive: false,
|
|
140
140
|
elemAfter: jsx("div", {
|
|
141
141
|
css: shortcutStyle
|
|
@@ -15,7 +15,9 @@ export default function ToolbarListsIndentation(props) {
|
|
|
15
15
|
showIndentationButtons,
|
|
16
16
|
popupsMountPoint,
|
|
17
17
|
popupsBoundariesElement,
|
|
18
|
-
popupsScrollableElement
|
|
18
|
+
popupsScrollableElement,
|
|
19
|
+
indentDisabled,
|
|
20
|
+
outdentDisabled
|
|
19
21
|
} = props;
|
|
20
22
|
|
|
21
23
|
if (isSmall) {
|
|
@@ -30,6 +32,8 @@ export default function ToolbarListsIndentation(props) {
|
|
|
30
32
|
showIndentationButtons: showIndentationButtons,
|
|
31
33
|
orderedListActive: orderedListActive,
|
|
32
34
|
orderedListDisabled: orderedListDisabled,
|
|
35
|
+
indentDisabled: indentDisabled,
|
|
36
|
+
outdentDisabled: outdentDisabled,
|
|
33
37
|
disabled: disabled,
|
|
34
38
|
onItemActivated: onItemActivated
|
|
35
39
|
});
|
|
@@ -43,6 +47,8 @@ export default function ToolbarListsIndentation(props) {
|
|
|
43
47
|
showIndentationButtons: showIndentationButtons,
|
|
44
48
|
orderedListActive: orderedListActive,
|
|
45
49
|
orderedListDisabled: orderedListDisabled,
|
|
50
|
+
indentDisabled: indentDisabled,
|
|
51
|
+
outdentDisabled: outdentDisabled,
|
|
46
52
|
disabled: disabled,
|
|
47
53
|
onItemActivated: onItemActivated
|
|
48
54
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { toggleBulletList, toggleOrderedList } from '../../list/commands';
|
|
1
|
+
import { indentList, outdentList, toggleBulletList, toggleOrderedList } from '../../list/commands';
|
|
2
|
+
import { getIndentCommand as indentParagraphOrHeading, getOutdentCommand as outdentParagraphOrHeading } from '../../indentation/commands';
|
|
3
|
+
import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
|
|
2
4
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
|
+
import { pluginKey as indentationButtonsPluginKey } from '../pm-plugins/indentation-buttons';
|
|
3
6
|
export function onItemActivated({
|
|
4
7
|
buttonName,
|
|
5
8
|
editorView
|
|
@@ -14,22 +17,41 @@ export function onItemActivated({
|
|
|
14
17
|
break;
|
|
15
18
|
|
|
16
19
|
case 'indent':
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
{
|
|
21
|
+
const node = indentationButtonsPluginKey.getState(editorView.state).node;
|
|
22
|
+
|
|
23
|
+
if (node === 'paragraph_heading') {
|
|
24
|
+
indentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (node === 'list') {
|
|
28
|
+
indentList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (node === 'taskList') {
|
|
32
|
+
indentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
24
37
|
|
|
25
38
|
case 'outdent':
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
{
|
|
40
|
+
const node = indentationButtonsPluginKey.getState(editorView.state).node;
|
|
41
|
+
|
|
42
|
+
if (node === 'paragraph_heading') {
|
|
43
|
+
outdentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (node === 'list') {
|
|
47
|
+
outdentList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (node === 'taskList') {
|
|
51
|
+
outdentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
34
56
|
}
|
|
35
57
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TextSelection } from 'prosemirror-state';
|
|
2
2
|
import { pluginKey } from '../pm-plugins/key';
|
|
3
3
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
4
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
5
|
export const openTypeAhead = props => tr => {
|
|
5
6
|
const {
|
|
6
7
|
triggerHandler,
|
|
@@ -21,6 +22,8 @@ export const openTypeAheadAtCursor = ({
|
|
|
21
22
|
inputMethod,
|
|
22
23
|
query
|
|
23
24
|
}) => tr => {
|
|
25
|
+
var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
|
|
26
|
+
|
|
24
27
|
openTypeAhead({
|
|
25
28
|
triggerHandler,
|
|
26
29
|
inputMethod,
|
|
@@ -46,6 +49,12 @@ export const openTypeAheadAtCursor = ({
|
|
|
46
49
|
|
|
47
50
|
if (nodeAtCursor && isPlaceholderAtCursorPosition) {
|
|
48
51
|
tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
|
|
52
|
+
} // ME-2375 remove the superfluous '@' inserted before decoration
|
|
53
|
+
// by composition (https://github.com/ProseMirror/prosemirror/issues/903)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if (browser.chrome && browser.android && cursorPos > 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, '@')) {
|
|
57
|
+
tr.delete(cursorPos - 1, cursorPos);
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
return tr;
|
|
@@ -13,10 +13,34 @@ const insideContentArea = ref => {
|
|
|
13
13
|
|
|
14
14
|
return false;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
|
|
18
|
+
* any part of the editor container is clicked
|
|
19
|
+
*
|
|
20
|
+
* Handles two cases when a click event is fired:
|
|
21
|
+
*
|
|
22
|
+
* 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
|
|
23
|
+
* 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export const checkForModal = target => {
|
|
28
|
+
const modalDialog = target.closest('[role=dialog]');
|
|
29
|
+
|
|
30
|
+
if (modalDialog) {
|
|
31
|
+
// return false if not an editor inside modal, otherwise return true
|
|
32
|
+
return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
|
|
33
|
+
} // no modal present so we can return true
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
16
38
|
|
|
17
39
|
const clickAreaClickHandler = (view, event) => {
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
var _view$hasFocus;
|
|
41
|
+
|
|
42
|
+
const isTargetContentArea = event.currentTarget.querySelector('.ak-editor-content-area');
|
|
43
|
+
const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus = view.hasFocus) !== null && _view$hasFocus !== void 0 && _view$hasFocus.call(view));
|
|
20
44
|
const target = event.target; // @see https://product-fabric.atlassian.net/browse/ED-4287
|
|
21
45
|
// click event gets triggered twice on a checkbox (on <label> first and then on <input>)
|
|
22
46
|
// by the time it gets triggered on input, PM already re-renders nodeView and detaches it from DOM
|
|
@@ -28,13 +52,10 @@ const clickAreaClickHandler = (view, event) => {
|
|
|
28
52
|
|
|
29
53
|
const isTextAreaClicked = target.nodeName === 'TEXTAREA';
|
|
30
54
|
const isBreadcrumbClicked = !!closestElement(target, 'nav[aria-label="Breadcrumbs"]');
|
|
31
|
-
const
|
|
32
|
-
const tragetIsNotChildOfContentArea = !insideContentArea(target.parentNode);
|
|
33
|
-
const editorIsNotInFocus = editorFocused === false;
|
|
55
|
+
const isTargetChildOfContentArea = insideContentArea(target.parentNode);
|
|
34
56
|
const selection = window.getSelection();
|
|
35
57
|
const isEditorPopupTextSelected = (selection === null || selection === void 0 ? void 0 : selection.type) === 'Range' && closestElement(selection === null || selection === void 0 ? void 0 : selection.anchorNode, '[data-editor-popup]');
|
|
36
|
-
const
|
|
37
|
-
const isClickOutsideEditor = (targetIsNotContentArea || tragetIsNotChildOfContentArea || editorIsNotInFocus) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isModalDialog && !isBreadcrumbClicked && !isPopupClicked && !isEditorPopupTextSelected;
|
|
58
|
+
const isClickOutsideEditor = (!isTargetContentArea || !isTargetChildOfContentArea || !isEditorFocused) && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target); // click was within editor container and focus should be brought to input
|
|
38
59
|
|
|
39
60
|
if (isClickOutsideEditor && view) {
|
|
40
61
|
outsideProsemirrorEditorClickHandler(view, event);
|
|
@@ -42,19 +63,25 @@ const clickAreaClickHandler = (view, event) => {
|
|
|
42
63
|
};
|
|
43
64
|
|
|
44
65
|
const outsideProsemirrorEditorClickHandler = (view, event) => {
|
|
66
|
+
var _view$hasFocus2;
|
|
67
|
+
|
|
45
68
|
const {
|
|
46
69
|
dispatch,
|
|
47
70
|
dom,
|
|
48
71
|
state
|
|
49
72
|
} = view;
|
|
50
|
-
const editorFocused = !!(view && view.hasFocus());
|
|
51
73
|
const {
|
|
52
74
|
tr
|
|
53
75
|
} = state;
|
|
54
|
-
|
|
76
|
+
const isEditorFocused = !!(view !== null && view !== void 0 && (_view$hasFocus2 = view.hasFocus) !== null && _view$hasFocus2 !== void 0 && _view$hasFocus2.call(view));
|
|
77
|
+
const isBottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
|
|
78
|
+
|
|
79
|
+
if (isBottomAreaClicked) {
|
|
80
|
+
addParagraphAtEnd(tr);
|
|
81
|
+
}
|
|
55
82
|
|
|
56
83
|
if (hasGapCursorPlugin(state)) {
|
|
57
|
-
setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view),
|
|
84
|
+
setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
58
85
|
}
|
|
59
86
|
|
|
60
87
|
if (!tr.docChanged && !tr.selectionSet) {
|
|
@@ -70,12 +97,4 @@ const outsideProsemirrorEditorClickHandler = (view, event) => {
|
|
|
70
97
|
event.preventDefault();
|
|
71
98
|
};
|
|
72
99
|
|
|
73
|
-
const appendEmptyParagraph = (event, dom, tr) => {
|
|
74
|
-
const bottomAreaClicked = event.clientY > dom.getBoundingClientRect().bottom;
|
|
75
|
-
|
|
76
|
-
if (bottomAreaClicked) {
|
|
77
|
-
addParagraphAtEnd(tr);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
100
|
export { clickAreaClickHandler };
|
|
@@ -36,7 +36,7 @@ const commentEditorStyle = css`
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
min-width: 272px;
|
|
39
|
-
/* Border + Toolbar + Footer + (Paragraph + ((
|
|
39
|
+
/* Border + Toolbar + Footer + (Paragraph + ((Paragraph + Margin) * (DefaultLines - 1)) */
|
|
40
40
|
/* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */
|
|
41
41
|
|
|
42
42
|
height: auto;
|
|
@@ -55,7 +55,7 @@ const ContentArea = createEditorContentStyle(css`
|
|
|
55
55
|
line-height: 24px;
|
|
56
56
|
|
|
57
57
|
/** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/
|
|
58
|
-
/** Hack for
|
|
58
|
+
/** Hack for table controls. Otherwise margin collapse and controls are misplaced. **/
|
|
59
59
|
.ProseMirror {
|
|
60
60
|
margin: 12px ${CommentEditorMargin}px ${CommentEditorMargin}px;
|
|
61
61
|
}
|
|
@@ -10,7 +10,7 @@ import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
|
|
|
10
10
|
import { tableStyles } from '../../plugins/table/ui/common-styles';
|
|
11
11
|
import { placeholderStyles } from '../../plugins/placeholder/styles';
|
|
12
12
|
import { blocktypeStyles } from '../../plugins/block-type/styles';
|
|
13
|
-
import { codeBlockStyles
|
|
13
|
+
import { codeBlockStyles } from '../../plugins/code-block/styles';
|
|
14
14
|
import { listsStyles } from '../../plugins/list/styles';
|
|
15
15
|
import { ruleStyles } from '../../plugins/rule/styles';
|
|
16
16
|
import { mediaStyles } from '../../plugins/media/styles';
|
|
@@ -35,15 +35,12 @@ import { embedCardStyles } from '../../plugins/card/ui/styled';
|
|
|
35
35
|
import { useFeatureFlags } from '../../plugins/feature-flags-context';
|
|
36
36
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
37
37
|
|
|
38
|
-
const contentStyles = props =>
|
|
39
|
-
var _props$featureFlags;
|
|
40
|
-
|
|
41
|
-
return css`
|
|
38
|
+
const contentStyles = props => css`
|
|
42
39
|
.ProseMirror {
|
|
43
40
|
outline: none;
|
|
44
41
|
font-size: ${editorFontSize({
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
theme: props.theme
|
|
43
|
+
})}px;
|
|
47
44
|
${whitespaceSharedStyles};
|
|
48
45
|
${paragraphSharedStyles};
|
|
49
46
|
${listsSharedStyles};
|
|
@@ -75,7 +72,7 @@ const contentStyles = props => {
|
|
|
75
72
|
|
|
76
73
|
${placeholderTextStyles}
|
|
77
74
|
${placeholderStyles}
|
|
78
|
-
${
|
|
75
|
+
${codeBlockStyles(props)}
|
|
79
76
|
|
|
80
77
|
${blocktypeStyles(props)}
|
|
81
78
|
${textFormattingStyles(props)}
|
|
@@ -158,7 +155,6 @@ const contentStyles = props => {
|
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
157
|
`;
|
|
161
|
-
};
|
|
162
158
|
|
|
163
159
|
export const createEditorContentStyle = styles => {
|
|
164
160
|
return /*#__PURE__*/React.forwardRef((props, ref) => {
|