From 6ea1c38e24ad4101ead05635d8eb626bdb5b36d9 Mon Sep 17 00:00:00 2001 From: Sauli Anto Date: Thu, 3 Oct 2019 12:43:46 +0300 Subject: [PATCH] Fix rest parameters --- src/automath.js | 12 ++++-------- src/mathediting.js | 10 +++------- src/mathui.js | 5 +---- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/automath.js b/src/automath.js index 30340374c..d4417222e 100644 --- a/src/automath.js +++ b/src/automath.js @@ -58,10 +58,7 @@ export default class AutoMath extends Plugin { _mathBetweenPositions( leftPosition, rightPosition ) { const editor = this.editor; - const mathConfig = { - ...defaultConfig, - ...this.editor.config.get( 'math' ) - }; + const mathConfig = Object.assign( defaultConfig, this.editor.config.get( 'math' ) ); const equationRange = new LiveRange( leftPosition, rightPosition ); const walker = equationRange.getWalker( { ignoreElementEnd: true } ); @@ -106,10 +103,9 @@ export default class AutoMath extends Plugin { } editor.model.change( writer => { - const params = { - ...extractDelimiters( text ), - type: mathConfig.outputType, - }; + const params = Object.assign( extractDelimiters( text ), { + type: mathConfig.outputType + } ); const mathElement = writer.createElement( 'mathtex', params ); editor.model.insertContent( mathElement, insertPosition ); diff --git a/src/mathediting.js b/src/mathediting.js index e7c1422cd..6c0b10c6c 100644 --- a/src/mathediting.js +++ b/src/mathediting.js @@ -36,10 +36,7 @@ export default class MathEditing extends Plugin { _defineConverters() { const conversion = this.editor.conversion; - const mathConfig = { - ...defaultConfig, - ...this.editor.config.get( 'math' ) - }; + const mathConfig = Object.assign( defaultConfig, this.editor.config.get( 'math' ) ); // View -> Model conversion.for( 'upcast' ) @@ -86,10 +83,9 @@ export default class MathEditing extends Plugin { model: ( viewElement, modelWriter ) => { const equation = viewElement.getChild( 0 ).data.trim(); - const params = { - ...extractDelimiters( equation ), + const params = Object.assign( extractDelimiters( equation ), { type: mathConfig.forceOutputType ? mathConfig.outputType : 'span' - }; + } ); return modelWriter.createElement( 'mathtex', params ); } diff --git a/src/mathui.js b/src/mathui.js index 09fabf3d2..73300a951 100644 --- a/src/mathui.js +++ b/src/mathui.js @@ -59,10 +59,7 @@ export default class MathUI extends Plugin { const editor = this.editor; const mathCommand = editor.commands.get( 'math' ); - const mathConfig = { - ...defaultConfig, - ...this.editor.config.get( 'math' ) - }; + const mathConfig = Object.assign( defaultConfig, this.editor.config.get( 'math' ) ); const formView = new MainFormView( editor.locale, mathConfig.engine, mathConfig.enablePreview );