Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(ckeditor/math): math can be inserted in code blocks (closes #7913)
Elian Doran5ae67fda7ff1
diff --git a/packages/ckeditor5-math/src/mathediting.ts b/packages/ckeditor5-math/src/mathediting.tsindex a5f1a11db0..53b50614bb 100644--- a/packages/ckeditor5-math/src/mathediting.ts+++ b/packages/ckeditor5-math/src/mathediting.ts@@ -62,6 +62,16 @@ export default class MathEditing extends Plugin {allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor', 'fontBackgroundColor' ]} );+ // Prevent <mathtex-inline> from being inserted inside <codeBlock>+ schema.addChildCheck( ( context, childDefinition ) => {+ if ( childDefinition && childDefinition.name === 'mathtex-inline' ) {+ // If the context is inside a codeBlock, disallow it+ if ( context.endsWith( 'codeBlock' ) ) {+ return false;+ }+ }+ });+schema.register( 'mathtex-display', {inheritAllFrom: '$blockObject',allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor' ]