@prismicio/editor-fields 0.4.69 → 0.4.71

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 (44) hide show
  1. package/dist/core/APIExplorer/components/APIExplorerContext.d.ts +70 -29
  2. package/dist/core/APIExplorer/components/Request/components/RequestLangFieldset.d.ts +5 -0
  3. package/dist/core/APIExplorer/components/Request/components/index.d.ts +1 -0
  4. package/dist/core/APIExplorer/components/Request/createRequest.d.ts +8 -3
  5. package/dist/core/APIExplorer/components/Request/index.d.ts +1 -1
  6. package/dist/core/APIExplorer/components/Request/types.d.ts +1 -0
  7. package/dist/core/MediaLibrary/hooks/mediaLibraryData.d.ts +44 -44
  8. package/dist/core/MediaLibrary/hooks/tagData.d.ts +3 -3
  9. package/dist/core/MediaLibrary/hooks/useMediaLibraryUpload.d.ts +4 -4
  10. package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +4 -4
  11. package/dist/core/UnsplashLibrary/unsplashData.d.ts +18 -18
  12. package/dist/core/service/customType.d.ts +9 -9
  13. package/dist/core/service/document.d.ts +163 -163
  14. package/dist/core/service/documentSearch.d.ts +40 -40
  15. package/dist/core/service/repository.d.ts +6 -6
  16. package/dist/core/service/role.d.ts +10 -10
  17. package/dist/fields/ImageField/useImageField.d.ts +4 -4
  18. package/dist/fields/ImageField/useImageFieldImageUpload.d.ts +4 -4
  19. package/dist/fields/IntegrationField/integrationData.d.ts +5 -5
  20. package/dist/fields/LinkField/Documents/documentsData.d.ts +12 -12
  21. package/dist/fields/LinkField/LinkField.d.ts +1 -1
  22. package/dist/fields/RichTextField/RichTextField.d.ts +1 -1
  23. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +4 -4
  24. package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +4 -4
  25. package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/TableHandlesPlugin.d.ts +8 -0
  26. package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/events.d.ts +19 -0
  27. package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/index.d.ts +1 -0
  28. package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/utils.d.ts +23 -0
  29. package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/index.d.ts +1 -0
  30. package/dist/fields/RichTextField/extensions/Table/TableControlsWrapper.d.ts +3 -0
  31. package/dist/fields/RichTextField/extensions/Table/TableView.d.ts +2 -0
  32. package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginDef.d.ts +8 -0
  33. package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginView.d.ts +34 -0
  34. package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginViewClass.d.ts +34 -0
  35. package/dist/fields/RichTextField/extensions/Table/plugins/index.d.ts +1 -0
  36. package/dist/fields/RichTextField/extensions/Table/plugins/tableCellFocusPlugin.d.ts +9 -0
  37. package/dist/index.cjs.js +133 -46
  38. package/dist/index.es.js +36889 -32346
  39. package/dist/slices/utils.d.ts +1 -1
  40. package/package.json +4 -4
  41. /package/dist/fields/RichTextField/extensions/Table/{plugins/tableHandles/tableHandlesPluginView.d.ts → TableCell/plugins/TableHandles/TableHandlesPluginView.d.ts} +0 -0
  42. /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles/tableHandlesPlugin.d.ts → TableHandles/TableHandlesPlugin.d.ts} +0 -0
  43. /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles → TableHandles}/index.d.ts +0 -0
  44. /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles → TableHandles}/utils.d.ts +0 -0
