@atlaskit/editor-core 171.0.0 → 172.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -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/table/ui/common-styles.js +1 -1
- 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 +18 -12
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- 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/table/ui/common-styles.js +2 -0
- 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 +18 -12
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- 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/table/ui/common-styles.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 +18 -12
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- 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
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.getUnindentCommand = exports.getIndentCommand = exports.default = void 0;
|
|
9
9
|
exports.keymapPlugin = keymapPlugin;
|
|
10
10
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -36,14 +36,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
36
36
|
|
|
37
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
38
38
|
|
|
39
|
-
var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction) {
|
|
39
|
+
var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction, inputMethod) {
|
|
40
40
|
return {
|
|
41
41
|
action: _analytics.ACTION.FORMATTED,
|
|
42
42
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
43
43
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
44
44
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
45
45
|
attributes: {
|
|
46
|
-
inputMethod:
|
|
46
|
+
inputMethod: inputMethod,
|
|
47
47
|
previousIndentationLevel: curIndentLevel,
|
|
48
48
|
newIndentLevel: direction === _analytics.INDENT_DIRECTION.OUTDENT ? curIndentLevel - 1 : curIndentLevel + 1,
|
|
49
49
|
direction: direction,
|
|
@@ -112,17 +112,23 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
|
|
|
112
112
|
return false;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
var
|
|
116
|
-
var
|
|
115
|
+
var getUnindentCommand = function getUnindentCommand() {
|
|
116
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
117
|
+
return (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
|
|
118
|
+
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
if (!curIndentLevel || curIndentLevel === 1) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
+
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _prosemirrorCommands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
|
|
125
|
+
});
|
|
126
|
+
}; // if selection is decision item or first action item in table cell
|
|
124
127
|
// then dont consume the Tab, as table-keymap should tab to the next cell
|
|
125
128
|
|
|
129
|
+
|
|
130
|
+
exports.getUnindentCommand = getUnindentCommand;
|
|
131
|
+
|
|
126
132
|
var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
|
|
127
133
|
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
|
|
128
134
|
var curIndex = (0, _helpers.getTaskItemIndex)(state);
|
|
@@ -138,28 +144,33 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
|
|
|
138
144
|
return false;
|
|
139
145
|
};
|
|
140
146
|
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
var getIndentCommand = function getIndentCommand() {
|
|
148
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
149
|
+
return (0, _commands.filter)(_helpers.isInsideTask, function (state, dispatch) {
|
|
150
|
+
// limit ui indentation to 6 levels
|
|
151
|
+
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(state.selection);
|
|
144
152
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
if (!curIndentLevel || curIndentLevel >= 6) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
148
156
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
var _state$schema$nodes3 = state.schema.nodes,
|
|
158
|
+
taskList = _state$schema$nodes3.taskList,
|
|
159
|
+
taskItem = _state$schema$nodes3.taskItem;
|
|
160
|
+
var _state$selection = state.selection,
|
|
161
|
+
$from = _state$selection.$from,
|
|
162
|
+
$to = _state$selection.$to;
|
|
163
|
+
var maxDepth = (0, _helpers.subtreeHeight)($from, $to, [taskList, taskItem]);
|
|
156
164
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
if (maxDepth >= 6) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
160
168
|
|
|
161
|
-
|
|
162
|
-
});
|
|
169
|
+
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _prosemirrorCommands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
exports.getIndentCommand = getIndentCommand;
|
|
163
174
|
|
|
164
175
|
var backspaceFrom = function backspaceFrom($from) {
|
|
165
176
|
return function (state, dispatch) {
|
|
@@ -176,7 +187,7 @@ var backspaceFrom = function backspaceFrom($from) {
|
|
|
176
187
|
paragraph = _state$schema$nodes4.paragraph;
|
|
177
188
|
|
|
178
189
|
if ($from.node($from.depth - 2).type === taskList) {
|
|
179
|
-
return
|
|
190
|
+
return getUnindentCommand()(state, dispatch);
|
|
180
191
|
} // bottom level, should "unwrap" taskItem contents into paragraph
|
|
181
192
|
// we achieve this by slicing the content out, and replacing
|
|
182
193
|
|
|
@@ -326,7 +337,7 @@ var splitListItem = function splitListItem(state, dispatch) {
|
|
|
326
337
|
return false;
|
|
327
338
|
};
|
|
328
339
|
|
|
329
|
-
var enter = (0, _commands.filter)(_helpers.isInsideTaskOrDecisionItem, (0, _prosemirrorCommands.chainCommands)((0, _commands.filter)(_helpers.isEmptyTaskDecision, (0, _prosemirrorCommands.chainCommands)(
|
|
340
|
+
var enter = (0, _commands.filter)(_helpers.isInsideTaskOrDecisionItem, (0, _prosemirrorCommands.chainCommands)((0, _commands.filter)(_helpers.isEmptyTaskDecision, (0, _prosemirrorCommands.chainCommands)(getUnindentCommand(), splitListItem)), function (state, dispatch) {
|
|
330
341
|
var selection = state.selection,
|
|
331
342
|
schema = state.schema;
|
|
332
343
|
var taskItem = schema.nodes.taskItem;
|
|
@@ -375,12 +386,12 @@ function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
|
375
386
|
'Shift-Tab': (0, _commands.filter)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
376
387
|
return !shouldLetTabThroughInTable(state);
|
|
377
388
|
}], function (state, dispatch) {
|
|
378
|
-
return
|
|
389
|
+
return getUnindentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
379
390
|
}),
|
|
380
391
|
Tab: (0, _commands.filter)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
381
392
|
return !shouldLetTabThroughInTable(state);
|
|
382
393
|
}], function (state, dispatch) {
|
|
383
|
-
return
|
|
394
|
+
return getIndentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
384
395
|
})
|
|
385
396
|
};
|
|
386
397
|
var defaultHandlers = consumeTabs ? {
|
|
@@ -17,25 +17,43 @@ var _types = require("../../ui/Toolbar/types");
|
|
|
17
17
|
|
|
18
18
|
var _main = require("../list/pm-plugins/main");
|
|
19
19
|
|
|
20
|
+
var _indentationButtons = require("./pm-plugins/indentation-buttons");
|
|
21
|
+
|
|
20
22
|
var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
|
|
21
|
-
var showIndentationButtons = _ref.showIndentationButtons
|
|
23
|
+
var showIndentationButtons = _ref.showIndentationButtons,
|
|
24
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
22
25
|
return {
|
|
23
26
|
name: 'toolbarListsIndentation',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
pmPlugins: function pmPlugins() {
|
|
28
|
+
return [{
|
|
29
|
+
name: 'indentationButtons',
|
|
30
|
+
plugin: function plugin(_ref2) {
|
|
31
|
+
var dispatch = _ref2.dispatch;
|
|
32
|
+
return (0, _indentationButtons.createPlugin)({
|
|
33
|
+
dispatch: dispatch,
|
|
34
|
+
showIndentationButtons: showIndentationButtons,
|
|
35
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
39
|
+
},
|
|
40
|
+
primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
|
|
41
|
+
var editorView = _ref3.editorView,
|
|
42
|
+
popupsMountPoint = _ref3.popupsMountPoint,
|
|
43
|
+
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
44
|
+
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
45
|
+
toolbarSize = _ref3.toolbarSize,
|
|
46
|
+
disabled = _ref3.disabled,
|
|
47
|
+
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
|
|
32
48
|
var isSmall = toolbarSize < _types.ToolbarSize.L;
|
|
33
49
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
34
50
|
plugins: {
|
|
35
|
-
listState: _main.pluginKey
|
|
51
|
+
listState: _main.pluginKey,
|
|
52
|
+
indentationState: _indentationButtons.pluginKey
|
|
36
53
|
},
|
|
37
|
-
render: function render(
|
|
38
|
-
var listState =
|
|
54
|
+
render: function render(_ref4) {
|
|
55
|
+
var listState = _ref4.listState,
|
|
56
|
+
indentationState = _ref4.indentationState;
|
|
39
57
|
|
|
40
58
|
if (!listState) {
|
|
41
59
|
return null;
|
|
@@ -53,7 +71,9 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
|
|
|
53
71
|
bulletListDisabled: listState.bulletListDisabled,
|
|
54
72
|
orderedListActive: listState.orderedListActive,
|
|
55
73
|
orderedListDisabled: listState.orderedListDisabled,
|
|
56
|
-
showIndentationButtons: !!showIndentationButtons
|
|
74
|
+
showIndentationButtons: !!showIndentationButtons,
|
|
75
|
+
indentDisabled: indentationState.indentDisabled,
|
|
76
|
+
outdentDisabled: indentationState.outdentDisabled
|
|
57
77
|
});
|
|
58
78
|
}
|
|
59
79
|
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pluginKey = exports.createPlugin = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
11
|
+
|
|
12
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../../../utils");
|
|
15
|
+
|
|
16
|
+
var _selection = require("../../list/utils/selection");
|
|
17
|
+
|
|
18
|
+
var _helpers = require("../../tasks-and-decisions/pm-plugins/helpers");
|
|
19
|
+
|
|
20
|
+
var _commands = require("../../indentation/commands");
|
|
21
|
+
|
|
22
|
+
var pluginKey = new _prosemirrorState.PluginKey('indentationButtonsPlugin');
|
|
23
|
+
exports.pluginKey = pluginKey;
|
|
24
|
+
|
|
25
|
+
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
26
|
+
var state = {
|
|
27
|
+
indentDisabled: true,
|
|
28
|
+
outdentDisabled: true,
|
|
29
|
+
node: null
|
|
30
|
+
};
|
|
31
|
+
var selection = editorState.selection;
|
|
32
|
+
var node = selection.$from.node(); // Handle bullet and numbered lists seperately as they do
|
|
33
|
+
// not use the indentation mark.
|
|
34
|
+
// Check for lists before paragraphs and headings in case
|
|
35
|
+
// the selection is in a list nested in a layout column.
|
|
36
|
+
|
|
37
|
+
if ((0, _selection.isInsideListItem)(editorState)) {
|
|
38
|
+
var _getListItemAttribute = (0, _selection.getListItemAttributes)(selection.$head),
|
|
39
|
+
indentLevel = _getListItemAttribute.indentLevel,
|
|
40
|
+
itemIndex = _getListItemAttribute.itemIndex;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
// List indent levels are zero indexed so we need to subtract 1
|
|
44
|
+
indentDisabled: itemIndex === 0 || indentLevel >= _commands.MAX_INDENTATION_LEVEL - 1,
|
|
45
|
+
outdentDisabled: false,
|
|
46
|
+
node: 'list'
|
|
47
|
+
};
|
|
48
|
+
} // Handle tasks seperately as they do not use the indentation mark
|
|
49
|
+
// and have different behaviour for outdent compared to lists
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if ((0, _helpers.isInsideTask)(editorState)) {
|
|
53
|
+
var _indentLevel = (0, _helpers.getCurrentIndentLevel)(selection) || 0;
|
|
54
|
+
|
|
55
|
+
var _itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
indentDisabled: _itemIndex === 0 || _indentLevel >= _commands.MAX_INDENTATION_LEVEL,
|
|
59
|
+
outdentDisabled: _indentLevel <= 1,
|
|
60
|
+
node: 'taskList'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var isTopLevelParagraphOrHeading = selection.$from.depth === 1;
|
|
65
|
+
var isInLayoutNode = (0, _prosemirrorUtils.hasParentNodeOfType)(editorState.schema.nodes.layoutColumn)(selection) && // depth of non-nested paragraphs and headings in layouts will always be 3
|
|
66
|
+
selection.$from.depth === 3;
|
|
67
|
+
|
|
68
|
+
if (allowHeadingAndParagraphIndentation && (0, _commands.isIndentationAllowed)(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
|
|
69
|
+
var indentationMark = node.marks.find(function (mark) {
|
|
70
|
+
return mark.type === editorState.schema.marks.indentation;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (!indentationMark) {
|
|
74
|
+
return {
|
|
75
|
+
outdentDisabled: true,
|
|
76
|
+
indentDisabled: false,
|
|
77
|
+
node: 'paragraph_heading'
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
indentDisabled: indentationMark.attrs.level >= _commands.MAX_INDENTATION_LEVEL,
|
|
83
|
+
outdentDisabled: false,
|
|
84
|
+
node: 'paragraph_heading'
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return state;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var createPlugin = function createPlugin(_ref) {
|
|
92
|
+
var dispatch = _ref.dispatch,
|
|
93
|
+
showIndentationButtons = _ref.showIndentationButtons,
|
|
94
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
95
|
+
return new _safePlugin.SafePlugin({
|
|
96
|
+
state: {
|
|
97
|
+
init: function init(_config, state) {
|
|
98
|
+
var initialState = {
|
|
99
|
+
indentDisabled: true,
|
|
100
|
+
outdentDisabled: true,
|
|
101
|
+
node: null
|
|
102
|
+
};
|
|
103
|
+
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
|
|
104
|
+
},
|
|
105
|
+
apply: function apply(_tr, pluginState, _oldState, newState) {
|
|
106
|
+
if (showIndentationButtons) {
|
|
107
|
+
var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
|
|
108
|
+
|
|
109
|
+
if (!(0, _utils.shallowEqual)(pluginState, state)) {
|
|
110
|
+
dispatch(pluginKey, state);
|
|
111
|
+
return state;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return pluginState;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
key: pluginKey
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
exports.createPlugin = createPlugin;
|
|
@@ -47,6 +47,8 @@ function Toolbar(props) {
|
|
|
47
47
|
orderedListActive = props.orderedListActive,
|
|
48
48
|
orderedListDisabled = props.orderedListDisabled,
|
|
49
49
|
showIndentationButtons = props.showIndentationButtons,
|
|
50
|
+
indentDisabled = props.indentDisabled,
|
|
51
|
+
outdentDisabled = props.outdentDisabled,
|
|
50
52
|
onItemActivated = props.onItemActivated;
|
|
51
53
|
var labelUnorderedList = formatMessage(_messages.messages.unorderedList);
|
|
52
54
|
var labelOrderedList = formatMessage(_messages.messages.orderedList);
|
|
@@ -93,28 +95,32 @@ function Toolbar(props) {
|
|
|
93
95
|
label: ""
|
|
94
96
|
})
|
|
95
97
|
}), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
|
|
96
|
-
buttonId: _ToolbarButton.TOOLBAR_BUTTON.
|
|
98
|
+
buttonId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
|
|
99
|
+
testId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
|
|
97
100
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
98
|
-
onClick: handleOnItemActivated('
|
|
99
|
-
iconBefore: (0, _react.jsx)(
|
|
101
|
+
onClick: handleOnItemActivated('outdent'),
|
|
102
|
+
iconBefore: (0, _react.jsx)(_outdent.default, {
|
|
100
103
|
label: ""
|
|
101
104
|
}),
|
|
102
|
-
disabled:
|
|
105
|
+
disabled: outdentDisabled || disabled,
|
|
106
|
+
"aria-label": formatMessage(_messages2.messages.outdent),
|
|
103
107
|
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
104
|
-
description: formatMessage(_messages2.messages.
|
|
105
|
-
keymap: _keymaps.
|
|
108
|
+
description: formatMessage(_messages2.messages.outdent),
|
|
109
|
+
keymap: _keymaps.outdent
|
|
106
110
|
})
|
|
107
111
|
}), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
|
|
108
|
-
buttonId: _ToolbarButton.TOOLBAR_BUTTON.
|
|
112
|
+
buttonId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
|
|
113
|
+
testId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
|
|
109
114
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
110
|
-
onClick: handleOnItemActivated('
|
|
111
|
-
iconBefore: (0, _react.jsx)(
|
|
115
|
+
onClick: handleOnItemActivated('indent'),
|
|
116
|
+
iconBefore: (0, _react.jsx)(_indent.default, {
|
|
112
117
|
label: ""
|
|
113
118
|
}),
|
|
114
|
-
disabled:
|
|
119
|
+
disabled: indentDisabled || disabled,
|
|
120
|
+
"aria-label": formatMessage(_messages2.messages.indent),
|
|
115
121
|
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
116
|
-
description: formatMessage(_messages2.messages.
|
|
117
|
-
keymap: _keymaps.
|
|
122
|
+
description: formatMessage(_messages2.messages.indent),
|
|
123
|
+
keymap: _keymaps.indent
|
|
118
124
|
})
|
|
119
125
|
}), (0, _react.jsx)("span", {
|
|
120
126
|
css: _styles.separatorStyles
|
|
@@ -143,27 +143,27 @@ function useItems(props) {
|
|
|
143
143
|
var labelIndent = formatMessage(_messages2.messages.indent);
|
|
144
144
|
var labelOutdent = formatMessage(_messages2.messages.outdent);
|
|
145
145
|
items.push({
|
|
146
|
-
key: '
|
|
147
|
-
content:
|
|
146
|
+
key: 'outdent',
|
|
147
|
+
content: labelOutdent,
|
|
148
148
|
value: {
|
|
149
|
-
name: '
|
|
149
|
+
name: 'outdent'
|
|
150
150
|
},
|
|
151
|
-
isDisabled:
|
|
151
|
+
isDisabled: props.outdentDisabled,
|
|
152
152
|
isActive: false,
|
|
153
153
|
elemAfter: (0, _react.jsx)("div", {
|
|
154
154
|
css: _styles.shortcutStyle
|
|
155
|
-
}, (0, _keymaps.tooltip)(_keymaps.
|
|
155
|
+
}, (0, _keymaps.tooltip)(_keymaps.outdent))
|
|
156
156
|
}, {
|
|
157
|
-
key: '
|
|
158
|
-
content:
|
|
157
|
+
key: 'indent',
|
|
158
|
+
content: labelIndent,
|
|
159
159
|
value: {
|
|
160
|
-
name: '
|
|
160
|
+
name: 'indent'
|
|
161
161
|
},
|
|
162
|
-
isDisabled:
|
|
162
|
+
isDisabled: props.indentDisabled,
|
|
163
163
|
isActive: false,
|
|
164
164
|
elemAfter: (0, _react.jsx)("div", {
|
|
165
165
|
css: _styles.shortcutStyle
|
|
166
|
-
}, (0, _keymaps.tooltip)(_keymaps.
|
|
166
|
+
}, (0, _keymaps.tooltip)(_keymaps.indent))
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -25,7 +25,9 @@ function ToolbarListsIndentation(props) {
|
|
|
25
25
|
showIndentationButtons = props.showIndentationButtons,
|
|
26
26
|
popupsMountPoint = props.popupsMountPoint,
|
|
27
27
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
28
|
-
popupsScrollableElement = props.popupsScrollableElement
|
|
28
|
+
popupsScrollableElement = props.popupsScrollableElement,
|
|
29
|
+
indentDisabled = props.indentDisabled,
|
|
30
|
+
outdentDisabled = props.outdentDisabled;
|
|
29
31
|
|
|
30
32
|
if (isSmall) {
|
|
31
33
|
return (0, _react.jsx)(_ToolbarDropdown.ToolbarDropdown, {
|
|
@@ -39,6 +41,8 @@ function ToolbarListsIndentation(props) {
|
|
|
39
41
|
showIndentationButtons: showIndentationButtons,
|
|
40
42
|
orderedListActive: orderedListActive,
|
|
41
43
|
orderedListDisabled: orderedListDisabled,
|
|
44
|
+
indentDisabled: indentDisabled,
|
|
45
|
+
outdentDisabled: outdentDisabled,
|
|
42
46
|
disabled: disabled,
|
|
43
47
|
onItemActivated: _onItemActivated.onItemActivated
|
|
44
48
|
});
|
|
@@ -52,6 +56,8 @@ function ToolbarListsIndentation(props) {
|
|
|
52
56
|
showIndentationButtons: showIndentationButtons,
|
|
53
57
|
orderedListActive: orderedListActive,
|
|
54
58
|
orderedListDisabled: orderedListDisabled,
|
|
59
|
+
indentDisabled: indentDisabled,
|
|
60
|
+
outdentDisabled: outdentDisabled,
|
|
55
61
|
disabled: disabled,
|
|
56
62
|
onItemActivated: _onItemActivated.onItemActivated
|
|
57
63
|
});
|
|
@@ -7,8 +7,14 @@ exports.onItemActivated = onItemActivated;
|
|
|
7
7
|
|
|
8
8
|
var _commands = require("../../list/commands");
|
|
9
9
|
|
|
10
|
+
var _commands2 = require("../../indentation/commands");
|
|
11
|
+
|
|
12
|
+
var _keymaps = require("../../tasks-and-decisions/pm-plugins/keymaps");
|
|
13
|
+
|
|
10
14
|
var _analytics = require("../../analytics");
|
|
11
15
|
|
|
16
|
+
var _indentationButtons = require("../pm-plugins/indentation-buttons");
|
|
17
|
+
|
|
12
18
|
function onItemActivated(_ref) {
|
|
13
19
|
var buttonName = _ref.buttonName,
|
|
14
20
|
editorView = _ref.editorView;
|
|
@@ -23,26 +29,41 @@ function onItemActivated(_ref) {
|
|
|
23
29
|
break;
|
|
24
30
|
|
|
25
31
|
case 'indent':
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
{
|
|
33
|
+
var node = _indentationButtons.pluginKey.getState(editorView.state).node;
|
|
34
|
+
|
|
35
|
+
if (node === 'paragraph_heading') {
|
|
36
|
+
(0, _commands2.getIndentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (node === 'list') {
|
|
40
|
+
(0, _commands.indentList)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (node === 'taskList') {
|
|
44
|
+
(0, _keymaps.getIndentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
35
49
|
|
|
36
50
|
case 'outdent':
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
{
|
|
52
|
+
var _node = _indentationButtons.pluginKey.getState(editorView.state).node;
|
|
53
|
+
|
|
54
|
+
if (_node === 'paragraph_heading') {
|
|
55
|
+
(0, _commands2.getOutdentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (_node === 'list') {
|
|
59
|
+
(0, _commands.outdentList)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (_node === 'taskList') {
|
|
63
|
+
(0, _keymaps.getUnindentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
47
68
|
}
|
|
48
69
|
}
|
|
@@ -11,6 +11,8 @@ var _key = require("../pm-plugins/key");
|
|
|
11
11
|
|
|
12
12
|
var _actions = require("../pm-plugins/actions");
|
|
13
13
|
|
|
14
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
+
|
|
14
16
|
var openTypeAhead = function openTypeAhead(props) {
|
|
15
17
|
return function (tr) {
|
|
16
18
|
var triggerHandler = props.triggerHandler,
|
|
@@ -34,6 +36,8 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
|
|
|
34
36
|
inputMethod = _ref.inputMethod,
|
|
35
37
|
query = _ref.query;
|
|
36
38
|
return function (tr) {
|
|
39
|
+
var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
|
|
40
|
+
|
|
37
41
|
openTypeAhead({
|
|
38
42
|
triggerHandler: triggerHandler,
|
|
39
43
|
inputMethod: inputMethod,
|
|
@@ -57,6 +61,12 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
|
|
|
57
61
|
|
|
58
62
|
if (nodeAtCursor && isPlaceholderAtCursorPosition) {
|
|
59
63
|
tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
|
|
64
|
+
} // ME-2375 remove the superfluous '@' inserted before decoration
|
|
65
|
+
// by composition (https://github.com/ProseMirror/prosemirror/issues/903)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if (_utils.browser.chrome && _utils.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, '@')) {
|
|
69
|
+
tr.delete(cursorPos - 1, cursorPos);
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
return tr;
|