@atlaskit/editor-core 178.0.1 → 178.1.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 +40 -0
- package/dist/cjs/create-editor/create-plugins-list.js +3 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/cjs/plugins/annotation/index.js +4 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/cjs/plugins/block-type/commands/delete-block-content.js +53 -0
- package/dist/cjs/plugins/block-type/commands/index.js +9 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +21 -4
- package/dist/cjs/plugins/card/toolbar.js +4 -2
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/cjs/plugins/collab-edit/actions.js +1 -1
- package/dist/cjs/plugins/collab-edit/index.js +1 -1
- package/dist/cjs/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/cjs/plugins/hyperlink/index.js +2 -1
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -2
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/cjs/plugins/list/styles.js +1 -1
- package/dist/cjs/plugins/media/commands/helpers.js +24 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +232 -183
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +1 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/keymap.js +46 -0
- package/dist/cjs/plugins/rank.js +3 -2
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +86 -0
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +84 -0
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +6 -56
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +22 -61
- package/dist/cjs/ui/Addon/ClickAreaInline/index.js +22 -56
- package/dist/cjs/ui/Addon/click-area-helper.js +28 -6
- package/dist/cjs/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/cjs/utils/document.js +11 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +3 -1
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +28 -13
- package/dist/es2019/plugins/annotation/index.js +4 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/es2019/plugins/block-type/commands/delete-block-content.js +49 -0
- package/dist/es2019/plugins/block-type/commands/index.js +2 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/pm-plugins/doc.js +19 -3
- package/dist/es2019/plugins/card/toolbar.js +4 -2
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +15 -9
- package/dist/es2019/plugins/collab-edit/actions.js +1 -1
- package/dist/es2019/plugins/collab-edit/index.js +1 -1
- package/dist/es2019/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/es2019/plugins/hyperlink/index.js +2 -1
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +11 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -5
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/es2019/plugins/list/styles.js +15 -11
- package/dist/es2019/plugins/media/commands/helpers.js +18 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +37 -13
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/es2019/plugins/rank.js +3 -2
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +79 -0
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +77 -0
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +5 -55
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +6 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +3 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +20 -31
- package/dist/es2019/ui/Addon/ClickAreaInline/index.js +20 -27
- package/dist/es2019/ui/Addon/click-area-helper.js +28 -6
- package/dist/es2019/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/es2019/utils/document.js +9 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +3 -1
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/esm/plugins/annotation/index.js +4 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/esm/plugins/block-type/commands/delete-block-content.js +46 -0
- package/dist/esm/plugins/block-type/commands/index.js +2 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/pm-plugins/doc.js +20 -3
- package/dist/esm/plugins/card/toolbar.js +4 -2
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/esm/plugins/collab-edit/actions.js +1 -1
- package/dist/esm/plugins/collab-edit/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/esm/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/esm/plugins/hyperlink/index.js +2 -1
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -3
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/esm/plugins/list/styles.js +1 -1
- package/dist/esm/plugins/media/commands/helpers.js +20 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +235 -184
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/esm/plugins/rank.js +3 -2
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +76 -0
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +74 -0
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +4 -57
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +17 -58
- package/dist/esm/ui/Addon/ClickAreaInline/index.js +17 -53
- package/dist/esm/ui/Addon/click-area-helper.js +28 -6
- package/dist/esm/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/esm/utils/document.js +11 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +10 -0
- package/dist/types/plugins/block-type/commands/index.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +6 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/types.d.ts +2 -0
- package/dist/types/plugins/selection/pm-plugins/events/create-selection-between.d.ts +4 -0
- package/dist/types/plugins/selection/pm-plugins/events/keydown.d.ts +2 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +2 -5
- package/dist/types/ui/Addon/ClickAreaInline/index.d.ts +2 -5
- package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
- package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
- package/docs/0-intro.tsx +9 -0
- package/package.json +17 -19
- package/report.api.md +4 -1
|
@@ -27,8 +27,6 @@ var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
|
27
27
|
|
|
28
28
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
29
29
|
|
|
30
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
31
|
-
|
|
32
30
|
var _prosemirrorState = require("prosemirror-state");
|
|
33
31
|
|
|
34
32
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -135,7 +133,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
135
133
|
value: function createDomRef() {
|
|
136
134
|
var domRef = document.createElement('div');
|
|
137
135
|
|
|
138
|
-
if (
|
|
136
|
+
if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
|
|
139
137
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
140
138
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
141
139
|
domRef.contentEditable = 'true';
|
|
@@ -558,7 +558,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
558
558
|
value: function createDomRef() {
|
|
559
559
|
var domRef = document.createElement('div');
|
|
560
560
|
|
|
561
|
-
if (
|
|
561
|
+
if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
|
|
562
562
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
563
563
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
564
564
|
domRef.contentEditable = 'true';
|
|
@@ -18,6 +18,8 @@ var _pluginKey = require("../pm-plugins/plugin-key");
|
|
|
18
18
|
|
|
19
19
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
20
20
|
|
|
21
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
22
|
+
|
|
21
23
|
var _captions = require("../commands/captions");
|
|
22
24
|
|
|
23
25
|
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); }
|
|
@@ -36,6 +38,8 @@ function keymapPlugin(options) {
|
|
|
36
38
|
if ((0, _mediaCommon.getMediaFeatureFlag)('captions', featureFlags)) {
|
|
37
39
|
keymaps.bindKeymapWithCommand(keymaps.moveDown.common, insertAndSelectCaption, list);
|
|
38
40
|
keymaps.bindKeymapWithCommand(keymaps.tab.common, insertAndSelectCaption, list);
|
|
41
|
+
keymaps.bindKeymapWithCommand(keymaps.moveLeft.common, arrowLeftFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
|
|
42
|
+
keymaps.bindKeymapWithCommand(keymaps.moveRight.common, arrowRightFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, splitMediaGroup, list);
|
|
@@ -75,5 +79,47 @@ var insertAndSelectCaption = function insertAndSelectCaption(state, dispatch) {
|
|
|
75
79
|
return false;
|
|
76
80
|
};
|
|
77
81
|
|
|
82
|
+
var arrowLeftFromMediaSingle = function arrowLeftFromMediaSingle(editorSelectionAPI) {
|
|
83
|
+
return function (state, dispatch) {
|
|
84
|
+
var selection = state.selection;
|
|
85
|
+
|
|
86
|
+
if (editorSelectionAPI && selection instanceof _prosemirrorState.NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
87
|
+
var tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
88
|
+
selectionRelativeToNode: undefined,
|
|
89
|
+
selection: new _selection.GapCursorSelection(state.doc.resolve(selection.from), _selection.Side.LEFT)
|
|
90
|
+
})(state);
|
|
91
|
+
|
|
92
|
+
if (dispatch) {
|
|
93
|
+
dispatch(tr);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return false;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var arrowRightFromMediaSingle = function arrowRightFromMediaSingle(editorSelectionAPI) {
|
|
104
|
+
return function (state, dispatch) {
|
|
105
|
+
var selection = state.selection;
|
|
106
|
+
|
|
107
|
+
if (editorSelectionAPI && selection instanceof _prosemirrorState.NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
108
|
+
var tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
109
|
+
selectionRelativeToNode: undefined,
|
|
110
|
+
selection: new _selection.GapCursorSelection(state.doc.resolve(selection.to), _selection.Side.RIGHT)
|
|
111
|
+
})(state);
|
|
112
|
+
|
|
113
|
+
if (dispatch) {
|
|
114
|
+
dispatch(tr);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
78
124
|
var _default = keymapPlugin;
|
|
79
125
|
exports.default = _default;
|
package/dist/cjs/plugins/rank.js
CHANGED
|
@@ -10,9 +10,10 @@ var _default = {
|
|
|
10
10
|
'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap', // task/decisions keymap needs to be above table keymap so can indent actions in a table
|
|
11
11
|
'tasksAndDecisionsKeyMap', // expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
|
|
12
12
|
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
|
|
13
|
-
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', //
|
|
13
|
+
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', // media keymap above selection keymap to allow navigating past the mediaSingle node
|
|
14
|
+
'mediaKeymap', // selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
14
15
|
// left/right arrows
|
|
15
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', '
|
|
16
|
+
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
16
17
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
17
18
|
marks: [// Fragment mark is both for inline and block elements
|
|
18
19
|
'fragment', // Inline marks
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onCreateSelectionBetween = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
function findEmptySelectableParentNodePosition($pos, isValidPosition) {
|
|
11
|
+
var doc = $pos.doc;
|
|
12
|
+
|
|
13
|
+
if ($pos.pos + 1 > doc.content.size) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if ($pos.depth === 0) {
|
|
18
|
+
if (isValidPosition($pos)) {
|
|
19
|
+
return $pos;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (isValidPosition($pos)) {
|
|
26
|
+
return $pos;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var positionLevelUp = $pos.before();
|
|
30
|
+
var resolvedPositionLevelUp = doc.resolve(positionLevelUp);
|
|
31
|
+
return findEmptySelectableParentNodePosition(resolvedPositionLevelUp, isValidPosition);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var checkPositionNode = function checkPositionNode($pos) {
|
|
35
|
+
var maybeNode = $pos.nodeAfter;
|
|
36
|
+
|
|
37
|
+
if (!maybeNode || !maybeNode.isBlock) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (maybeNode.isAtom) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var isParentEmpty = maybeNode.content.size === 0 || maybeNode.textContent === '';
|
|
46
|
+
return isParentEmpty && _prosemirrorState.NodeSelection.isSelectable(maybeNode);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function findNextSelectionPosition(_ref) {
|
|
50
|
+
var $targetHead = _ref.$targetHead,
|
|
51
|
+
$anchor = _ref.$anchor,
|
|
52
|
+
doc = _ref.doc;
|
|
53
|
+
var direction = $anchor.pos < $targetHead.pos ? 'down' : 'up';
|
|
54
|
+
var maybeNextPosition = findEmptySelectableParentNodePosition($targetHead, checkPositionNode);
|
|
55
|
+
|
|
56
|
+
if (maybeNextPosition && maybeNextPosition.nodeAfter) {
|
|
57
|
+
var nodeAfter = maybeNextPosition.nodeAfter;
|
|
58
|
+
var pos = maybeNextPosition.pos;
|
|
59
|
+
var nextPositionToSelect = direction === 'down' ? Math.min(nodeAfter.nodeSize + pos, doc.content.size) : Math.max(pos, 0);
|
|
60
|
+
return doc.resolve(nextPositionToSelect);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
|
|
67
|
+
if ($anchor.pos === $head.pos) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var $nextHeadPosition = findNextSelectionPosition({
|
|
72
|
+
$targetHead: $head,
|
|
73
|
+
$anchor: $anchor,
|
|
74
|
+
doc: view.state.doc
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (!$nextHeadPosition) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var forcedTextSelection = _prosemirrorState.TextSelection.create(view.state.doc, $anchor.pos, $nextHeadPosition.pos);
|
|
82
|
+
|
|
83
|
+
return forcedTextSelection;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.onCreateSelectionBetween = onCreateSelectionBetween;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onKeydown = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var isCollpasedExpand = function isCollpasedExpand(node) {
|
|
11
|
+
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && !node.attrs.__expanded);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var findFixedProblematicNodePosition = function findFixedProblematicNodePosition($pos, direction) {
|
|
15
|
+
if ($pos.pos === 0 || $pos.depth === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var pos = direction === 'up' ? $pos.before() : $pos.after();
|
|
20
|
+
var $posResolved = $pos.doc.resolve(pos);
|
|
21
|
+
var maybeExpandNode = direction === 'up' ? $posResolved.nodeBefore : $posResolved.nodeAfter;
|
|
22
|
+
|
|
23
|
+
if (maybeExpandNode && isCollpasedExpand(maybeExpandNode)) {
|
|
24
|
+
var nodeSize = maybeExpandNode.nodeSize;
|
|
25
|
+
var expandPosition = direction === 'up' ? pos - nodeSize : pos + nodeSize;
|
|
26
|
+
var startPosNode = Math.max(expandPosition, 0);
|
|
27
|
+
var $startPosNode = $pos.doc.resolve(Math.min(startPosNode, $pos.doc.content.size));
|
|
28
|
+
return $startPosNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var onKeydown = function onKeydown(view, event) {
|
|
35
|
+
/*
|
|
36
|
+
* This workaround is needed for some specific situation with collapsed expand.
|
|
37
|
+
*
|
|
38
|
+
* The way expand was built, no browser reconize selection on it.
|
|
39
|
+
* For instance, when a selection going to a "collapsed" expand
|
|
40
|
+
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
41
|
+
* this behavior is caused because the expand content is never true hidden
|
|
42
|
+
* we just set the height to 1px.
|
|
43
|
+
*
|
|
44
|
+
* So, we need to capture a possible selection event
|
|
45
|
+
* when a collapsed exxpand is the next node in the common depth.
|
|
46
|
+
* If that is true, we create a new TextSelection and stop the event bubble
|
|
47
|
+
*/
|
|
48
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!['ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', 'Home', 'End'].includes(event.key)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var _view$state$selection = view.state.selection,
|
|
61
|
+
$head = _view$state$selection.$head,
|
|
62
|
+
$anchor = _view$state$selection.$anchor;
|
|
63
|
+
|
|
64
|
+
if (event.key === 'ArrowRight' && $head.nodeAfter || event.key === 'ArrowLeft' && $head.nodeBefore) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var direction = ['ArrowLeft', 'ArrowUp', 'Home'].includes(event.key) ? 'up' : 'down';
|
|
69
|
+
var $fixedProblematicNodePosition = findFixedProblematicNodePosition($head, direction);
|
|
70
|
+
|
|
71
|
+
if ($fixedProblematicNodePosition) {
|
|
72
|
+
var forcedTextSelection = _prosemirrorState.TextSelection.create(view.state.doc, $anchor.pos, $fixedProblematicNodePosition.pos);
|
|
73
|
+
|
|
74
|
+
var tr = view.state.tr;
|
|
75
|
+
tr.setSelection(forcedTextSelection);
|
|
76
|
+
view.dispatch(tr);
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
exports.onKeydown = onKeydown;
|
|
@@ -17,6 +17,10 @@ var _types = require("../types");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("../utils");
|
|
19
19
|
|
|
20
|
+
var _keydown = require("./events/keydown");
|
|
21
|
+
|
|
22
|
+
var _createSelectionBetween = require("./events/create-selection-between");
|
|
23
|
+
|
|
20
24
|
var getInitialState = function getInitialState(state) {
|
|
21
25
|
return {
|
|
22
26
|
decorationSet: (0, _utils.getDecorations)(state.tr),
|
|
@@ -26,28 +30,6 @@ var getInitialState = function getInitialState(state) {
|
|
|
26
30
|
|
|
27
31
|
exports.getInitialState = getInitialState;
|
|
28
32
|
|
|
29
|
-
var toggleContentEditable = function toggleContentEditable(node) {
|
|
30
|
-
var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
31
|
-
|
|
32
|
-
if (root || node.getAttribute('contenteditable') === 'true') {
|
|
33
|
-
var wasTrue = node.getAttribute('contenteditable') === 'true';
|
|
34
|
-
node.setAttribute('contenteditable', 'false');
|
|
35
|
-
requestAnimationFrame(function () {
|
|
36
|
-
if (wasTrue) {
|
|
37
|
-
node.setAttribute('contenteditable', 'true');
|
|
38
|
-
} else {
|
|
39
|
-
node.removeAttribute('contenteditable');
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
} // any children with contenteditable = true block selection from proceeding
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var children = Array.from(node.children);
|
|
46
|
-
children.forEach(function (child) {
|
|
47
|
-
return toggleContentEditable(child);
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
33
|
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
52
34
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
53
35
|
return new _safePlugin.SafePlugin({
|
|
@@ -111,10 +93,12 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
|
111
93
|
return true;
|
|
112
94
|
},
|
|
113
95
|
props: {
|
|
96
|
+
createSelectionBetween: _createSelectionBetween.onCreateSelectionBetween,
|
|
114
97
|
decorations: function decorations(state) {
|
|
115
98
|
return (0, _pluginFactory.getPluginState)(state).decorationSet;
|
|
116
99
|
},
|
|
117
100
|
handleDOMEvents: {
|
|
101
|
+
keydown: _keydown.onKeydown,
|
|
118
102
|
// We only want to fire analytics for a click and drag range/cell selection when
|
|
119
103
|
// the user has finished, otherwise we will get an event almost every time they move
|
|
120
104
|
// their mouse which is too much
|
|
@@ -129,40 +113,6 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
|
129
113
|
}
|
|
130
114
|
}
|
|
131
115
|
|
|
132
|
-
return false;
|
|
133
|
-
},
|
|
134
|
-
keydown: function keydown(editorView, event) {
|
|
135
|
-
// Bugfix for block ReactNodeViews like table and extension
|
|
136
|
-
// They could not be selected with Shift + ArrowDown/ArrowUp
|
|
137
|
-
// Fixed when contenteditable = false, but then you couldn't edit their contents
|
|
138
|
-
// Therefore, briefly set contenteditable=false to allow the selection through, then set it back to true
|
|
139
|
-
if (event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
140
|
-
var state = editorView.state; // If current depth is on the top most level, skip that
|
|
141
|
-
|
|
142
|
-
if (state.selection.$head.depth <= 0) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
var pos;
|
|
147
|
-
|
|
148
|
-
if (event.key === 'ArrowDown') {
|
|
149
|
-
pos = state.selection.$head.after();
|
|
150
|
-
} else {
|
|
151
|
-
pos = Math.max(state.selection.$head.before() - 1, 0); // block extensions only take up one position, dont need to get before()
|
|
152
|
-
|
|
153
|
-
if (!editorView.nodeDOM(pos)) {
|
|
154
|
-
pos = state.doc.resolve(pos).before();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
var node = editorView.nodeDOM(pos);
|
|
159
|
-
|
|
160
|
-
if (node instanceof HTMLDivElement && node.className.includes('View-content-wrap') // class added by ReactNodeView
|
|
161
|
-
) {
|
|
162
|
-
toggleContentEditable(node, true);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
116
|
return false;
|
|
167
117
|
}
|
|
168
118
|
}
|
|
@@ -229,7 +229,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
229
229
|
zIndex: _editorSharedStyles.akEditorMenuZIndex,
|
|
230
230
|
fitWidth: fitWidth,
|
|
231
231
|
onOpenChange: this.onOpenChange,
|
|
232
|
-
|
|
232
|
+
closeOnTab: true,
|
|
233
233
|
trigger: (0, _react2.jsx)(_ToolbarButton.default, {
|
|
234
234
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.TEXT_COLOR,
|
|
235
235
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -47,9 +47,14 @@ var FormattingTextDropdownMenu = /*#__PURE__*/_react.default.memo(function (_ref
|
|
|
47
47
|
}];
|
|
48
48
|
}, [items]);
|
|
49
49
|
var onItemActivated = (0, _react.useCallback)(function (_ref2) {
|
|
50
|
-
var item = _ref2.item
|
|
50
|
+
var item = _ref2.item,
|
|
51
|
+
_ref2$shouldCloseMenu = _ref2.shouldCloseMenu,
|
|
52
|
+
shouldCloseMenu = _ref2$shouldCloseMenu === void 0 ? true : _ref2$shouldCloseMenu;
|
|
51
53
|
item.command(editorView.state, editorView.dispatch);
|
|
52
|
-
|
|
54
|
+
|
|
55
|
+
if (shouldCloseMenu) {
|
|
56
|
+
closeMenu();
|
|
57
|
+
}
|
|
53
58
|
}, [editorView.state, editorView.dispatch, closeMenu]);
|
|
54
59
|
return /*#__PURE__*/_react.default.createElement(_DropdownMenu.default, {
|
|
55
60
|
mountTo: popupsMountPoint,
|
|
@@ -65,8 +65,10 @@ function ToolbarDropdown(props) {
|
|
|
65
65
|
var items = useItems(props);
|
|
66
66
|
|
|
67
67
|
var handleOnItemActivated = function handleOnItemActivated(_ref) {
|
|
68
|
-
var item = _ref.item
|
|
69
|
-
|
|
68
|
+
var item = _ref.item,
|
|
69
|
+
_ref$shouldCloseMenu = _ref.shouldCloseMenu,
|
|
70
|
+
shouldCloseMenu = _ref$shouldCloseMenu === void 0 ? true : _ref$shouldCloseMenu;
|
|
71
|
+
setIsDropdownOpen(!shouldCloseMenu);
|
|
70
72
|
return onItemActivated({
|
|
71
73
|
editorView: props.editorView,
|
|
72
74
|
buttonName: item.value.name
|
|
@@ -5,21 +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;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
|
+
exports.default = exports.ClickAreaBlock = void 0;
|
|
23
9
|
|
|
24
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
25
11
|
|
|
@@ -31,55 +17,30 @@ var _clickAreaHelper = require("../click-area-helper");
|
|
|
31
17
|
|
|
32
18
|
var _templateObject;
|
|
33
19
|
|
|
34
|
-
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); }; }
|
|
35
|
-
|
|
36
|
-
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; } }
|
|
37
|
-
|
|
38
20
|
var clickWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n height: 100%;\n"])));
|
|
39
21
|
|
|
40
|
-
var ClickAreaBlock =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
function ClickAreaBlock() {
|
|
46
|
-
var _this;
|
|
47
|
-
|
|
48
|
-
(0, _classCallCheck2.default)(this, ClickAreaBlock);
|
|
22
|
+
var ClickAreaBlock = function ClickAreaBlock(_ref) {
|
|
23
|
+
var editorView = _ref.editorView,
|
|
24
|
+
editorDisabled = _ref.editorDisabled,
|
|
25
|
+
children = _ref.children;
|
|
49
26
|
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
var handleMouseDown = _react.default.useCallback(function (event) {
|
|
28
|
+
if (!editorView) {
|
|
29
|
+
return;
|
|
52
30
|
}
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var _this$props = _this.props,
|
|
57
|
-
view = _this$props.editorView,
|
|
58
|
-
editorDisabled = _this$props.editorDisabled;
|
|
59
|
-
|
|
60
|
-
if (!view) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!editorDisabled) {
|
|
65
|
-
// if the editor is disabled -- we don't want to intercept any click events
|
|
66
|
-
(0, _clickAreaHelper.clickAreaClickHandler)(view, event);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
(0, _createClass2.default)(ClickAreaBlock, [{
|
|
73
|
-
key: "render",
|
|
74
|
-
value: function render() {
|
|
75
|
-
return (0, _react2.jsx)("div", {
|
|
76
|
-
"data-testid": "click-wrapper",
|
|
77
|
-
css: clickWrapper,
|
|
78
|
-
onClick: this.handleClick
|
|
79
|
-
}, this.props.children);
|
|
32
|
+
if (!editorDisabled) {
|
|
33
|
+
(0, _clickAreaHelper.clickAreaClickHandler)(editorView, event);
|
|
80
34
|
}
|
|
81
|
-
}]);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
35
|
+
}, [editorView, editorDisabled]);
|
|
36
|
+
|
|
37
|
+
return (0, _react2.jsx)("div", {
|
|
38
|
+
"data-testid": "click-wrapper",
|
|
39
|
+
css: clickWrapper,
|
|
40
|
+
onMouseDown: handleMouseDown
|
|
41
|
+
}, children);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.ClickAreaBlock = ClickAreaBlock;
|
|
45
|
+
var _default = ClickAreaBlock;
|
|
46
|
+
exports.default = _default;
|
|
@@ -5,21 +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;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
|
+
exports.default = exports.ClickAreaInline = void 0;
|
|
23
9
|
|
|
24
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
25
11
|
|
|
@@ -31,50 +17,30 @@ var _commands = require("../../../commands");
|
|
|
31
17
|
|
|
32
18
|
var _templateObject;
|
|
33
19
|
|
|
34
|
-
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); }; }
|
|
35
|
-
|
|
36
|
-
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; } }
|
|
37
|
-
|
|
38
20
|
var clickArea = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n"])));
|
|
39
21
|
|
|
40
|
-
var ClickAreaInline =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var _super = _createSuper(ClickAreaInline);
|
|
44
|
-
|
|
45
|
-
function ClickAreaInline() {
|
|
46
|
-
var _this;
|
|
47
|
-
|
|
48
|
-
(0, _classCallCheck2.default)(this, ClickAreaInline);
|
|
22
|
+
var ClickAreaInline = function ClickAreaInline(_ref) {
|
|
23
|
+
var editorView = _ref.editorView,
|
|
24
|
+
children = _ref.children;
|
|
49
25
|
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
var handleMouseDown = _react.default.useCallback(function (event) {
|
|
27
|
+
if (!editorView) {
|
|
28
|
+
return;
|
|
52
29
|
}
|
|
53
30
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (editorView) {
|
|
59
|
-
if ((0, _commands.createParagraphAtEnd)()(editorView.state, editorView.dispatch)) {
|
|
60
|
-
editorView.focus();
|
|
61
|
-
event.stopPropagation();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return _this;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
(0, _createClass2.default)(ClickAreaInline, [{
|
|
69
|
-
key: "render",
|
|
70
|
-
value: function render() {
|
|
71
|
-
return (0, _react2.jsx)("div", {
|
|
72
|
-
css: clickArea,
|
|
73
|
-
onClick: this.handleClick
|
|
74
|
-
});
|
|
31
|
+
if ((0, _commands.createParagraphAtEnd)()(editorView.state, editorView.dispatch)) {
|
|
32
|
+
editorView.focus();
|
|
33
|
+
event.stopPropagation();
|
|
75
34
|
}
|
|
76
|
-
}]);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
35
|
+
}, [editorView]);
|
|
36
|
+
|
|
37
|
+
return (0, _react2.jsx)("div", {
|
|
38
|
+
"data-testid": "click-wrapper",
|
|
39
|
+
css: clickArea,
|
|
40
|
+
onMouseDown: handleMouseDown
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.ClickAreaInline = ClickAreaInline;
|
|
45
|
+
var _default = ClickAreaInline;
|
|
46
|
+
exports.default = _default;
|