Open An-png opened 4 years ago
Have you hit Save
? I tested, and it seems to work for me. I had autosaving in an earlier version, but it caused some problems, so I added the Save button at some point.
Oh wow, didn't see that. :rofl: :rofl: Maybe there could be autosave when you hit Done!, or close with the cross?
p.s. what is "SIAC"?
For example, here, you could add this pseudocode in actual python
if note_type = text:
execute_javascript_command(saveTextNote(nid, remove=False))
I don't know how to invoke javascript functions using python, and I don't know what the (note id), nid
parameter is referring toso I can't actually write the code. I attempted at righting some code, but it's probably wrong in some sense.
is_text_note = False
if note.text is None:
is_text_note = True
on line 634
of readingmodal.py
.
and then change this on line 646
:
<a onclick='if (!pdfLoading && !modalShown) {{ noteLoading = true; greyoutBottom(); pycmd("{queue_btn_action}") }}' class='siac-clickable-anchor' style='font-size: 16px; font-weight: bold;' id='siac-first-in-queue-btn'>{queue_btn_text}</a><br>
to this:
<a onclick='if (!pdfLoading && !modalShown) {{ noteLoading = true; greyoutBottom(); pycmd("{queue_btn_action}") }} if ({is_text_note}) {{ saveTextNote({note_id}, remove = false) }}' class='siac-clickable-anchor' style='font-size: 16px; font-weight: bold;' id='siac-first-in-queue-btn'>{queue_btn_text}</a><br>
(and do the same for the close button, located at line 358
)
I think this might work? I don't know any way of distinguishing text notes from PDF notes using (what seems to be) the SQL entry for the current note. I looked around that file and note.text
might work, however I don't know if note.text
calls the textlayer for PDFs. If it does, then obviously that IF statement isn't effective.
p.s. what is "SIAC"?
"Search in Add Card", the original add-on name, I started using this prefix at some point to prevent name clashes.
As for the saving on Done, I will look into it again, but there was some reason I abandoned it, I just don't exactly remember it at the moment.
Changed the title to reflect the issue that text notes aren't saved on "Done", "Close" buttons as well as clicking on an article in the queue head.
Currently, you can make changes in the tinyMCE editor. However, those changes do not leave the editor, and aren't stored in the notes database at all. This means closing a text note or pressing "Done!" means all changes made in the tinyMCE editor are lost.