Fix bug where chunks still editable with Allow Editing off

If, with Allow Editing on, you change a chunk and then click directly on
the "Allow Editing" switch again to turn it off without defocusing the
chunk in-between (by clicking outside the chunk, using enter/escape,
etc), all story chunks would still be editable.
That behaviour has now been fixed.
This commit is contained in:
Gnome Ann 2021-08-23 14:25:40 -04:00
parent 723e02d793
commit 81c83dfef7
1 changed files with 2 additions and 2 deletions

View File

@ -774,8 +774,8 @@ $(document).ready(function(){
$('body').on('input', autofocus).on('keydown', 'chunk', chunkOnKeyDown).on('focusout', 'chunk', submitEditedChunk); $('body').on('input', autofocus).on('keydown', 'chunk', chunkOnKeyDown).on('focusout', 'chunk', submitEditedChunk);
$('#allowediting').prop('checked', allowedit).prop('disabled', false).change().on('change', function () { $('#allowediting').prop('checked', allowedit).prop('disabled', false).change().on('change', function () {
if(allowtoggle) { if(allowtoggle) {
checked = $(this).prop('checked') allowedit = $(this).prop('checked')
$("chunk").attr('contenteditable', checked) $("chunk").attr('contenteditable', allowedit)
} }
}); });
} else if(msg.cmd == "updatescreen") { } else if(msg.cmd == "updatescreen") {