Skip to content

Unable to dynamically set the editor's formula in the demo and automatically render it. #140

Open
@uniconnector

Description

  1. Add formula content to the file:

    ClassicEditor
        .create( document.querySelector( '#editor' ), {
    	    math: {
    		    engine: 'katex',
    		    katexRenderOptions: {
    			    macros: {
    				    '\\test': '\\mathrel{\\char`≠}'
    			    }
    		    }
    	    },
    	    plugins: [
    		    Math,
    		    AutoformatMath,
    		    .....
    	    ],
    	    toolbar: [
    		    'math',
    		    ...
    	    ]
                      ...
        } )
        .then( editor => {
    	    window.editor = editor;
    
                    // dynamically set the editor's formula
                    editor.setData('\[ x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \]');
    
    	    CKEditorInspector.attach( editor );
    	    window.console.log( 'CKEditor 5 is ready.', editor );
        } )
        .catch( err => {
    	    window.console.error( err.stack );
        } );
  2. show contents

    \[ x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \]
  3. Expected result:
    Format formula

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions