Skip to content

Commit 7a6ca2d

Browse files
authored
Implement BootstrapDialog for adding headers
Replaced header display logic with BootstrapDialog for adding a new header.
1 parent 59cef61 commit 7a6ca2d

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

app/js/editor/editor.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,29 @@ function del() {
181181
}
182182

183183
function openHeader() {
184-
$("#header-button").hide();
185-
$("#new-header-container").show();
186-
$("#new-header").focus();
184+
BootstrapDialog.show({
185+
title: 'Add Header',
186+
message: '<input autocomplete="on" id="dialog-new-header" type="text" class="form-control" placeholder="New Header&hellip;">',
187+
buttons: [{
188+
label: 'Add',
189+
cssClass: 'btn-primary',
190+
action: function(dialog) {
191+
var headerValue = $('#dialog-new-header').val();
192+
if(headerValue) {
193+
addHeader(headerValue);
194+
dialog.close();
195+
}
196+
}
197+
}, {
198+
label: 'Cancel',
199+
action: function(dialog) {
200+
dialog.close();
201+
}
202+
}],
203+
onshown: function(dialog) {
204+
$('#dialog-new-header').focus();
205+
}
206+
});
187207
}
188208

189209
function closeHeader() {

0 commit comments

Comments
 (0)