@atlaskit/editor-core 187.17.5 → 187.18.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 +18 -0
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/annotation/toolbar.js +31 -8
- package/dist/cjs/plugins/base/pm-plugins/inline-cursor-target.js +7 -41
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/annotation/toolbar.js +34 -9
- package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +9 -41
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/annotation/toolbar.js +30 -7
- package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +7 -41
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/extensibility.d.ts +0 -2
- package/dist/types/index.d.ts +0 -5
- package/dist/types/labs/next/presets/default.d.ts +28 -30
- package/dist/types/plugins/analytics/index.d.ts +0 -2
- package/dist/types/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/annotation/types.d.ts +9 -3
- package/dist/types/plugins/annotation/utils.d.ts +2 -5
- package/dist/types/plugins/base/pm-plugins/context-identifier.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/block-type.d.ts +0 -2
- package/dist/types/plugins/block-type/pm-plugins/main.d.ts +6 -1
- package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +5 -1
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/code-block/utils.d.ts +1 -1
- package/dist/types/plugins/collab-edit/utils.d.ts +1 -5
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +10 -1
- package/dist/types/plugins/copy-button/toolbar.d.ts +0 -2
- package/dist/types/plugins/copy-button/utils.d.ts +1 -1
- package/dist/types/plugins/custom-autoformat/index.d.ts +2 -1
- package/dist/types/plugins/date/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/expand/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/expand/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/extension/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/extension/utils.d.ts +1 -1
- package/dist/types/plugins/find-replace/plugin.d.ts +0 -2
- package/dist/types/plugins/find-replace/utils/index.d.ts +1 -4
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
- package/dist/types/plugins/media/commands/helpers.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/index.d.ts +1 -3
- package/dist/types/plugins/media/pm-plugins/linking/index.d.ts +0 -2
- package/dist/types/plugins/media/toolbar/utils.d.ts +1 -3
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +0 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +0 -1
- package/dist/types/plugins/mobile-dimensions/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/panel/utils.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/paste/util/index.d.ts +1 -1
- package/dist/types/plugins/selection/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-main.d.ts +1 -1
- package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +1 -2
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/action.d.ts +1 -60
- package/dist/types/utils/list-commands.d.ts +0 -1
- package/dist/types-ts4.5/extensibility.d.ts +0 -2
- package/dist/types-ts4.5/index.d.ts +0 -5
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -30
- package/dist/types-ts4.5/plugins/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/types.d.ts +9 -3
- package/dist/types-ts4.5/plugins/annotation/utils.d.ts +2 -5
- package/dist/types-ts4.5/plugins/base/pm-plugins/context-identifier.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +0 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +6 -1
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +8 -1
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/code-block/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +1 -5
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +10 -1
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -2
- package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/custom-autoformat/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/date/pm-plugins/main.d.ts +0 -2
- package/dist/types-ts4.5/plugins/expand/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/expand/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/extension/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/extension/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/find-replace/plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/find-replace/utils/index.d.ts +1 -4
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
- package/dist/types-ts4.5/plugins/media/commands/helpers.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/index.d.ts +1 -3
- package/dist/types-ts4.5/plugins/media/pm-plugins/linking/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -3
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/mobile-dimensions/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/panel/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/util/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/selection/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/selection/pm-plugins/gap-cursor-main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +1 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/action.d.ts +1 -60
- package/dist/types-ts4.5/utils/list-commands.d.ts +0 -1
- package/package.json +5 -4
- package/report.api.md +1 -24
- package/tmp/api-report-tmp.d.ts +1 -21
- package/dist/cjs/plugins/text-formatting/actions.js +0 -188
- package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +0 -111
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +0 -143
- package/dist/cjs/plugins/text-formatting/commands/transform-to-code.js +0 -68
- package/dist/cjs/plugins/text-formatting/index.js +0 -136
- package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -21
- package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -36
- package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +0 -55
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +0 -276
- package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +0 -52
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +0 -113
- package/dist/cjs/plugins/text-formatting/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -176
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/constants.js +0 -19
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -86
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -53
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -225
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -23
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -60
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +0 -201
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +0 -40
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -46
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/types.js +0 -17
- package/dist/cjs/plugins/text-formatting/utils/cell-selection.js +0 -12
- package/dist/cjs/plugins/text-formatting/utils.js +0 -86
- package/dist/es2019/plugins/text-formatting/actions.js +0 -161
- package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +0 -105
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +0 -144
- package/dist/es2019/plugins/text-formatting/commands/transform-to-code.js +0 -71
- package/dist/es2019/plugins/text-formatting/index.js +0 -127
- package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
- package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -26
- package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +0 -52
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +0 -244
- package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +0 -43
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +0 -109
- package/dist/es2019/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -155
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/constants.js +0 -20
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -66
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -42
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -210
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -11
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -48
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +0 -168
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +0 -32
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -36
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/types.js +0 -10
- package/dist/es2019/plugins/text-formatting/utils/cell-selection.js +0 -5
- package/dist/es2019/plugins/text-formatting/utils.js +0 -74
- package/dist/esm/plugins/text-formatting/actions.js +0 -168
- package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +0 -101
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +0 -134
- package/dist/esm/plugins/text-formatting/commands/transform-to-code.js +0 -61
- package/dist/esm/plugins/text-formatting/index.js +0 -128
- package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
- package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -28
- package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +0 -48
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +0 -259
- package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +0 -43
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +0 -98
- package/dist/esm/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -169
- package/dist/esm/plugins/text-formatting/ui/Toolbar/constants.js +0 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -75
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -45
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -213
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -15
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -50
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +0 -191
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +0 -31
- package/dist/esm/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -35
- package/dist/esm/plugins/text-formatting/ui/Toolbar/types.js +0 -10
- package/dist/esm/plugins/text-formatting/utils/cell-selection.js +0 -5
- package/dist/esm/plugins/text-formatting/utils.js +0 -75
- package/dist/types/plugins/text-formatting/actions.d.ts +0 -22
- package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
- package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
- package/dist/types/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
- package/dist/types/plugins/text-formatting/index.d.ts +0 -17
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
- package/dist/types/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
- package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
- package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
- package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
- package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
- package/dist/types/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
- package/dist/types/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
- package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
- package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
- package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
- package/dist/types/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
- package/dist/types/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
- package/dist/types/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
- package/dist/types/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -11
- package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +0 -22
- package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
- package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
- package/dist/types-ts4.5/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -5
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
- package/dist/types-ts4.5/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
- package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +0 -11
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
11
|
-
var _main = require("./pm-plugins/main");
|
|
12
|
-
var _clearFormatting = require("./pm-plugins/clear-formatting");
|
|
13
|
-
var _clearFormattingKeymap = _interopRequireDefault(require("./pm-plugins/clear-formatting-keymap"));
|
|
14
|
-
var _cursor = _interopRequireDefault(require("./pm-plugins/cursor"));
|
|
15
|
-
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
16
|
-
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
17
|
-
var _smartInputRule = _interopRequireDefault(require("./pm-plugins/smart-input-rule"));
|
|
18
|
-
var _Toolbar = _interopRequireDefault(require("./ui/Toolbar"));
|
|
19
|
-
var _actions = require("./actions");
|
|
20
|
-
var textFormatting = function textFormatting() {
|
|
21
|
-
var _api$dependencies$ana7, _api$dependencies$ana8, _api$dependencies$ana9, _api$dependencies$ana10, _api$dependencies$ana11, _api$dependencies$ana12, _api$dependencies$ana13;
|
|
22
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
|
-
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
24
|
-
return {
|
|
25
|
-
name: 'textFormatting',
|
|
26
|
-
marks: function marks() {
|
|
27
|
-
return [{
|
|
28
|
-
name: 'em',
|
|
29
|
-
mark: _adfSchema.em
|
|
30
|
-
}, {
|
|
31
|
-
name: 'strong',
|
|
32
|
-
mark: _adfSchema.strong
|
|
33
|
-
}, {
|
|
34
|
-
name: 'strike',
|
|
35
|
-
mark: _adfSchema.strike
|
|
36
|
-
}].concat(options.disableCode ? [] : {
|
|
37
|
-
name: 'code',
|
|
38
|
-
mark: _adfSchema.code
|
|
39
|
-
}).concat(options.disableSuperscriptAndSubscript ? [] : {
|
|
40
|
-
name: 'subsup',
|
|
41
|
-
mark: _adfSchema.subsup
|
|
42
|
-
}).concat(options.disableUnderline ? [] : {
|
|
43
|
-
name: 'underline',
|
|
44
|
-
mark: _adfSchema.underline
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
pmPlugins: function pmPlugins() {
|
|
48
|
-
return [{
|
|
49
|
-
name: 'textFormatting',
|
|
50
|
-
plugin: function plugin(_ref) {
|
|
51
|
-
var _api$dependencies$ana;
|
|
52
|
-
var dispatch = _ref.dispatch;
|
|
53
|
-
return (0, _main.plugin)(dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
name: 'textFormattingCursor',
|
|
57
|
-
plugin: function plugin() {
|
|
58
|
-
return _cursor.default;
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
name: 'textFormattingInputRule',
|
|
62
|
-
// Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
|
|
63
|
-
plugin: function plugin(_ref2) {
|
|
64
|
-
var _api$dependencies$ana2;
|
|
65
|
-
var schema = _ref2.schema,
|
|
66
|
-
featureFlags = _ref2.featureFlags;
|
|
67
|
-
return (0, _inputRule.default)(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
name: 'textFormattingSmartRule',
|
|
71
|
-
plugin: function plugin() {
|
|
72
|
-
var _api$dependencies$ana3;
|
|
73
|
-
return !options.disableSmartTextCompletion ? (0, _smartInputRule.default)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions) : undefined;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
name: 'textFormattingClear',
|
|
77
|
-
plugin: function plugin(_ref3) {
|
|
78
|
-
var dispatch = _ref3.dispatch;
|
|
79
|
-
return (0, _clearFormatting.plugin)(dispatch);
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
name: 'textFormattingClearKeymap',
|
|
83
|
-
plugin: function plugin() {
|
|
84
|
-
var _api$dependencies$ana4;
|
|
85
|
-
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
name: 'textFormattingKeymap',
|
|
89
|
-
plugin: function plugin(_ref4) {
|
|
90
|
-
var _api$dependencies$ana5;
|
|
91
|
-
var schema = _ref4.schema;
|
|
92
|
-
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
|
|
93
|
-
}
|
|
94
|
-
}];
|
|
95
|
-
},
|
|
96
|
-
primaryToolbarComponent: function primaryToolbarComponent(_ref5) {
|
|
97
|
-
var editorView = _ref5.editorView,
|
|
98
|
-
popupsMountPoint = _ref5.popupsMountPoint,
|
|
99
|
-
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
100
|
-
isToolbarReducedSpacing = _ref5.isToolbarReducedSpacing,
|
|
101
|
-
toolbarSize = _ref5.toolbarSize,
|
|
102
|
-
disabled = _ref5.disabled;
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
104
|
-
plugins: {
|
|
105
|
-
textFormattingState: _main.pluginKey,
|
|
106
|
-
clearFormattingPluginState: _clearFormatting.pluginKey
|
|
107
|
-
},
|
|
108
|
-
render: function render() {
|
|
109
|
-
var _api$dependencies$ana6;
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, {
|
|
111
|
-
editorState: editorView.state,
|
|
112
|
-
popupsMountPoint: popupsMountPoint,
|
|
113
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
114
|
-
toolbarSize: toolbarSize,
|
|
115
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
116
|
-
editorView: editorView,
|
|
117
|
-
isToolbarDisabled: disabled,
|
|
118
|
-
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
119
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
actions: {
|
|
125
|
-
toggleSuperscript: (0, _actions.toggleSuperscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions),
|
|
126
|
-
toggleSubscript: (0, _actions.toggleSubscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions),
|
|
127
|
-
toggleStrike: (0, _actions.toggleStrikeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions),
|
|
128
|
-
toggleCode: (0, _actions.toggleCodeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions),
|
|
129
|
-
toggleUnderline: (0, _actions.toggleUnderlineWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana11 = api.dependencies.analytics) === null || _api$dependencies$ana11 === void 0 ? void 0 : _api$dependencies$ana11.actions),
|
|
130
|
-
toggleEm: (0, _actions.toggleEmWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana12 = api.dependencies.analytics) === null || _api$dependencies$ana12 === void 0 ? void 0 : _api$dependencies$ana12.actions),
|
|
131
|
-
toggleStrong: (0, _actions.toggleStrongWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana13 = api.dependencies.analytics) === null || _api$dependencies$ana13 === void 0 ? void 0 : _api$dependencies$ana13.actions)
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
var _default = textFormatting;
|
|
136
|
-
exports.default = _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.keymapPlugin = keymapPlugin;
|
|
9
|
-
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
|
-
var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
|
|
11
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _clearFormatting = require("../commands/clear-formatting");
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
function keymapPlugin(editorAnalyticsAPI) {
|
|
16
|
-
var list = {};
|
|
17
|
-
keymaps.bindKeymapWithCommand(keymaps.clearFormatting.common, (0, _clearFormatting.clearFormattingWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
|
|
18
|
-
return (0, _keymap.keymap)(list);
|
|
19
|
-
}
|
|
20
|
-
var _default = keymapPlugin;
|
|
21
|
-
exports.default = _default;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.pluginKey = exports.plugin = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var _utils = require("../utils");
|
|
10
|
-
var pluginKey = new _state.PluginKey('clearFormattingPlugin');
|
|
11
|
-
exports.pluginKey = pluginKey;
|
|
12
|
-
var plugin = function plugin(dispatch) {
|
|
13
|
-
return new _safePlugin.SafePlugin({
|
|
14
|
-
state: {
|
|
15
|
-
init: function init(_config, state) {
|
|
16
|
-
return {
|
|
17
|
-
formattingIsPresent: (0, _utils.checkFormattingIsPresent)(state)
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
apply: function apply(_tr, pluginState, _oldState, newState) {
|
|
21
|
-
var formattingIsPresent = (0, _utils.checkFormattingIsPresent)(newState);
|
|
22
|
-
if (formattingIsPresent !== pluginState.formattingIsPresent) {
|
|
23
|
-
dispatch(pluginKey, {
|
|
24
|
-
formattingIsPresent: formattingIsPresent
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
formattingIsPresent: formattingIsPresent
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return pluginState;
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
key: pluginKey
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
exports.plugin = plugin;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var _default = new _safePlugin.SafePlugin({
|
|
10
|
-
props: {
|
|
11
|
-
handleClick: function handleClick(view, clickPos, event) {
|
|
12
|
-
// Don't apply in Edge as per ED-4546
|
|
13
|
-
if (navigator && /Edge\/\d/.test(navigator.userAgent)) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// @see ED-6231
|
|
18
|
-
if (clickPos > view.state.doc.content.size) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
var code = view.state.schema.marks.code;
|
|
22
|
-
var paragraph = view.state.schema.nodes.paragraph;
|
|
23
|
-
var $click = view.state.doc.resolve(clickPos);
|
|
24
|
-
var clickWasAtEdgeOfATextNode = ($click.nodeBefore ? $click.nodeBefore.isInline : $click.nodeAfter) && ($click.nodeAfter ? $click.nodeAfter.isInline : $click.nodeBefore) && $click.textOffset === 0;
|
|
25
|
-
var clickWasNearACodeMark = code && ($click.nodeBefore && code.isInSet($click.nodeBefore.marks) || $click.nodeAfter && code.isInSet($click.nodeAfter.marks));
|
|
26
|
-
|
|
27
|
-
// Find the starting position of the clicked dom-element
|
|
28
|
-
// TODO: Remove calls to private API
|
|
29
|
-
var clickedDOMElementPosition = event.target && event.target instanceof Node && view.posAtDOM(event.target);
|
|
30
|
-
var clickNode = view.state.doc.nodeAt(clickPos);
|
|
31
|
-
var clickWasAtTextNode = !!(clickNode && clickNode.isText);
|
|
32
|
-
var clickWasAtEndOfAParagraphNode = $click.parent.type === paragraph && $click.textOffset === 0 && $click.nodeAfter === null;
|
|
33
|
-
if (clickWasAtEdgeOfATextNode && clickWasNearACodeMark && clickedDOMElementPosition && (
|
|
34
|
-
// if click did not occur at a text node or end of paragraph, then
|
|
35
|
-
// it was at a directly adjacent non-text node, so we skip this manual
|
|
36
|
-
// text selection logic to preserve that non-text node's selection
|
|
37
|
-
clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
|
|
38
|
-
var clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node && code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
|
|
39
|
-
var nodeNextToClick = $click.nodeBefore && code.isInSet($click.nodeBefore.marks) ? $click.nodeAfter : $click.nodeBefore;
|
|
40
|
-
|
|
41
|
-
// Need to set the selection here to allow clicking between [code('text'),{<>},emoji()]
|
|
42
|
-
var tr = view.state.tr.setSelection(_state.TextSelection.near($click));
|
|
43
|
-
if (clickWasInsideNodeDOM) {
|
|
44
|
-
tr.setStoredMarks([code.create()]);
|
|
45
|
-
} else {
|
|
46
|
-
tr.setStoredMarks(nodeNextToClick ? nodeNextToClick.marks : []);
|
|
47
|
-
}
|
|
48
|
-
view.dispatch(tr);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
exports.default = _default;
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.codeRegex = exports.ValidCombinations = void 0;
|
|
8
|
-
exports.inputRulePlugin = inputRulePlugin;
|
|
9
|
-
exports.strongRegex2 = exports.strongRegex1 = exports.strikeRegex = exports.italicRegex2 = exports.italicRegex1 = void 0;
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
20
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
|
-
var _mark = require("@atlaskit/editor-common/mark");
|
|
22
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
|
-
var _ValidCombinations;
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
-
var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
|
|
27
|
-
ValidAutoformatChars["STRONG"] = "__";
|
|
28
|
-
ValidAutoformatChars["STRIKE"] = "~~";
|
|
29
|
-
ValidAutoformatChars["STRONG_MARKDOWN"] = "**";
|
|
30
|
-
ValidAutoformatChars["ITALIC_MARKDOWN"] = "*";
|
|
31
|
-
ValidAutoformatChars["ITALIC"] = "_";
|
|
32
|
-
ValidAutoformatChars["CODE"] = "`";
|
|
33
|
-
return ValidAutoformatChars;
|
|
34
|
-
}(ValidAutoformatChars || {});
|
|
35
|
-
var ValidCombinations = (_ValidCombinations = {}, (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.STRIKE, [
|
|
36
|
-
// e.g: _~~lol~~_
|
|
37
|
-
ValidAutoformatChars.ITALIC,
|
|
38
|
-
// e.g: __~~lol~~__
|
|
39
|
-
ValidAutoformatChars.STRONG,
|
|
40
|
-
// e.g: **~~lol~~**
|
|
41
|
-
ValidAutoformatChars.STRONG_MARKDOWN,
|
|
42
|
-
// e.g: *~~lol~~*
|
|
43
|
-
ValidAutoformatChars.ITALIC_MARKDOWN]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.STRONG, [
|
|
44
|
-
// e.g: ~~__lol__~~
|
|
45
|
-
ValidAutoformatChars.STRIKE,
|
|
46
|
-
// e.g: *__lol__*
|
|
47
|
-
ValidAutoformatChars.ITALIC_MARKDOWN]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.STRONG_MARKDOWN, [
|
|
48
|
-
// e.g: _**lol**_
|
|
49
|
-
ValidAutoformatChars.ITALIC,
|
|
50
|
-
// e.g: ~~**lol**~~
|
|
51
|
-
ValidAutoformatChars.STRIKE]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.ITALIC_MARKDOWN, [
|
|
52
|
-
// e.g: ~~*lol*~~
|
|
53
|
-
ValidAutoformatChars.STRIKE,
|
|
54
|
-
// e.g: __*lol*__
|
|
55
|
-
ValidAutoformatChars.STRONG]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.ITALIC, [
|
|
56
|
-
// e.g: ~~_lol_~~
|
|
57
|
-
ValidAutoformatChars.STRIKE,
|
|
58
|
-
// e.g: **_lol_**
|
|
59
|
-
ValidAutoformatChars.STRONG_MARKDOWN]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.CODE, [
|
|
60
|
-
// e.g: loko (`some code`
|
|
61
|
-
'( ']), _ValidCombinations);
|
|
62
|
-
exports.ValidCombinations = ValidCombinations;
|
|
63
|
-
function addMark(markType, schema, char) {
|
|
64
|
-
return function (state, match, start, end) {
|
|
65
|
-
var _schema$marks, _schema$marks$code;
|
|
66
|
-
var doc = state.doc,
|
|
67
|
-
schema = state.schema,
|
|
68
|
-
tr = state.tr;
|
|
69
|
-
var textPrefix = state.doc.textBetween(start, start + char.length);
|
|
70
|
-
|
|
71
|
-
// fixes the following case: my `*name` is *
|
|
72
|
-
// expected result: should ignore special characters inside "code"
|
|
73
|
-
if (textPrefix !== char || schema !== null && schema !== void 0 && (_schema$marks = schema.marks) !== null && _schema$marks !== void 0 && (_schema$marks$code = _schema$marks.code) !== null && _schema$marks$code !== void 0 && _schema$marks$code.isInSet(doc.resolve(start + 1).marks())) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Prevent autoformatting across hardbreaks
|
|
78
|
-
var containsHardBreak;
|
|
79
|
-
doc.nodesBetween(start, end, function (node) {
|
|
80
|
-
if (node.type === schema.nodes.hardBreak) {
|
|
81
|
-
containsHardBreak = true;
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
return !containsHardBreak;
|
|
85
|
-
});
|
|
86
|
-
if (containsHardBreak) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// fixes autoformatting in heading nodes: # Heading *bold*
|
|
91
|
-
// expected result: should not autoformat *bold*; <h1>Heading *bold*</h1>
|
|
92
|
-
var startPosResolved = doc.resolve(start);
|
|
93
|
-
var endPosResolved = doc.resolve(end);
|
|
94
|
-
if (startPosResolved.sameParent(endPosResolved) && !startPosResolved.parent.type.allowsMarkType(markType)) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
if (markType.name === 'code') {
|
|
98
|
-
(0, _mark.transformSmartCharsMentionsAndEmojis)(tr.mapping.map(start), tr.mapping.map(end), tr);
|
|
99
|
-
}
|
|
100
|
-
var mappedStart = tr.mapping.map(start);
|
|
101
|
-
var mappedEnd = tr.mapping.map(end);
|
|
102
|
-
tr.addMark(mappedStart, mappedEnd, markType.create());
|
|
103
|
-
var textSuffix = tr.doc.textBetween(mappedEnd - char.length, mappedEnd);
|
|
104
|
-
if (textSuffix === char) {
|
|
105
|
-
tr.delete(mappedEnd - char.length, mappedEnd);
|
|
106
|
-
}
|
|
107
|
-
if (textPrefix === char) {
|
|
108
|
-
tr.delete(mappedStart, mappedStart + char.length);
|
|
109
|
-
}
|
|
110
|
-
return tr.removeStoredMark(markType);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
var ReverseRegexExp = /*#__PURE__*/function (_RegExp) {
|
|
114
|
-
(0, _inherits2.default)(ReverseRegexExp, _RegExp);
|
|
115
|
-
var _super = _createSuper(ReverseRegexExp);
|
|
116
|
-
function ReverseRegexExp() {
|
|
117
|
-
(0, _classCallCheck2.default)(this, ReverseRegexExp);
|
|
118
|
-
return _super.apply(this, arguments);
|
|
119
|
-
}
|
|
120
|
-
(0, _createClass2.default)(ReverseRegexExp, [{
|
|
121
|
-
key: "exec",
|
|
122
|
-
value: function exec(str) {
|
|
123
|
-
if (!str) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
var reverseStr = (0, _toConsumableArray2.default)(str).reverse().join('');
|
|
127
|
-
var result = (0, _get2.default)((0, _getPrototypeOf2.default)(ReverseRegexExp.prototype), "exec", this).call(this, reverseStr);
|
|
128
|
-
if (!result) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
for (var i = 0; i < result.length; i++) {
|
|
132
|
-
if (result[i] && typeof result[i] === 'string') {
|
|
133
|
-
result[i] = (0, _toConsumableArray2.default)(result[i]).reverse().join('');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (result.input && typeof result.input === 'string') {
|
|
137
|
-
result.input = (0, _toConsumableArray2.default)(result.input).reverse().join('');
|
|
138
|
-
}
|
|
139
|
-
if (result.input && result[0]) {
|
|
140
|
-
result.index = result.input.length - result[0].length;
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
}]);
|
|
145
|
-
return ReverseRegexExp;
|
|
146
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(RegExp));
|
|
147
|
-
var buildRegex = function buildRegex(char) {
|
|
148
|
-
var escapedChar = char.replace(/(\W)/g, '\\$1');
|
|
149
|
-
var combinations = ValidCombinations[char].map(function (c) {
|
|
150
|
-
return c.replace(/(\W)/g, '\\$1');
|
|
151
|
-
}).join('|');
|
|
152
|
-
|
|
153
|
-
// Single X - https://regex101.com/r/McT3yq/14/
|
|
154
|
-
// Double X - https://regex101.com/r/pQUgjx/1/
|
|
155
|
-
var baseRegex = '^X(?=[^X\\s]).*?[^\\sX]X(?=[\\sOBJECT_REPLACEMENT_CHARACTER]COMBINATIONS|$)'.replace('OBJECT_REPLACEMENT_CHARACTER', _prosemirrorInputRules.leafNodeReplacementCharacter).replace('COMBINATIONS', combinations ? "|".concat(combinations) : '');
|
|
156
|
-
var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ? baseRegex.replaceAll('X', escapedChar) : baseRegex.replace(/X/g, escapedChar);
|
|
157
|
-
return new ReverseRegexExp(replacedRegex);
|
|
158
|
-
};
|
|
159
|
-
var strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);
|
|
160
|
-
exports.strongRegex1 = strongRegex1;
|
|
161
|
-
var strongRegex2 = buildRegex(ValidAutoformatChars.STRONG_MARKDOWN);
|
|
162
|
-
exports.strongRegex2 = strongRegex2;
|
|
163
|
-
var italicRegex1 = buildRegex(ValidAutoformatChars.ITALIC);
|
|
164
|
-
exports.italicRegex1 = italicRegex1;
|
|
165
|
-
var italicRegex2 = buildRegex(ValidAutoformatChars.ITALIC_MARKDOWN);
|
|
166
|
-
exports.italicRegex2 = italicRegex2;
|
|
167
|
-
var strikeRegex = buildRegex(ValidAutoformatChars.STRIKE);
|
|
168
|
-
exports.strikeRegex = strikeRegex;
|
|
169
|
-
var codeRegex = buildRegex(ValidAutoformatChars.CODE);
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Create input rules for strong mark
|
|
173
|
-
*
|
|
174
|
-
* @param {Schema} schema
|
|
175
|
-
* @returns {InputRuleWrapper[]}
|
|
176
|
-
*/
|
|
177
|
-
exports.codeRegex = codeRegex;
|
|
178
|
-
function getStrongInputRules(schema, editorAnalyticsAPI) {
|
|
179
|
-
var ruleWithStrongAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
180
|
-
action: _analytics.ACTION.FORMATTED,
|
|
181
|
-
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
182
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
183
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
184
|
-
attributes: {
|
|
185
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
186
|
-
}
|
|
187
|
-
}, editorAnalyticsAPI);
|
|
188
|
-
// **string** or __strong__ should bold the text
|
|
189
|
-
var doubleUnderscoreRule = (0, _prosemirrorInputRules.createRule)(strongRegex1, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG));
|
|
190
|
-
var doubleAsterixRule = (0, _prosemirrorInputRules.createRule)(strongRegex2, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG_MARKDOWN));
|
|
191
|
-
return [ruleWithStrongAnalytics(doubleUnderscoreRule), ruleWithStrongAnalytics(doubleAsterixRule)];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Create input rules for em mark
|
|
196
|
-
*
|
|
197
|
-
* @param {Schema} schema
|
|
198
|
-
* @returns {InputRuleWrapper[]}
|
|
199
|
-
*/
|
|
200
|
-
function getItalicInputRules(schema, editorAnalyticsAPI) {
|
|
201
|
-
var ruleWithItalicAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
202
|
-
action: _analytics.ACTION.FORMATTED,
|
|
203
|
-
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
204
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
205
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
206
|
-
attributes: {
|
|
207
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
208
|
-
}
|
|
209
|
-
}, editorAnalyticsAPI);
|
|
210
|
-
var underscoreRule = (0, _prosemirrorInputRules.createRule)(italicRegex1, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC));
|
|
211
|
-
var asterixRule = (0, _prosemirrorInputRules.createRule)(italicRegex2, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC_MARKDOWN));
|
|
212
|
-
return [ruleWithItalicAnalytics(underscoreRule), ruleWithItalicAnalytics(asterixRule)];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Create input rules for strike mark
|
|
217
|
-
*
|
|
218
|
-
* @param {Schema} schema
|
|
219
|
-
* @returns {InputRuleWrapper[]}
|
|
220
|
-
*/
|
|
221
|
-
function getStrikeInputRules(schema, editorAnalyticsAPI) {
|
|
222
|
-
var ruleWithStrikeAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
223
|
-
action: _analytics.ACTION.FORMATTED,
|
|
224
|
-
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
225
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
226
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
227
|
-
attributes: {
|
|
228
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
229
|
-
}
|
|
230
|
-
}, editorAnalyticsAPI);
|
|
231
|
-
var doubleTildeRule = (0, _prosemirrorInputRules.createRule)(strikeRegex, addMark(schema.marks.strike, schema, ValidAutoformatChars.STRIKE));
|
|
232
|
-
return [ruleWithStrikeAnalytics(doubleTildeRule)];
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Create input rules for code mark
|
|
237
|
-
*
|
|
238
|
-
* @param {Schema} schema
|
|
239
|
-
* @returns {InputRuleWrapper[]}
|
|
240
|
-
*/
|
|
241
|
-
function getCodeInputRules(schema, editorAnalyticsAPI) {
|
|
242
|
-
var ruleWithCodeAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
243
|
-
action: _analytics.ACTION.FORMATTED,
|
|
244
|
-
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
245
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
246
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
247
|
-
attributes: {
|
|
248
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
249
|
-
}
|
|
250
|
-
}, editorAnalyticsAPI);
|
|
251
|
-
var backTickRule = (0, _prosemirrorInputRules.createRule)(codeRegex, addMark(schema.marks.code, schema, ValidAutoformatChars.CODE));
|
|
252
|
-
return [ruleWithCodeAnalytics(backTickRule)];
|
|
253
|
-
}
|
|
254
|
-
function inputRulePlugin(schema,
|
|
255
|
-
// Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
|
|
256
|
-
_featureFlags, editorAnalyticsAPI) {
|
|
257
|
-
var rules = [];
|
|
258
|
-
if (schema.marks.strong) {
|
|
259
|
-
rules.push.apply(rules, (0, _toConsumableArray2.default)(getStrongInputRules(schema, editorAnalyticsAPI)));
|
|
260
|
-
}
|
|
261
|
-
if (schema.marks.em) {
|
|
262
|
-
rules.push.apply(rules, (0, _toConsumableArray2.default)(getItalicInputRules(schema, editorAnalyticsAPI)));
|
|
263
|
-
}
|
|
264
|
-
if (schema.marks.strike) {
|
|
265
|
-
rules.push.apply(rules, (0, _toConsumableArray2.default)(getStrikeInputRules(schema, editorAnalyticsAPI)));
|
|
266
|
-
}
|
|
267
|
-
if (schema.marks.code) {
|
|
268
|
-
rules.push.apply(rules, (0, _toConsumableArray2.default)(getCodeInputRules(schema, editorAnalyticsAPI)));
|
|
269
|
-
}
|
|
270
|
-
if (rules.length !== 0) {
|
|
271
|
-
return (0, _prosemirrorInputRules.createPlugin)('text-formatting', rules);
|
|
272
|
-
}
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
var _default = inputRulePlugin;
|
|
276
|
-
exports.default = _default;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = keymapPlugin;
|
|
8
|
-
var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
|
|
9
|
-
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
-
var _actions = require("../actions");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
15
|
-
var list = {};
|
|
16
|
-
if (schema.marks.strong) {
|
|
17
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, (0, _actions.toggleStrongWithAnalytics)(editorAnalyticsAPI)({
|
|
18
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
19
|
-
}), list);
|
|
20
|
-
}
|
|
21
|
-
if (schema.marks.em) {
|
|
22
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, (0, _actions.toggleEmWithAnalytics)(editorAnalyticsAPI)({
|
|
23
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
24
|
-
}), list);
|
|
25
|
-
}
|
|
26
|
-
if (schema.marks.code) {
|
|
27
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, (0, _actions.toggleCodeWithAnalytics)(editorAnalyticsAPI)({
|
|
28
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
29
|
-
}), list);
|
|
30
|
-
}
|
|
31
|
-
if (schema.marks.strike) {
|
|
32
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, (0, _actions.toggleStrikeWithAnalytics)(editorAnalyticsAPI)({
|
|
33
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
34
|
-
}), list);
|
|
35
|
-
}
|
|
36
|
-
if (schema.marks.subsup) {
|
|
37
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, (0, _actions.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)({
|
|
38
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
39
|
-
}), list);
|
|
40
|
-
}
|
|
41
|
-
if (schema.marks.subsup) {
|
|
42
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, (0, _actions.toggleSuperscriptWithAnalytics)(editorAnalyticsAPI)({
|
|
43
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
44
|
-
}), list);
|
|
45
|
-
}
|
|
46
|
-
if (schema.marks.underline) {
|
|
47
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, (0, _actions.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)({
|
|
48
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
49
|
-
}), list);
|
|
50
|
-
}
|
|
51
|
-
return (0, _keymap.keymap)(list);
|
|
52
|
-
}
|