Fix existing notes not being prefilled when editing an annotation

This commit is contained in:
Kovid Goyal 2020-06-24 15:06:22 +05:30
parent c5c3182a59
commit ded52279fc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -271,6 +271,9 @@ class CreateAnnotation:
return document.getElementById(self.middle_id) return document.getElementById(self.middle_id)
def add_notes(self): def add_notes(self):
current_notes = self.current_notes
if not current_notes and self.editing_annot_uuid:
current_notes = self.annotations_manager.notes_for_highlight(self.editing_annot_uuid)
self.show_middle(self.apply_notes) self.show_middle(self.apply_notes)
container = self.middle container = self.middle
clear(container) clear(container)
@ -283,7 +286,7 @@ class CreateAnnotation:
E.h3(_('Add notes for this highlight')), E.h3(_('Add notes for this highlight')),
E.textarea( E.textarea(
self.current_notes or '', current_notes or '',
rows='10', spellcheck='true', style='resize: none; width: 80vw; max-width: 80em; margin: 1ex', rows='10', spellcheck='true', style='resize: none; width: 80vw; max-width: 80em; margin: 1ex',
onkeydown=def(ev): onkeydown=def(ev):
ev.stopPropagation() ev.stopPropagation()