Fix: Rich TextBox (Summernote) not saving changes in code-view

The richtext box had an annoying bug: If you switch to code view, modify
the code then save, the changes would be ignored.

One had to switch back to preview mode prior to save. (See
summernote/summernote#94 for more details)
This commit is contained in:
Nicolas Dorier
2025-11-07 11:13:26 +09:00
parent b7aed3e3d8
commit 88d3e7ad55

View File

@@ -127,6 +127,16 @@
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
<script src="~/vendor/summernote/summernote-bs5.js" asp-append-version="true"></script>
<script>
// Fix annoying summernote bug (need to go back to preview after changing codeview): https://github.com/summernote/summernote/issues/94
document.querySelector('#save-form').addEventListener('submit', function (e) {
const codeView = document.querySelector(".note-codeview-keep.active");
if (codeView) {
codeView.click();
}
});
</script>
<script>
var triggers = @Safe.Json(Model.Triggers);
var triggersByType = {};