From 219d4f28c25b4835960ba444fedba1ab9e58b0bd Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 7 Oct 2024 10:30:04 -0400 Subject: [PATCH] When in-line editing yaml and other files, the tab key now uses spaces --- CHANGELOG.md | 1 + .../web_client/views/itemViewCodemirror.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 132fad808..9a4d26b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Handle a variation in a bioformats exception ([#1656](../../pull/1656)) - Increase logging slow histograms ([#1658](../../pull/1658)) - Use paginated item lists ([#1664](../../pull/1664)) +- When in-line editing yaml and other files, the tab key now uses spaces ([#1667](../../pull/1667)) ### Bug Fixes diff --git a/girder/girder_large_image/web_client/views/itemViewCodemirror.js b/girder/girder_large_image/web_client/views/itemViewCodemirror.js index 021db1a4c..d455708bf 100644 --- a/girder/girder_large_image/web_client/views/itemViewCodemirror.js +++ b/girder/girder_large_image/web_client/views/itemViewCodemirror.js @@ -214,6 +214,13 @@ var CodemirrorEditWidget = View.extend({ value: this._contents, mode: Formats[this.mimeType].mode, lineNumbers: true, + indentWithTabs: false, + extraKeys: { + Tab: function(cm) { + var spaces = Array(cm.getOption("tabSize") + 1).join(" "); + cm.replaceSelection(spaces); + } + }, gutters: ['CodeMirror-lint-markers'], lint: true, readOnly: this.accessLevel < AccessType.WRITE