Reputation: 3
i am currently experimenting a markdown text editor, i found on: uikit markdown editor
but i could not found a way to get a callback when inserting or editing.
is there anyway to call a function whenever user editing or pasting something?
I am trying to call prettyprint()
whenever user edit something and the prettyprint will execute make code on the preview side prettyprinted.
right now i am using interval to execute the prettyprint and it works but i want more precise way to call it.
Upvotes: 0
Views: 629
Reputation: 1760
In addition to Marijn suggested, I would like to give a sample code for the reference:
editor.on("change",function(cm,obj){
alert("Content Changed");
console.log(obj);
});
where 'editor' is the CodeMirror instance.
Upvotes: 1
Reputation: 8929
CodeMirror raises a "change"
event whenever the document is modified. See http://codemirror.net/doc/manual.html#event_change
Upvotes: 0