@atlaskit/editor-core 187.46.1 → 187.47.2
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 +17 -0
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/plugins/annotation/commands/index.js +5 -2
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +7 -7
- package/dist/cjs/plugins/expand/commands.js +2 -2
- package/dist/cjs/plugins/expand/index.js +6 -2
- package/dist/cjs/plugins/expand/nodeviews/index.js +26 -23
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +10 -12
- package/dist/cjs/plugins/expand/pm-plugins/main.js +9 -6
- package/dist/cjs/plugins/extension/pm-plugins/main.js +8 -9
- package/dist/cjs/plugins/layout/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/media/toolbar/commands.js +1 -1
- package/dist/cjs/plugins/panel/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/paste/handlers.js +3 -3
- package/dist/cjs/plugins/selection/commands.js +27 -14
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/cjs/plugins/selection/index.js +13 -1
- package/dist/cjs/plugins/selection/utils.js +11 -25
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -3
- package/dist/cjs/test-utils.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/annotation/commands/index.js +5 -2
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/expand/commands.js +1 -1
- package/dist/es2019/plugins/expand/index.js +4 -2
- package/dist/es2019/plugins/expand/nodeviews/index.js +24 -19
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +6 -6
- package/dist/es2019/plugins/expand/pm-plugins/main.js +6 -4
- package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/media/toolbar/commands.js +1 -1
- package/dist/es2019/plugins/panel/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +1 -1
- package/dist/es2019/plugins/selection/commands.js +17 -6
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/es2019/plugins/selection/index.js +13 -1
- package/dist/es2019/plugins/selection/utils.js +2 -21
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +1 -1
- package/dist/es2019/test-utils.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/annotation/commands/index.js +5 -2
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/expand/commands.js +1 -1
- package/dist/esm/plugins/expand/index.js +6 -2
- package/dist/esm/plugins/expand/nodeviews/index.js +24 -21
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +6 -8
- package/dist/esm/plugins/expand/pm-plugins/main.js +6 -3
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/media/toolbar/commands.js +1 -1
- package/dist/esm/plugins/panel/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +1 -1
- package/dist/esm/plugins/selection/commands.js +18 -6
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +1 -1
- package/dist/esm/plugins/selection/index.js +13 -1
- package/dist/esm/plugins/selection/utils.js +2 -21
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +1 -1
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +9 -5
- package/dist/types/plugins/annotation/commands/index.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +4 -0
- package/dist/types/plugins/expand/index.d.ts +6 -1
- package/dist/types/plugins/expand/nodeviews/index.d.ts +7 -3
- package/dist/types/plugins/expand/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/plugins/expand/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/panel/pm-plugins/main.d.ts +3 -3
- package/dist/types/plugins/selection/commands.d.ts +4 -2
- package/dist/types/plugins/selection/index.d.ts +5 -2
- package/dist/types/plugins/selection/utils.d.ts +2 -7
- package/dist/types/test-utils.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +9 -5
- package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/nodeviews/index.d.ts +7 -3
- package/dist/types-ts4.5/plugins/expand/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/plugins/panel/pm-plugins/main.d.ts +3 -3
- package/dist/types-ts4.5/plugins/selection/commands.d.ts +4 -2
- package/dist/types-ts4.5/plugins/selection/index.d.ts +5 -2
- package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -7
- package/dist/types-ts4.5/test-utils.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +1 -3
- package/tmp/api-report-tmp.d.ts +1 -4
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { GapCursorSelection, Side } from './gap-cursor-selection';
|
|
3
|
-
import { isIgnored as isIgnoredByGapCursor } from '
|
|
3
|
+
import { isIgnored as isIgnoredByGapCursor } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { isNodeEmpty, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { SelectionActionTypes } from './actions';
|
|
6
6
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
7
7
|
import { isSelectableContainerNode, isSelectionAtEndOfParentNode, findSelectableContainerParent, isSelectionAtStartOfParentNode, findSelectableContainerBefore, findSelectableContainerAfter, findFirstChildNodeToSelect, findLastChildNodeToSelect } from './utils';
|
|
8
|
-
import { RelativeSelectionPos, SelectionDirection } from './types';
|
|
8
|
+
import { RelativeSelectionPos, SelectionDirection, selectionPluginKey } from './types';
|
|
9
|
+
export var selectNearNode = function selectNearNode(selectionRelativeToNode, selection) {
|
|
10
|
+
return function (_ref) {
|
|
11
|
+
var tr = _ref.tr;
|
|
12
|
+
tr.setMeta(selectionPluginKey, {
|
|
13
|
+
type: SelectionActionTypes.SET_RELATIVE_SELECTION,
|
|
14
|
+
selectionRelativeToNode: selectionRelativeToNode
|
|
15
|
+
});
|
|
16
|
+
if (selection) {
|
|
17
|
+
return tr.setSelection(selection);
|
|
18
|
+
}
|
|
19
|
+
return tr;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
9
22
|
export var setSelectionRelativeToNode = function setSelectionRelativeToNode(selectionRelativeToNode, selection) {
|
|
10
23
|
return createCommand({
|
|
11
24
|
type: SelectionActionTypes.SET_RELATIVE_SELECTION,
|
|
12
25
|
selectionRelativeToNode: selectionRelativeToNode
|
|
13
26
|
}, function (tr) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return tr;
|
|
27
|
+
return selectNearNode(selectionRelativeToNode, selection)({
|
|
28
|
+
tr: tr
|
|
29
|
+
}) || tr;
|
|
18
30
|
});
|
|
19
31
|
};
|
|
20
32
|
export var arrowRight = function arrowRight(state, dispatch) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toArray from "@babel/runtime/helpers/toArray";
|
|
2
2
|
import { getLayoutModeFromTargetNode, isLeftCursor, getComputedStyleForLayoutMode } from '../utils';
|
|
3
|
-
import { Side } from '
|
|
3
|
+
import { Side } from '@atlaskit/editor-common/selection';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* We have a couple of nodes that require us to compute style
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/selection-main';
|
|
2
|
+
import { selectionPluginKey } from './types';
|
|
2
3
|
import selectionKeymapPlugin from './pm-plugins/keymap';
|
|
3
4
|
import gapCursorPlugin from './pm-plugins/gap-cursor-main';
|
|
4
5
|
import { gapCursorPluginKey } from './pm-plugins/gap-cursor-plugin-key';
|
|
5
6
|
import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
|
|
7
|
+
import { selectNearNode } from './commands';
|
|
6
8
|
var displayGapCursor = function displayGapCursor(toggle) {
|
|
7
9
|
return function (_ref) {
|
|
8
10
|
var tr = _ref.tr;
|
|
@@ -16,7 +18,17 @@ export var selectionPlugin = function selectionPlugin(_ref2) {
|
|
|
16
18
|
return {
|
|
17
19
|
name: 'selection',
|
|
18
20
|
commands: {
|
|
19
|
-
displayGapCursor: displayGapCursor
|
|
21
|
+
displayGapCursor: displayGapCursor,
|
|
22
|
+
selectNearNode: selectNearNode
|
|
23
|
+
},
|
|
24
|
+
getSharedState: function getSharedState(editorState) {
|
|
25
|
+
if (!editorState) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
var pluginState = selectionPluginKey.getState(editorState);
|
|
29
|
+
return {
|
|
30
|
+
selectionRelativeToNode: pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectionRelativeToNode
|
|
31
|
+
};
|
|
20
32
|
},
|
|
21
33
|
pmPlugins: function pmPlugins() {
|
|
22
34
|
return [{
|
|
@@ -2,28 +2,9 @@ import { NodeSelection, TextSelection, Selection, AllSelection } from '@atlaskit
|
|
|
2
2
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { flatten, findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode, getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload,
|
|
5
|
+
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode, getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, isIgnored as isIgnoredByGapCursor } from '@atlaskit/editor-common/selection';
|
|
6
6
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
|
|
8
7
|
import { selectionPluginKey } from './types';
|
|
9
|
-
export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
10
|
-
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
11
|
-
if (options.useLongPressSelection) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
15
|
-
if (event.target) {
|
|
16
|
-
var _target = event.target;
|
|
17
|
-
if (isValidTarget(_target)) {
|
|
18
|
-
var selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
19
|
-
selectNode(selectionPos)(view.state, view.dispatch);
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
8
|
export var getDecorations = function getDecorations(tr) {
|
|
28
9
|
if (tr.selection instanceof NodeSelection) {
|
|
29
10
|
return DecorationSet.create(tr.doc, [Decoration.node(tr.selection.from, tr.selection.to, {
|
|
@@ -257,4 +238,4 @@ export var isSelectionAtStartOfParentNode = function isSelectionAtStartOfParentN
|
|
|
257
238
|
export var isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
|
|
258
239
|
return isSelectionAtEndOfNode($pos, findSelectableContainerParent(selection));
|
|
259
240
|
};
|
|
260
|
-
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload };
|
|
241
|
+
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler };
|
|
@@ -7,7 +7,7 @@ import { findParentNodeOfType, hasParentNodeOfType, replaceParentNodeOfType, saf
|
|
|
7
7
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
import { uuid } from '@atlaskit/adf-schema';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD, USER_CONTEXT } from '../analytics';
|
|
10
|
-
import { GapCursorSelection } from '
|
|
10
|
+
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
11
11
|
import { stateKey as taskDecisionStateKey } from './pm-plugins/plugin-key';
|
|
12
12
|
import { autoJoinTr } from '@atlaskit/editor-common/utils';
|
|
13
13
|
var getContextData = function getContextData() {
|
|
@@ -7,7 +7,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
7
7
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { uuid } from '@atlaskit/adf-schema';
|
|
9
9
|
import { nodesBetweenChanged, SetAttrsStep } from '../../../utils';
|
|
10
|
-
import { createSelectionClickHandler } from '
|
|
10
|
+
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
11
11
|
import { decisionItemNodeView } from '../nodeviews/decisionItem';
|
|
12
12
|
import { taskItemNodeViewFactory } from '../nodeviews/taskItem';
|
|
13
13
|
import { stateKey } from './plugin-key';
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -91,7 +91,7 @@ export var createPMSchemaAndPlugins = function createPMSchemaAndPlugins() {
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
export { EventDispatcher } from './event-dispatcher';
|
|
94
|
-
export { GapCursorSelection, Side as GapCursorSide } from '
|
|
94
|
+
export { GapCursorSelection, Side as GapCursorSide } from '@atlaskit/editor-common/selection';
|
|
95
95
|
export function setTextSelection(view, anchor, head) {
|
|
96
96
|
var state = view.state;
|
|
97
97
|
var tr = state.tr.setSelection(TextSelection.create(state.doc, anchor, head));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export type { Command, EditorPlugin, EditorProps, EditorInstance, CommandDispatc
|
|
|
75
75
|
export { default as EditorActions } from './actions';
|
|
76
76
|
export type { MacroProvider, MacroAttributes, ExtensionType, CardProvider, } from '@atlaskit/editor-common/provider-factory';
|
|
77
77
|
export { PortalProvider, PortalProviderAPI, PortalRenderer, } from '@atlaskit/editor-common/portal-provider';
|
|
78
|
-
export { GapCursorSelection, Side as GapCursorSide, } from '
|
|
78
|
+
export { GapCursorSelection, Side as GapCursorSide, } from '@atlaskit/editor-common/selection';
|
|
79
79
|
export type { HistoryPluginState } from './plugins/history/types';
|
|
80
80
|
export type { MentionPluginState } from './plugins/mentions/types';
|
|
81
81
|
export type { TOOLBAR_MENU_TYPE as InsertBlockInputMethodToolbar } from './plugins/insert-block/ui/ToolbarInsertBlock/types';
|
|
@@ -8,7 +8,7 @@ import type { PlaceholderPluginOptions } from '@atlaskit/editor-plugin-placehold
|
|
|
8
8
|
import type { AnnotationProviders } from '../../../plugins/annotation';
|
|
9
9
|
import type { TextFormattingOptions, HyperlinkPluginOptions, QuickInsertPluginOptions } from '@atlaskit/editor-common/types';
|
|
10
10
|
import type { CodeBlockOptions } from '../../../plugins/code-block/types';
|
|
11
|
-
import type { SelectionPluginOptions } from '
|
|
11
|
+
import type { SelectionPluginOptions } from '@atlaskit/editor-common/selection';
|
|
12
12
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
13
13
|
import type { TypeAheadPluginOptions } from '../../../plugins/type-ahead';
|
|
14
14
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
@@ -60,11 +60,13 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
60
60
|
insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
|
|
61
61
|
};
|
|
62
62
|
}, CodeBlockOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
63
|
-
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
63
|
+
pluginConfiguration: import("../../../plugins/selection/types").SelectionPluginOptions | undefined;
|
|
64
64
|
commands: {
|
|
65
65
|
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
66
|
+
selectNearNode: import("@atlaskit/editor-common/types").EditorCommandWithMetadata;
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
69
|
+
}, import("../../../plugins/selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
|
|
68
70
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
69
71
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
70
72
|
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
@@ -268,11 +270,13 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
268
270
|
insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
|
|
269
271
|
};
|
|
270
272
|
}, CodeBlockOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
271
|
-
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
273
|
+
pluginConfiguration: import("../../../plugins/selection/types").SelectionPluginOptions | undefined;
|
|
272
274
|
commands: {
|
|
273
275
|
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
276
|
+
selectNearNode: import("@atlaskit/editor-common/types").EditorCommandWithMetadata;
|
|
274
277
|
};
|
|
275
|
-
|
|
278
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
279
|
+
}, import("../../../plugins/selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
|
|
276
280
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
277
281
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
278
282
|
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
|
|
2
3
|
import type { Command } from '../../../types';
|
|
3
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
5
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
6
7
|
export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
7
|
-
export declare const closeComponent: () => Command;
|
|
8
|
+
export declare const closeComponent: (state: EditorState) => Command;
|
|
8
9
|
export declare const clearDirtyMark: () => Command;
|
|
9
10
|
export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
10
11
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
@@ -43,6 +43,9 @@ export type InlineCommentAction = {
|
|
|
43
43
|
type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
|
|
44
44
|
} | {
|
|
45
45
|
type: ACTIONS.CLOSE_COMPONENT;
|
|
46
|
+
data: {
|
|
47
|
+
lastClosedPos: number;
|
|
48
|
+
};
|
|
46
49
|
} | {
|
|
47
50
|
type: ACTIONS.ADD_INLINE_COMMENT;
|
|
48
51
|
data: {
|
|
@@ -71,4 +74,5 @@ export type InlineCommentPluginState = {
|
|
|
71
74
|
bookmark?: SelectionBookmark;
|
|
72
75
|
disallowOnWhitespace: boolean;
|
|
73
76
|
isVisible: boolean;
|
|
77
|
+
lastClosedPos?: number;
|
|
74
78
|
};
|
|
@@ -2,13 +2,18 @@ import type { NextEditorPlugin, EditorProps } from '../../types';
|
|
|
2
2
|
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
+
import type { SelectionPlugin } from '../selection';
|
|
5
6
|
interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
6
7
|
allowInsertion?: boolean;
|
|
7
8
|
appearance?: EditorProps['appearance'];
|
|
8
9
|
}
|
|
9
10
|
declare const expandPlugin: NextEditorPlugin<'expand', {
|
|
10
11
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
11
|
-
dependencies: [
|
|
12
|
+
dependencies: [
|
|
13
|
+
FeatureFlagsPlugin,
|
|
14
|
+
typeof decorationsPlugin,
|
|
15
|
+
SelectionPlugin
|
|
16
|
+
];
|
|
12
17
|
}>;
|
|
13
18
|
interface ExpandEditorProps {
|
|
14
19
|
allowExpand?: EditorProps['allowExpand'];
|
|
@@ -2,8 +2,10 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { EditorView, NodeView, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { getPosHandlerNode, getPosHandler } from '../../../nodeviews/';
|
|
5
|
-
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { FeatureFlags, ExtractInjectionAPI, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type expandPlugin from '../index';
|
|
6
7
|
export declare class ExpandNodeView implements NodeView {
|
|
8
|
+
private selectNearNode;
|
|
7
9
|
node: PmNode;
|
|
8
10
|
view: EditorView;
|
|
9
11
|
dom: HTMLElement;
|
|
@@ -17,7 +19,8 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
17
19
|
allowInteractiveExpand: boolean;
|
|
18
20
|
isMobile: boolean;
|
|
19
21
|
featureFlags: FeatureFlags;
|
|
20
|
-
|
|
22
|
+
api: ExtractInjectionAPI<typeof expandPlugin> | undefined;
|
|
23
|
+
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, featureFlags: FeatureFlags, selectNearNode: EditorCommandWithMetadata | undefined, api: ExtractInjectionAPI<typeof expandPlugin> | undefined);
|
|
21
24
|
private initHandlers;
|
|
22
25
|
private focusTitle;
|
|
23
26
|
private handleIconKeyDown;
|
|
@@ -43,8 +46,9 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
43
46
|
update(node: PmNode, _decorations: readonly Decoration[]): boolean;
|
|
44
47
|
destroy(): void;
|
|
45
48
|
}
|
|
46
|
-
export default function ({ getIntl, isMobile, featureFlags, }: {
|
|
49
|
+
export default function ({ getIntl, isMobile, featureFlags, api, }: {
|
|
47
50
|
getIntl: () => IntlShape;
|
|
48
51
|
isMobile: boolean;
|
|
49
52
|
featureFlags: FeatureFlags;
|
|
53
|
+
api: ExtractInjectionAPI<typeof expandPlugin> | undefined;
|
|
50
54
|
}): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type expandPlugin from '../index';
|
|
4
|
+
export declare function expandKeymap(api: ExtractInjectionAPI<typeof expandPlugin> | undefined): SafePlugin;
|
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { Dispatch } from '../../../event-dispatcher';
|
|
3
3
|
import type { EditorProps } from '../../../types';
|
|
4
4
|
import type { IntlShape } from 'react-intl-next';
|
|
5
|
-
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { FeatureFlags, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type expandPlugin from '../index';
|
|
6
7
|
export declare function containsClass(element: Element | null, className: string): boolean;
|
|
7
|
-
export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorProps['appearance'], useLongPressSelection: boolean | undefined, featureFlags: FeatureFlags) => SafePlugin<import("
|
|
8
|
+
export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorProps['appearance'], useLongPressSelection: boolean | undefined, featureFlags: FeatureFlags, api: ExtractInjectionAPI<typeof expandPlugin> | undefined) => SafePlugin<import("../types").ExpandPluginState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import { PanelPluginOptions } from '../types';
|
|
4
|
-
import { Dispatch } from '../../../event-dispatcher';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { PanelPluginOptions } from '../types';
|
|
4
|
+
import type { Dispatch } from '../../../event-dispatcher';
|
|
5
5
|
export type PanelOptions = {
|
|
6
6
|
color?: string;
|
|
7
7
|
emoji?: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Command } from '
|
|
3
|
+
import type { Command } from '../../types';
|
|
4
4
|
import { RelativeSelectionPos } from './types';
|
|
5
|
-
|
|
5
|
+
import type { EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare const selectNearNode: EditorCommandWithMetadata;
|
|
7
|
+
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => import("@atlaskit/editor-common/types").Command;
|
|
6
8
|
export declare const arrowRight: Command;
|
|
7
9
|
export declare const arrowLeft: Command;
|
|
8
10
|
export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { EditorCommand, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { EditorCommand, NextEditorPlugin, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import type { SelectionPluginOptions } from './types';
|
|
3
|
-
type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
4
|
+
export type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
4
5
|
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
5
6
|
commands: {
|
|
6
7
|
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
8
|
+
selectNearNode: EditorCommandWithMetadata;
|
|
7
9
|
};
|
|
10
|
+
sharedState: SelectionSharedState;
|
|
8
11
|
}>;
|
|
9
12
|
export declare const selectionPlugin: SelectionPlugin;
|
|
10
13
|
export default selectionPlugin;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { Transaction, ReadonlyTransaction, EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
4
|
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
6
5
|
import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
|
|
8
|
-
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
9
|
-
useLongPressSelection: boolean;
|
|
10
|
-
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
11
|
-
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
6
|
+
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
12
7
|
export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
|
|
13
8
|
/**
|
|
14
9
|
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
@@ -60,4 +55,4 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
60
55
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
61
56
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
62
57
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
63
|
-
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, };
|
|
58
|
+
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, };
|
|
@@ -30,7 +30,7 @@ export declare const createPMSchemaAndPlugins: (inputPreset?: EditorPresetBuilde
|
|
|
30
30
|
}) => PluginData;
|
|
31
31
|
export { EventDispatcher } from './event-dispatcher';
|
|
32
32
|
export type { Dispatch } from './event-dispatcher';
|
|
33
|
-
export { GapCursorSelection, Side as GapCursorSide, } from '
|
|
33
|
+
export { GapCursorSelection, Side as GapCursorSide, } from '@atlaskit/editor-common/selection';
|
|
34
34
|
export declare function setTextSelection(view: EditorView, anchor: number, head?: number): void;
|
|
35
35
|
/**
|
|
36
36
|
* Given a selector, checks if an element matching the selector exists in the
|
|
@@ -75,7 +75,7 @@ export type { Command, EditorPlugin, EditorProps, EditorInstance, CommandDispatc
|
|
|
75
75
|
export { default as EditorActions } from './actions';
|
|
76
76
|
export type { MacroProvider, MacroAttributes, ExtensionType, CardProvider, } from '@atlaskit/editor-common/provider-factory';
|
|
77
77
|
export { PortalProvider, PortalProviderAPI, PortalRenderer, } from '@atlaskit/editor-common/portal-provider';
|
|
78
|
-
export { GapCursorSelection, Side as GapCursorSide, } from '
|
|
78
|
+
export { GapCursorSelection, Side as GapCursorSide, } from '@atlaskit/editor-common/selection';
|
|
79
79
|
export type { HistoryPluginState } from './plugins/history/types';
|
|
80
80
|
export type { MentionPluginState } from './plugins/mentions/types';
|
|
81
81
|
export type { TOOLBAR_MENU_TYPE as InsertBlockInputMethodToolbar } from './plugins/insert-block/ui/ToolbarInsertBlock/types';
|
|
@@ -8,7 +8,7 @@ import type { PlaceholderPluginOptions } from '@atlaskit/editor-plugin-placehold
|
|
|
8
8
|
import type { AnnotationProviders } from '../../../plugins/annotation';
|
|
9
9
|
import type { TextFormattingOptions, HyperlinkPluginOptions, QuickInsertPluginOptions } from '@atlaskit/editor-common/types';
|
|
10
10
|
import type { CodeBlockOptions } from '../../../plugins/code-block/types';
|
|
11
|
-
import type { SelectionPluginOptions } from '
|
|
11
|
+
import type { SelectionPluginOptions } from '@atlaskit/editor-common/selection';
|
|
12
12
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
13
13
|
import type { TypeAheadPluginOptions } from '../../../plugins/type-ahead';
|
|
14
14
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
@@ -84,11 +84,13 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
84
84
|
};
|
|
85
85
|
}, CodeBlockOptions>,
|
|
86
86
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
87
|
-
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
87
|
+
pluginConfiguration: import("../../../plugins/selection/types").SelectionPluginOptions | undefined;
|
|
88
88
|
commands: {
|
|
89
89
|
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
90
|
+
selectNearNode: import("@atlaskit/editor-common/types").EditorCommandWithMetadata;
|
|
90
91
|
};
|
|
91
|
-
|
|
92
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
93
|
+
}, import("../../../plugins/selection/types").SelectionPluginOptions | undefined>,
|
|
92
94
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
|
|
93
95
|
dependencies: [
|
|
94
96
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
@@ -363,11 +365,13 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
363
365
|
};
|
|
364
366
|
}, CodeBlockOptions>,
|
|
365
367
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
366
|
-
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
368
|
+
pluginConfiguration: import("../../../plugins/selection/types").SelectionPluginOptions | undefined;
|
|
367
369
|
commands: {
|
|
368
370
|
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
371
|
+
selectNearNode: import("@atlaskit/editor-common/types").EditorCommandWithMetadata;
|
|
369
372
|
};
|
|
370
|
-
|
|
373
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
374
|
+
}, import("../../../plugins/selection/types").SelectionPluginOptions | undefined>,
|
|
371
375
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
|
|
372
376
|
dependencies: [
|
|
373
377
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
|
|
2
3
|
import type { Command } from '../../../types';
|
|
3
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
5
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
6
7
|
export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
7
|
-
export declare const closeComponent: () => Command;
|
|
8
|
+
export declare const closeComponent: (state: EditorState) => Command;
|
|
8
9
|
export declare const clearDirtyMark: () => Command;
|
|
9
10
|
export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
10
11
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
@@ -43,6 +43,9 @@ export type InlineCommentAction = {
|
|
|
43
43
|
type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
|
|
44
44
|
} | {
|
|
45
45
|
type: ACTIONS.CLOSE_COMPONENT;
|
|
46
|
+
data: {
|
|
47
|
+
lastClosedPos: number;
|
|
48
|
+
};
|
|
46
49
|
} | {
|
|
47
50
|
type: ACTIONS.ADD_INLINE_COMMENT;
|
|
48
51
|
data: {
|
|
@@ -71,4 +74,5 @@ export type InlineCommentPluginState = {
|
|
|
71
74
|
bookmark?: SelectionBookmark;
|
|
72
75
|
disallowOnWhitespace: boolean;
|
|
73
76
|
isVisible: boolean;
|
|
77
|
+
lastClosedPos?: number;
|
|
74
78
|
};
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, EditorProps } from '../../types';
|
|
|
2
2
|
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
+
import type { SelectionPlugin } from '../selection';
|
|
5
6
|
interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
6
7
|
allowInsertion?: boolean;
|
|
7
8
|
appearance?: EditorProps['appearance'];
|
|
@@ -10,7 +11,8 @@ declare const expandPlugin: NextEditorPlugin<'expand', {
|
|
|
10
11
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
11
12
|
dependencies: [
|
|
12
13
|
FeatureFlagsPlugin,
|
|
13
|
-
typeof decorationsPlugin
|
|
14
|
+
typeof decorationsPlugin,
|
|
15
|
+
SelectionPlugin
|
|
14
16
|
];
|
|
15
17
|
}>;
|
|
16
18
|
interface ExpandEditorProps {
|
|
@@ -2,8 +2,10 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { EditorView, NodeView, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { getPosHandlerNode, getPosHandler } from '../../../nodeviews/';
|
|
5
|
-
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { FeatureFlags, ExtractInjectionAPI, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type expandPlugin from '../index';
|
|
6
7
|
export declare class ExpandNodeView implements NodeView {
|
|
8
|
+
private selectNearNode;
|
|
7
9
|
node: PmNode;
|
|
8
10
|
view: EditorView;
|
|
9
11
|
dom: HTMLElement;
|
|
@@ -17,7 +19,8 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
17
19
|
allowInteractiveExpand: boolean;
|
|
18
20
|
isMobile: boolean;
|
|
19
21
|
featureFlags: FeatureFlags;
|
|
20
|
-
|
|
22
|
+
api: ExtractInjectionAPI<typeof expandPlugin> | undefined;
|
|
23
|
+
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, featureFlags: FeatureFlags, selectNearNode: EditorCommandWithMetadata | undefined, api: ExtractInjectionAPI<typeof expandPlugin> | undefined);
|
|
21
24
|
private initHandlers;
|
|
22
25
|
private focusTitle;
|
|
23
26
|
private handleIconKeyDown;
|
|
@@ -43,8 +46,9 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
43
46
|
update(node: PmNode, _decorations: readonly Decoration[]): boolean;
|
|
44
47
|
destroy(): void;
|
|
45
48
|
}
|
|
46
|
-
export default function ({ getIntl, isMobile, featureFlags, }: {
|
|
49
|
+
export default function ({ getIntl, isMobile, featureFlags, api, }: {
|
|
47
50
|
getIntl: () => IntlShape;
|
|
48
51
|
isMobile: boolean;
|
|
49
52
|
featureFlags: FeatureFlags;
|
|
53
|
+
api: ExtractInjectionAPI<typeof expandPlugin> | undefined;
|
|
50
54
|
}): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type expandPlugin from '../index';
|
|
4
|
+
export declare function expandKeymap(api: ExtractInjectionAPI<typeof expandPlugin> | undefined): SafePlugin;
|
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { Dispatch } from '../../../event-dispatcher';
|
|
3
3
|
import type { EditorProps } from '../../../types';
|
|
4
4
|
import type { IntlShape } from 'react-intl-next';
|
|
5
|
-
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { FeatureFlags, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type expandPlugin from '../index';
|
|
6
7
|
export declare function containsClass(element: Element | null, className: string): boolean;
|
|
7
|
-
export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorProps['appearance'], useLongPressSelection: boolean | undefined, featureFlags: FeatureFlags) => SafePlugin<import("
|
|
8
|
+
export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorProps['appearance'], useLongPressSelection: boolean | undefined, featureFlags: FeatureFlags, api: ExtractInjectionAPI<typeof expandPlugin> | undefined) => SafePlugin<import("../types").ExpandPluginState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import { PanelPluginOptions } from '../types';
|
|
4
|
-
import { Dispatch } from '../../../event-dispatcher';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { PanelPluginOptions } from '../types';
|
|
4
|
+
import type { Dispatch } from '../../../event-dispatcher';
|
|
5
5
|
export type PanelOptions = {
|
|
6
6
|
color?: string;
|
|
7
7
|
emoji?: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Command } from '
|
|
3
|
+
import type { Command } from '../../types';
|
|
4
4
|
import { RelativeSelectionPos } from './types';
|
|
5
|
-
|
|
5
|
+
import type { EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare const selectNearNode: EditorCommandWithMetadata;
|
|
7
|
+
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => import("@atlaskit/editor-common/types").Command;
|
|
6
8
|
export declare const arrowRight: Command;
|
|
7
9
|
export declare const arrowLeft: Command;
|
|
8
10
|
export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { EditorCommand, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { EditorCommand, NextEditorPlugin, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import type { SelectionPluginOptions } from './types';
|
|
3
|
-
type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
4
|
+
export type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
4
5
|
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
5
6
|
commands: {
|
|
6
7
|
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
8
|
+
selectNearNode: EditorCommandWithMetadata;
|
|
7
9
|
};
|
|
10
|
+
sharedState: SelectionSharedState;
|
|
8
11
|
}>;
|
|
9
12
|
export declare const selectionPlugin: SelectionPlugin;
|
|
10
13
|
export default selectionPlugin;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { Transaction, ReadonlyTransaction, EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
4
|
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
6
5
|
import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
|
|
8
|
-
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
9
|
-
useLongPressSelection: boolean;
|
|
10
|
-
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
11
|
-
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
6
|
+
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
12
7
|
export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
|
|
13
8
|
/**
|
|
14
9
|
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
@@ -60,4 +55,4 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
60
55
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
61
56
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
62
57
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
63
|
-
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, };
|
|
58
|
+
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, };
|