mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New plugin hook: extra_body_script
This commit is contained in:
parent
0a14a4846b
commit
5cf0c6c91c
6 changed files with 88 additions and 0 deletions
|
|
@ -222,6 +222,23 @@ def extra_js_urls():
|
|||
'url': 'https://example.com/jquery.js',
|
||||
'sri': 'SRIHASH',
|
||||
}, 'https://example.com/plugin1.js']
|
||||
|
||||
|
||||
@hookimpl
|
||||
def extra_body_script(template, database, table, datasette):
|
||||
import json
|
||||
return 'var extra_body_script = {};'.format(
|
||||
json.dumps({
|
||||
"template": template,
|
||||
"database": database,
|
||||
"table": table,
|
||||
"config": datasette.plugin_config(
|
||||
"name-of-plugin",
|
||||
database=database,
|
||||
table=table,
|
||||
)
|
||||
})
|
||||
)
|
||||
'''
|
||||
|
||||
PLUGIN2 = '''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue