mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
Implement plugin
This commit is contained in:
35
src/ui/mathview.js
Normal file
35
src/ui/mathview.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import View from '@ckeditor/ckeditor5-ui/src/view';
|
||||
import { renderEquation } from '../utils';
|
||||
|
||||
export default class MathView extends View {
|
||||
constructor( engine, locale ) {
|
||||
super( locale );
|
||||
|
||||
this.engine = engine;
|
||||
|
||||
this.set( 'value', '' );
|
||||
|
||||
this.on( 'change:value', () => {
|
||||
this.updateMath();
|
||||
} );
|
||||
|
||||
this.setTemplate( {
|
||||
tag: 'div',
|
||||
attributes: {
|
||||
class: [
|
||||
'ck',
|
||||
'ck-math-preview'
|
||||
],
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
updateMath() {
|
||||
renderEquation( this.value, this.element, this.engine );
|
||||
}
|
||||
|
||||
render() {
|
||||
super.render();
|
||||
this.updateMath();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user