diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 04edf2a9..a9f70f43 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -3744,6 +3744,10 @@ this.svgToString = function (elem, indent) { let attrVal = toXml(attr.value); // remove bogus attributes added by Gecko if (mozAttrs.includes(attr.localName)) { continue; } + if (attrVal === 'null') { + const styleName = attr.localName.replace(/-[a-z]/g, (s) => s[1].toUpperCase()); + if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) { continue; } + } if (attrVal !== '') { if (attrVal.startsWith('pointer-events')) { continue; } if (attr.localName === 'class' && attrVal.startsWith('se_')) { continue; } @@ -3786,7 +3790,7 @@ this.svgToString = function (elem, indent) { switch (child.nodeType) { case 1: // element node out.push('\n'); - out.push(this.svgToString(childs.item(i), indent)); + out.push(this.svgToString(child, indent)); break; case 3: { // text node const str = child.nodeValue.replace(/^\s+|\s+$/g, ''); @@ -4072,7 +4076,8 @@ this.exportPDF = async function ( // We do not currently have these paths configurable as they are // currently global-only, so not Rolled-up 'jspdf/underscore-min.js', - 'jspdf/jspdf.min.js' + // 'jspdf/jspdf.min.js', + '../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js' ]); const modularVersion = !('svgEditor' in window) || diff --git a/editor/utilities.js b/editor/utilities.js index 8d0086b2..ecd1985e 100644 --- a/editor/utilities.js +++ b/editor/utilities.js @@ -1237,7 +1237,14 @@ export const assignAttributes = function (elem, attrs, suspendLength, unitCheck) const ns = (key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null); - + if (isNullish(value)) { + if (ns) { + elem.removeAttributeNS(ns, key); + } else { + elem.removeAttribute(key); + } + continue; + } if (ns) { elem.setAttributeNS(ns, key, value); } else if (!unitCheck) {