d1vanov/libquentier

Improve handling of JavaScript scripts

Opened this issue · 1 comments

Currently there are about 50 .js files in src/note_editor/javascript/scripts. Each of these has a corresponding data member in NoteEditorPrivate class, each is read from the corresponding qrc resource separately and executed separately. It's becoming more and more inconvenient over time, need to do something to automate it.

Ideally most if not all scripts should be automatically put into .qrc via CMake at build time, then read from that .qrc automatically within the note editor code and loaded into the page. Some scripts actually are special so they might need manual handling. For example, the script setting up the web channel in QtWebEngine-based note editor.

Should probably use QWebEngineScriptCollection class for QWebEngine-based note editor. It seems this way it'd be possible to bind JavaScript console messages to particular scripts.