mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-30 17:36:37 +08:00
Update config
This commit is contained in:
parent
dbaaa96ae9
commit
fe3c7ba393
@ -5,7 +5,7 @@ import Widget from '@ckeditor/ckeditor5-widget/src/widget';
|
||||
|
||||
import MathCommand from './mathcommand';
|
||||
|
||||
import { renderEquation } from './utils';
|
||||
import { renderEquation, defaultConfig } from './utils';
|
||||
|
||||
export default class MathEditing extends Plugin {
|
||||
static get requires() {
|
||||
@ -37,9 +37,10 @@ export default class MathEditing extends Plugin {
|
||||
|
||||
_defineConverters() {
|
||||
const conversion = this.editor.conversion;
|
||||
const mathConfig = this.editor.config.get( 'math' );
|
||||
// Todo: better checks
|
||||
const engine = typeof mathConfig !== 'undefined' && typeof mathConfig.engine !== 'undefined' ? mathConfig.engine : 'mathjax';
|
||||
const mathConfig = {
|
||||
...defaultConfig,
|
||||
...this.editor.config.get( 'math' )
|
||||
}
|
||||
|
||||
// View -> Model
|
||||
conversion.for( 'upcast' )
|
||||
@ -122,7 +123,7 @@ export default class MathEditing extends Plugin {
|
||||
const uiElement = viewWriter.createUIElement( 'div', null, function( domDocument ) {
|
||||
const domElement = this.toDomElement( domDocument );
|
||||
|
||||
renderEquation( equation, domElement, engine, display );
|
||||
renderEquation( equation, domElement, mathConfig.engine, display );
|
||||
|
||||
return domElement;
|
||||
} );
|
||||
|
@ -8,6 +8,7 @@ import MainFormView from './ui/mainformview';
|
||||
|
||||
// Need math commands from there
|
||||
import MathEditing from './mathediting';
|
||||
import { defaultConfig } from './utils';
|
||||
|
||||
import pluginIcon from '../theme/icons/icon.svg';
|
||||
|
||||
@ -58,11 +59,12 @@ export default class MathUI extends Plugin {
|
||||
const editor = this.editor;
|
||||
const mathCommand = editor.commands.get( 'math' );
|
||||
|
||||
const mathConfig = editor.config.get( 'math' );
|
||||
// Todo: better checks
|
||||
const engine = typeof mathConfig !== 'undefined' && typeof mathConfig.engine !== 'undefined' ? mathConfig.engine : 'mathjax';
|
||||
const mathConfig = {
|
||||
...defaultConfig,
|
||||
...this.editor.config.get( 'math' )
|
||||
}
|
||||
|
||||
const formView = new MainFormView( editor.locale, engine );
|
||||
const formView = new MainFormView( editor.locale, mathConfig.engine );
|
||||
|
||||
formView.mathInputView.bind( 'value' ).to( mathCommand, 'value' );
|
||||
formView.displayButtonView.bind( 'displayIsOn' ).to( mathCommand, 'display');
|
||||
|
@ -32,3 +32,10 @@ export function getSelectedMathModelWidget( selection ) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
export const defaultConfig = {
|
||||
engine: 'mathjax',
|
||||
outputMode: 'script',
|
||||
forceOutputMode: false
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user