|
|
@ -64,10 +64,16 @@ function initEditPreviewTab($form) { |
|
|
|
previewFileModes = $previewTab.data('preview-file-modes').split(','); |
|
|
|
previewFileModes = $previewTab.data('preview-file-modes').split(','); |
|
|
|
$previewTab.on('click', function () { |
|
|
|
$previewTab.on('click', function () { |
|
|
|
const $this = $(this); |
|
|
|
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'), { |
|
|
|
$.post($this.data('url'), { |
|
|
|
_csrf: csrf, |
|
|
|
_csrf: csrf, |
|
|
|
mode: 'gfm', |
|
|
|
mode: 'gfm', |
|
|
|
context: $this.data('context'), |
|
|
|
context, |
|
|
|
text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val() |
|
|
|
text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val() |
|
|
|
}, (data) => { |
|
|
|
}, (data) => { |
|
|
|
const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`); |
|
|
|
const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`); |
|
|
|