mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 14:06:59 +02:00
chore(client): address requested changes
This commit is contained in:
@@ -66,6 +66,7 @@ export default function NoteTitleWidget(props: {className?: string}) {
|
||||
useEffect(() => {
|
||||
if (pendingSelect.current && textBoxRef.current && document.activeElement === textBoxRef.current) {
|
||||
textBoxRef.current.select();
|
||||
pendingSelect.current = false;
|
||||
}
|
||||
}, [title]);
|
||||
|
||||
|
||||
@@ -233,18 +233,19 @@ function extractHighlightsFromTextEditor(editor: CKTextEditor) {
|
||||
if (Object.values(attrs).some(Boolean)) {
|
||||
// Get HTML content from DOM (includes nested elements like math)
|
||||
let html = item.data;
|
||||
const modelPos = editor.model.createPositionAt(item.textNode, "before");
|
||||
const viewPos = editor.editing.mapper.toViewPosition(modelPos);
|
||||
const domPos = editor.editing.view.domConverter.viewPositionToDom(viewPos);
|
||||
if (domPos?.parent instanceof HTMLElement) {
|
||||
// Get the formatting span's innerHTML (includes math elements)
|
||||
html = domPos.parent.innerHTML;
|
||||
try {
|
||||
const modelPos = editor.model.createPositionAt(item.textNode, "before");
|
||||
const viewPos = editor.editing.mapper.toViewPosition(modelPos);
|
||||
const domPos = editor.editing.view.domConverter.viewPositionToDom(viewPos);
|
||||
if (domPos?.parent instanceof HTMLElement) {
|
||||
// Get the formatting span's innerHTML (includes math elements)
|
||||
html = domPos.parent.innerHTML;
|
||||
}
|
||||
} catch {
|
||||
// During change:data events, the view may not be fully synchronized with the model.
|
||||
// Fall back to using the raw text data.
|
||||
}
|
||||
|
||||
// Skip if we already have this exact content (same parent element)
|
||||
const prev = result[result.length - 1];
|
||||
if (prev?.text === html) continue;
|
||||
|
||||
result.push({
|
||||
id: randomString(),
|
||||
text: html,
|
||||
|
||||
Reference in New Issue
Block a user