AddOn
MBlock Multiple-Blöcke in Modul-Input-Formularen
Beschreibung
MBlock - multiple Datenblöcke innerhalb eines Moduls anlegen und sortieren.Mit MBlock ist es möglich innerhalb eines Moduls belieb viele Datenblöcke zu erzeugen. Die Datenblöcke können dann einfach per Drag & Drop oder auch via Up-/Down-Button sortiert werden.
Die aktuellste MBlock Version auf Github: https://github.com/FriendsOfREDAXO/mblock
Umsetzung
Versionen
4.5.5
Fehlerbehebungen
- CKEditor 5-Füllinhalt: Automatische Bereinigung von Ersatzinhalten für CKEditor 5 (
<p><br data-cke-filler="true"></p>) und Platzhaltern (<p class="ck-placeholder" ...>) bei der Formularübermittlung hinzugefügt. Dadurch wird verhindert, dass leere Blöcke mit unsichtbaren HTML-Artefakten gespeichert werden.
Cleanup Script for Existing Data
Use the following PHP script Example:
<?php
/**
* MBlock CKEditor 5 Filler Cleanup Script
*
* Run this script in the REDAXO PHP Console (System > Console) or via CLI
* to remove existing filler content from your database.
*/
$tables = [
'rex_article_slice' => 20, // Check value1 - value20
// Add custom YForm tables here if needed:
// 'rex_my_table' => ['description', 'text_column'],
];
$filler1 = '<p><br data-cke-filler="true"></p>';
$filler2 = '<br data-cke-filler="true">';
// JSON escaped variants (often found in MBlock data)
$filler1_json = '<p><br data-cke-filler=\"true\"><\/p>';
$filler2_json = '<br data-cke-filler=\"true\">';
echo "<h2>Cleaning CKEditor 5 Filler Content...</h2>";
foreach ($tables as $table => $columns) {
if (is_int($columns)) {
// Generate value1...valueN for slices
$cols = [];
for ($i = 1; $i <= $columns; $i++) {
$cols[] = 'value' . $i;
}
} else {
$cols = (array) $columns;
}
$sql = rex_sql::factory();
foreach ($cols as $col) {
// 1. Standard HTML replacement
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler1, '') WHERE `$col` LIKE :search1";
$sql->setQuery($query, ['filler1' => $filler1, 'search1' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (HTML Variant 1): " . $sql->getRows() . " rows<br>";
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler2, '') WHERE `$col` LIKE :search2";
$sql->setQuery($query, ['filler2' => $filler2, 'search2' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (HTML Variant 2): " . $sql->getRows() . " rows<br>";
// 2. JSON Escaped replacement (common in mblock)
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler1, '') WHERE `$col` LIKE :search1";
$sql->setQuery($query, ['filler1' => $filler1_json, 'search1' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (JSON Variant 1): " . $sql->getRows() . " rows<br>";
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler2, '') WHERE `$col` LIKE :search2";
$sql->setQuery($query, ['filler2' => $filler2_json, 'search2' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (JSON Variant 2): " . $sql->getRows() . " rows<br>";
// 3. Regex Replacement for Placeholders (PHP-based because SQL lacks REGEX replace)
// Matches: <p class="ck-placeholder" data-placeholder="..."></p>
$fetchQuery = "SELECT id, `$col` FROM `$table` WHERE `$col` LIKE '%ck-placeholder%'";
// Iterate only over rows that actually match
$iterator = rex_sql::factory()->getArray($fetchQuery);
$localUpdateCount = 0;
foreach ($iterator as $row) {
$original = $row[$col];
$current = $original;
// Regex for HTML variant
$current = preg_replace('/<p class="ck-placeholder" data-placeholder="[^"]+"><\/p>/', '', $current);
// Regex for JSON escaped variant (need to be careful with backslashes)
// Pattern: <p class=\"ck-placeholder\" data-placeholder=\"...\"><\/p>
$current = preg_replace('/<p class=\\\\"ck-placeholder\\\\" data-placeholder=\\\\"[^"]+\\\\"><\\\\\/p>/', '', $current);
if ($current !== $original) {
// Determine ID column name (usually 'id')
$idCol = 'id';
$upd = rex_sql::factory();
$upd->setTable($table);
$upd->setWhere([$idCol => $row[$idCol]]);
$upd->setValue($col, $current);
$upd->update();
$localUpdateCount++;
}
}
if ($localUpdateCount > 0) echo "Updated $table.$col (Placeholders via PHP Regex): " . $localUpdateCount . " rows<br>";
}
}
echo "<br><strong>Cleanup complete!</strong> Clear the cache manually if needed.";
What's Changed
- Fix: Remove CKEditor 5 filler and placeholder content on submit by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/224
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.4...4.5.5
4.5.4
Verbesserter Gridblock-Support
4.5.3
4.5.3
fixed: CKE5: Interne Links wurden in # umgeschrieben. redaxo links wurden als nicht gültig betrachtet
MBlock - REDAXO Addon für Modul-Input-Blöcke
Version 4.5.1 - 2025-11-26
Bug Fixes
- Double Icons: Fixed duplicate icons in copy/paste buttons when Bloecks addon is active.
- TinyMCE Drag & Drop: Fixed issue where TinyMCE editors became unresponsive after moving blocks (Drag & Drop or Arrow Buttons).
Version 4.5.0 - 2025-11-26
Features
- TinyMCE Support: Added full support for TinyMCE (v4, v5, v6, v7, v8) in MBlock instances.
- CKEditor 5 Improvements: Enhanced copy & paste functionality for CKEditor 5, ensuring content is correctly preserved and restored.
Improvements
- Code Modernization: Updated PHP classes to use strict types and modern array syntax.
- Performance: Optimized JavaScript for better editor initialization and cleanup.
- Cleanup: Removed debug code and unnecessary files.
fixed: https://github.com/FriendsOfREDAXO/mblock/issues/216
What's Changed
- 4.5.0 by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/219
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.8...4.5.0
What's Changed
- Fix: Duplicate icons in copy/paste buttons when Bloecks is active (v4… by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/220
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.0...4.5.1
4.3.7
Fixed:
Das aktuelle MBlock meldet bei mir einen JS-Fehler: MBlock: Sortable.js ist nicht verfügbar
@iceman-fx
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.6...4.3.7
4.3.6
What's Changed
- Fix translation placeholders by correcting to {{mblock::key}} format by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/214
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.5...4.3.6
4.3.5
Fixes a JavaScript conflict between the mblock and search_it plugins by disabling toplevel variable mangling in the Terser minification configuration. The issue was causing "redeclaration of let h" errors when both plugins were active, preventing search_it's incremental indexing from working properly.
Disabled toplevel mangling in Terser configuration to preserve global variable names
Added explanatory comments documenting why this change was necessary
Prevents naming collisions while maintaining effective minification of local variables
4.3.4
What's Changed
- Fix media field ID mismatch after moving blocks by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/209
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.3...4.3.4
4.3.3
4.3.2 - 4.3.3
What's Changed
- Change mblock language placeholders to {{mblock::key}} syntax by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/205
New Contributors
- @Copilot made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/205
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.1...4.3.2
4.2.1
4.2.0 🎉 :: Hello Gridblock
- Verbesserter Support für Gridblock
- Erweiterte Dokumentation
Hinweis für markitup- und ckeditor-Nutzer
Copy & Paste funktioniert leider nicht!
Es sollte in den betreffenden Modulen oder global in den Einstellungen deaktiviert werden.
Nicht traurig sein, dafür könnt ihr immerhin online/offline nun nutzen.
Beispiel
echo MBlock::show(1, $form, [
'min' => 1, // Minimale Anzahl Items
'max' => 10, // Maximale Anzahl Items
'template' => 'modern', // Template-Name
'copy_paste' => false, // Copy & Paste aktivieren
'online_offline' => true // Online/Offline Toggle , hidden field muss angelegt sein.
]);
4.1.1
🚨🚨🚨🚨🚨 4.0 - 4.1.1 NICHT FÜR GRIDBLOCK EINSETZEN 🚨🚨🚨🚨🚨
🚨🚨🚨🚨🚨Bitte noch die 3.x verwenden ... 4.2.0 wird es richten 🚨🚨🚨🚨🚨
Hier gibt's ein paar Fixes.
Alles wird wieder gut
Sorry an die Gridlockfreunde
3.4.13
What's Changed
- fix problems with iconv on some servers by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/161
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.12...3.4.13
3.4.12
Behebt einen Darstellungsfehler, wenn kein initiales Fieldset gesetzt wurde.
3.4.11
Updated Examples to MForm >= 7
Added notice about MForm version
3.4.10
What's Changed
- fix Fix: "iconv illegal characters found..." by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/157
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.9...3.4.10
3.4.9
What's Changed
- fix "Deprecated: mb_convert_encoding()" Warning by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/156
New Contributors
- @tyrant88 made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/156
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.8...3.4.9
3.4.8
What's Changed
- fix: typos by @eaCe in https://github.com/FriendsOfREDAXO/mblock/pull/154
- uses: actions/checkout@v3 by @alxndr-w in https://github.com/FriendsOfREDAXO/mblock/pull/155
New Contributors
- @alxndr-w made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/155
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.7...3.4.8
3.4.7
Fixes an issue with PHP 8.1
https://github.com/FriendsOfREDAXO/mblock/commit/5092ac99a00f5e746c4f41a44e28b4bf3cf8abd9
3.4.6
Fix für Gridblock @https://github.com/iceman-fx/gridblock/issues/61
Danke @novinet-dsteffen @iceman-fx
3.4.5
PRESAVE-Action: Die REX_VALUES werden nach einer PRESAVE Aktion aus dem $_POST geladen.
Dadurch sind Validierungen ohne Neueingabe des Contents jetzt möglich. @skerbis
3.4.4
Fixes return types for YForm 4 in yform values
3.4.3
3.4.0 - 3.4.3
- Fixed: don't remove \' in media widget id
- Notice: add mblock:change and set rex:change to deprecated. rex:change will remove in next minor version
- Fixed: refresh disabled button status by drag and drop movements
- Fixed: don't add empty link and media list option
- dark mode support for REDAXO >= 5.13 thx to: @eaCe
- Compatibility: compare fix for REDAXO widgets
3.1.0
added rex:change event after item movements
3.0.0
ACHTUNG!!
Dies ist ein Major-Release.
- MBlock funktioniert nun vollständig mit rex:ready
Der verwendete Editor sollte rex:ready nutzen. - Spezieller Code für Editoren entfernt.
Ausführliche
Release-Notes:
https://github.com/FriendsOfREDAXO/mblock/releases/tag/3.0.0