This commit is contained in:
2026-06-14 10:53:21 +02:00
parent 80f92a384e
commit ec9bc3fe1f
2 changed files with 145 additions and 13 deletions
+12 -13
View File
@@ -22,24 +22,23 @@ if (!isset($_SESSION["user"])) {
<div id="block-container"></div> <div id="block-container"></div>
<!-- Plus-Button und das Pop-up-Menü --> <!-- Plus-Button und das Pop-up-Menü -->
<div id="add-block-control" class="add-block-control"> <div id="add-block-control" class="article-editor-scope add-block-control">
<button type="button" id="plus-button" class="plus-button">+</button> <button type="button" id="plus-button" class="article-editor-scope plus-button">+</button>
<div id="block-popup" class="block-popup hidden"> <div id="block-popup" class="article-editor-scope block-popup hidden">
<button type="button" data-type="text">Textblock</button> <button type="button" data-type="text">Textblock</button>
<button type="button" data-type="image">Bild einfügen</button> <button type="button" data-type="image">Bild einfügen</button>
</div> </div>
</div> </div>
<!-- Unsichtbares Textfeld, das die JSON-Daten hält und an den Controller postet --> <!-- Unsichtbares Textfeld, das die JSON-Daten hält und an den Controller postet -->
<textarea id="content" name="content" style="display:none;"> <textarea id="content" name="content" style="display:none;"><?php
<?php if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){ echo htmlspecialchars($_SESSION['old_content']);
echo htmlspecialchars($_SESSION['old_content']); unset($_SESSION['old_content']);
unset($_SESSION['old_content']); } else {
} else { echo '[]'; // Standardmäßig ein leeres JSON-Array
echo '[]'; // Standardmäßig ein leeres JSON-Array }
}?> ?></textarea>
</textarea>
</main> </main>
<!-- Seitenleiste --> <!-- Seitenleiste -->
+133
View File
@@ -90,6 +90,135 @@
padding: 18px 12px; padding: 18px 12px;
} }
/* Container für die dynamisch per JS eingefügten Blöcke */
.article-editor-scope #block-container {
width: 100%;
display: flex;
flex-direction: column;
gap: 20px;
}
/* Styling für jeden einzelnen dynamisch generierten Block */
.article-editor-scope .editor-block {
position: relative; /* Wichtig für die absolute Positionierung des Lösch-Buttons */
width: 100%;
padding: 15px;
background-color: #fafafa;
border: 1px dashed #cccccc;
border-radius: 6px;
}
/* Textarea innerhalb eines dynamischen Textblocks */
.article-editor-scope .editor-block textarea {
width: 100%;
min-height: 120px;
padding: 10px;
border: 1px solid #dddddd;
border-radius: 4px;
font-family: inherit;
font-size: 1.1rem;
line-height: 1.6;
resize: vertical;
outline: none;
background: #ffffff;
}
/* Komfort-Löschbutton oben rechts an jedem Block */
.article-editor-scope .delete-block-btn {
position: absolute;
top: -10px;
right: -10px;
width: 24px;
height: 24px;
border-radius: 50%;
background-color: #e74c3c;
color: #ffffff;
border: none;
font-size: 12px;
font-weight: bold;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: background-color 0.2s ease;
}
.article-editor-scope .delete-block-btn:hover {
background-color: #c0392b;
}
/* Steuerungselement für den Plus-Button und das Pop-up */
.article-editor-scope .add-block-control {
position: relative; /* Dient als Anker für das absolut positionierte Pop-up */
margin-top: 10px;
display: inline-block;
align-self: flex-start; /* Verhindert, dass der Button die volle Breite spannt */
}
/* Der runde Plus-Button */
.article-editor-scope .plus-button {
width: 45px;
height: 45px;
border-radius: 50%;
background-color: #3498db;
color: #ffffff;
border: none;
font-size: 26px;
font-weight: 300;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
transition: background-color 0.2s ease, transform 0.2s ease;
}
.article-editor-scope .plus-button:hover {
background-color: #2980b9;
transform: scale(1.05);
}
/* Das Pop-up Menü */
.article-editor-scope .block-popup {
position: absolute;
left: 60px; /* Platziert das Menü rechts neben dem Plus-Button */
top: 50%;
transform: translateY(-50%); /* Zentriert das Menü vertikal zum Button */
background-color: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 8px;
display: flex;
gap: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
z-index: 999;
white-space: nowrap;
}
/* Die entscheidende Klasse zum Ausblenden */
.article-editor-scope .block-popup.hidden {
display: none !important;
}
/* Buttons im Pop-up (Textblock / Bild einfügen) */
.article-editor-scope .block-popup button {
background-color: #f8f9fa;
border: 1px solid #dcdde1;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
color: #2f3640;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
.article-editor-scope .block-popup button:hover {
background-color: #f1f2f6;
border-color: #b2bec3;
}
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */ /* Responsive Anpassungen unter 760px (für z.B. Smartphones) */
@media (max-width: 760px) { @media (max-width: 760px) {
.article-editor-scope.editor-container { .article-editor-scope.editor-container {
@@ -113,4 +242,8 @@
border-left: none; border-left: none;
border-top: 1px solid #e0e0e0; border-top: 1px solid #e0e0e0;
} }
.article-editor-scope .editor-block textarea {
min-height: 150px;
}
} }