i'm working ckeditor past few months.but, i'm facing issue
for deletion in ckeditor.
my question is::
how lastly deleted element's html value in ckeditor.
when click delete button, want element will
be deleted , deleted elements html value.
anyone, please me.
you can attach listener when editor content ready, , check delete or backspace press , last deleted content, example like::
ckeditor.replace( 'your-editor', { ..., on: { contentdom: function () { //editor content ready var myeditor = this; //add listener this.editable().attachlistener( editor, 'key', function( evt ) { //if delete or backspace pressed if ( ( evt.data.keycode in { 8: 1, 46: 1 } ) ) { //get last element var lastelement = myeditor.elementpath().lastelement, lastelementname = lastelement.getname(), lastelementnode = lastelement.$; //native dom object //see properties node has console.log(lastelementnode); //you can use getattribute fetch specific attr //for example, img element's src attribute console.log(lastelementnode.getattribute("src")); } }); } } });
Comments
Post a Comment