mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Allow customisation of the CodeMirror font size. Fixes #1565
This commit is contained in:
parent
9ec05d6bb1
commit
b3f25cb4bb
@ -193,6 +193,14 @@ class BrowserModule(PgAdminModule):
|
||||
category_label=gettext('Display')
|
||||
)
|
||||
|
||||
self.sql_font_size = self.preference.register(
|
||||
'display', 'sql_font_size',
|
||||
gettext("Font size"), 'text', '1em',
|
||||
category_label=gettext('Display'),
|
||||
help_str=gettext('The font size (and unit) to use for the SQL text boxes and editors. '
|
||||
'Specify a value and unit; for example "1.2em" for 1.2x the primary font size '
|
||||
'or "12px" for 12 pixels. Use of "em" units is highly recommended.')
|
||||
)
|
||||
|
||||
blueprint = BrowserModule(MODULE_NAME, __name__)
|
||||
|
||||
@ -557,6 +565,16 @@ def collection_js():
|
||||
def browser_css():
|
||||
"""Render and return CSS snippets from the nodes and modules."""
|
||||
snippets = []
|
||||
|
||||
# Get configurable options
|
||||
prefs = Preferences.module('browser')
|
||||
|
||||
sql_font_size_pref = prefs.preference('sql_font_size')
|
||||
sql_font_size = sql_font_size_pref.get()
|
||||
|
||||
if sql_font_size != '':
|
||||
snippets.append('.CodeMirror { font-size: %s; }' % sql_font_size)
|
||||
|
||||
for submodule in blueprint.submodules:
|
||||
snippets.extend(submodule.csssnippets)
|
||||
return make_response(
|
||||
|
Loading…
Reference in New Issue
Block a user