Browse Source

Skip empty property values in widget text

Updated addWidgetModal.js to exclude properties with default or empty values when generating widgetText. This prevents unnecessary attributes from being added to the widget markup.
pull/24110/head
EngincanV 3 months ago
parent
commit
792356be2d
  1. 9
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js

9
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js

@ -31,7 +31,14 @@ $(function () {
for (var propertyName in properties) {
if (!propertyName.includes(']') && !propertyName.includes('[')) {
widgetText += propertyName + "=\"" + properties[propertyName] + "\" ";
var propertyValue = properties[propertyName];
//skip default/empty values
if(!propertyValue) {
continue;
}
widgetText += propertyName + "=\"" + propertyValue + "\" ";
}
}

Loading…
Cancel
Save