Implement plugin

This commit is contained in:
Sauli Anto
2019-08-31 20:48:37 +03:00
commit 13a10dcfdd
16 changed files with 3813 additions and 0 deletions

35
src/ui/mathview.js Normal file
View 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();
}
}