File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,16 @@ function initEditPreviewTab($form) {
64
64
previewFileModes = $previewTab . data ( 'preview-file-modes' ) . split ( ',' ) ;
65
65
$previewTab . on ( 'click' , function ( ) {
66
66
const $this = $ ( this ) ;
67
+ let context = `{$this.data('context')}/` ;
68
+ const treePathEl = $form . find ( 'input#tree_path' ) ;
69
+ if ( treePathEl . length > 0 ) {
70
+ context += treePathEl . val ( ) ;
71
+ }
72
+ context = context . substring ( 0 , context . lastIndexOf ( '/' ) ) ;
67
73
$ . post ( $this . data ( 'url' ) , {
68
74
_csrf : csrf ,
69
75
mode : 'gfm' ,
70
- context : $this . data ( 'context' ) ,
76
+ context,
71
77
text : $form . find ( `.tab.segment[data-tab="${ $tabMenu . data ( 'write' ) } "] textarea` ) . val ( )
72
78
} , ( data ) => {
73
79
const $previewPanel = $form . find ( `.tab.segment[data-tab="${ $tabMenu . data ( 'preview' ) } "]` ) ;
You can’t perform that action at this time.
0 commit comments