From 5f2f64bc884347ec8c43009e145668228771d221 Mon Sep 17 00:00:00 2001 From: gerard1001 Date: Wed, 10 Jun 2026 18:58:48 +0200 Subject: [PATCH 1/4] Fix accordion mdb parent attribute --- index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/index.js b/index.js index f05a4ee..e2a2fa7 100644 --- a/index.js +++ b/index.js @@ -816,6 +816,37 @@ const wrapIt = ( - + ${headersInBody(headers)} - ${config.colorscheme === "navbar-light" ? navbarSolidOnScroll : ""} `; }; @@ -1595,23 +1593,14 @@ const configuration_workflow = (config) => attributes: { options: [ { name: "", label: "Default" }, + { name: "sidenav-light bg-light", label: "Light" }, + { name: "sidenav-light", label: "Transparent Light" }, { name: "sidenav-dark bg-dark", label: "Dark" }, { name: "sidenav-dark bg-primary", label: "Dark Primary" }, { name: "sidenav-dark bg-secondary", label: "Dark Secondary", }, - { name: "sidenav-light bg-light", label: "Light" }, - { name: "sidenav-light bg-white", label: "White" }, - { name: "sidenav-light", label: "Transparent Light" }, - { - name: "sidenav-light navbar-scrolling bg-light", - label: "Scrolling Light", - }, - { - name: "sidenav-dark navbar-scrolled bg-dark", - label: "Scrolled Dark", - }, ], }, showIf: { layout_style: "Vertical" }, @@ -1624,22 +1613,16 @@ const configuration_workflow = (config) => default: "", attributes: { options: [ - { name: "", label: "Default" }, + { name: "navbar-light bg-light", label: "Light" }, + { name: "navbar-light bg-white", label: "White" }, { name: "navbar-dark bg-dark", label: "Dark" }, { name: "navbar-dark bg-primary", label: "Dark Primary" }, { name: "navbar-dark bg-secondary", label: "Dark Secondary", }, - { name: "navbar-light bg-light", label: "Light" }, - { name: "navbar-light bg-white", label: "White" }, { name: "", label: "Transparent Light" }, { name: "transparent-dark", label: "Transparent Dark" }, - { - name: "navbar-scrolling bg-light", - label: "Scrolling Light", - }, - { name: "navbar-scrolled bg-dark", label: "Scrolled Dark" }, ], }, showIf: { layout_style: "Horizontal" }, diff --git a/public/js/reinit-collapses.js b/public/js/reinit-collapses.js deleted file mode 100644 index 24b3339..0000000 --- a/public/js/reinit-collapses.js +++ /dev/null @@ -1,68 +0,0 @@ -(function () { - function markAndInitCollapses(root) { - try { - root = root || document; - // Find Bootstrap-standard collapse triggers not yet picked up by MDB autoinit - var nodes = Array.prototype.slice.call( - root.querySelectorAll - ? root.querySelectorAll( - '[data-bs-toggle="collapse"]:not([data-bs-collapse-init])' - ) - : [] - ); - if (!nodes.length) return; - - var CollapseClass = - (window.mdb && window.mdb.Collapse) || - (window.bootstrap && window.bootstrap.Collapse) || - null; - - nodes.forEach(function (el) { - try { - el.setAttribute("data-bs-collapse-init", ""); - if (!CollapseClass) return; - var selector = - el.getAttribute("data-bs-target") || el.getAttribute("href"); - if (!selector) return; - document.querySelectorAll(selector).forEach(function (target) { - CollapseClass.getOrCreateInstance(target, { toggle: false }); - }); - } catch (e) { - console.error(e); - } - }); - } catch (e) { - console.error(e); - } - } - - markAndInitCollapses(document); - if (window.reinitCollapses) window.reinitCollapses(document); - - try { - var mo = new MutationObserver(function (muts) { - for (var i = 0; i < muts.length; i++) { - var m = muts[i]; - if (m.addedNodes && m.addedNodes.length) { - for (var j = 0; j < m.addedNodes.length; j++) { - var n = m.addedNodes[j]; - if (n && n.nodeType === 1) { - markAndInitCollapses(n); - if (window.reinitCollapses) window.reinitCollapses(n); - } - } - } - } - }); - mo.observe(document.body, { childList: true, subtree: true }); - } catch (e) { - console.error(e); - } - - if (window.jQuery && window.jQuery(document).ajaxComplete) { - window.jQuery(document).ajaxComplete(function () { - markAndInitCollapses(document); - if (window.reinitCollapses) window.reinitCollapses(document); - }); - } -})(); diff --git a/public/js/reinit-dropdowns.js b/public/js/reinit-dropdowns.js deleted file mode 100644 index 3787c5e..0000000 --- a/public/js/reinit-dropdowns.js +++ /dev/null @@ -1,82 +0,0 @@ -(function () { - function markAndInitDropdowns(root) { - try { - root = root || document; - var toggleSelector = - '[data-bs-toggle="dropdown"],[data-bs-dropdown-init]'; - var nodes = Array.prototype.slice.call( - root.querySelectorAll ? root.querySelectorAll(toggleSelector) : [], - ); - if (!nodes.length) return; - var DropdownClass = - (window.mdb && window.mdb.Dropdown) || - (window.bootstrap && window.bootstrap.Dropdown) || - null; - - nodes.forEach(function (el) { - try { - if ( - DropdownClass && - typeof DropdownClass.getOrCreateInstance === "function" - ) { - DropdownClass.getOrCreateInstance(el); - } else if ( - window.bootstrap && - window.bootstrap.Dropdown && - typeof window.bootstrap.Dropdown.getOrCreateInstance === "function" - ) { - window.bootstrap.Dropdown.getOrCreateInstance(el); - } else if ( - window.jQuery && - window.jQuery.fn && - window.jQuery.fn.dropdown - ) { - window.jQuery(el).dropdown(); - } - el.setAttribute("data-bs-dropdown-initialized", "true"); - } catch (e) { - console.error(e); - } - }); - } catch (e) { - console.error(e); - } - } - - // Initial run - markAndInitDropdowns(document); - if (window.reinitDropdowns) window.reinitDropdowns(document); - - // Observe dynamic DOM changes - try { - var mo = new MutationObserver(function (muts) { - for (var i = 0; i < muts.length; i++) { - var m = muts[i]; - if (m.addedNodes && m.addedNodes.length) { - for (var j = 0; j < m.addedNodes.length; j++) { - var n = m.addedNodes[j]; - if (n && n.nodeType === 1) { - markAndInitDropdowns(n); - if (window.reinitDropdowns) window.reinitDropdowns(n); - } - } - } - } - }); - mo.observe(document.body, { childList: true, subtree: true }); - } catch (e) { - console.error(e); - } - - // jQuery AJAX hook (if present) - if ( - window.jQuery && - window.jQuery(document) && - window.jQuery(document).ajaxComplete - ) { - window.jQuery(document).ajaxComplete(function () { - markAndInitDropdowns(document); - if (window.reinitDropdowns) window.reinitDropdowns(document); - }); - } -})(); diff --git a/public/js/reinit-toasts.js b/public/js/reinit-toasts.js deleted file mode 100644 index 01b0a7e..0000000 --- a/public/js/reinit-toasts.js +++ /dev/null @@ -1,54 +0,0 @@ -(function () { - function markAndInitToasts(root) { - try { - root = root || document; - var nodes = Array.prototype.slice.call( - root.querySelectorAll - ? root.querySelectorAll('.toast:not([data-bs-toast-initialized])') - : [] - ); - if (!nodes.length) return; - - var ToastClass = window.mdb && window.mdb.Toast; - if (!ToastClass) return; - - nodes.forEach(function (el) { - try { - // Initializing registers enableDismissTrigger(Toast) as a global - // document-level handler for [data-bs-dismiss="toast"] clicks. - // autohide:false prevents MDB from starting a countdown on already-shown toasts. - ToastClass.getOrCreateInstance(el, { autohide: false }); - } catch (e) { - console.error(e); - } - }); - } catch (e) { - console.error(e); - } - } - - markAndInitToasts(document); - - try { - var mo = new MutationObserver(function (muts) { - for (var i = 0; i < muts.length; i++) { - var m = muts[i]; - if (m.addedNodes && m.addedNodes.length) { - for (var j = 0; j < m.addedNodes.length; j++) { - var n = m.addedNodes[j]; - if (n && n.nodeType === 1) markAndInitToasts(n); - } - } - } - }); - mo.observe(document.body, { childList: true, subtree: true }); - } catch (e) { - console.error(e); - } - - if (window.jQuery && window.jQuery(document).ajaxComplete) { - window.jQuery(document).ajaxComplete(function () { - markAndInitToasts(document); - }); - } -})(); From 724d200e4ec24ce3ff92f05d825169301c68ccee Mon Sep 17 00:00:00 2001 From: gerard1001 Date: Fri, 19 Jun 2026 21:56:29 +0200 Subject: [PATCH 4/4] How to rebuild mdb.min.js from mdb-ui-kit --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/README.md b/README.md index 385389b..162d6b8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,62 @@ # material-design Material Design theme for Saltcorn based on mdbootstrap + +## Rebuilding `mdb.min.js` from mdb-ui-kit + +`public/js/mdb.min.js` is generated from [mdb-ui-kit](https://github.com/mdbootstrap/mdb-ui-kit) with MDB-specific attribute and class name prefixes patched from `mdb-` to `bs-` to stay consistent with Bootstrap naming used in this plugin. + +### Steps + +**1. Fork mdb-ui-kit** + +Go to [https://github.com/mdbootstrap/mdb-ui-kit/tree/master](https://github.com/mdbootstrap/mdb-ui-kit/tree/master) and fork the repo to your GitHub account. + +**2. Clone your fork** + +```bash +git clone https://github.com//mdb-ui-kit.git +cd mdb-ui-kit +``` + +**3. (Optional) Patch the source files** + +Replace `data-mdb-` with `data-bs-` across all JS source files: + +```bash +find src -type f -name "*.js" -exec sed -i '' 's/data-mdb-/data-bs-/g' {} + +``` + +This keeps the fork's source consistent with the built output — only needed if you plan to rebuild the bundle from webpack source in the future. + +**4. Add the build script to `package.json`** + +In `mdb-ui-kit/package.json`, add this under `"scripts"`: + +```json +"build": "sed 's/data-mdb-/data-bs-/g' js/mdb.umd.min.js | sed 's/startsWith(\"mdb\")/startsWith(\"bs\")/g' | sed 's/\\.replace(\\/\\^mdb\\/,\"\")/.replace(\\/\\^bs\\/,\"\")/g' > js/mdb.bs.umd.min.js" +``` + +This chains three replacements on `js/mdb.umd.min.js` (the pre-built bundle that ships with the repo) and writes the patched result to `js/mdb.bs.umd.min.js`: + +| Original | Replaced with | +|---|---| +| `data-mdb-` | `data-bs-` | +| `startsWith("mdb")` | `startsWith("bs")` | +| `.replace(/^mdb/,"")` | `.replace(/^bs/,"")` | + +**5. Run the build** + +```bash +npm run build +``` + +**6. Copy `js/mdb.bs.umd.min.js` into this plugin as `public/js/mdb.min.js`** + +Verify no `mdb-` attribute names leaked through: + +```bash +grep 'data-mdb-' public/js/mdb.min.js # should print nothing +``` + +> Current bundle: MDB5 FREE **9.3.0** +