diff --git a/apps/client/src/services/note_tooltip.ts b/apps/client/src/services/note_tooltip.ts index 19ac71801..55982e644 100644 --- a/apps/client/src/services/note_tooltip.ts +++ b/apps/client/src/services/note_tooltip.ts @@ -176,7 +176,25 @@ function renderFootnote($link: JQuery, url: string) { .closest(".footnote-item") // find the parent container of the footnote .find(".footnote-content"); // find the actual text content of the footnote - return $footnoteContent.html() || ""; + const isEditable = $link.closest(".ck-content").hasClass("note-detail-editable-text-editor"); + if (isEditable) { + /* Remove widget buttons for tables, formulas, and images in editable notes. */ + $footnoteContent.find('.ck-widget__selection-handle').remove(); + $footnoteContent.find('.ck-widget__type-around').remove(); + $footnoteContent.find('.ck-widget__resizer').remove(); + + /* Handling in-line math formulas */ + $footnoteContent.find('.ck-math-tex.ck-math-tex-inline.ck-widget').each(function () { + const $katex = $(this).find('.katex, .katex-display').first(); + if ($katex.length) { + $(this).replaceWith($('').append($('').append($katex.clone()))); + } + }); + } + + let footnoteContent = $footnoteContent.html(); + footnoteContent = `
${footnoteContent}
` + return footnoteContent || ""; } export default {