qumra-engine 2.0.124 → 2.0.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,11 +57,14 @@ exports.default = new (class WidgetExtension {
|
|
|
57
57
|
blocks: widget.blocks ?? [],
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
|
-
let
|
|
60
|
+
let showDevTools = false;
|
|
61
61
|
if (env.getGlobal("isIframe")) {
|
|
62
|
-
|
|
62
|
+
showDevTools = env.getGlobal("isIframe");
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (env.getGlobal("showDevTools")) {
|
|
65
|
+
showDevTools = env.getGlobal("showDevTools");
|
|
66
|
+
}
|
|
67
|
+
if (showDevTools) {
|
|
65
68
|
renderedWidgets.push(`
|
|
66
69
|
<section content-type="widget" widget-id="${widget._id}" id="qumra-widget-id-${widget._id}" template-key="main" template-id="${template._id}">
|
|
67
70
|
${html}
|
|
@@ -23,7 +23,7 @@ exports.default = new (class WidgetExtension {
|
|
|
23
23
|
// if (templateKey === "main") {
|
|
24
24
|
// return new nunjucks.runtime.SafeString(`
|
|
25
25
|
// <div style="padding: 12px; background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; border-radius: 4px; margin: 8px 0;">
|
|
26
|
-
// ⚠️ <strong>لا يمكن تضمين قالب "{% template "main" %}" بشكل مباشر:</strong>
|
|
26
|
+
// ⚠️ <strong>لا يمكن تضمين قالب "{% template "main" %}" بشكل مباشر:</strong>
|
|
27
27
|
// <p>يمكنك استخدام "{% content %}" لعرض المحتوى الرئيسي للصفحة</p>
|
|
28
28
|
// </div>
|
|
29
29
|
// `);
|
|
@@ -52,11 +52,14 @@ exports.default = new (class WidgetExtension {
|
|
|
52
52
|
blocks: widget.blocks ?? [],
|
|
53
53
|
},
|
|
54
54
|
});
|
|
55
|
-
let
|
|
55
|
+
let showDevTools = false;
|
|
56
56
|
if (env.getGlobal("isIframe")) {
|
|
57
|
-
|
|
57
|
+
showDevTools = env.getGlobal("isIframe");
|
|
58
58
|
}
|
|
59
|
-
if (
|
|
59
|
+
if (env.getGlobal("showDevTools")) {
|
|
60
|
+
showDevTools = env.getGlobal("showDevTools");
|
|
61
|
+
}
|
|
62
|
+
if (showDevTools) {
|
|
60
63
|
renderedWidgets.push(`
|
|
61
64
|
<section widget-id="${widget._id}" id="qumra-widget-id-${widget._id}" template-key="${templateKey}" template-id="${template._id}">
|
|
62
65
|
${html}
|
|
@@ -19,6 +19,12 @@ const mergeDataMiddleware = async (req, res, next) => {
|
|
|
19
19
|
else {
|
|
20
20
|
res.locals.env.addGlobal("isIframe", false);
|
|
21
21
|
}
|
|
22
|
+
if (res.locals.showDevTools) {
|
|
23
|
+
res.locals.env.addGlobal("showDevTools", res.locals.showDevTools);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
res.locals.env.addGlobal("showDevTools", false);
|
|
27
|
+
}
|
|
22
28
|
res.locals.env.addGlobal("templates", res.locals.render.engine?.templates);
|
|
23
29
|
res.locals.env.addGlobal("engineData", res.locals.render.engine);
|
|
24
30
|
res.locals.env.addGlobal("widgets", widgets);
|
package/dist/middleware.js
CHANGED
|
@@ -40,6 +40,7 @@ const startEngine = async ({ renderApi, mode, getRender, setRender, port = 3000,
|
|
|
40
40
|
return;
|
|
41
41
|
});
|
|
42
42
|
app.use((req, res, next) => {
|
|
43
|
+
res.locals.showDevTools = req.query.showDevTools ?? false;
|
|
43
44
|
const isIframe = req.query.iframe === "1" || req.headers["sec-fetch-dest"] === "iframe";
|
|
44
45
|
if (isIframe) {
|
|
45
46
|
console.log("🚀 هذا الطلب جاي من iframe");
|