Add preview fix

This commit is contained in:
Sauli Anto
2019-10-03 03:47:26 +03:00
parent e6605706c0
commit b7ccab38ff
5 changed files with 144 additions and 84 deletions

View File

@@ -64,7 +64,7 @@ export default class MathUI extends Plugin {
...this.editor.config.get( 'math' )
};
const formView = new MainFormView( editor.locale, mathConfig.engine );
const formView = new MainFormView( editor.locale, mathConfig.engine, mathConfig.enablePreview );
formView.mathInputView.bind( 'value' ).to( mathCommand, 'value' );
formView.displayButtonView.bind( 'isOn' ).to( mathCommand, 'display' );
@@ -106,6 +106,13 @@ export default class MathUI extends Plugin {
this._form.mathInputView.select();
}
// Show preview element
const elId = 'math-preview';
let prewviewEl = document.getElementById( elId );// eslint-disable-line
if ( prewviewEl ) {
prewviewEl.style.display = 'block';
}
this._form.equation = mathCommand.value || '';
this._form.displayButtonView.isOn = mathCommand.display || false;
}
@@ -141,6 +148,13 @@ export default class MathUI extends Plugin {
this._balloon.remove( this._form );
// Hide preview element
const elId = 'math-preview';
let prewviewEl = document.getElementById( elId );// eslint-disable-line
if ( prewviewEl ) {
prewviewEl.style.display = 'none';
}
this.editor.editing.view.focus();
}
}