@atlaskit/editor-core 188.5.0 → 188.6.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 +13 -0
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +1 -6
- package/dist/cjs/plugins/expand/index.js +0 -2
- package/dist/cjs/plugins/expand/nodeviews/index.js +37 -13
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/cjs/plugins/status/actions.js +14 -11
- package/dist/cjs/plugins/status/index.js +17 -8
- package/dist/cjs/plugins/status/keymap.js +1 -1
- package/dist/cjs/plugins/status/ui/statusPicker.js +2 -2
- package/dist/cjs/ui/Addon/click-area-helper.js +9 -11
- package/dist/cjs/ui/ContentStyles/index.js +13 -13
- package/dist/cjs/utils/selection.js +12 -14
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +1 -6
- package/dist/es2019/plugins/expand/index.js +0 -2
- package/dist/es2019/plugins/expand/nodeviews/index.js +37 -13
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/es2019/plugins/status/actions.js +3 -2
- package/dist/es2019/plugins/status/index.js +91 -80
- package/dist/es2019/plugins/status/keymap.js +1 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +1 -1
- package/dist/es2019/ui/Addon/click-area-helper.js +4 -6
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/utils/selection.js +2 -17
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +1 -6
- package/dist/esm/plugins/expand/index.js +0 -2
- package/dist/esm/plugins/expand/nodeviews/index.js +37 -13
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/esm/plugins/status/actions.js +14 -11
- package/dist/esm/plugins/status/index.js +17 -8
- package/dist/esm/plugins/status/keymap.js +1 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +1 -1
- package/dist/esm/ui/Addon/click-area-helper.js +4 -6
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/utils/selection.js +2 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +22 -8
- package/dist/types/plugins/expand/index.d.ts +1 -1
- package/dist/types/plugins/expand/nodeviews/index.d.ts +3 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/status/actions.d.ts +4 -2
- package/dist/types/plugins/status/index.d.ts +12 -3
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/status/plugin.d.ts +1 -1
- package/dist/types/utils/selection.d.ts +1 -4
- package/package.json +4 -3
- package/dist/cjs/plugins/selection/actions.js +0 -11
- package/dist/cjs/plugins/selection/commands.js +0 -257
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +0 -272
- package/dist/cjs/plugins/selection/gap-cursor/direction.js +0 -23
- package/dist/cjs/plugins/selection/gap-cursor/selection.js +0 -30
- package/dist/cjs/plugins/selection/gap-cursor/styles.js +0 -17
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-ignored.js +0 -12
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -12
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -103
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +0 -137
- package/dist/cjs/plugins/selection/gap-cursor-selection.js +0 -37
- package/dist/cjs/plugins/selection/index.js +0 -65
- package/dist/cjs/plugins/selection/plugin-factory.js +0 -49
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +0 -92
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +0 -115
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -46
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +0 -160
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -8
- package/dist/cjs/plugins/selection/pm-plugins/keymap.js +0 -16
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +0 -104
- package/dist/cjs/plugins/selection/reducer.js +0 -26
- package/dist/cjs/plugins/selection/types.js +0 -20
- package/dist/cjs/plugins/selection/utils.js +0 -280
- package/dist/cjs/selection-api/api.js +0 -27
- package/dist/es2019/plugins/selection/actions.js +0 -5
- package/dist/es2019/plugins/selection/commands.js +0 -250
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +0 -270
- package/dist/es2019/plugins/selection/gap-cursor/direction.js +0 -15
- package/dist/es2019/plugins/selection/gap-cursor/selection.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/styles.js +0 -145
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-ignored.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -94
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +0 -124
- package/dist/es2019/plugins/selection/gap-cursor-selection.js +0 -2
- package/dist/es2019/plugins/selection/index.js +0 -51
- package/dist/es2019/plugins/selection/plugin-factory.js +0 -43
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +0 -89
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +0 -112
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -40
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +0 -158
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -2
- package/dist/es2019/plugins/selection/pm-plugins/keymap.js +0 -10
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +0 -97
- package/dist/es2019/plugins/selection/reducer.js +0 -18
- package/dist/es2019/plugins/selection/types.js +0 -9
- package/dist/es2019/plugins/selection/utils.js +0 -233
- package/dist/es2019/selection-api/api.js +0 -20
- package/dist/esm/plugins/selection/actions.js +0 -5
- package/dist/esm/plugins/selection/commands.js +0 -251
- package/dist/esm/plugins/selection/gap-cursor/actions.js +0 -266
- package/dist/esm/plugins/selection/gap-cursor/direction.js +0 -15
- package/dist/esm/plugins/selection/gap-cursor/selection.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/styles.js +0 -10
- package/dist/esm/plugins/selection/gap-cursor/utils/is-ignored.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -97
- package/dist/esm/plugins/selection/gap-cursor/utils.js +0 -128
- package/dist/esm/plugins/selection/gap-cursor-selection.js +0 -2
- package/dist/esm/plugins/selection/index.js +0 -58
- package/dist/esm/plugins/selection/plugin-factory.js +0 -43
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +0 -86
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +0 -110
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -40
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +0 -154
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -2
- package/dist/esm/plugins/selection/pm-plugins/keymap.js +0 -10
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +0 -98
- package/dist/esm/plugins/selection/reducer.js +0 -19
- package/dist/esm/plugins/selection/types.js +0 -9
- package/dist/esm/plugins/selection/utils.js +0 -241
- package/dist/esm/selection-api/api.js +0 -21
- package/dist/types/plugins/selection/actions.d.ts +0 -17
- package/dist/types/plugins/selection/commands.d.ts +0 -10
- package/dist/types/plugins/selection/gap-cursor/actions.d.ts +0 -25
- package/dist/types/plugins/selection/gap-cursor/direction.d.ts +0 -10
- package/dist/types/plugins/selection/gap-cursor/selection.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/styles.d.ts +0 -2
- package/dist/types/plugins/selection/gap-cursor/utils/is-ignored.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/utils/is-valid-target-node.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/utils/place-gap-cursor.d.ts +0 -2
- package/dist/types/plugins/selection/gap-cursor/utils.d.ts +0 -8
- package/dist/types/plugins/selection/gap-cursor-selection.d.ts +0 -2
- package/dist/types/plugins/selection/index.d.ts +0 -13
- package/dist/types/plugins/selection/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/events/create-selection-between.d.ts +0 -4
- package/dist/types/plugins/selection/pm-plugins/events/keydown.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-keymap.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-main.d.ts +0 -6
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-plugin-key.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +0 -7
- package/dist/types/plugins/selection/reducer.d.ts +0 -3
- package/dist/types/plugins/selection/types.d.ts +0 -12
- package/dist/types/plugins/selection/utils.d.ts +0 -58
- package/dist/types/selection-api/api.d.ts +0 -11
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createEditorSelectionAPI } from '../../../selection-api/api';
|
|
2
1
|
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
|
|
3
2
|
import { datePlugin } from '../../../plugins/date';
|
|
4
3
|
import { captionPlugin } from '@atlaskit/editor-plugin-caption';
|
|
@@ -37,7 +36,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
37
36
|
const isChromeless = appearance === 'chromeless';
|
|
38
37
|
const isFullPage = fullPageCheck(appearance);
|
|
39
38
|
const getEditorFeatureFlags = () => featureFlags;
|
|
40
|
-
const editorSelectionAPI = createEditorSelectionAPI();
|
|
41
39
|
const defaultPreset = createDefaultPreset({
|
|
42
40
|
...props,
|
|
43
41
|
createAnalyticsEvent
|
|
@@ -109,7 +107,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
109
107
|
allowDropzoneDropLine: isFullPage,
|
|
110
108
|
allowMediaSingleEditable: !isMobile,
|
|
111
109
|
allowRemoteDimensionsFetch: !isMobile,
|
|
112
|
-
editorSelectionAPI,
|
|
113
110
|
// This is a wild one. I didnt quite understand what the code was doing
|
|
114
111
|
// so a bit of guess for now.
|
|
115
112
|
allowMarkingUploadsAsIncomplete: isMobile,
|
|
@@ -157,7 +154,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
157
154
|
allowContextualMenu: !isMobile,
|
|
158
155
|
fullWidthEnabled: appearance === 'full-width',
|
|
159
156
|
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
160
|
-
editorSelectionAPI,
|
|
161
157
|
getEditorFeatureFlags
|
|
162
158
|
}]);
|
|
163
159
|
}
|
|
@@ -198,8 +194,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
198
194
|
disableLayout: true
|
|
199
195
|
},
|
|
200
196
|
allowMediaGroup: false,
|
|
201
|
-
isCopyPasteEnabled: true
|
|
202
|
-
editorSelectionAPI
|
|
197
|
+
isCopyPasteEnabled: true
|
|
203
198
|
}]);
|
|
204
199
|
}
|
|
205
200
|
return builder;
|
|
@@ -8,8 +8,6 @@ import { getToolbarConfig } from './toolbar';
|
|
|
8
8
|
import { createExpandNode } from './commands';
|
|
9
9
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
10
10
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
11
|
-
// TO-DO: replace with editor-plugin-selection
|
|
12
|
-
|
|
13
11
|
const expandPlugin = ({
|
|
14
12
|
config: options = {},
|
|
15
13
|
api
|
|
@@ -56,8 +56,12 @@ export class ExpandNodeView {
|
|
|
56
56
|
dispatch
|
|
57
57
|
} = this.view;
|
|
58
58
|
if (this.selectNearNode) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const tr = this.selectNearNode({
|
|
60
|
+
selectionRelativeToNode: RelativeSelectionPos.Start
|
|
61
|
+
})(state);
|
|
62
|
+
if (dispatch) {
|
|
63
|
+
dispatch(tr);
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
const pos = this.getPos();
|
|
63
67
|
if (typeof pos === 'number') {
|
|
@@ -279,13 +283,19 @@ export class ExpandNodeView {
|
|
|
279
283
|
selectionEnd
|
|
280
284
|
} = this.input;
|
|
281
285
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
282
|
-
var _this$api2;
|
|
283
286
|
event.preventDefault();
|
|
284
287
|
const {
|
|
285
|
-
state
|
|
288
|
+
state,
|
|
289
|
+
dispatch
|
|
286
290
|
} = this.view;
|
|
287
291
|
this.view.focus();
|
|
288
|
-
|
|
292
|
+
const tr = this.selectNearNode({
|
|
293
|
+
selectionRelativeToNode: RelativeSelectionPos.End,
|
|
294
|
+
selection: NodeSelection.create(state.doc, pos)
|
|
295
|
+
})(state);
|
|
296
|
+
if (dispatch) {
|
|
297
|
+
dispatch(tr);
|
|
298
|
+
}
|
|
289
299
|
}
|
|
290
300
|
});
|
|
291
301
|
_defineProperty(this, "handleArrowLeftFromTitle", event => {
|
|
@@ -301,21 +311,32 @@ export class ExpandNodeView {
|
|
|
301
311
|
selectionEnd
|
|
302
312
|
} = this.input;
|
|
303
313
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
304
|
-
var _this$
|
|
314
|
+
var _this$api, _this$api$selection;
|
|
305
315
|
event.preventDefault();
|
|
306
316
|
const {
|
|
307
|
-
state
|
|
317
|
+
state,
|
|
318
|
+
dispatch
|
|
308
319
|
} = this.view;
|
|
309
320
|
this.view.focus();
|
|
310
|
-
const selectionSharedState = ((_this$
|
|
321
|
+
const selectionSharedState = ((_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$selection = _this$api.selection) === null || _this$api$selection === void 0 ? void 0 : _this$api$selection.sharedState.currentState()) || {};
|
|
311
322
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
312
323
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
313
324
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
314
|
-
|
|
315
|
-
|
|
325
|
+
const tr = this.selectNearNode({
|
|
326
|
+
selectionRelativeToNode: undefined,
|
|
327
|
+
selection: new GapCursorSelection(state.doc.resolve(pos), Side.LEFT)
|
|
328
|
+
})(state);
|
|
329
|
+
if (dispatch) {
|
|
330
|
+
dispatch(tr);
|
|
331
|
+
}
|
|
316
332
|
} else {
|
|
317
|
-
|
|
318
|
-
|
|
333
|
+
const tr = this.selectNearNode({
|
|
334
|
+
selectionRelativeToNode: RelativeSelectionPos.Start,
|
|
335
|
+
selection: NodeSelection.create(state.doc, pos)
|
|
336
|
+
})(state);
|
|
337
|
+
if (dispatch) {
|
|
338
|
+
dispatch(tr);
|
|
339
|
+
}
|
|
319
340
|
}
|
|
320
341
|
}
|
|
321
342
|
});
|
|
@@ -444,5 +465,8 @@ export default function ({
|
|
|
444
465
|
featureFlags,
|
|
445
466
|
api
|
|
446
467
|
}) {
|
|
447
|
-
return (node, view, getPos) =>
|
|
468
|
+
return (node, view, getPos) => {
|
|
469
|
+
var _api$selection, _api$selection$action;
|
|
470
|
+
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags, api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : (_api$selection$action = _api$selection.actions) === null || _api$selection$action === void 0 ? void 0 : _api$selection$action.selectNearNode, api);
|
|
471
|
+
};
|
|
448
472
|
}
|
|
@@ -35,7 +35,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
|
35
35
|
export { default as scrollIntoViewPlugin } from './scroll-into-view';
|
|
36
36
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
37
37
|
export { default as findReplacePlugin } from './find-replace';
|
|
38
|
-
export { default as selectionPlugin } from './selection';
|
|
39
38
|
export { default as mobileSelectionPlugin } from './mobile-selection';
|
|
40
39
|
export { default as undoRedoPlugin } from './undo-redo';
|
|
41
40
|
export { default as avatarGroupPlugin } from './avatar-group';
|
|
@@ -13,7 +13,6 @@ import { showPlaceholderFloatingToolbar } from '../../../placeholder-text/action
|
|
|
13
13
|
import { insertLayoutColumnsWithAnalytics } from '../../../layout/actions';
|
|
14
14
|
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
15
15
|
import { insertExpand } from '../../../expand/commands';
|
|
16
|
-
import { updateStatusWithAnalytics } from '../../../status/actions';
|
|
17
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
17
|
import { messages } from './messages';
|
|
19
18
|
import { createItems } from './create-items';
|
|
@@ -212,11 +211,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
212
211
|
return true;
|
|
213
212
|
});
|
|
214
213
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
214
|
+
var _pluginInjectionApi$s, _pluginInjectionApi$s2, _pluginInjectionApi$s3;
|
|
215
215
|
const {
|
|
216
|
+
pluginInjectionApi,
|
|
216
217
|
editorView
|
|
217
218
|
} = this.props;
|
|
218
|
-
|
|
219
|
-
return true;
|
|
219
|
+
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : (_pluginInjectionApi$s3 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s3 === void 0 ? void 0 : _pluginInjectionApi$s3.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
220
220
|
});
|
|
221
221
|
_defineProperty(this, "openMediaPicker", inputMethod => {
|
|
222
222
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { uuid } from '@atlaskit/adf-schema';
|
|
4
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE
|
|
4
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
5
6
|
import { pluginKey } from './plugin-key';
|
|
6
7
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
export const DEFAULT_STATUS = {
|
|
@@ -70,7 +71,7 @@ export const updateStatus = status => (state, dispatch) => {
|
|
|
70
71
|
}
|
|
71
72
|
return false;
|
|
72
73
|
};
|
|
73
|
-
export const updateStatusWithAnalytics = (inputMethod, status) => withAnalytics({
|
|
74
|
+
export const updateStatusWithAnalytics = editorAnalyticsAPI => (inputMethod, status) => withAnalytics(editorAnalyticsAPI, {
|
|
74
75
|
action: ACTION.INSERTED,
|
|
75
76
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
76
77
|
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
@@ -1,91 +1,99 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { status } from '@atlaskit/adf-schema';
|
|
4
|
-
import WithPluginState from '
|
|
5
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
4
|
+
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
7
7
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
8
|
-
import { commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
8
|
+
import { updateStatusWithAnalytics, commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
9
9
|
import { keymapPlugin } from './keymap';
|
|
10
10
|
import createStatusPlugin from './plugin';
|
|
11
11
|
import { pluginKey } from './plugin-key';
|
|
12
12
|
import StatusPicker from './ui/statusPicker';
|
|
13
13
|
const baseStatusPlugin = ({
|
|
14
|
-
config: options
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
text,
|
|
59
|
-
color,
|
|
60
|
-
localId
|
|
61
|
-
} = statusNode.attrs;
|
|
62
|
-
return /*#__PURE__*/React.createElement(StatusPicker, {
|
|
63
|
-
isNew: statusState.isNew,
|
|
64
|
-
target: target,
|
|
65
|
-
defaultText: text,
|
|
66
|
-
defaultColor: color,
|
|
67
|
-
defaultLocalId: localId,
|
|
68
|
-
mountTo: popupsMountPoint,
|
|
69
|
-
boundariesElement: popupsBoundariesElement,
|
|
70
|
-
scrollableElement: popupsScrollableElement,
|
|
71
|
-
onSelect: status => {
|
|
72
|
-
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
73
|
-
},
|
|
74
|
-
onTextChanged: status => {
|
|
75
|
-
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
76
|
-
},
|
|
77
|
-
closeStatusPicker: closingPayload => {
|
|
78
|
-
commitStatusPicker(closingPayload)(editorView);
|
|
79
|
-
},
|
|
80
|
-
onEnter: () => {
|
|
81
|
-
commitStatusPicker()(editorView);
|
|
14
|
+
config: options,
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
17
|
+
var _api$analytics;
|
|
18
|
+
return {
|
|
19
|
+
name: 'status',
|
|
20
|
+
nodes() {
|
|
21
|
+
return [{
|
|
22
|
+
name: 'status',
|
|
23
|
+
node: status
|
|
24
|
+
}];
|
|
25
|
+
},
|
|
26
|
+
pmPlugins() {
|
|
27
|
+
return [{
|
|
28
|
+
name: 'status',
|
|
29
|
+
plugin: pmPluginFactoryParams => createStatusPlugin(pmPluginFactoryParams, options)
|
|
30
|
+
}, {
|
|
31
|
+
name: 'statusKeymap',
|
|
32
|
+
plugin: keymapPlugin
|
|
33
|
+
}];
|
|
34
|
+
},
|
|
35
|
+
actions: {
|
|
36
|
+
commitStatusPicker,
|
|
37
|
+
updateStatus: updateStatusWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
38
|
+
},
|
|
39
|
+
contentComponent({
|
|
40
|
+
editorView,
|
|
41
|
+
popupsMountPoint,
|
|
42
|
+
popupsBoundariesElement,
|
|
43
|
+
popupsScrollableElement
|
|
44
|
+
}) {
|
|
45
|
+
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
46
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
47
|
+
plugins: {
|
|
48
|
+
statusState: pluginKey
|
|
49
|
+
},
|
|
50
|
+
render: ({
|
|
51
|
+
statusState = {}
|
|
52
|
+
}) => {
|
|
53
|
+
const {
|
|
54
|
+
showStatusPickerAt
|
|
55
|
+
} = statusState;
|
|
56
|
+
if (typeof showStatusPickerAt !== 'number') {
|
|
57
|
+
return null;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
const
|
|
59
|
+
const target = findDomRefAtPos(showStatusPickerAt, domAtPos);
|
|
60
|
+
const statusNode = editorView.state.doc.nodeAt(showStatusPickerAt);
|
|
61
|
+
if (!statusNode || statusNode.type.name !== 'status') {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
text,
|
|
66
|
+
color,
|
|
67
|
+
localId
|
|
68
|
+
} = statusNode.attrs;
|
|
69
|
+
return /*#__PURE__*/React.createElement(StatusPicker, {
|
|
70
|
+
isNew: statusState.isNew,
|
|
71
|
+
target: target,
|
|
72
|
+
defaultText: text,
|
|
73
|
+
defaultColor: color,
|
|
74
|
+
defaultLocalId: localId,
|
|
75
|
+
mountTo: popupsMountPoint,
|
|
76
|
+
boundariesElement: popupsBoundariesElement,
|
|
77
|
+
scrollableElement: popupsScrollableElement,
|
|
78
|
+
onSelect: status => {
|
|
79
|
+
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
80
|
+
},
|
|
81
|
+
onTextChanged: status => {
|
|
82
|
+
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
83
|
+
},
|
|
84
|
+
closeStatusPicker: closingPayload => {
|
|
85
|
+
commitStatusPicker(closingPayload)(editorView);
|
|
86
|
+
},
|
|
87
|
+
onEnter: () => {
|
|
88
|
+
commitStatusPicker()(editorView);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const decorateWithPluginOptions = (plugin, options, api) => {
|
|
89
97
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
|
|
90
98
|
return plugin;
|
|
91
99
|
}
|
|
@@ -100,7 +108,9 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
100
108
|
keywords: ['lozenge'],
|
|
101
109
|
icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
|
|
102
110
|
action(insert, state) {
|
|
103
|
-
|
|
111
|
+
var _api$analytics2;
|
|
112
|
+
const tr = createStatus()(insert, state);
|
|
113
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
104
114
|
action: ACTION.INSERTED,
|
|
105
115
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
106
116
|
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
@@ -108,7 +118,8 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
108
118
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
109
119
|
},
|
|
110
120
|
eventType: EVENT_TYPE.TRACK
|
|
111
|
-
});
|
|
121
|
+
})(tr);
|
|
122
|
+
return tr;
|
|
112
123
|
}
|
|
113
124
|
}]
|
|
114
125
|
};
|
|
@@ -120,5 +131,5 @@ const statusPlugin = ({
|
|
|
120
131
|
}) => decorateWithPluginOptions(baseStatusPlugin({
|
|
121
132
|
config: options,
|
|
122
133
|
api
|
|
123
|
-
}), options);
|
|
134
|
+
}), options, api);
|
|
124
135
|
export default statusPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { bindKeymapWithCommand, enter, tab } from '
|
|
2
|
+
import { bindKeymapWithCommand, enter, tab } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { mayGetStatusAtSelection } from './utils';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
const list = {};
|
|
@@ -9,7 +9,7 @@ import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
9
9
|
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
10
10
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
11
11
|
import { N0 } from '@atlaskit/theme/colors';
|
|
12
|
-
import withOuterListeners from '
|
|
12
|
+
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
13
13
|
import { DEFAULT_STATUS } from '../actions';
|
|
14
14
|
import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
|
|
15
15
|
const PopupWithListeners = withOuterListeners(Popup);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { closestElement } from '
|
|
2
|
-
import { setSelectionTopLevelBlocks
|
|
3
|
-
import { addParagraphAtEnd } from '
|
|
1
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { setSelectionTopLevelBlocks } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { addParagraphAtEnd } from '@atlaskit/editor-common/commands';
|
|
4
4
|
|
|
5
5
|
// we ignore all of the clicks made inside <div class="ak-editor-content-area" /> (but not clicks on the node itself)
|
|
6
6
|
const insideContentArea = ref => {
|
|
@@ -98,9 +98,7 @@ const outsideProsemirrorEditorClickHandler = (view, event) => {
|
|
|
98
98
|
if (isBottomAreaClicked) {
|
|
99
99
|
addParagraphAtEnd(tr);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
103
|
-
}
|
|
101
|
+
setSelectionTopLevelBlocks(tr, event, dom, view.posAtCoords.bind(view), isEditorFocused);
|
|
104
102
|
if (!tr.docChanged && !tr.selectionSet) {
|
|
105
103
|
return;
|
|
106
104
|
}
|
|
@@ -5,7 +5,6 @@ import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, inden
|
|
|
5
5
|
import { akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackgroundWithOpacity, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle, akEditorLineHeight, akEditorSelectedBorderColor } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
7
7
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
8
|
-
import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
|
|
9
8
|
import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
10
9
|
import { blocktypeStyles } from '@atlaskit/editor-plugin-block-type/styles';
|
|
11
10
|
import { codeBlockStyles } from '../../plugins/code-block/styles';
|
|
@@ -26,6 +25,7 @@ import { linkSharedStyle, codeMarkSharedStyles, ruleSharedStyles } from '@atlask
|
|
|
26
25
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
27
26
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
28
27
|
import { N500, N30A, N200 } from '@atlaskit/theme/colors';
|
|
28
|
+
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
29
29
|
export const linkStyles = css`
|
|
30
30
|
.ProseMirror {
|
|
31
31
|
${linkSharedStyle}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
2
|
-
import { NodeSelection, TextSelection
|
|
2
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
4
|
-
export { setNodeSelection, setTextSelection } from '@atlaskit/editor-common/utils';
|
|
5
|
-
export function setAllSelection(view) {
|
|
6
|
-
const {
|
|
7
|
-
state,
|
|
8
|
-
dispatch
|
|
9
|
-
} = view;
|
|
10
|
-
const tr = state.tr.setSelection(new AllSelection(view.state.doc));
|
|
11
|
-
dispatch(tr);
|
|
12
|
-
}
|
|
13
|
-
export function setCellSelection(view, anchor, head) {
|
|
14
|
-
const {
|
|
15
|
-
state,
|
|
16
|
-
dispatch
|
|
17
|
-
} = view;
|
|
18
|
-
dispatch(state.tr.setSelection(CellSelection.create(state.doc, anchor, head)));
|
|
19
|
-
}
|
|
4
|
+
export { setNodeSelection, setTextSelection, setAllSelection, setCellSelection } from '@atlaskit/editor-common/utils';
|
|
20
5
|
|
|
21
6
|
// checks if the given position is within the ProseMirror document
|
|
22
7
|
export const isValidPosition = (pos, state) => {
|
|
@@ -23,7 +23,7 @@ import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
|
|
|
23
23
|
import annotationPlugin from '../../../plugins/annotation';
|
|
24
24
|
import { compositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
25
25
|
import { quickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
26
|
-
import selectionPlugin from '
|
|
26
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
27
27
|
import codeBlockPlugin from '../../../plugins/code-block';
|
|
28
28
|
import undoRedoPlugin from '../../../plugins/undo-redo';
|
|
29
29
|
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -2,7 +2,6 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import { createEditorSelectionAPI } from '../../../selection-api/api';
|
|
6
5
|
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
|
|
7
6
|
import { datePlugin } from '../../../plugins/date';
|
|
8
7
|
import { captionPlugin } from '@atlaskit/editor-plugin-caption';
|
|
@@ -43,7 +42,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
43
42
|
var getEditorFeatureFlags = function getEditorFeatureFlags() {
|
|
44
43
|
return featureFlags;
|
|
45
44
|
};
|
|
46
|
-
var editorSelectionAPI = createEditorSelectionAPI();
|
|
47
45
|
var defaultPreset = createDefaultPreset(_objectSpread(_objectSpread({}, props), {}, {
|
|
48
46
|
createAnalyticsEvent: createAnalyticsEvent
|
|
49
47
|
}));
|
|
@@ -113,7 +111,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
113
111
|
allowDropzoneDropLine: isFullPage,
|
|
114
112
|
allowMediaSingleEditable: !isMobile,
|
|
115
113
|
allowRemoteDimensionsFetch: !isMobile,
|
|
116
|
-
editorSelectionAPI: editorSelectionAPI,
|
|
117
114
|
// This is a wild one. I didnt quite understand what the code was doing
|
|
118
115
|
// so a bit of guess for now.
|
|
119
116
|
allowMarkingUploadsAsIncomplete: isMobile,
|
|
@@ -161,7 +158,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
161
158
|
allowContextualMenu: !isMobile,
|
|
162
159
|
fullWidthEnabled: appearance === 'full-width',
|
|
163
160
|
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
164
|
-
editorSelectionAPI: editorSelectionAPI,
|
|
165
161
|
getEditorFeatureFlags: getEditorFeatureFlags
|
|
166
162
|
}]);
|
|
167
163
|
}
|
|
@@ -202,8 +198,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
202
198
|
disableLayout: true
|
|
203
199
|
},
|
|
204
200
|
allowMediaGroup: false,
|
|
205
|
-
isCopyPasteEnabled: true
|
|
206
|
-
editorSelectionAPI: editorSelectionAPI
|
|
201
|
+
isCopyPasteEnabled: true
|
|
207
202
|
}]);
|
|
208
203
|
}
|
|
209
204
|
return builder;
|
|
@@ -9,8 +9,6 @@ import { getToolbarConfig } from './toolbar';
|
|
|
9
9
|
import { createExpandNode } from './commands';
|
|
10
10
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
11
11
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
12
|
-
// TO-DO: replace with editor-plugin-selection
|
|
13
|
-
|
|
14
12
|
var expandPlugin = function expandPlugin(_ref) {
|
|
15
13
|
var _api$featureFlags;
|
|
16
14
|
var _ref$config = _ref.config,
|
|
@@ -61,8 +61,12 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
61
61
|
state = _this$view.state,
|
|
62
62
|
dispatch = _this$view.dispatch;
|
|
63
63
|
if (_this.selectNearNode) {
|
|
64
|
-
var _this
|
|
65
|
-
|
|
64
|
+
var tr = _this.selectNearNode({
|
|
65
|
+
selectionRelativeToNode: RelativeSelectionPos.Start
|
|
66
|
+
})(state);
|
|
67
|
+
if (dispatch) {
|
|
68
|
+
dispatch(tr);
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
var pos = _this.getPos();
|
|
68
72
|
if (typeof pos === 'number') {
|
|
@@ -272,11 +276,18 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
272
276
|
selectionStart = _this$input4.selectionStart,
|
|
273
277
|
selectionEnd = _this$input4.selectionEnd;
|
|
274
278
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
275
|
-
var _this$api2;
|
|
276
279
|
event.preventDefault();
|
|
277
|
-
var
|
|
280
|
+
var _this$view8 = _this.view,
|
|
281
|
+
state = _this$view8.state,
|
|
282
|
+
dispatch = _this$view8.dispatch;
|
|
278
283
|
_this.view.focus();
|
|
279
|
-
|
|
284
|
+
var tr = _this.selectNearNode({
|
|
285
|
+
selectionRelativeToNode: RelativeSelectionPos.End,
|
|
286
|
+
selection: NodeSelection.create(state.doc, pos)
|
|
287
|
+
})(state);
|
|
288
|
+
if (dispatch) {
|
|
289
|
+
dispatch(tr);
|
|
290
|
+
}
|
|
280
291
|
}
|
|
281
292
|
});
|
|
282
293
|
_defineProperty(this, "handleArrowLeftFromTitle", function (event) {
|
|
@@ -291,19 +302,31 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
291
302
|
selectionStart = _this$input5.selectionStart,
|
|
292
303
|
selectionEnd = _this$input5.selectionEnd;
|
|
293
304
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
294
|
-
var _this$
|
|
305
|
+
var _this$api;
|
|
295
306
|
event.preventDefault();
|
|
296
|
-
var
|
|
307
|
+
var _this$view9 = _this.view,
|
|
308
|
+
state = _this$view9.state,
|
|
309
|
+
dispatch = _this$view9.dispatch;
|
|
297
310
|
_this.view.focus();
|
|
298
|
-
var selectionSharedState = ((_this$
|
|
311
|
+
var selectionSharedState = ((_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.selection) === null || _this$api === void 0 ? void 0 : _this$api.sharedState.currentState()) || {};
|
|
299
312
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
300
313
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
301
314
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
302
|
-
var _this
|
|
303
|
-
|
|
315
|
+
var tr = _this.selectNearNode({
|
|
316
|
+
selectionRelativeToNode: undefined,
|
|
317
|
+
selection: new GapCursorSelection(state.doc.resolve(pos), Side.LEFT)
|
|
318
|
+
})(state);
|
|
319
|
+
if (dispatch) {
|
|
320
|
+
dispatch(tr);
|
|
321
|
+
}
|
|
304
322
|
} else {
|
|
305
|
-
var _this
|
|
306
|
-
|
|
323
|
+
var _tr = _this.selectNearNode({
|
|
324
|
+
selectionRelativeToNode: RelativeSelectionPos.Start,
|
|
325
|
+
selection: NodeSelection.create(state.doc, pos)
|
|
326
|
+
})(state);
|
|
327
|
+
if (dispatch) {
|
|
328
|
+
dispatch(_tr);
|
|
329
|
+
}
|
|
307
330
|
}
|
|
308
331
|
}
|
|
309
332
|
});
|
|
@@ -445,6 +468,7 @@ export default function (_ref2) {
|
|
|
445
468
|
featureFlags = _ref2.featureFlags,
|
|
446
469
|
api = _ref2.api;
|
|
447
470
|
return function (node, view, getPos) {
|
|
448
|
-
|
|
471
|
+
var _api$selection;
|
|
472
|
+
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.actions) === null || _api$selection === void 0 ? void 0 : _api$selection.selectNearNode, api);
|
|
449
473
|
};
|
|
450
474
|
}
|
|
@@ -35,7 +35,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
|
35
35
|
export { default as scrollIntoViewPlugin } from './scroll-into-view';
|
|
36
36
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
37
37
|
export { default as findReplacePlugin } from './find-replace';
|
|
38
|
-
export { default as selectionPlugin } from './selection';
|
|
39
38
|
export { default as mobileSelectionPlugin } from './mobile-selection';
|
|
40
39
|
export { default as undoRedoPlugin } from './undo-redo';
|
|
41
40
|
export { default as avatarGroupPlugin } from './avatar-group';
|