mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add preferences to enable brace matching and brace closing in the SQL editors. Fixes #2513
This commit is contained in:
committed by
Dave Page
parent
a87ee6d059
commit
1b49bb8b22
@@ -549,6 +549,12 @@ def browser_js():
|
||||
editor_wrap_code_pref = prefs.preference('wrap_code')
|
||||
editor_wrap_code = editor_wrap_code_pref.get()
|
||||
|
||||
brace_matching_pref = prefs.preference('brace_matching')
|
||||
brace_matching = brace_matching_pref.get()
|
||||
|
||||
insert_pair_brackets_perf = prefs.preference('insert_pair_brackets')
|
||||
insert_pair_brackets = insert_pair_brackets_perf.get()
|
||||
|
||||
for submodule in current_blueprint.submodules:
|
||||
snippets.extend(submodule.jssnippets)
|
||||
return make_response(
|
||||
@@ -561,6 +567,8 @@ def browser_js():
|
||||
editor_tab_size=editor_tab_size,
|
||||
editor_use_spaces=editor_use_spaces,
|
||||
editor_wrap_code=editor_wrap_code,
|
||||
editor_brace_matching=brace_matching,
|
||||
editor_insert_pair_brackets=insert_pair_brackets,
|
||||
_=gettext
|
||||
),
|
||||
200, {'Content-Type': 'application/x-javascript'})
|
||||
|
||||
@@ -7,7 +7,8 @@ define(
|
||||
'pgadmin.alertifyjs', 'pgadmin.browser.messages',
|
||||
'pgadmin.browser.menu', 'pgadmin.browser.panel',
|
||||
'pgadmin.browser.error', 'pgadmin.browser.frame',
|
||||
'pgadmin.browser.node', 'pgadmin.browser.collection'
|
||||
'pgadmin.browser.node', 'pgadmin.browser.collection',
|
||||
'codemirror/addon/edit/matchbrackets', 'codemirror/addon/edit/closebrackets'
|
||||
], function(
|
||||
gettext, url_for, require, $, _, S, Bootstrap, pgAdmin, Alertify,
|
||||
CodeMirror, checkNodeVisibility
|
||||
@@ -388,7 +389,9 @@ define(
|
||||
readOnly: true,
|
||||
extraKeys: pgAdmin.Browser.editor_shortcut_keys,
|
||||
tabSize: pgAdmin.Browser.editor_options.tabSize,
|
||||
lineWrapping: pgAdmin.Browser.editor_options.wrapCode
|
||||
lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
|
||||
autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
|
||||
matchBrackets: pgAdmin.Browser.editor_options.brace_matching
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
@@ -1834,7 +1837,9 @@ define(
|
||||
},
|
||||
editor_options: {
|
||||
tabSize: '{{ editor_tab_size }}',
|
||||
wrapCode: '{{ editor_wrap_code }}' == 'True'
|
||||
wrapCode: '{{ editor_wrap_code }}' == 'True',
|
||||
insert_pair_brackets: '{{ editor_insert_pair_brackets }}' == 'True',
|
||||
brace_matching: '{{ editor_brace_matching }}' == 'True'
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user