Skip to content

Commit 1967be3

Browse files
committed
Make Save+Back asynchronous
1 parent dd2ffad commit 1967be3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

admin/templates/edit-section.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
{#<h1>{{ _section_name }}</h1>#}
113113

114114
<script>
115-
function _doSave() {
115+
function _doSave(options) {
116116
let $editor = $('#editor');
117117
let content
118118
if ($editor[0].codeMirror) {
@@ -126,6 +126,10 @@
126126
section: '{{ _section }}',
127127
section_name,
128128
content
129+
}).then(value => {
130+
if (options && options.goBack){
131+
window.history.back();
132+
}
129133
})
130134
}
131135

services/section-editor-commands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"scope" => ["edit:section"],
5454
"order" => "first",
5555
"render" => function ($context) use ($twig) {
56-
return '<a class="button" onclick="_doSave();window.history.back();return false;"><i class="fa fa-reply"></i>Save+Back</a>';
56+
return '<a class="button" onclick="_doSave({goBack:true});return false;"><i class="fa fa-reply"></i>Save+Back</a>';
5757
}
5858
]);
5959

0 commit comments

Comments
 (0)