@eightyfourthousand/lib-editing 2026.6.1 → 2026.6.2
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/lib/components/editor/EditorProvider.js +1 -1
- package/lib/components/editor/EditorProvider.js.map +1 -1
- package/lib/components/editor/TranslationEditor.js +2 -1
- package/lib/components/editor/TranslationEditor.js.map +1 -1
- package/lib/components/editor/extensions/EndNoteLink/EndNoteLinkMark.js +2 -1
- package/lib/components/editor/extensions/EndNoteLink/EndNoteLinkMark.js.map +1 -1
- package/lib/components/editor/extensions/GlossaryInstance/GlossaryInstanceNode.js +4 -1
- package/lib/components/editor/extensions/GlossaryInstance/GlossaryInstanceNode.js.map +1 -1
- package/lib/components/editor/extensions/GlossaryInstance/GlossaryInstanceNode.ssr.js +3 -1
- package/lib/components/editor/extensions/GlossaryInstance/GlossaryInstanceNode.ssr.js.map +1 -1
- package/lib/components/editor/extensions/InternalLink/InternalLink.js +4 -1
- package/lib/components/editor/extensions/InternalLink/InternalLink.js.map +1 -1
- package/lib/components/editor/extensions/InternalLink/InternalLink.ssr.js +3 -1
- package/lib/components/editor/extensions/InternalLink/InternalLink.ssr.js.map +1 -1
- package/lib/components/editor/extensions/Mention/Mention.js +1 -1
- package/lib/components/editor/extensions/Mention/Mention.js.map +1 -1
- package/lib/components/editor/extensions/Mention/Mention.ssr.js +13 -3
- package/lib/components/editor/extensions/Mention/Mention.ssr.js.map +1 -1
- package/lib/components/editor/extensions/Passage/EditLabel.d.ts +5 -2
- package/lib/components/editor/extensions/Passage/EditLabel.js +5 -5
- package/lib/components/editor/extensions/Passage/EditLabel.js.map +1 -1
- package/lib/components/editor/extensions/Passage/EditorOptions.d.ts +2 -2
- package/lib/components/editor/extensions/Passage/EditorOptions.js +4 -6
- package/lib/components/editor/extensions/Passage/EditorOptions.js.map +1 -1
- package/lib/components/editor/extensions/Passage/PassageMenuOverlay.d.ts +13 -0
- package/lib/components/editor/extensions/Passage/PassageMenuOverlay.js +150 -0
- package/lib/components/editor/extensions/Passage/PassageMenuOverlay.js.map +1 -0
- package/lib/components/editor/extensions/Passage/PassageNode.d.ts +33 -2
- package/lib/components/editor/extensions/Passage/PassageNode.js +294 -107
- package/lib/components/editor/extensions/Passage/PassageNode.js.map +1 -1
- package/lib/components/editor/extensions/Passage/PassageNode.ssr.js +70 -8
- package/lib/components/editor/extensions/Passage/PassageNode.ssr.js.map +1 -1
- package/lib/components/editor/extensions/Passage/ReaderOptions.d.ts +2 -2
- package/lib/components/editor/extensions/Passage/ReaderOptions.js +4 -7
- package/lib/components/editor/extensions/Passage/ReaderOptions.js.map +1 -1
- package/lib/components/editor/extensions/Passage/ShowAnnotations.d.ts +7 -2
- package/lib/components/editor/extensions/Passage/ShowAnnotations.js +10 -7
- package/lib/components/editor/extensions/Passage/ShowAnnotations.js.map +1 -1
- package/lib/components/editor/extensions/WordBreak.d.ts +41 -0
- package/lib/components/editor/extensions/WordBreak.js +59 -0
- package/lib/components/editor/extensions/WordBreak.js.map +1 -0
- package/lib/components/editor/extensions/translationSSRExtensions.js +2 -0
- package/lib/components/editor/extensions/translationSSRExtensions.js.map +1 -1
- package/lib/components/editor/hooks/useDefaultExtensions.d.ts +1 -1
- package/lib/components/editor/hooks/useDefaultExtensions.js +2 -0
- package/lib/components/editor/hooks/useDefaultExtensions.js.map +1 -1
- package/lib/components/editor/hooks/useTranslationExtensions.d.ts +1 -1
- package/lib/components/editor/hooks/useTranslationExtensions.js +2 -0
- package/lib/components/editor/hooks/useTranslationExtensions.js.map +1 -1
- package/lib/components/editor/menus/MainBubbleMenu.js +17 -4
- package/lib/components/editor/menus/MainBubbleMenu.js.map +1 -1
- package/lib/components/editor/menus/TranslationBubbleMenu.js +3 -2
- package/lib/components/editor/menus/TranslationBubbleMenu.js.map +1 -1
- package/lib/components/editor/menus/selectors/TextAlignSelector.d.ts +1 -1
- package/lib/components/editor/menus/selectors/TextAlignSelector.js +33 -24
- package/lib/components/editor/menus/selectors/TextAlignSelector.js.map +1 -1
- package/lib/components/editor/menus/selectors/TranslationNodeSelector.js +1 -1
- package/lib/components/editor/menus/selectors/TranslationNodeSelector.js.map +1 -1
- package/lib/components/editor/menus/selectors/WordBreakSelector.d.ts +4 -0
- package/lib/components/editor/menus/selectors/WordBreakSelector.js +38 -0
- package/lib/components/editor/menus/selectors/WordBreakSelector.js.map +1 -0
- package/lib/components/editor/menus/selectors/index.d.ts +1 -0
- package/lib/components/editor/menus/selectors/index.js +1 -0
- package/lib/components/editor/menus/selectors/index.js.map +1 -1
- package/lib/components/reader/TranslationSSRContent.js +3 -1
- package/lib/components/reader/TranslationSSRContent.js.map +1 -1
- package/lib/components/shared/LeftPanel.js +1 -1
- package/lib/components/shared/LeftPanel.js.map +1 -1
- package/lib/components/shared/hooks/useTohToggle.d.ts +2 -3
- package/lib/components/shared/hooks/useTohToggle.js +31 -30
- package/lib/components/shared/hooks/useTohToggle.js.map +1 -1
- package/lib/exporters/heading.js +3 -0
- package/lib/exporters/heading.js.map +1 -1
- package/lib/exporters/paragraph.js +5 -0
- package/lib/exporters/paragraph.js.map +1 -1
- package/lib/transformers/heading.js +2 -0
- package/lib/transformers/heading.js.map +1 -1
- package/lib/transformers/paragraph.js +3 -1
- package/lib/transformers/paragraph.js.map +1 -1
- package/package.json +7 -7
- package/lib/components/editor/extensions/Passage/Passage.d.ts +0 -3
- package/lib/components/editor/extensions/Passage/Passage.js +0 -86
- package/lib/components/editor/extensions/Passage/Passage.js.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from '@eightyfourthousand/design-system';
|
|
5
|
+
import { cn } from '@eightyfourthousand/lib-utils';
|
|
6
|
+
import { getBookmarks, useBookmark, } from '@eightyfourthousand/data-access';
|
|
7
|
+
import { PANEL_FOR_SECTION, SuggestRevisionForm, TAB_FOR_SECTION, useNavigation, } from '../../../shared';
|
|
8
|
+
import { EditorOptions } from './EditorOptions';
|
|
9
|
+
import { ReaderOptions } from './ReaderOptions';
|
|
10
|
+
import { EditLabel } from './EditLabel';
|
|
11
|
+
import { ShowAnnotations } from './ShowAnnotations';
|
|
12
|
+
import { deleteEndnotePassageNode } from '../EndNoteLink/endnote-utils';
|
|
13
|
+
import { findPassageNode } from '../../util';
|
|
14
|
+
/**
|
|
15
|
+
* A single, stable React layer (mounted as a sibling of EditorContent) that
|
|
16
|
+
* renders the passage label dropdown menu and its dialogs. Because it lives
|
|
17
|
+
* outside the per-passage node view, ProseMirror never remounts it, so the
|
|
18
|
+
* menu/dialog state survives editor transactions — the fix for the previous
|
|
19
|
+
* NodeView remount churn. It also feeds navigation-derived state into the
|
|
20
|
+
* PassageNode view plugin so the compare-source and bookmark chrome stay in sync.
|
|
21
|
+
*/
|
|
22
|
+
export const PassageMenuOverlay = ({ editor }) => {
|
|
23
|
+
const [menu, setMenu] = useState(null);
|
|
24
|
+
const [open, setOpen] = useState(false);
|
|
25
|
+
const [dialogType, setDialogType] = useState();
|
|
26
|
+
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
27
|
+
const [showRevisionForm, setShowRevisionForm] = useState(false);
|
|
28
|
+
const [bookmarkVersion, setBookmarkVersion] = useState(0);
|
|
29
|
+
const { toh, panels, updatePanel, imprint } = useNavigation();
|
|
30
|
+
const isCompare = panels.main.open && panels.main.tab === 'compare';
|
|
31
|
+
// Resolve the clicked passage's attributes + excerpt from the document.
|
|
32
|
+
const passage = useMemo(() => {
|
|
33
|
+
if (!menu)
|
|
34
|
+
return null;
|
|
35
|
+
const found = findPassageNode(editor, menu.uuid);
|
|
36
|
+
if (!found)
|
|
37
|
+
return null;
|
|
38
|
+
const text = found.node.textContent || '';
|
|
39
|
+
return {
|
|
40
|
+
uuid: menu.uuid,
|
|
41
|
+
label: found.node.attrs.label || '',
|
|
42
|
+
type: found.node.attrs.type || '',
|
|
43
|
+
excerpt: text.slice(0, 100) + (text.length > 100 ? '...' : ''),
|
|
44
|
+
hasCompare: !!found.node.attrs.alignments?.[toh ?? ''],
|
|
45
|
+
};
|
|
46
|
+
}, [editor, menu, toh]);
|
|
47
|
+
const contentType = (isCompare && passage?.hasCompare ? 'compare' : (passage?.type ?? ''));
|
|
48
|
+
const workTitle = imprint?.mainTitles?.en ?? toh;
|
|
49
|
+
const { isBookmarked, toggle: toggleBookmark } = useBookmark(passage?.uuid ?? '', {
|
|
50
|
+
type: 'passage',
|
|
51
|
+
subType: passage?.type,
|
|
52
|
+
tab: passage?.type ?? '',
|
|
53
|
+
label: passage?.label,
|
|
54
|
+
body: passage?.excerpt,
|
|
55
|
+
workTitle,
|
|
56
|
+
toh,
|
|
57
|
+
});
|
|
58
|
+
// Register the openMenu / navigateRef callbacks the PassageNode click plugin
|
|
59
|
+
// calls, plus clean them up on unmount.
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const storage = editor.storage.passage;
|
|
62
|
+
if (!storage)
|
|
63
|
+
return;
|
|
64
|
+
storage.openMenu = (payload) => {
|
|
65
|
+
setMenu({ uuid: payload.uuid, rect: payload.rect });
|
|
66
|
+
setShowRevisionForm(false);
|
|
67
|
+
setOpen(true);
|
|
68
|
+
};
|
|
69
|
+
storage.navigateRef = (ref) => {
|
|
70
|
+
updatePanel({
|
|
71
|
+
name: PANEL_FOR_SECTION[ref.type] || 'main',
|
|
72
|
+
state: {
|
|
73
|
+
open: true,
|
|
74
|
+
tab: TAB_FOR_SECTION[ref.type] || 'translation',
|
|
75
|
+
hash: ref.uuid,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return () => {
|
|
80
|
+
storage.openMenu = undefined;
|
|
81
|
+
storage.navigateRef = undefined;
|
|
82
|
+
};
|
|
83
|
+
}, [editor, updatePanel]);
|
|
84
|
+
// Feed navigation + bookmark state to the view plugin that paints the
|
|
85
|
+
// compare-source text and the reader bookmark icon.
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const storage = editor.storage.passage;
|
|
88
|
+
if (!storage)
|
|
89
|
+
return;
|
|
90
|
+
storage.chrome = {
|
|
91
|
+
toh,
|
|
92
|
+
isCompare,
|
|
93
|
+
bookmarkedUuids: new Set(getBookmarks().map((b) => b.uuid)),
|
|
94
|
+
};
|
|
95
|
+
storage.refreshChrome?.();
|
|
96
|
+
}, [editor, toh, isCompare, bookmarkVersion]);
|
|
97
|
+
// Keep the bookmark chrome fresh when bookmarks change in another tab.
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const onStorage = () => setBookmarkVersion((v) => v + 1);
|
|
100
|
+
window.addEventListener('storage', onStorage);
|
|
101
|
+
return () => window.removeEventListener('storage', onStorage);
|
|
102
|
+
}, []);
|
|
103
|
+
// The menu is anchored to a fixed-position trigger placed over the clicked
|
|
104
|
+
// label; a captured rect goes stale on scroll, so close instead of drift.
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!open)
|
|
107
|
+
return;
|
|
108
|
+
const close = () => setOpen(false);
|
|
109
|
+
window.addEventListener('scroll', close, true);
|
|
110
|
+
window.addEventListener('resize', close);
|
|
111
|
+
return () => {
|
|
112
|
+
window.removeEventListener('scroll', close, true);
|
|
113
|
+
window.removeEventListener('resize', close);
|
|
114
|
+
};
|
|
115
|
+
}, [open]);
|
|
116
|
+
const onMenuOpenChange = useCallback((next) => {
|
|
117
|
+
setOpen(next);
|
|
118
|
+
if (!next)
|
|
119
|
+
setShowRevisionForm(false);
|
|
120
|
+
}, []);
|
|
121
|
+
const handleToggleBookmark = useCallback(() => {
|
|
122
|
+
toggleBookmark();
|
|
123
|
+
setBookmarkVersion((v) => v + 1);
|
|
124
|
+
}, [toggleBookmark]);
|
|
125
|
+
const handleDelete = useCallback(() => {
|
|
126
|
+
if (passage)
|
|
127
|
+
deleteEndnotePassageNode(editor, passage.uuid);
|
|
128
|
+
setIsDialogOpen(false);
|
|
129
|
+
}, [editor, passage]);
|
|
130
|
+
const rect = menu?.rect;
|
|
131
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { modal: false, open: open, onOpenChange: onMenuOpenChange, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("span", { "aria-hidden": true, style: {
|
|
132
|
+
position: 'fixed',
|
|
133
|
+
left: rect?.left ?? 0,
|
|
134
|
+
top: rect?.top ?? 0,
|
|
135
|
+
width: rect?.width ?? 0,
|
|
136
|
+
height: rect?.height ?? 0,
|
|
137
|
+
pointerEvents: 'none',
|
|
138
|
+
} }) }), _jsx(DropdownMenuContent, { align: "start", alignOffset: 48, onCloseAutoFocus: (e) => e.preventDefault(), className: cn(showRevisionForm ? 'w-80' : 'w-64'), children: passage &&
|
|
139
|
+
(showRevisionForm ? (_jsx(SuggestRevisionForm, { toh: toh ?? '', type: 'passage', label: passage.label, onClose: () => {
|
|
140
|
+
setShowRevisionForm(false);
|
|
141
|
+
setOpen(false);
|
|
142
|
+
} })) : editor.isEditable ? (_jsx(EditorOptions, { uuid: passage.uuid, contentType: contentType, onSelection: (item) => {
|
|
143
|
+
setDialogType(item);
|
|
144
|
+
setIsDialogOpen(true);
|
|
145
|
+
setOpen(false);
|
|
146
|
+
} })) : (_jsx(ReaderOptions, { uuid: passage.uuid, contentType: contentType, isBookmarked: isBookmarked, toggleBookmark: handleToggleBookmark, onSuggestRevision: () => setShowRevisionForm(true) }))) })] }), editor.isEditable && passage && (_jsxs(Dialog, { open: isDialogOpen, onOpenChange: setIsDialogOpen, children: [dialogType === 'label' && (_jsx(EditLabel, { editor: editor, uuid: passage.uuid, label: passage.label, close: () => setIsDialogOpen(false) })), dialogType === 'attributes' && (_jsx(ShowAnnotations, { editor: editor, uuid: passage.uuid, label: passage.label, type: passage.type })), dialogType === 'delete' && (_jsxs(DialogContent, { className: "max-w-readable w-full font-serif", showCloseButton: false, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Delete Passage" }), _jsxs(DialogDescription, { children: ["This will delete passage ", passage.label, passage.type === 'endnotes' &&
|
|
147
|
+
' and remove all links to it in the translation', ". This action cannot be undone after saving."] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setIsDialogOpen(false), children: "Cancel" }), _jsx(Button, { variant: "destructive", onClick: handleDelete, children: "Delete" })] })] }))] }))] }));
|
|
148
|
+
};
|
|
149
|
+
export default PassageMenuOverlay;
|
|
150
|
+
//# sourceMappingURL=PassageMenuOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PassageMenuOverlay.js","sourceRoot":"","sources":["../../../../../../../../libs/lib-editing/src/lib/components/editor/extensions/Passage/PassageMenuOverlay.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,+BAA+B,CAAC;AACnD,OAAO,EACL,YAAY,EAEZ,WAAW,GACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,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C,WAAW,iCAA6B,EACzC,MAAC,iBAAiB,4CACU,OAAO,CAAC,KAAK,EACtC,OAAO,CAAC,IAAI,KAAK,UAAU;gDAC1B,gDAAgD,oDAEhC,IACP,EACf,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,uBAEtD,EACT,KAAC,MAAM,IAAC,OAAO,EAAC,aAAa,EAAC,OAAO,EAAE,YAAY,uBAE1C,IACI,IACD,CACjB,IACM,CACV,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
import { Node } from '@tiptap/core';
|
|
2
1
|
declare module '@tiptap/core' {
|
|
3
2
|
interface Commands<ReturnType> {
|
|
4
3
|
passage: {
|
|
5
4
|
normalizeLabelsAfter: () => ReturnType;
|
|
6
5
|
splitPassage: () => ReturnType;
|
|
6
|
+
setPassageLabel: (uuid: string, label: string) => ReturnType;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type PassageMenuPayload = {
|
|
11
|
+
uuid: string;
|
|
12
|
+
rect: {
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
right: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type PassageChrome = {
|
|
22
|
+
toh?: string;
|
|
23
|
+
isCompare: boolean;
|
|
24
|
+
bookmarkedUuids: Set<string>;
|
|
25
|
+
};
|
|
26
|
+
export type PassageStorage = {
|
|
27
|
+
openMenu?: (payload: PassageMenuPayload) => void;
|
|
28
|
+
navigateRef?: (ref: {
|
|
29
|
+
uuid: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
chrome?: PassageChrome;
|
|
33
|
+
refreshChrome?: () => void;
|
|
34
|
+
};
|
|
35
|
+
declare module '@tiptap/core' {
|
|
36
|
+
interface Storage {
|
|
37
|
+
passage: PassageStorage;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export declare const PassageNode: import("@tiptap/core").Node<any, any>;
|
|
41
|
+
export default PassageNode;
|