C
C
cyberlain2016-01-09 22:43:45
meteor
cyberlain, 2016-01-09 22:43:45

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 } });        
    }

Is it a meteor bug?
all code can be viewed here https://github.com/kiberlain/notes.git

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question