aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/index.js')
-rw-r--r--web_src/js/index.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 2bf34a956d..ed747765a0 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -64,10 +64,16 @@ function initEditPreviewTab($form) {
previewFileModes = $previewTab.data('preview-file-modes').split(',');
$previewTab.on('click', function () {
const $this = $(this);
+ let context = `{$this.data('context')}/`;
+ const treePathEl = $form.find('input#tree_path');
+ if (treePathEl.length > 0) {
+ context += treePathEl.val();
+ }
+ context = context.substring(0, context.lastIndexOf('/'));
$.post($this.data('url'), {
_csrf: csrf,
mode: 'gfm',
- context: $this.data('context'),
+ context,
text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val()
}, (data) => {
const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`);