|
@@ -48,11 +48,6 @@
|
|
|
doSave($(this).closest('.note-section'));
|
|
|
});
|
|
|
|
|
|
- // [name="data"] change listener
|
|
|
- $('.note-section input[name="data"], .note-section input[name="items"]').each(function() {
|
|
|
- initChangeListener($(this));
|
|
|
- });
|
|
|
-
|
|
|
@if(isset($guestAccessCode))
|
|
|
$('.note-section form').append("<input type='hidden' name='guest_access_code' value='{{$guestAccessCode}}'/>");
|
|
|
@endif
|
|
@@ -67,6 +62,11 @@
|
|
|
toastr.success("The link " + copyText.val() + " has been copied to the clipboard");
|
|
|
return false;
|
|
|
});
|
|
|
+
|
|
|
+ // [name="data"] change listener
|
|
|
+ $('.note-section input[name="data"], .note-section input[name="items"]').each(function() {
|
|
|
+ initChangeListener($(this));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
const debounce = (func, wait) => {
|
|
@@ -128,7 +128,13 @@
|
|
|
|
|
|
function initChangeListener(_elem) {
|
|
|
new MutationObserver(debounce(function() {
|
|
|
- doSave(_elem.closest('.note-section'))
|
|
|
+ if(_elem.closest('.note-section').is('.edit')) {
|
|
|
+ console.log('ALIX: In edit mode. Auto-saving', _elem.closest('.note-section').attr('data-section-template-name'))
|
|
|
+ doSave(_elem.closest('.note-section'))
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ console.log('ALIX: Not in edit mode. Not auto-saving', _elem.closest('.note-section').attr('data-section-template-name'))
|
|
|
+ }
|
|
|
}, 250))
|
|
|
.observe(_elem[0], {
|
|
|
attributes: true
|