From 47e5133bc19c3a8861aa2fde1108637fd37b04b8 Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Wed, 17 Jul 2024 01:19:20 +0200 Subject: [PATCH] Fix support for Eruda v3.2.0 The function util.classPrefix is no longer available via exports. --- app/src/main/assets/eruda.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/assets/eruda.js b/app/src/main/assets/eruda.js index 1063a7a..8d36d8b 100644 --- a/app/src/main/assets/eruda.js +++ b/app/src/main/assets/eruda.js @@ -193,7 +193,20 @@ class Filter { } } -const c = eruda.util.classPrefix; +function c(str) { + const prefix = `eruda-`; + return str + .trim() + .split(/\s+/) + .map((singleClass) => { + if (singleClass.includes(prefix)) { + return singleClass; + } + return singleClass.replace(/[\w-]+/, (match) => `${prefix}${match}`); + }) + .join(" "); +} + const s = (spans) => spans .map((e) => ``)