@atlaskit/editor-plugin-selection 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/pm-plugins/events/create-selection-between.js +3 -0
  3. package/dist/cjs/utils.js +9 -1
  4. package/dist/es2019/pm-plugins/events/create-selection-between.js +3 -0
  5. package/dist/es2019/utils.js +12 -2
  6. package/dist/esm/pm-plugins/events/create-selection-between.js +3 -0
  7. package/dist/esm/utils.js +10 -2
  8. package/dist/types-ts4.5/actions.d.ts +17 -0
  9. package/dist/types-ts4.5/commands.d.ts +9 -0
  10. package/dist/types-ts4.5/gap-cursor/actions.d.ts +23 -0
  11. package/dist/types-ts4.5/gap-cursor/direction.d.ts +10 -0
  12. package/dist/types-ts4.5/gap-cursor/selection.d.ts +1 -0
  13. package/dist/types-ts4.5/gap-cursor/utils/is-ignored.d.ts +1 -0
  14. package/dist/types-ts4.5/gap-cursor/utils/is-valid-target-node.d.ts +1 -0
  15. package/dist/types-ts4.5/gap-cursor/utils/place-gap-cursor.d.ts +2 -0
  16. package/dist/types-ts4.5/gap-cursor/utils.d.ts +8 -0
  17. package/dist/types-ts4.5/gap-cursor-selection.d.ts +2 -0
  18. package/dist/types-ts4.5/index.d.ts +3 -0
  19. package/dist/types-ts4.5/plugin-factory.d.ts +2 -0
  20. package/dist/types-ts4.5/plugin.d.ts +13 -0
  21. package/dist/types-ts4.5/pm-plugins/events/create-selection-between.d.ts +4 -0
  22. package/dist/types-ts4.5/pm-plugins/events/keydown.d.ts +2 -0
  23. package/dist/types-ts4.5/pm-plugins/gap-cursor-keymap.d.ts +2 -0
  24. package/dist/types-ts4.5/pm-plugins/gap-cursor-main.d.ts +6 -0
  25. package/dist/types-ts4.5/pm-plugins/gap-cursor-plugin-key.d.ts +2 -0
  26. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -0
  27. package/dist/types-ts4.5/pm-plugins/selection-main.d.ts +7 -0
  28. package/dist/types-ts4.5/reducer.d.ts +3 -0
  29. package/dist/types-ts4.5/types.d.ts +20 -0
  30. package/dist/types-ts4.5/utils.d.ts +58 -0
  31. package/package.json +3 -3
  32. package/report.api.md +72 -0
package/CHANGELOG.md CHANGED
@@ -1 +1,7 @@
1
1
  # @atlaskit/editor-plugin-selection
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#57079](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/57079) [`d15db1b00c5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d15db1b00c5a) - [ED-21267] Improve arrow navigation across MultiBodiedExtensions
@@ -33,6 +33,9 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
33
33
  if (isValidPosition($pos)) {
34
34
  return $pos;
35
35
  }
36
+ if ($pos.depth === 0 && $pos.pos === 0) {
37
+ return $pos;
38
+ }
36
39
  var positionLevelUp = $pos.before();
37
40
  var resolvedPositionLevelUp = doc.resolve(positionLevelUp);
38
41
  return findEmptySelectableParentNodePosition(resolvedPositionLevelUp, isValidPosition);
package/dist/cjs/utils.js CHANGED
@@ -276,5 +276,13 @@ var isSelectionAtStartOfParentNode = exports.isSelectionAtStartOfParentNode = fu
276
276
  return (0, _selection.isSelectionAtStartOfNode)($pos, findSelectableContainerParent(selection));
277
277
  };
278
278
  var isSelectionAtEndOfParentNode = exports.isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
279
- return (0, _selection.isSelectionAtEndOfNode)($pos, findSelectableContainerParent(selection));
279
+ var isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
280
+ if (!isAtTheEndOfCurrentLevel) {
281
+ return false;
282
+ }
283
+ if ($pos.depth === 0 || _state.NodeSelection.isSelectable($pos.parent)) {
284
+ return isAtTheEndOfCurrentLevel;
285
+ }
286
+ var $after = $pos.doc.resolve($pos.after());
287
+ return $after.parent.content.size === $after.parentOffset;
280
288
  };
