kirby-deprecated-plugins/field-engineer

Delete / Save

H-i-red opened this issue · 2 comments

If you delete a field and leave the page without saving, the field will still be there.
It should not be there and the sign "You have unsaved changes" should be visible.

well I digged around your JS code and found that you do not "keep" the state when you "DELETE/SORT/CLONE" an entry/module, if you trigger it in your render function everything works..
: obj.closest('form').trigger('keep');

fn.render = function(obj) {
		var output = '';
		var fields = obj.find('.egr-presentation').children();
		var out = '';
		var textarea = obj.find('.egr-output').find('textarea');
		out = fn.renderLoop(fields, out, level, true);
		textarea.val(out);
		textarea.blur();
		obj.closest('form').trigger('keep');
	};

Nice digging! I'll try your fix to the next version. In the meantime, you can keep the fix in your code if it works well. Thanks!