mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	Fix rest parameters
This commit is contained in:
		
							parent
							
								
									b7ccab38ff
								
							
						
					
					
						commit
						6ea1c38e24
					
				@ -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 );
 | 
			
		||||
 | 
			
		||||
@ -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 );
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
@ -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 );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user