@prismicio/editor-fields 0.4.67-alpha.5 → 0.4.68
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/MediaLibrary/hooks/mediaLibraryData.d.ts +13 -13
- package/dist/core/MediaLibrary/hooks/tagData.d.ts +3 -3
- package/dist/core/MediaLibrary/hooks/useMediaLibraryUpload.d.ts +1 -1
- package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +1 -1
- package/dist/core/service/customType.d.ts +9 -9
- package/dist/core/service/document.d.ts +85 -85
- package/dist/core/service/documentSearch.d.ts +15 -15
- package/dist/core/service/repository.d.ts +6 -6
- package/dist/core/service/role.d.ts +10 -10
- package/dist/fields/ImageField/useImageField.d.ts +1 -1
- package/dist/fields/ImageField/useImageFieldImageUpload.d.ts +1 -1
- package/dist/fields/IntegrationField/integrationData.d.ts +5 -5
- package/dist/fields/LinkField/Documents/documentsData.d.ts +4 -4
- package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +4 -4
- package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +1 -1
- package/dist/fields/RichTextField/extensions/Table/plugins/{TableHandles/TableHandlesPlugin.d.ts → tableHandles/tableHandlesPlugin.d.ts} +1 -4
- package/dist/fields/RichTextField/extensions/Table/{TableCell/plugins/TableHandles → plugins/tableHandles}/utils.d.ts +1 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +17 -30
- package/dist/slices/utils.d.ts +4 -4
- package/package.json +4 -4
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/TableHandlesPlugin.d.ts +0 -8
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/events.d.ts +0 -19
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/index.d.ts +0 -1
- package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/index.d.ts +0 -1
- package/dist/fields/RichTextField/extensions/Table/TableControlsWrapper.d.ts +0 -3
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginDef.d.ts +0 -8
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginView.d.ts +0 -34
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginViewClass.d.ts +0 -34
- package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/utils.d.ts +0 -23
- /package/dist/fields/RichTextField/extensions/Table/plugins/{TableHandles → tableHandles}/index.d.ts +0 -0
- /package/dist/fields/RichTextField/extensions/Table/{TableCell/plugins/TableHandles/TableHandlesPluginView.d.ts → plugins/tableHandles/tableHandlesPluginView.d.ts} +0 -0
package/dist/index.es.js
CHANGED
|
@@ -58796,7 +58796,7 @@ function UW(e) {
|
|
|
58796
58796
|
return r;
|
|
58797
58797
|
}
|
|
58798
58798
|
function DW(e) {
|
|
58799
|
-
const { type: t, editor: n,
|
|
58799
|
+
const { type: t, editor: n, index: r } = e, i = Bee({
|
|
58800
58800
|
title: `Select ${t} & show options`,
|
|
58801
58801
|
className: MX(
|
|
58802
58802
|
cc.tableHandle,
|
|
@@ -58804,20 +58804,18 @@ function DW(e) {
|
|
|
58804
58804
|
),
|
|
58805
58805
|
[Vee]: t,
|
|
58806
58806
|
"aria-expanded": !1,
|
|
58807
|
-
onMouseDown: (
|
|
58808
|
-
|
|
58809
|
-
const c = t === "row" ? r : i;
|
|
58810
|
-
n.view.dispatch($2(t, { index: c, tr: n.state.tr }));
|
|
58807
|
+
onMouseDown: (a) => {
|
|
58808
|
+
a.preventDefault(), a.stopImmediatePropagation(), n.view.dispatch($2(t, { index: r, tr: n.state.tr }));
|
|
58811
58809
|
},
|
|
58812
|
-
onClick: (
|
|
58813
|
-
|
|
58810
|
+
onClick: (a, s) => {
|
|
58811
|
+
a.preventDefault(), a.stopImmediatePropagation(), co.dispatch("handleClick", {
|
|
58814
58812
|
type: t,
|
|
58815
58813
|
editor: n,
|
|
58816
|
-
referenceElement:
|
|
58814
|
+
referenceElement: s
|
|
58817
58815
|
});
|
|
58818
58816
|
}
|
|
58819
|
-
}),
|
|
58820
|
-
return
|
|
58817
|
+
}), o = Nee(Wte);
|
|
58818
|
+
return o && i.appendChild(o), i;
|
|
58821
58819
|
}
|
|
58822
58820
|
class Oze {
|
|
58823
58821
|
constructor(t) {
|
|
@@ -58893,17 +58891,16 @@ function Fze(e) {
|
|
|
58893
58891
|
throw new Error("Element is not a table");
|
|
58894
58892
|
}
|
|
58895
58893
|
function xze(e) {
|
|
58896
|
-
const { editor: t, name: n } = e;
|
|
58897
58894
|
return new wn({
|
|
58898
58895
|
key: new nr("tableCellHandles"),
|
|
58899
|
-
view: (
|
|
58896
|
+
view: (t) => new Oze(t),
|
|
58900
58897
|
state: {
|
|
58901
|
-
init: (
|
|
58902
|
-
apply: (
|
|
58898
|
+
init: (t, n) => WW({ editor: e, state: n }),
|
|
58899
|
+
apply: (t, n, r, i) => t.docChanged ? WW({ editor: e, state: i }) : n.map(t.mapping, t.doc)
|
|
58903
58900
|
},
|
|
58904
58901
|
props: {
|
|
58905
|
-
decorations(
|
|
58906
|
-
return this.getState(
|
|
58902
|
+
decorations(t) {
|
|
58903
|
+
return this.getState(t);
|
|
58907
58904
|
}
|
|
58908
58905
|
}
|
|
58909
58906
|
});
|
|
@@ -58912,23 +58909,13 @@ function WW(e) {
|
|
|
58912
58909
|
const { editor: t, state: n } = e, r = [], i = $ze(0)(n.selection);
|
|
58913
58910
|
i && i.forEach(({ pos: a }, s) => {
|
|
58914
58911
|
r.push(
|
|
58915
|
-
lr.widget(a + 1, () => DW({
|
|
58916
|
-
type: "row",
|
|
58917
|
-
editor: t,
|
|
58918
|
-
columnIndex: 0,
|
|
58919
|
-
rowIndex: s
|
|
58920
|
-
}))
|
|
58912
|
+
lr.widget(a + 1, () => DW({ type: "row", editor: t, index: s }))
|
|
58921
58913
|
);
|
|
58922
58914
|
});
|
|
58923
58915
|
const o = kze(0)(n.selection);
|
|
58924
58916
|
return o && o.forEach(({ pos: a }, s) => {
|
|
58925
58917
|
r.push(
|
|
58926
|
-
lr.widget(a + 1, () => DW({
|
|
58927
|
-
type: "column",
|
|
58928
|
-
editor: t,
|
|
58929
|
-
columnIndex: s,
|
|
58930
|
-
rowIndex: 0
|
|
58931
|
-
}))
|
|
58918
|
+
lr.widget(a + 1, () => DW({ type: "column", editor: t, index: s }))
|
|
58932
58919
|
);
|
|
58933
58920
|
}), Bt.create(n.doc, r);
|
|
58934
58921
|
}
|
|
@@ -59287,8 +59274,8 @@ const A0 = bze.extend({
|
|
|
59287
59274
|
return [
|
|
59288
59275
|
...this.options.resizable && this.editor.isEditable ? [Uee(this.options)] : [],
|
|
59289
59276
|
Pee(this.options),
|
|
59290
|
-
|
|
59291
|
-
|
|
59277
|
+
xze(this.editor),
|
|
59278
|
+
Bze()
|
|
59292
59279
|
];
|
|
59293
59280
|
}
|
|
59294
59281
|
});
|
package/dist/slices/utils.d.ts
CHANGED
|
@@ -291,7 +291,7 @@ export declare function maybeResetSliceWidget(args: MaybeResetSliceWidgetArgs):
|
|
|
291
291
|
label?: string | null | undefined;
|
|
292
292
|
direction?: string | null | undefined;
|
|
293
293
|
}) | ({
|
|
294
|
-
type: "image" | "
|
|
294
|
+
type: "image" | "embed" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
|
|
295
295
|
content: {
|
|
296
296
|
text: string;
|
|
297
297
|
} & {
|
|
@@ -344,7 +344,7 @@ export declare function maybeResetSliceWidget(args: MaybeResetSliceWidgetArgs):
|
|
|
344
344
|
} | {
|
|
345
345
|
start: number;
|
|
346
346
|
end: number;
|
|
347
|
-
type: "
|
|
347
|
+
type: "strong" | "em" | "list-item";
|
|
348
348
|
})[] | undefined;
|
|
349
349
|
};
|
|
350
350
|
} & {
|
|
@@ -456,7 +456,7 @@ export declare function maybeResetSliceWidget(args: MaybeResetSliceWidgetArgs):
|
|
|
456
456
|
label?: string | null | undefined;
|
|
457
457
|
direction?: string | null | undefined;
|
|
458
458
|
}) | ({
|
|
459
|
-
type: "image" | "
|
|
459
|
+
type: "image" | "embed" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "list-item" | "o-list-item" | "rtl";
|
|
460
460
|
content: {
|
|
461
461
|
text: string;
|
|
462
462
|
} & {
|
|
@@ -509,7 +509,7 @@ export declare function maybeResetSliceWidget(args: MaybeResetSliceWidgetArgs):
|
|
|
509
509
|
} | {
|
|
510
510
|
start: number;
|
|
511
511
|
end: number;
|
|
512
|
-
type: "
|
|
512
|
+
type: "strong" | "em" | "list-item";
|
|
513
513
|
})[] | undefined;
|
|
514
514
|
};
|
|
515
515
|
} & {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@floating-ui/react-dom-interactions": "0.9.3",
|
|
4
4
|
"@prismicio/client": "7.15.1",
|
|
5
|
-
"@prismicio/editor-support": "0.4.
|
|
5
|
+
"@prismicio/editor-support": "0.4.68",
|
|
6
6
|
"@prismicio/richtext": "2.1.1",
|
|
7
7
|
"@prismicio/types-internal": "3.8.0",
|
|
8
8
|
"@tiptap/core": "2.11.5",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"zod": "3.23.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@prismicio/editor-ui": "^0.4.
|
|
41
|
+
"@prismicio/editor-ui": "^0.4.68",
|
|
42
42
|
"@testing-library/react": "15.0.7",
|
|
43
43
|
"@types/react": "18.0.18",
|
|
44
44
|
"@types/react-dom": "18.3.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"module": "./dist/index.es.js",
|
|
73
73
|
"name": "@prismicio/editor-fields",
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@prismicio/editor-ui": "^0.4.
|
|
75
|
+
"@prismicio/editor-ui": "^0.4.68",
|
|
76
76
|
"@tanstack/react-query": "5.55.4",
|
|
77
77
|
"react": "18",
|
|
78
78
|
"react-dom": "18"
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"sideEffects": false,
|
|
91
91
|
"stableVersion": "0.0.0",
|
|
92
92
|
"types": "./dist/index.d.ts",
|
|
93
|
-
"version": "0.4.
|
|
93
|
+
"version": "0.4.68"
|
|
94
94
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 tableCellHandlesPlugin(this: {
|
|
6
|
-
editor: Editor;
|
|
7
|
-
name: string;
|
|
8
|
-
}): Plugin<DecorationSet>;
|
package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/events.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/fields/RichTextField/extensions/Table/TableCell/plugins/TableHandles/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { tableCellHandlesPlugin as TableHandlesPlugin } from "./TableHandlesPlugin";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TableHandlesPlugin } from "./TableHandles";
|
package/dist/fields/RichTextField/extensions/Table/plugins/TableHandles/TableHandlesPluginDef.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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,34 +0,0 @@
|
|
|
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,23 +0,0 @@
|
|
|
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 {};
|
/package/dist/fields/RichTextField/extensions/Table/plugins/{TableHandles → tableHandles}/index.d.ts
RENAMED
|
File without changes
|