@atlaskit/editor-common 74.44.1 → 74.45.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/mark/commands.js +21 -26
  3. package/dist/cjs/media-single/constants.js +3 -1
  4. package/dist/cjs/media-single/index.js +6 -0
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/selection/index.js +36 -0
  7. package/dist/cjs/selection/utils.js +46 -1
  8. package/dist/cjs/ui/DropList/index.js +1 -1
  9. package/dist/cjs/utils/index.js +150 -0
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/mark/commands.js +21 -28
  12. package/dist/es2019/mark/index.js +1 -1
  13. package/dist/es2019/media-single/constants.js +1 -0
  14. package/dist/es2019/media-single/index.js +1 -1
  15. package/dist/es2019/monitoring/error.js +1 -1
  16. package/dist/es2019/selection/index.js +1 -1
  17. package/dist/es2019/selection/utils.js +52 -1
  18. package/dist/es2019/ui/DropList/index.js +1 -1
  19. package/dist/es2019/utils/index.js +139 -1
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/mark/commands.js +21 -26
  22. package/dist/esm/mark/index.js +1 -1
  23. package/dist/esm/media-single/constants.js +1 -0
  24. package/dist/esm/media-single/index.js +1 -1
  25. package/dist/esm/monitoring/error.js +1 -1
  26. package/dist/esm/selection/index.js +1 -1
  27. package/dist/esm/selection/utils.js +40 -1
  28. package/dist/esm/ui/DropList/index.js +1 -1
  29. package/dist/esm/utils/index.js +141 -1
  30. package/dist/esm/version.json +1 -1
  31. package/dist/types/mark/commands.d.ts +4 -4
  32. package/dist/types/mark/index.d.ts +1 -1
  33. package/dist/types/media-single/constants.d.ts +1 -0
  34. package/dist/types/media-single/index.d.ts +1 -1
  35. package/dist/types/selection/index.d.ts +1 -1
  36. package/dist/types/selection/utils.d.ts +9 -2
  37. package/dist/types/utils/index.d.ts +17 -0
  38. package/dist/types/utils/input-rules.d.ts +3 -2
  39. package/dist/types-ts4.5/mark/commands.d.ts +4 -4
  40. package/dist/types-ts4.5/mark/index.d.ts +1 -1
  41. package/dist/types-ts4.5/media-single/constants.d.ts +1 -0
  42. package/dist/types-ts4.5/media-single/index.d.ts +1 -1
  43. package/dist/types-ts4.5/selection/index.d.ts +1 -1
  44. package/dist/types-ts4.5/selection/utils.d.ts +9 -2
  45. package/dist/types-ts4.5/utils/index.d.ts +17 -0
  46. package/dist/types-ts4.5/utils/input-rules.d.ts +3 -2
  47. package/package.json +1 -1
@@ -1,3 +1,6 @@
1
+ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
1
4
  export { canApplyAnnotationOnRange, getAnnotationIdsFromRange, } from './annotation';
2
5
  export { getExtensionLozengeData } from './macro';
3
6
  export type { Params } from './macro';
@@ -59,3 +62,17 @@ export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertCo
59
62
  export type { WalkNode } from './commands';
60
63
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
61
64
  export { inputRuleWithAnalytics, createWrappingJoinRule, createRule, } from './input-rules';
