Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 6cb2727

Browse files
committed
fix(ui): fix misaligned display in footnote tooltip
1 parent ad6671b commit 6cb2727

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

apps/client/src/services/note_tooltip.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,25 @@ function renderFootnote($link: JQuery<HTMLElement>, url: string) {
176176
.closest(".footnote-item") // find the parent container of the footnote
177177
.find(".footnote-content"); // find the actual text content of the footnote
178178

179-
return $footnoteContent.html() || "";
179+
const isEditable = $link.closest(".ck-content").hasClass("note-detail-editable-text-editor");
180+
if (isEditable) {
181+
/* Remove widget buttons for tables, formulas, and images in editable notes. */
182+
$footnoteContent.find('.ck-widget__selection-handle').remove();
183+
$footnoteContent.find('.ck-widget__type-around').remove();
184+
$footnoteContent.find('.ck-widget__resizer').remove();
185+
186+
/* Handling in-line math formulas */
187+
$footnoteContent.find('.ck-math-tex.ck-math-tex-inline.ck-widget').each(function () {
188+
const $katex = $(this).find('.katex, .katex-display').first();
189+
if ($katex.length) {
190+
$(this).replaceWith($('<span class="math-tex"></span>').append($('<span></span>').append($katex.clone())));
191+
}
192+
});
193+
}
194+
195+
let footnoteContent = $footnoteContent.html();
196+
footnoteContent = `<div class="ck-content">${footnoteContent}</div>`
197+
return footnoteContent || "";
180198
}
181199

182200
export default {

0 commit comments

Comments
 (0)