Editor.js: How to save editor.js at all time and places

Created on 15 Jul 2020  Â·  9Comments  Â·  Source: codex-team/editor.js

i want to save the data all the times but there is no method ,also not have the blur event 。has any ways to get it?

Most helpful comment

You can use the onChange callback where simply call the .save()

All 9 comments

What do you mean "all the times"?

The blur event is implemented and waiting for the code review

What do you mean "all the times"?

just like i edit a block it can immediately save this data

The blur event is implemented and waiting for the code review

how i can listening the keydown and keyup events in edtor.js

You can use the onChange callback where simply call the .save()

Answered

@neSpecc Could you give me an example of implementation with "onchange", since I can't find the way to use .save (), it gives me an error when I try it

@ShadowMyst See an example from our landing page

thanks you. based on the link you passed me I did this.

const editor = new EditorJS({
    holder: 'editorjs',
    autofocus: true,
    tools:{
        header:{
            class: Header,
            config:{
                placeholder: "Escriba el titulo",
                levels: [2,3,4,5,6],
                defaultLevel:2
            },
            inlineToolbar: true
        },
        list: {
            class: List,
            inlineToolbar:true,
        }
    },
    data:{},
    onReady: ()=>{

    },
    onChange:() =>{
        saved();
    }
});
function saved(){
    editor.save().then((savedData) =>{
        console.log('salvado',savedData);
    }).catch((error) =>{
        console.log("fallo al guardar",error)
    })
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yakumo-Yukari picture Yakumo-Yukari  Â·  5Comments

hata6502 picture hata6502  Â·  3Comments

cossssmin picture cossssmin  Â·  3Comments

vincentdesmares picture vincentdesmares  Â·  3Comments

oknoorap picture oknoorap  Â·  4Comments