65
+ export declare function isSelectionInsideLastNodeInDocument(selection: Selection): boolean;
66
+ export declare const isInListItem: (state: EditorState) => boolean;
67
+ /**
68
+ * Find the farthest node given a condition
69
+ * @param predicate Function to check the node
70
+ */
71
+ export declare const findFarthestParentNode: (predicate: (node: PMNode) => boolean) => ($pos: ResolvedPos) => ContentNodeWithPos | null;
72
+ export declare const insideTableCell: (state: EditorState) => boolean;
73
+ export declare function checkNodeDown(selection: Selection, doc: PMNode, filter: (node: PMNode) => boolean): boolean;
74
+ export declare const isEmptyNode: (schema: Schema) => (node: PMNode) => boolean;
75
+ /**
76
+ * Checks if a node has any content. Ignores node that only contain empty block nodes.
77
+ */
78
+ export declare function isNodeEmpty(node?: PMNode): boolean;
@@ -1,7 +1,8 @@
1
1
  import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { type AnalyticsEventPayload, type EditorAnalyticsAPI, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
4
- import { InputRuleHandler, InputRuleWrapper } from '../types';
3
+ import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '../analytics';
4
+ import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
5
+ import type { InputRuleHandler, InputRuleWrapper } from '../types';
5
6
  type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
6
7
  export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
7
8
  type WrappingRuleProps = {
@@ -1,6 +1,6 @@
1
1
  import type { Mark, MarkType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { Command } from '../types';
3
+ import type { PluginCommand } from '../types';
4
4
  export declare function filterChildrenBetween(doc: PMNode, from: number, to: number, predicate: (node: PMNode, pos: number, parent: PMNode | null) => boolean | undefined): {
5
5
  node: PMNode;
6
6
  pos: number;
@@ -8,11 +8,11 @@ export declare function filterChildrenBetween(doc: PMNode, from: number, to: num
8
8
  export declare const transformSmartCharsMentionsAndEmojis: (from: number, to: number, tr: Transaction) => void;
9
9
  export declare const applyMarkOnRange: (from: number, to: number, removeMark: boolean, mark: Mark, tr: Transaction) => Transaction;
10
10
  /**
11
- * A wrapper over the default toggleMark, except when we have a selection
12
- * we only toggle marks on text nodes rather than inline nodes.
11
+ * A custom version of the ProseMirror toggleMark, where we only toggle marks
12
+ * on text nodes in the selection rather than all inline nodes.
13
13
  * @param markType
14
14
  * @param attrs
15
15
  */
16
16
  export declare const toggleMark: (markType: MarkType, attrs?: {
17
17
  [key: string]: any;
18
- } | undefined) => Command;
18
+ } | undefined) => PluginCommand;
@@ -1,2 +1,2 @@
1
- export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, toggleMark, filterChildrenBetween, } from './commands';
1
+ export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark, } from './commands';
2
2
  export { anyMarkActive } from './text-formatting';
@@ -6,6 +6,7 @@ export declare const MEDIA_SINGLE_HANDLE_MARGIN = 12;
6
6
  export declare const MEDIA_SINGLE_GUTTER_SIZE: number;
7
7
  export declare const DEFAULT_IMAGE_WIDTH = 250;
8
8
  export declare const DEFAULT_IMAGE_HEIGHT = 200;
9
+ export declare const MEDIA_SINGLE_RESIZE_THROTTLE_TIME = 100;
9
10
  export declare enum Layout {
10
11
  FULL_WIDTH = "full-width",
11
12
  WIDE = "wide",
@@ -1,2 +1,2 @@
1
- export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, } from './constants';
1
+ export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, } from './constants';
2
2
  export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, } from './utils';
@@ -2,4 +2,4 @@ export { RelativeSelectionPos } from './types';
2
2
  export type { SelectionPluginState, EditorSelectionAPI } from './types';
3
3
  export { GapCursorSelection, Side, JSON_ID, GapBookmark, } from './gap-cursor/selection';
4
4
  export { isIgnored, isValidTargetNode } from './gap-cursor/utils';
5
- export { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from './utils';
5
+ export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, isSelectionAtEndOfNode, isSelectionAtStartOfNode, startPositionOfParent, } from './utils';
@@ -1,4 +1,11 @@
1
- import { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
1
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
3
4
  export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
4
5
  export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
6
+ export declare function atTheEndOfDoc(state: EditorState): boolean;
7
+ export declare function atTheBeginningOfDoc(state: EditorState): boolean;
8
+ export declare function atTheEndOfBlock(state: EditorState): boolean;
9
+ export declare function atTheBeginningOfBlock(state: EditorState): boolean;
10
+ export declare function startPositionOfParent(resolvedPos: ResolvedPos): number;
11
+ export declare function endPositionOfParent(resolvedPos: ResolvedPos): number;
@@ -1,3 +1,6 @@
1
+ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
1
4
  export { canApplyAnnotationOnRange, getAnnotationIdsFromRange, } from './annotation';
2
5
  export { getExtensionLozengeData } from './macro';
3
6
  export type { Params } from './macro';
@@ -59,3 +62,17 @@ export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertCo
59
62
  export type { WalkNode } from './commands';
60
63
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
61
64
  export { inputRuleWithAnalytics, createWrappingJoinRule, createRule, } from './input-rules';
65
+ export declare function isSelectionInsideLastNodeInDocument(selection: Selection): boolean;
66
+ export declare const isInListItem: (state: EditorState) => boolean;
67
+ /**
68
+ * Find the farthest node given a condition
69
+ * @param predicate Function to check the node
70
+ */
71
+ export declare const findFarthestParentNode: (predicate: (node: PMNode) => boolean) => ($pos: ResolvedPos) => ContentNodeWithPos | null;
72
+ export declare const insideTableCell: (state: EditorState) => boolean;
73
+ export declare function checkNodeDown(selection: Selection, doc: PMNode, filter: (node: PMNode) => boolean): boolean;
74
+ export declare const isEmptyNode: (schema: Schema) => (node: PMNode) => boolean;
75
+ /**
76
+ * Checks if a node has any content. Ignores node that only contain empty block nodes.
77
+ */
78
+ export declare function isNodeEmpty(node?: PMNode): boolean;
@@ -1,7 +1,8 @@
1
1
  import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { type AnalyticsEventPayload, type EditorAnalyticsAPI, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
4
- import { InputRuleHandler, InputRuleWrapper } from '../types';
3
+ import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '../analytics';
4
+ import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
5
+ import type { InputRuleHandler, InputRuleWrapper } from '../types';
5
6
  type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
6
7
  export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
7
8
  type WrappingRuleProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.44.1",
3
+ "version": "74.45.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"