@atlaskit/editor-common 74.30.0 → 74.31.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 (67) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/lists/analytics.js +40 -0
  3. package/dist/cjs/lists/indentation.js +24 -0
  4. package/dist/cjs/lists/index.js +89 -0
  5. package/dist/cjs/lists/node.js +97 -0
  6. package/dist/cjs/lists/replace-content.js +24 -0
  7. package/dist/cjs/lists/selection.js +59 -0
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/node-width/index.js +10 -2
  10. package/dist/cjs/ui/DropList/index.js +1 -1
  11. package/dist/cjs/utils/commands.js +110 -2
  12. package/dist/cjs/utils/document.js +26 -1
  13. package/dist/cjs/utils/index.js +51 -2
  14. package/dist/cjs/utils/prosemirror/autojoin.js +68 -0
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/lists/analytics.js +36 -0
  17. package/dist/es2019/lists/indentation.js +18 -0
  18. package/dist/es2019/lists/index.js +6 -0
  19. package/dist/es2019/lists/node.js +97 -0
  20. package/dist/es2019/lists/replace-content.js +18 -0
  21. package/dist/es2019/lists/selection.js +53 -0
  22. package/dist/es2019/monitoring/error.js +1 -1
  23. package/dist/es2019/node-width/index.js +7 -0
  24. package/dist/es2019/ui/DropList/index.js +1 -1
  25. package/dist/es2019/utils/commands.js +106 -2
  26. package/dist/es2019/utils/document.js +25 -1
  27. package/dist/es2019/utils/index.js +3 -2
  28. package/dist/es2019/utils/prosemirror/autojoin.js +57 -0
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/lists/analytics.js +32 -0
  31. package/dist/esm/lists/indentation.js +17 -0
  32. package/dist/esm/lists/index.js +6 -0
  33. package/dist/esm/lists/node.js +87 -0
  34. package/dist/esm/lists/replace-content.js +17 -0
  35. package/dist/esm/lists/selection.js +50 -0
  36. package/dist/esm/monitoring/error.js +1 -1
  37. package/dist/esm/node-width/index.js +7 -0
  38. package/dist/esm/ui/DropList/index.js +1 -1
  39. package/dist/esm/utils/commands.js +104 -2
  40. package/dist/esm/utils/document.js +25 -1
  41. package/dist/esm/utils/index.js +3 -2
  42. package/dist/esm/utils/prosemirror/autojoin.js +63 -0
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/lists/analytics.d.ts +4 -0
  45. package/dist/types/lists/indentation.d.ts +5 -0
  46. package/dist/types/lists/index.d.ts +6 -0
  47. package/dist/types/lists/node.d.ts +18 -0
  48. package/dist/types/lists/replace-content.d.ts +8 -0
  49. package/dist/types/lists/selection.d.ts +13 -0
  50. package/dist/types/node-width/index.d.ts +1 -0
  51. package/dist/types/utils/commands.d.ts +36 -2
  52. package/dist/types/utils/document.d.ts +4 -0
  53. package/dist/types/utils/index.d.ts +4 -2
  54. package/dist/types/utils/prosemirror/autojoin.d.ts +13 -0
  55. package/dist/types-ts4.5/lists/analytics.d.ts +4 -0
  56. package/dist/types-ts4.5/lists/indentation.d.ts +5 -0
  57. package/dist/types-ts4.5/lists/index.d.ts +6 -0
  58. package/dist/types-ts4.5/lists/node.d.ts +18 -0
  59. package/dist/types-ts4.5/lists/replace-content.d.ts +8 -0
  60. package/dist/types-ts4.5/lists/selection.d.ts +13 -0
  61. package/dist/types-ts4.5/node-width/index.d.ts +1 -0
  62. package/dist/types-ts4.5/utils/commands.d.ts +42 -2
  63. package/dist/types-ts4.5/utils/document.d.ts +4 -0
  64. package/dist/types-ts4.5/utils/index.d.ts +4 -2
  65. package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +13 -0
  66. package/lists/package.json +15 -0
  67. package/package.json +3 -2
