mirror of
https://github.com/zadam/trilium.git
synced 2025-12-03 22:14:24 +01:00
fix(ckeditor/math): math can be inserted in code blocks (closes #7913)
This commit is contained in:
parent
1a03c0ca9f
commit
5ae67fda7f
@ -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' ]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user