Answer the question
In order to leave comments, you need to log in
Why are titles duplicated when focus is removed from an editable block?
I made a simple application on a meteor with the addition and removal of sections, sections, chapters and blocks. I made the headings of sections, sections and chapters contenteditable="true" - everything works, but a strange bug occurs, the contents of the headings are duplicated as soon as we remove the focus. Did I mess up here
'click #partition-title' (evt, ti) {
ti.editTitle.set(true);
$(evt.target).focus();
},
'blur #partition-title' (evt, ti) {
const title = ti.$(evt.target).htmltext();
ti.editTitle.set(false);
Partitions.update(this._id, { $set: { title: title } });
},
'click #chapter-title' (evt, ti) {
ti.editChapterTitle.set(true);
ti.$(evt.target).focus();
},
'blur #chapter-title' (evt, ti) {
const title = ti.$(evt.target).htmltext();
const chapterId = Session.get('currentChapter');
ti.editChapterTitle.set(false);
Chapters.update(chapterId, { $set: { title: title } });
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question