@@ -12,3 +12,4 @@ export declare const layoutToWidth: {
12
12
  */
13
13
  export declare const getParentNodeWidth: (pos: number | undefined, state: EditorState, containerWidth: EditorContainerWidth, isFullWidthModeEnabled?: boolean) => any;
14
14
  export declare const getTableContainerWidth: (node: PMNode) => number;
15
+ export declare const getTableWidthWithNumberColumn: (node: PMNode, offset: number) => number;
@@ -1,2 +1,42 @@
1
- import type { Command, Predicate } from '../types';
2
- export declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
1
+ import type { Fragment, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { Command } from '../types';
5
+ export type WalkNode = {
6
+ $pos: ResolvedPos;
7
+ foundNode: boolean;
8
+ };
9
+ type Predicate = (state: EditorState, view?: EditorView) => boolean;
10
+ declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
11
+ /**
12
+ * Walk forwards from a position until we encounter the (inside) start of
13
+ * the next node, or reach the end of the document.
14
+ *
15
+ * @param $startPos Position to start walking from.
16
+ */
17
+ export declare const walkNextNode: ($startPos: ResolvedPos) => WalkNode;
18
+ /**
19
+ * Walk backwards from a position until we encounter the (inside) end of
20
+ * the previous node, or reach the start of the document.
21
+ *
22
+ * @param $startPos Position to start walking from.
23
+ */
24
+ export declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
25
+ /**
26
+ * If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
27
+ * and move the node below it up. The selection will be retained, to be placed in the moved node.
28
+ *
29
+ * @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
30
+ * @returns PM Command
31
+ */
32
+ export declare const deleteEmptyParagraphAndMoveBlockUp: (canNextNodeMoveUp: (nextNode: PMNode) => boolean) => Command;
33
+ export declare const insertContentDeleteRange: (tr: Transaction, getSelectionResolvedPos: (tr: Transaction) => ResolvedPos, insertions: [
34
+ Fragment,
35
+ number
36
+ ][], deletions: [
37
+ number,
38
+ number
39
+ ][]) => void;
40
+ export declare const isEmptySelectionAtStart: (state: EditorState) => boolean;
41
+ export declare const isEmptySelectionAtEnd: (state: EditorState) => boolean;
42
+ export { filter as filterCommand };
@@ -16,4 +16,8 @@ export declare function isEmptyDocument(node: Node): boolean;
16
16
  export declare function bracketTyped(state: EditorState): boolean;
17
17
  export declare function nodesBetweenChanged(tr: Transaction | ReadonlyTransaction, f: ChangedFn, startPos?: number): void;
18
18
  export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
19
+ /**
20
+ * Returns false if node contains only empty inline nodes and hardBreaks.
21
+ */
22
+ export declare function hasVisibleContent(node: Node): boolean;
19
23
  export {};
@@ -45,14 +45,16 @@ export type { ShallowPropsDifference, PropsDifference } from './compare-props';
45
45
  export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
46
46
  export type { UseComponentRenderTrackingArgs } from './performance/hooks/use-component-render-tracking';
47
47
  export { isOutdatedBrowser } from './outdated-browsers';
48
+ export { autoJoinTr } from './prosemirror/autojoin';
48
49
  export { isReferencedSource, removeConnectedNodes, getChildrenInfo, getNodeName, } from './referentiality';
49
50
  export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder, isListNode, isParagraphNode, isListItemNode, isBulletList, } from './list';
50
51
  export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLinkDomain, findFilepaths, isLinkInMatches, FILEPATH_REGEXP, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, canLinkBeCreatedInRange, } from './hyperlink';
51
52
  export declare const pmHistoryPluginKey = "history$";
52
53
  export { gridTypeForLayout } from './grid';
53
- export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, } from './document';
54
+ export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, } from './document';
54
55
  export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
55
56
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
56
57
  export { canRenderDatasource } from './datasource';
57
- export { filter as filterCommands } from './commands';
58
+ export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, } from './commands';
59
+ export type { WalkNode } from './commands';
58
60
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
@@ -0,0 +1,13 @@
1
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ /**
4
+ * Checks whether two adjacent nodes can be joined. If so, the document
5
+ * will be updated to join those nodes. If not, the original transaction
6
+ * remains untouched.
7
+ *
8
+ * Nodes are considered joinable if the `isJoinable` predicate returns true or,
9
+ * if an array of strings was passed, if their node type name is in that array.
10
+ *
11
+ * Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
12
+ */
13
+ export declare function autoJoinTr(tr: Transaction, isJoinable: ((before: Node, after: Node) => boolean) | string[]): void;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/lists",
3
+ "main": "../dist/cjs/lists/index.js",
4
+ "module": "../dist/esm/lists/index.js",
5
+ "module:es2019": "../dist/es2019/lists/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/lists/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <4.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/lists/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.30.0",
3
+ "version": "74.31.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/"
@@ -75,7 +75,8 @@
75
75
  "./guideline": "./src/guideline/index.ts",
76
76
  "./quick-insert": "./src/quick-insert/index.ts",
77
77
  "./link": "./src/link/index.ts",
78
- "./mark": "./src/mark/index.ts"
78
+ "./mark": "./src/mark/index.ts",
79
+ "./lists": "./src/lists/index.ts"
79
80
  },
80
81
  "dependencies": {
81
82
  "@atlaskit/activity-provider": "^2.4.0",