This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff 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
182200export default {
You can’t perform that action at this time.
0 commit comments