erweiterter Beitragseditor

content ist nun im json-Format
Bilder können hochgeladen werden
Textblöcke können im Editor angehangen werden
This commit is contained in:
2026-06-14 10:44:17 +02:00
parent f9c1c67a38
commit 80f92a384e
7 changed files with 202 additions and 14 deletions
+22 -1
View File
@@ -17,8 +17,29 @@ if (!isset($_SESSION["user"])) {
<input type="text" id="title" name="title"
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
placeholder="Titel hier eingeben" required>
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."><?php if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){echo htmlspecialchars($_SESSION['old_content']); unset($_SESSION['old_content']);}elseif (isset($content) && !empty($content)){echo htmlspecialchars($content);}?></textarea>
<!-- Hier werden die dynamischen divs via JavaScript eingefügt -->
<div id="block-container"></div>
<!-- Plus-Button und das Pop-up-Menü -->
<div id="add-block-control" class="add-block-control">
<button type="button" id="plus-button" class="plus-button">+</button>
<div id="block-popup" class="block-popup hidden">
<button type="button" data-type="text">Textblock</button>
<button type="button" data-type="image">Bild einfügen</button>
</div>
</div>
<!-- Unsichtbares Textfeld, das die JSON-Daten hält und an den Controller postet -->
<textarea id="content" name="content" style="display:none;">
<?php
if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
echo htmlspecialchars($_SESSION['old_content']);
unset($_SESSION['old_content']);
} else {
echo '[]'; // Standardmäßig ein leeres JSON-Array
}?>
</textarea>
</main>
<!-- Seitenleiste -->