@saltcorn/markup
Advanced tools
Comparing version 0.7.1 to 0.7.2-beta.0
@@ -143,3 +143,6 @@ "use strict"; | ||
getLabelText: columnSummary, | ||
onUpdate: apply_showif, | ||
onUpdate: ()=>{ | ||
apply_showif(); | ||
repeaterCopyValuesToForm($('#menuForm').closest("form"), editor); | ||
}, | ||
labelEdit: 'Edit <i class="fas fa-edit clickable"></i>', | ||
@@ -155,2 +158,3 @@ maxLevel: 0 // (Optional) Default is -1 (no level limit) | ||
editor.add(); | ||
repeaterCopyValuesToForm($('#menuForm').closest("form"), editor) | ||
}); | ||
@@ -160,18 +164,8 @@ | ||
editor.update(); | ||
repeaterCopyValuesToForm($('#menuForm').closest("form"), editor) | ||
}); | ||
$('#menuForm').closest("form").submit(function(event) { | ||
event.preventDefault(); //this will prevent the default submit | ||
event.preventDefault(); //this will prevent the default submit | ||
const vs = JSON.parse(editor.getString()) | ||
const form = $('#menuForm').closest("form") | ||
//console.log(vs) | ||
vs.forEach((v,ix)=>{ | ||
Object.entries(v).forEach(([k,v])=>{ | ||
//console.log(ix, k, typeof v, v) | ||
if(typeof v === "boolean") | ||
form.append('<input type="hidden" name="'+k+'_'+ix+'" value="'+(v?'on':'')+'"></input>') | ||
else form.append('<input type="hidden" name="'+k+'_'+ix+'" value="'+v+'"></input>') | ||
}) | ||
}) | ||
repeaterCopyValuesToForm($('#menuForm').closest("form"), editor) | ||
$(this).unbind('submit').submit(); // continue the submit unbind preventDefault | ||
@@ -178,0 +172,0 @@ })`))); |
@@ -197,2 +197,8 @@ "use strict"; | ||
style: segment.style, | ||
srcset: segment.imgResponsiveWidths && srctype === "File" | ||
? segment.imgResponsiveWidths | ||
.split(",") | ||
.map((w) => `/files/resize/${segment.fileid}/${w.trim()} ${w.trim()}w`) | ||
.join(",") | ||
: undefined, | ||
src: srctype === "File" ? `/files/serve/${segment.fileid}` : segment.url, | ||
@@ -276,3 +282,3 @@ })); | ||
if (segment.type === "container") { | ||
const { bgFileId, bgType, bgColor, vAlign, hAlign, block, display, imageSize, borderWidth, borderStyle, setTextColor, textColor, showForRole, hide, customClass, customCSS, minScreenWidth, maxScreenWidth, showIfFormulaInputs, show_for_owner, borderDirection, borderRadius, borderRadiusUnit, borderColor, url, hoverColor, gradStartColor, gradEndColor, gradDirection, fullPageWidth, overflow, rotate, style, htmlElement, } = segment; | ||
const { bgFileId, bgType, bgColor, vAlign, hAlign, block, display, imageSize, borderWidth, borderStyle, setTextColor, textColor, showForRole, hide, customClass, customCSS, minScreenWidth, maxScreenWidth, showIfFormulaInputs, show_for_owner, borderDirection, borderRadius, borderRadiusUnit, borderColor, url, hoverColor, gradStartColor, gradEndColor, gradDirection, fullPageWidth, overflow, rotate, style, imgResponsiveWidths, htmlElement, } = segment; | ||
if (hide) | ||
@@ -312,2 +318,4 @@ return ""; | ||
}; | ||
const hasImgBg = renderBg && bgType === "Image" && bgFileId && +bgFileId; | ||
const useImgTagAsBg = hasImgBg && imageSize !== "repeat"; | ||
return wrap(segment, isTop, ix, genericElement(htmlElement || "div", { | ||
@@ -330,3 +338,3 @@ class: [ | ||
? ` overflow: ${overflow};` | ||
: ""} ${renderBg && bgType === "Image" && bgFileId && +bgFileId | ||
: ""} ${hasImgBg && !useImgTagAsBg | ||
? `background-image: url('/files/serve/${bgFileId}'); background-size: ${imageSize === "repeat" ? "auto" : imageSize || "contain"}; background-repeat: ${imageSize === "repeat" ? "repeat" : "no-repeat"};` | ||
@@ -343,12 +351,16 @@ : ""} ${renderBg && bgType === "Color" | ||
: {}), | ||
}, renderBg && | ||
bgType === "Image" && | ||
bgFileId && | ||
+bgFileId && | ||
div({ style: "display:none" }, img({ | ||
height: "1", | ||
width: "1", | ||
}, hasImgBg && | ||
useImgTagAsBg && | ||
img({ | ||
class: `containerbgimage `, | ||
srcset: imgResponsiveWidths | ||
? imgResponsiveWidths | ||
.split(",") | ||
.map((w) => `/files/resize/${bgFileId}/${w.trim()} ${w.trim()}w`) | ||
.join(",") | ||
: undefined, | ||
style: { "object-fit": imageSize || "contain" }, | ||
alt: "", | ||
src: `/files/serve/${bgFileId}`, | ||
})), go(segment.contents))); | ||
}), go(segment.contents))); | ||
} | ||
@@ -355,0 +367,0 @@ if (segment.type === "line_break") { |
{ | ||
"name": "@saltcorn/markup", | ||
"version": "0.7.1", | ||
"version": "0.7.2-beta.0", | ||
"description": "Markup for Saltcorn, open-source no-code platform", | ||
@@ -35,3 +35,3 @@ "homepage": "https://saltcorn.com", | ||
"devDependencies": { | ||
"@saltcorn/types": "0.7.1", | ||
"@saltcorn/types": "0.7.2-beta.0", | ||
"@types/escape-html": "^1.0.1", | ||
@@ -38,0 +38,0 @@ "@types/jest": "^27.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206167
55
2414