mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-19 01:15:04 -05:00
1. Fixed issues reported while testing changes for editor preferences. #2659
2. Updated preferences docs.
This commit is contained in:
@@ -481,32 +481,6 @@ def utils():
|
||||
pg_help_path_pref = prefs.preference('pg_help_path')
|
||||
pg_help_path = pg_help_path_pref.get()
|
||||
|
||||
# Get sqleditor options
|
||||
prefs = Preferences.module('sqleditor')
|
||||
|
||||
editor_tab_size_pref = prefs.preference('tab_size')
|
||||
editor_tab_size = editor_tab_size_pref.get()
|
||||
|
||||
editor_use_spaces_pref = prefs.preference('use_spaces')
|
||||
editor_use_spaces = editor_use_spaces_pref.get()
|
||||
|
||||
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()
|
||||
|
||||
highlight_selection_matches_pref = prefs.preference(
|
||||
'highlight_selection_matches'
|
||||
)
|
||||
highlight_selection_matches = highlight_selection_matches_pref.get()
|
||||
|
||||
insert_pair_brackets_perf = prefs.preference('insert_pair_brackets')
|
||||
insert_pair_brackets = insert_pair_brackets_perf.get()
|
||||
|
||||
# This will be opposite of use_space option
|
||||
editor_indent_with_tabs = False if editor_use_spaces else True
|
||||
|
||||
# Try to fetch current libpq version from the driver
|
||||
try:
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
@@ -537,13 +511,6 @@ def utils():
|
||||
layout=layout,
|
||||
jssnippets=snippets,
|
||||
pg_help_path=pg_help_path,
|
||||
editor_tab_size=editor_tab_size,
|
||||
editor_use_spaces=editor_use_spaces,
|
||||
editor_wrap_code=editor_wrap_code,
|
||||
editor_brace_matching=brace_matching,
|
||||
editor_highlight_selection_matches=highlight_selection_matches,
|
||||
editor_insert_pair_brackets=insert_pair_brackets,
|
||||
editor_indent_with_tabs=editor_indent_with_tabs,
|
||||
app_name=config.APP_NAME,
|
||||
app_version_int=config.APP_VERSION_INT,
|
||||
pg_libpq_version=pg_libpq_version,
|
||||
|
||||
@@ -1653,38 +1653,7 @@ define('pgadmin.browser', [
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
editor_shortcut_keys: {
|
||||
// Autocomplete sql command
|
||||
'Ctrl-Space': 'autocomplete',
|
||||
'Cmd-Space': 'autocomplete',
|
||||
|
||||
'Alt-Up': 'goLineUp',
|
||||
'Alt-Down': 'goLineDown',
|
||||
|
||||
// Move word by word left/right
|
||||
'Ctrl-Alt-Left': 'goGroupLeft',
|
||||
'Cmd-Alt-Left': 'goGroupLeft',
|
||||
'Ctrl-Alt-Right': 'goGroupRight',
|
||||
'Cmd-Alt-Right': 'goGroupRight',
|
||||
|
||||
// Allow user to delete Tab(s)
|
||||
'Shift-Tab': 'indentLess',
|
||||
},
|
||||
editor_options: {
|
||||
tabSize: parseInt(pgBrowser.utils.tabSize),
|
||||
wrapCode: pgBrowser.utils.wrapCode,
|
||||
insert_pair_brackets: pgBrowser.utils.insertPairBrackets,
|
||||
brace_matching: pgBrowser.utils.braceMatching,
|
||||
indent_with_tabs: pgBrowser.utils.is_indent_with_tabs,
|
||||
highlightSelectionMatches:pgBrowser.utils.highlightSelectionMatches
|
||||
},
|
||||
});
|
||||
|
||||
// Use spaces instead of tab
|
||||
if (pgBrowser.utils.useSpaces == 'True') {
|
||||
pgAdmin.Browser.editor_shortcut_keys.Tab = 'insertSoftTab';
|
||||
}
|
||||
|
||||
return pgAdmin.Browser;
|
||||
});
|
||||
|
||||
@@ -85,13 +85,6 @@ define('pgadmin.browser.utils',
|
||||
layout: {{ layout|tojson }},
|
||||
theme: '{{ theme }}',
|
||||
pg_help_path: '{{ pg_help_path }}',
|
||||
tabSize: '{{ editor_tab_size }}',
|
||||
wrapCode: '{{ editor_wrap_code }}' == 'True',
|
||||
useSpaces: '{{ editor_use_spaces }}',
|
||||
insertPairBrackets: '{{ editor_insert_pair_brackets }}' == 'True',
|
||||
braceMatching: '{{ editor_brace_matching }}' == 'True',
|
||||
highlightSelectionMatches: '{{editor_highlight_selection_matches}}' == 'True',
|
||||
is_indent_with_tabs: '{{ editor_indent_with_tabs }}' == 'True',
|
||||
app_name: '{{ app_name }}',
|
||||
app_version_int: '{{ app_version_int}}',
|
||||
pg_libpq_version: {{pg_libpq_version|e}},
|
||||
|
||||
Reference in New Issue
Block a user