@prismicio/editor-fields 0.4.73 → 0.4.74
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/dist/core/APIExplorer/components/APIExplorerContext.d.ts +4 -4
- package/dist/core/APIExplorer/hooks/useRepositoryCustomTypes.d.ts +1 -1
- package/dist/core/MediaLibrary/hooks/mediaLibraryData.d.ts +84 -84
- package/dist/core/MediaLibrary/hooks/tagData.d.ts +3 -3
- package/dist/core/MediaLibrary/hooks/useMediaLibraryUpload.d.ts +8 -8
- package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +8 -8
- package/dist/core/UnsplashLibrary/unsplashData.d.ts +9 -9
- package/dist/core/service/customType.d.ts +21 -21
- package/dist/core/service/document.d.ts +115 -115
- package/dist/core/service/documentSearch.d.ts +37 -37
- package/dist/core/service/onboarding.d.ts +3 -3
- package/dist/core/service/repository.d.ts +18 -18
- package/dist/core/service/role.d.ts +64 -64
- package/dist/core/service/user.d.ts +8 -8
- package/dist/fields/ImageField/useImageField.d.ts +8 -8
- package/dist/fields/ImageField/useImageFieldImageUpload.d.ts +8 -8
- package/dist/fields/IntegrationField/integrationData.d.ts +5 -5
- package/dist/fields/LinkField/Documents/documentsData.d.ts +12 -12
- package/dist/fields/LinkField/LinkField.d.ts +1 -1
- package/dist/fields/LinkField/useLinkField.d.ts +1 -1
- package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +8 -8
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/TableHandlesPlugin.d.ts +8 -0
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/events.d.ts +19 -0
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/index.d.ts +1 -0
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/utils.d.ts +23 -0
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/index.d.ts +1 -0
- package/dist/fields/RichTextField/extensions/Table/TableCell/utils.d.ts +1 -0
- package/dist/fields/RichTextField/extensions/Table/TableControlsWrapper.d.ts +3 -0
- package/dist/fields/RichTextField/extensions/Table/TableView.d.ts +5 -8
- package/dist/fields/RichTextField/extensions/Table/menus/PassthroughTrigger.d.ts +12 -0
- package/dist/fields/RichTextField/extensions/Table/menus/TableColumnMenu.d.ts +6 -4
- package/dist/fields/RichTextField/extensions/Table/menus/TableRowMenu.d.ts +6 -4
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginDef.d.ts +8 -0
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginView.d.ts +34 -0
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginViewClass.d.ts +34 -0
- package/dist/index.cjs.js +35 -35
- package/dist/index.es.js +5424 -5373
- package/dist/slices/utils.d.ts +5 -5
- package/package.json +4 -4
- /package/dist/fields/RichTextField/extensions/Table/{plugins/tableHandles/tableHandlesPluginView.d.ts → TableCell/plugins/TableHandles/TableHandlesPluginView.d.ts} +0 -0
- /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles/tableHandlesPlugin.d.ts → TableHandles/TableHandlesPlugin.d.ts} +0 -0
- /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles → TableHandles}/index.d.ts +0 -0
- /package/dist/fields/RichTextField/extensions/Table/plugins/{tableHandles → TableHandles}/utils.d.ts +0 -0
|
@@ -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";
|
|
@@ -5,6 +5,7 @@ interface CreateButtonElementArgs {
|
|
|
5
5
|
title: string;
|
|
6
6
|
className: string;
|
|
7
7
|
tabIndex?: number;
|
|
8
|
+
contentEditable?: boolean;
|
|
8
9
|
onMouseDown?: (event: MouseEvent, currentTarget: HTMLButtonElement) => void;
|
|
9
10
|
onClick: (event: MouseEvent, currentTarget: HTMLButtonElement) => void;
|
|
10
11
|
[key: `data-${string}`]: string | number | boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { TableOptions as TTTableOptions } from "@tiptap/extension-table";
|
|
2
|
-
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
3
2
|
import { TableView as TTTableView } from "@tiptap/pm/tables";
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
3
|
+
import type { ViewMutationRecord } from "@tiptap/pm/view";
|
|
4
|
+
import { type NodeViewRendererProps } from "@tiptap/react";
|
|
6
5
|
export interface TableOptions extends TTTableOptions {
|
|
7
6
|
defaultCellMinWidth: number;
|
|
8
7
|
}
|
|
@@ -11,12 +10,10 @@ export interface TableOptions extends TTTableOptions {
|
|
|
11
10
|
* row/column buttons, while keeping the default table view for the
|
|
12
11
|
* table content.
|
|
13
12
|
*/
|
|
14
|
-
export declare class TableView extends TTTableView
|
|
13
|
+
export declare class TableView extends TTTableView {
|
|
14
|
+
private tableWrapper;
|
|
15
15
|
private selectionOverlay;
|
|
16
|
-
constructor(
|
|
17
|
-
node: ProseMirrorNode;
|
|
18
|
-
editor: Editor;
|
|
19
|
-
}, options: TableOptions);
|
|
16
|
+
constructor(props: NodeViewRendererProps, options: TableOptions);
|
|
20
17
|
destroy(): void;
|
|
21
18
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
22
19
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HTMLAttributes, type MutableRefObject } from "react";
|
|
2
|
+
interface TriggerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
targetTriggerElementRef: MutableRefObject<HTMLElement | undefined>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* This component serves as a dummy trigger for radix dialog to be able to open
|
|
7
|
+
* and to position the floating menu relative to the real trigger. The trigger
|
|
8
|
+
* rendered here won't be visible, and the props that would be passed to it are
|
|
9
|
+
* passed to the real trigger via the targetTriggerElementRef prop.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PassthroughTrigger: (props: TriggerProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Editor } from "@tiptap/core";
|
|
2
|
-
import {
|
|
2
|
+
import type { CSSProperties, MutableRefObject } from "react";
|
|
3
3
|
interface TableColumnMenuProps {
|
|
4
4
|
editor: Editor;
|
|
5
5
|
style?: CSSProperties;
|
|
6
|
-
open
|
|
7
|
-
onOpenChange
|
|
8
|
-
|
|
6
|
+
open: boolean;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
floatingStyle: CSSProperties;
|
|
9
|
+
triggerRef: (node: HTMLElement | null) => void;
|
|
10
|
+
targetTriggerElementRef: MutableRefObject<HTMLElement | undefined>;
|
|
9
11
|
}
|
|
10
12
|
export declare function TableColumnMenu(props: TableColumnMenuProps): JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import type { CSSProperties, MutableRefObject } from "react";
|
|
3
3
|
interface TableRowMenuProps {
|
|
4
4
|
editor: Editor;
|
|
5
|
-
open
|
|
6
|
-
onOpenChange
|
|
7
|
-
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
floatingStyle: CSSProperties;
|
|
8
|
+
triggerRef: (node: HTMLElement | null) => void;
|
|
9
|
+
targetTriggerElementRef: MutableRefObject<HTMLElement | undefined>;
|
|
8
10
|
}
|
|
9
11
|
export declare function TableRowMenu(props: TableRowMenuProps): JSX.Element;
|
|
10
12
|
export {};
|
package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginDef.d.ts
ADDED
|
@@ -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>;
|
package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginView.d.ts
ADDED
|
@@ -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
|
+
}
|