I am creating an addon which uses
.js file. I have tried following but didn’t work any.
- web.stdHtml (viewed in editor.py)
folder = os.path.dirname(__file__) def addCustomJS(buttons, editor): editor.web.stdHtml( "", css=, js=[folder + "/index.js"], context=editor, )
- Reading content of file and calling function
from .code import js_code def addCustomJS(buttons, editor): editor.web.evalWithCallback(js_code % text, cb)
- Adding content
from .code import js_code js_code = "<script>" + js_code + "</script>" gui_hooks.webview_will_set_content(js_code, aqt.editor.Editor)
There is a function in
index.js. It will added to note editor. When I call the function it will return the result. First one didn’t work. But for second one there is
% symbol in index.js which give error in python showing less arguments passed. It is working for file not containing
So, is there way to add
index.js file to note editor?
Error for second one: