fix editor for short_story and chapters

This commit is contained in:
2026-05-01 21:53:43 +03:00
parent ce6fffaa57
commit b69a110b97
4 changed files with 88 additions and 142 deletions
+6 -13
View File
@@ -5,7 +5,7 @@ include 'views/layouts/header.php';
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="col-lg-10">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2">Создание новой книги</h1>
<a href="<?= SITE_URL ?>/books" class="btn btn-outline-secondary">
@@ -109,10 +109,10 @@ include 'views/layouts/header.php';
<h5 class="card-title mb-0">Содержание рассказа</h5>
</div>
<div class="card-body">
<div id="story-editor" style="height: 400px;" data-content="<?= htmlspecialchars($_POST['content'] ?? '', ENT_QUOTES) ?>">
<div id="quill-editor" style="height: 400px;" data-content="<?= htmlspecialchars($_POST['content'] ?? '', ENT_QUOTES) ?>">
<?= $_POST['content'] ?? '' ?>
</div>
<input type="hidden" name="content" id="story-content" <?= !empty($_POST['content']) ? 'value="' . htmlspecialchars($_POST['content'], ENT_QUOTES) . '"' : '' ?>>
<input type="hidden" name="content" id="content" <?= !empty($_POST['content']) ? 'value="' . htmlspecialchars($_POST['content'], ENT_QUOTES) . '"' : '' ?>>
</div>
</div>
@@ -141,18 +141,11 @@ function toggleStoryEditor() {
storyCard.style.display = isShortStory ? 'block' : 'none';
if (isShortStory && !window.writerEditor) {
initQuillEditor(true);
} else if (!isShortStory && window.writerEditor) {
window.writerEditor.quill.destroy();
window.writerEditor = new WriterEditor('#book-form', 'quill-editor', 'content');
} else if (!isShortStory && window.writerEditor && window.writerEditor.quill) {
try { window.writerEditor.quill.destroy(); } catch(e) {}
window.writerEditor = null;
}
if (isShortStory && window.writerEditor && window.writerEditor.quill) {
setTimeout(() => {
window.writerEditor.quill.root.style.height = '400px';
window.writerEditor.quill.container.style.height = '400px';
}, 100);
}
}
}