@@ -29,6 +29,9 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
29
29
  if (isValidPosition($pos)) {
30
30
  return $pos;
31
31
  }
32
+ if ($pos.depth === 0 && $pos.pos === 0) {
33
+ return $pos;
34
+ }
32
35
  const positionLevelUp = $pos.before();
33
36
  const resolvedPositionLevelUp = doc.resolve(positionLevelUp);
34
37
  return findEmptySelectableParentNodePosition(resolvedPositionLevelUp, isValidPosition);
@@ -1,4 +1,4 @@
1
- import { createSelectionClickHandler, getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, isIgnored as isIgnoredByGapCursor, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
1
+ import { createSelectionClickHandler, getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
2
2
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
3
  import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNode, flatten } from '@atlaskit/editor-prosemirror/utils';
@@ -229,5 +229,15 @@ export const findLastChildNodeToSelect = parent => {
229
229
  }
230
230
  };
231
231
  export const isSelectionAtStartOfParentNode = ($pos, selection) => isSelectionAtStartOfNode($pos, findSelectableContainerParent(selection));
232
- export const isSelectionAtEndOfParentNode = ($pos, selection) => isSelectionAtEndOfNode($pos, findSelectableContainerParent(selection));
232
+ export const isSelectionAtEndOfParentNode = ($pos, selection) => {
233
+ const isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
234
+ if (!isAtTheEndOfCurrentLevel) {
235
+ return false;
236
+ }
237
+ if ($pos.depth === 0 || NodeSelection.isSelectable($pos.parent)) {
238
+ return isAtTheEndOfCurrentLevel;
239
+ }
240
+ const $after = $pos.doc.resolve($pos.after());
241
+ return $after.parent.content.size === $after.parentOffset;
242
+ };
233
243
  export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler };
@@ -27,6 +27,9 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
27
27
  if (isValidPosition($pos)) {
28
28
  return $pos;
29
29
  }
30
+ if ($pos.depth === 0 && $pos.pos === 0) {
31
+ return $pos;
32
+ }
30
33
  var positionLevelUp = $pos.before();
31
34
  var resolvedPositionLevelUp = doc.resolve(positionLevelUp);
32
35
  return findEmptySelectableParentNodePosition(resolvedPositionLevelUp, isValidPosition);
package/dist/esm/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createSelectionClickHandler, getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, isIgnored as isIgnoredByGapCursor, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
1
+ import { createSelectionClickHandler, getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
2
2
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
3
  import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNode, flatten } from '@atlaskit/editor-prosemirror/utils';
@@ -236,6 +236,14 @@ export var isSelectionAtStartOfParentNode = function isSelectionAtStartOfParentN
236
236
  return isSelectionAtStartOfNode($pos, findSelectableContainerParent(selection));
237
237
  };
238
238
  export var isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
239
- return isSelectionAtEndOfNode($pos, findSelectableContainerParent(selection));
239
+ var isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
240
+ if (!isAtTheEndOfCurrentLevel) {
241
+ return false;
242
+ }
243
+ if ($pos.depth === 0 || NodeSelection.isSelectable($pos.parent)) {
244
+ return isAtTheEndOfCurrentLevel;
245
+ }
246
+ var $after = $pos.doc.resolve($pos.after());
247
+ return $after.parent.content.size === $after.parentOffset;
240
248
  };
241
249
  export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler };
@@ -0,0 +1,17 @@
1
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
+ import type { RelativeSelectionPos } from './types';
4
+ export declare enum SelectionActionTypes {
5
+ SET_DECORATIONS = "SET_DECORATIONS",
6
+ SET_RELATIVE_SELECTION = "SET_RELATIVE_SELECTION"
7
+ }
8
+ export interface SetDecorations {
9
+ type: SelectionActionTypes.SET_DECORATIONS;
10
+ decorationSet: DecorationSet;
11
+ selection: Selection;
12
+ }
13
+ export interface SetRelativeSelection {
14
+ type: SelectionActionTypes.SET_RELATIVE_SELECTION;
15
+ selectionRelativeToNode?: RelativeSelectionPos;
16
+ }
17
+ export type SelectionAction = SetDecorations | SetRelativeSelection;
@@ -0,0 +1,9 @@
1
+ import type { Command, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
2
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
4
+ import { RelativeSelectionPos } from './types';
5
+ export declare const selectNearNode: EditorCommandWithMetadata;
6
+ export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
7
+ export declare const arrowRight: Command;
8
+ export declare const arrowLeft: Command;
9
+ export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
@@ -0,0 +1,23 @@
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import { Direction } from './direction';
5
+ export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
6
+ export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
7
+ export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
8
+ export declare const deleteNode: (dir: Direction) => Command;
9
+ export declare const setSelectionTopLevelBlocks: (tr: Transaction, event: React.MouseEvent<any>, editorRef: HTMLElement, posAtCoords: (coords: {
10
+ left: number;
11
+ top: number;
12
+ }) => {
13
+ pos: number;
14
+ inside: number;
15
+ } | null | void, editorFocused: boolean) => void;
16
+ export declare const setCursorForTopLevelBlocks: (event: React.MouseEvent<any>, editorRef: HTMLElement, posAtCoords: (coords: {
17
+ left: number;
18
+ top: number;
19
+ }) => {
20
+ pos: number;
21
+ inside: number;
22
+ } | null | void, editorFocused: boolean) => Command;
23
+ export declare const hasGapCursorPlugin: (state: EditorState) => boolean;
@@ -0,0 +1,10 @@
1
+ export declare enum Direction {
2
+ UP = "up",
3
+ RIGHT = "right",
4
+ DOWN = "down",
5
+ LEFT = "left",
6
+ BACKWARD = "backward",
7
+ FORWARD = "forward"
8
+ }
9
+ export declare function isBackward(dir: Direction): boolean;
10
+ export declare function isForward(dir: Direction): boolean;
@@ -0,0 +1 @@
1
+ export { GapCursorSelection, JSON_ID, Side, GapBookmark, } from '@atlaskit/editor-common/selection';
@@ -0,0 +1 @@
1
+ export { isIgnored } from '@atlaskit/editor-common/selection';
@@ -0,0 +1 @@
1
+ export { isValidTargetNode } from '@atlaskit/editor-common/selection';
@@ -0,0 +1,2 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const toDOM: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
@@ -0,0 +1,8 @@
1
+ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import { Side } from './selection';
3
+ export declare const isLeftCursor: (side: Side) => side is Side.LEFT;
4
+ export declare function getMediaNearPos(doc: PMNode, $pos: ResolvedPos, schema: Schema, dir?: number): PMNode | null;
5
+ export declare const isTextBlockNearPos: (doc: PMNode, schema: Schema, $pos: ResolvedPos, dir: number) => boolean;
6
+ export declare function getLayoutModeFromTargetNode(node: PMNode): string;
7
+ export declare const isIgnoredClick: (elem: HTMLElement) => boolean;
8
+ export declare const getComputedStyleForLayoutMode: (dom: HTMLElement, node: PMNode | undefined | null, style: CSSStyleDeclaration) => CSSStyleDeclaration;
@@ -0,0 +1,2 @@
1
+ export { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
2
+ export { setCursorForTopLevelBlocks, setSelectionTopLevelBlocks, hasGapCursorPlugin, } from './gap-cursor/actions';
@@ -0,0 +1,3 @@
1
+ export { selectionPlugin } from './plugin';
2
+ export type { SelectionPlugin } from './plugin';
3
+ export type { EditorSelectionAPI, SetSelectionRelativeToNode } from './types';
@@ -0,0 +1,2 @@
1
+ import type { SelectionPluginState } from './types';
2
+ export declare const createCommand: <A = import("./actions").SelectionAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => SelectionPluginState, createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: SelectionPluginState | ((state: import("prosemirror-state").EditorState) => SelectionPluginState)) => import("prosemirror-state").SafeStateField<SelectionPluginState>;
@@ -0,0 +1,13 @@
1
+ import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
2
+ import type { EditorCommand, NextEditorPlugin } from '@atlaskit/editor-common/types';
3
+ import type { EditorSelectionAPI, SelectionPluginOptions } from './types';
4
+ export type SelectionPlugin = NextEditorPlugin<'selection', {
5
+ pluginConfiguration: SelectionPluginOptions | undefined;
6
+ actions: EditorSelectionAPI;
7
+ commands: {
8
+ displayGapCursor: (toggle: boolean) => EditorCommand;
9
+ };
10
+ sharedState: SelectionSharedState;
11
+ }>;
12
+ export declare const selectionPlugin: SelectionPlugin;
13
+ export default selectionPlugin;
@@ -0,0 +1,4 @@
1
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ export declare const onCreateSelectionBetween: (view: EditorView, $anchor: ResolvedPos, $head: ResolvedPos) => TextSelection | null;
@@ -0,0 +1,2 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const onKeydown: (view: EditorView, event: Event) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ export default function keymapPlugin(): SafePlugin;
@@ -0,0 +1,6 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ declare const plugin: SafePlugin<{
3
+ selectionIsGapCursor: boolean;
4
+ displayGapCursor: boolean;
5
+ }>;
6
+ export default plugin;
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const gapCursorPluginKey: PluginKey<any>;
@@ -0,0 +1,3 @@
1
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ declare function keymapPlugin(): SafePlugin<any>;
3
+ export default keymapPlugin;
@@ -0,0 +1,7 @@
1
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
+ import type { SelectionPluginOptions, SelectionPluginState } from '../types';
6
+ export declare const getInitialState: (state: EditorState) => SelectionPluginState;
7
+ export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
@@ -0,0 +1,3 @@
1
+ import type { SelectionAction } from './actions';
2
+ import type { SelectionPluginState } from './types';
3
+ export declare function reducer(pluginState: SelectionPluginState, action: SelectionAction): SelectionPluginState;
@@ -0,0 +1,20 @@
1
+ import { RelativeSelectionPos } from '@atlaskit/editor-common/selection';
2
+ export type { SelectionPluginState } from '@atlaskit/editor-common/selection';
3
+ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
4
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
6
+ export declare const selectionPluginKey: PluginKey<any>;
7
+ export { RelativeSelectionPos };
8
+ export declare enum SelectionDirection {
9
+ Before = -1,
10
+ After = 1
11
+ }
12
+ export type SetSelectionRelativeToNode = (props: {
13
+ selectionRelativeToNode?: RelativeSelectionPos;
14
+ selection?: Selection | null;
15
+ }) => (state: EditorState) => Transaction;
16
+ export type EditorSelectionAPI = {
17
+ selectNearNode: SetSelectionRelativeToNode;
18
+ };
19
+ export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
20
+ }
@@ -0,0 +1,58 @@
1
+ import { createSelectionClickHandler, getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
2
+ import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
5
+ import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
6
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
+ export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
8
+ /**
9
+ * Use `getNodesToDecorateFromSelection` to collect and return
10
+ * a list of nodes within the Selection that should have Selection
11
+ * decorations applied. This allows selection styles to be added to
12
+ * nested nodes. It will ignore text nodes as decorations are
13
+ * applied natively and also ignore nodes that don't completely
14
+ * sit within the given `Selection`.
15
+ */
16
+ export declare const getNodesToDecorateFromSelection: (selection: Selection, doc: PmNode) => {
17
+ node: PmNode;
18
+ pos: number;
19
+ }[];
20
+ export declare function shouldRecalcDecorations({ oldEditorState, newEditorState, }: {
21
+ oldEditorState: EditorState;
22
+ newEditorState: EditorState;
23
+ }): boolean;
24
+ export declare const isSelectableContainerNode: (node?: PmNode | null) => boolean;
25
+ export declare const isSelectableChildNode: (node?: PmNode | null) => boolean;
26
+ /**
27
+ * Finds closest parent node that is a selectable block container node
28
+ * If it finds a parent that is not selectable but supports gap cursor, will
29
+ * return undefined
30
+ */
31
+ export declare const findSelectableContainerParent: (selection: Selection) => ContentNodeWithPos | undefined;
32
+ /**
33
+ * Finds node before that is a selectable block container node, starting
34
+ * from $pos.depth + 1 and working in
35
+ * If it finds a node that is not selectable but supports gap cursor, will
36
+ * return undefined
37
+ */
38
+ export declare const findSelectableContainerBefore: ($pos: ResolvedPos, doc: PmNode) => NodeWithPos | undefined;
39
+ /**
40
+ * Finds node after that is a selectable block container node, starting
41
+ * from $pos.depth + 1 and working in
42
+ * If it finds a node that is not selectable but supports gap cursor, will
43
+ * return undefined
44
+ */
45
+ export declare const findSelectableContainerAfter: ($pos: ResolvedPos, doc: PmNode) => NodeWithPos | undefined;
46
+ /**
47
+ * Finds first child node that is a selectable block container node OR that
48
+ * supports gap cursor
49
+ */
50
+ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
51
+ /**
52
+ * Finds last child node that is a selectable block container node OR that
53
+ * supports gap cursor
54
+ */
55
+ export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
56
+ export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
57
+ export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
58
+ export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,7 +20,7 @@
20
20
  "singleton": true
21
21
  },
