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

Für REDAXO
^5.18.0
Veröffentlicht am
15.02.2026

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

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.4...4.5.5

4.5.4

Für REDAXO
^5.18.0
Veröffentlicht am
01.12.2025

Verbesserter Gridblock-Support

4.5.3

Für REDAXO
^5.18.0
Veröffentlicht am
01.12.2025

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

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.8...4.5.0

What's Changed

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.0...4.5.1

4.3.7

Für REDAXO
^5.18.0
Veröffentlicht am
23.10.2025

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

Für REDAXO
^5.18.0
Veröffentlicht am
21.10.2025

What's Changed

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.5...4.3.6

4.3.5

Für REDAXO
^5.18.0
Veröffentlicht am
10.10.2025

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

Für REDAXO
^5.18.0
Veröffentlicht am
10.10.2025

What's Changed

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.3...4.3.4

4.3.3

Für REDAXO
^5.18.0
Veröffentlicht am
29.09.2025

4.3.2 - 4.3.3

What's Changed

New Contributors

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.1...4.3.2

4.2.1

Für REDAXO
^5.18.0
Veröffentlicht am
28.08.2025

4.2.0 🎉 :: Hello Gridblock

  1. Verbesserter Support für Gridblock
  2. 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

Für REDAXO
^5.18.0
Veröffentlicht am
26.08.2025

🚨🚨🚨🚨🚨 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

Für REDAXO
^5.6.0
Veröffentlicht am
25.08.2023
Require / PHP Extensions
xml

What's Changed

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.12...3.4.13

3.4.12

Für REDAXO
^5.6.0
Veröffentlicht am
02.03.2023
Require / PHP Extensions
xml

Behebt einen Darstellungsfehler, wenn kein initiales Fieldset gesetzt wurde.

3.4.11

Für REDAXO
^5.6.0
Veröffentlicht am
04.02.2023
Require / PHP Extensions
xml

Updated Examples to MForm >= 7
Added notice about MForm version

3.4.10

Für REDAXO
^5.6.0
Veröffentlicht am
03.02.2023
Require / PHP Extensions
xml

What's Changed

3.4.9

Für REDAXO
^5.6.0
Veröffentlicht am
20.01.2023
Require / PHP Extensions
xml

What's Changed

New Contributors

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.8...3.4.9

3.4.8

Für REDAXO
^5.6.0
Veröffentlicht am
05.01.2023
Require / PHP Extensions
xml

What's Changed

New Contributors

Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.7...3.4.8

3.4.7

Für REDAXO
^5.6.0
Veröffentlicht am
14.09.2022
Require / PHP Extensions
xml

3.4.6

Für REDAXO
^5.6.0
Veröffentlicht am
09.08.2022
Require / PHP Extensions
xml

Fix für Gridblock @https://github.com/iceman-fx/gridblock/issues/61
Danke @novinet-dsteffen @iceman-fx

3.4.5

Für REDAXO
^5.6.0
Veröffentlicht am
01.08.2022
Require / PHP Extensions
xml

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

Für REDAXO
^5.6.0
Veröffentlicht am
06.12.2021
Require / PHP Extensions
xml

Fixes return types for YForm 4 in yform values

3.4.3

Für REDAXO
^5.6.0
Veröffentlicht am
25.11.2021
Require / PHP Extensions
xml

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

Für REDAXO
^5.6.0
Veröffentlicht am
15.01.2019
Require / PHP Extensions
xml

added rex:change event after item movements

3.0.0

Für REDAXO
^5.6.0
Veröffentlicht am
17.12.2018
Require / PHP Extensions
xml

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