@@ -0,0 +1,8 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ import { Plugin } from "@tiptap/pm/state";
3
+ import { DecorationSet } from "@tiptap/pm/view";
4
+ /** Plugin responsible for showing and hiding the row and column handles. */
5
+ export declare function TableHandlesPlugin(this: {
6
+ editor: Editor;
7
+ name: string;
8
+ }): Plugin<DecorationSet>;
@@ -0,0 +1,19 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ export type TableHandleEventDetail = {
3
+ type: "row" | "column";
4
+ referenceElement: HTMLElement;
5
+ };
6
+ export type TableHandleEventType = {
7
+ name: "handleClick";
8
+ detail: TableHandleEventDetail;
9
+ };
10
+ export declare class TableHandleEvent extends CustomEvent<TableHandleEventType["detail"]> {
11
+ constructor({ name, detail }: TableHandleEventType);
12
+ static dispatch<TEvent extends TableHandleEventType>(name: TEvent["name"], args: {
13
+ editor: Editor;
14
+ } & TEvent["detail"]): void;
15
+ static listen<TEvent extends TableHandleEventType>(name: TEvent["name"], args: {
16
+ editor: Editor;
17
+ callback: (detail: TEvent["detail"]) => void;
18
+ }): () => void;
19
+ }
@@ -0,0 +1 @@
1
+ export { TableHandlesPlugin } from "./TableHandlesPlugin";
@@ -0,0 +1,23 @@
1
+ import { type Editor } from "@tiptap/core";
2
+ import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
3
+ import type { Selection } from "@tiptap/pm/state";
4
+ interface NodePos {
5
+ pos: number;
6
+ start: number;
7
+ node: ProseMirrorNode | null | undefined;
8
+ }
9
+ export declare function getCellsInColumn(columnIndex: number | number[]): (selection: Selection) => NodePos[] | null;
10
+ export declare function getCellsInRow(rowIndex: number | number[]): (selection: Selection) => NodePos[] | null;
11
+ /** Finds the table handle element for the given type and element. */
12
+ export declare function findTableHandleElement(args: {
13
+ type: "row" | "column";
14
+ element: Element;
15
+ }): Element;
16
+ /** Creates a table handle element for the given type. */
17
+ export declare function createTableHandleElement(args: {
18
+ type: "row" | "column";
19
+ editor: Editor;
20
+ rowIndex: number;
21
+ columnIndex: number;
22
+ }): HTMLButtonElement;
23
+ export {};
@@ -0,0 +1 @@
1
+ export { TableHandlesPlugin } from "./TableHandles";
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { type NodeViewProps } from "@tiptap/react";
3
+ export declare function TableControlsWrapper({ editor }: NodeViewProps): JSX.Element;
@@ -12,9 +12,11 @@ export interface TableOptions extends TTTableOptions {
12
12
  * table content.
13
13
  */
14
14
  export declare class TableView extends TTTableView implements NodeView {
15
+ private selectionOverlay;
15
16
  constructor(args: {
16
17
  node: ProseMirrorNode;
17
18
  editor: Editor;
18
19
  }, options: TableOptions);
20
+ destroy(): void;
19
21
  ignoreMutation(mutation: ViewMutationRecord): boolean;
20
22
  }
@@ -0,0 +1,8 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ import { Plugin } from "@tiptap/pm/state";
3
+ import { DecorationSet } from "@tiptap/pm/view";
4
+ /** Plugin responsible for showing and hiding the row and column handles. */
5
+ export declare function tableHandlesPlugin(args: {
6
+ editor: Editor;
7
+ name: string;
8
+ }): Plugin<DecorationSet>;
@@ -0,0 +1,34 @@
1
+ import { type PluginView } from "@tiptap/pm/state";
2
+ import type { EditorView } from "@tiptap/pm/view";
3
+ /**
4
+ * This plugin centralizes the logic for showing and hiding the row and column
5
+ * handle buttons (the ones that on click open a floating menu).
6
+ *
7
+ * Ideally, hiding and showing the handles would be handled using only CSS,
8
+ * but identifying the topmost cell in a column is not trivial, as the grouping
9
+ * of cells in a column is not clearly defined in the DOM (only by colgroup),
10
+ * and CSS cannot dynamically select it depending on the hovered cell.
11
+ *
12
+ * Another option was to dynamically generate hardcoded selectors, given that
13
+ * we know the number of rows and cells, but inline styles can only contain
14
+ * property declarations, not pseudo-classes like :hover.
15
+ *
16
+ * That leaves us with handling it solely in JavaScript, which is what this
17
+ * plugin does.
18
+ */
19
+ export declare class TableHandlesPluginView implements PluginView {
20
+ private readonly view;
21
+ private abortController;
22
+ private currentRowHandle;
23
+ private currentColumnHandle;
24
+ constructor(view: EditorView);
25
+ update(view: EditorView): void;
26
+ destroy(): void;
27
+ private attachEventListeners;
28
+ private showCurrentHandles;
29
+ private hidePreviousHandles;
30
+ private getRowHandle;
31
+ private getColumnHandle;
32
+ private displayHandle;
33
+ private hideHandle;
34
+ }
@@ -0,0 +1,34 @@
1
+ import { type PluginView } from "@tiptap/pm/state";
2
+ import type { EditorView } from "@tiptap/pm/view";
3
+ /**
4
+ * This plugin centralizes the logic for showing and hiding the row and column
5
+ * handle buttons (the ones that on click open a floating menu).
6
+ *
7
+ * Ideally, hiding and showing the handles would be handled using only CSS,
8
+ * but identifying the topmost cell in a column is not trivial, as the grouping
9
+ * of cells in a column is not clearly defined in the DOM (only by colgroup),
10
+ * and CSS cannot dynamically select it depending on the hovered cell.
11
+ *
12
+ * Another option was to dynamically generate hardcoded selectors, given that
13
+ * we know the number of rows and cells, but inline styles can only contain
14
+ * property declarations, not pseudo-classes like :hover.
15
+ *
16
+ * That leaves us with handling it solely in JavaScript, which is what this
17
+ * plugin does.
18
+ */
19
+ export declare class TableHandlesPluginView implements PluginView {
20
+ private readonly view;
21
+ private abortController;
22
+ private currentRowHandle;
23
+ private currentColumnHandle;
24
+ constructor(view: EditorView);
25
+ update(view: EditorView): void;
26
+ destroy(): void;
27
+ private attachEventListeners;
28
+ private showCurrentHandles;
29
+ private hidePreviousHandles;
30
+ private getRowHandle;
31
+ private getColumnHandle;
32
+ private displayHandle;
33
+ private hideHandle;
34
+ }
@@ -1 +1,2 @@
1
+ export { tableCellFocusPlugin } from "./tableCellFocusPlugin";
1
2
  export { tableHandlesPlugin } from "./tableHandles";
@@ -0,0 +1,9 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { Plugin } from "@tiptap/pm/state";
3
+ /**
4
+ * Focus plugin based on `extension-focus`, but only for table cells and with
5
+ * a small fix to prevent focus jumping when it's a cell selection.
6
+ * Applies a className of `focusedCell` to the cell that is focused.
7
+ * See: https://github.com/ueberdosis/tiptap/blob/v2.11.5/packages/extension-focus/src/focus.ts
8
+ */
9
+ export declare function tableCellFocusPlugin(editor: Editor): Plugin<any>;