22
22
  "dependencies": {
23
- "@atlaskit/editor-common": "^76.8.0",
23
+ "@atlaskit/editor-common": "^76.23.0",
24
24
  "@atlaskit/editor-prosemirror": "1.1.0",
25
25
  "@atlaskit/editor-shared-styles": "^2.7.0",
26
26
  "@atlaskit/editor-tables": "^2.3.10",
@@ -32,7 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@af/editor-libra": "*",
34
34
  "@af/visual-regression": "*",
35
- "@atlaskit/editor-plugin-analytics": "^0.2.4",
35
+ "@atlaskit/editor-plugin-analytics": "^0.3.0",
36
36
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
37
37
  "@atlaskit/editor-plugin-focus": "^0.2.1",
38
38
  "@atlaskit/editor-plugin-grid": "^0.3.0",
package/report.api.md ADDED
@@ -0,0 +1,72 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
3
+ ## API Report File for "@atlaskit/editor-plugin-selection"
4
+
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
9
+
10
+ - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
12
+
13
+ ### Main Entry Types
14
+
15
+ <!--SECTION START: Main Entry Types-->
16
+
17
+ ```ts
18
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
19
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
20
+ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
21
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
22
+ import { RelativeSelectionPos } from '@atlaskit/editor-common/selection';
23
+ import type { Selection as Selection_2 } from '@atlaskit/editor-prosemirror/state';
24
+ import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
25
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
26
+
27
+ // @public (undocumented)
28
+ export type EditorSelectionAPI = {
29
+ selectNearNode: SetSelectionRelativeToNode;
30
+ };
31
+
32
+ // @public (undocumented)
33
+ export type SelectionPlugin = NextEditorPlugin<
34
+ 'selection',
35
+ {
36
+ pluginConfiguration: SelectionPluginOptions | undefined;
37
+ actions: EditorSelectionAPI;
38
+ commands: {
39
+ displayGapCursor: (toggle: boolean) => EditorCommand;
40
+ };
41
+ sharedState: SelectionSharedState;
42
+ }
43
+ >;
44
+
45
+ // @public (undocumented)
46
+ export const selectionPlugin: SelectionPlugin;
47
+
48
+ // @public (undocumented)
49
+ interface SelectionPluginOptions extends LongPressSelectionPluginOptions {}
50
+
51
+ // @public (undocumented)
52
+ export type SetSelectionRelativeToNode = (props: {
53
+ selectionRelativeToNode?: RelativeSelectionPos;
54
+ selection?: Selection_2 | null;
55
+ }) => (state: EditorState) => Transaction;
56
+
57
+ // (No @packageDocumentation comment for this package)
58
+ ```
59
+
60
+ <!--SECTION END: Main Entry Types-->
61
+
62
+ ### Peer Dependencies
63
+
64
+ <!--SECTION START: Peer Dependencies-->
65
+
66
+ ```json
67
+ {
68
+ "react": "^16.8.0"
69
+ }
70
+ ```
71
+
72
+ <!--SECTION END: Peer Dependencies-->