@svgedit/svgcanvas 7.2.4 → 7.2.6

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.
package/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # svgcanvas CHANGES
2
2
 
3
+ ## 7.2.5
4
+ - update dependencies
5
+
3
6
  ## 7.2.4
4
7
  - bug fixes
5
8
  - update dependencies
package/core/event.js CHANGED
@@ -662,9 +662,18 @@ const mouseUpEvent = (evt) => {
662
662
  const elem = selectedElements[0]
663
663
  if (elem) {
664
664
  elem.removeAttribute('style')
665
- walkTree(elem, (el) => {
666
- el.removeAttribute('style')
667
- })
665
+
666
+ // we don't remove the style elements for contents of foreignObjects
667
+ // because that is a valid way to style them
668
+ if (elem.localName === 'foreignObject') {
669
+ walkTree(elem, (el) => {
670
+ el.style.removeProperty('pointer-events')
671
+ })
672
+ } else {
673
+ walkTree(elem, (el) => {
674
+ el.removeAttribute('style')
675
+ })
676
+ }
668
677
  }
669
678
  }
670
679
  return
package/core/sanitize.js CHANGED
@@ -61,6 +61,18 @@ const svgWhiteList_ = {
61
61
  title: [],
62
62
  tspan: ['clip-path', 'clip-rule', 'dx', 'dy', 'dominant-baseline', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'mask', 'opacity', 'requiredFeatures', 'rotate', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'text-anchor', 'textLength', 'x', 'xml:space', 'y'],
63
63
  use: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'width', 'x', 'xlink:href', 'y', 'overflow'],
64
+ // Filter Primitives
65
+ feComponentTransfer: ['in', 'result'],
66
+ feFuncR: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
67
+ feFuncG: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
68
+ feFuncB: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
69
+ feFuncA: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
70
+ feConvolveMatrix: ['in', 'order', 'kernelMatrix', 'divisor', 'bias', 'targetX', 'targetY', 'edgeMode', 'kernelUnitLength', 'preserveAlpha'],
71
+ feDiffuseLighting: ['in', 'surfaceScale', 'diffuseConstant', 'kernelUnitLength', 'lighting-color'],
72
+ feSpecularLighting: ['in', 'surfaceScale', 'specularConstant', 'specularExponent', 'kernelUnitLength', 'lighting-color'],
73
+ feDisplacementMap: ['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector'],
74
+ feTurbulence: ['baseFrequency', 'numOctaves', 'result', 'seed', 'stitchTiles', 'type'],
75
+ feTile: ['in'],
64
76
 
65
77
  // MathML Elements
66
78
  annotation: ['encoding'],
@@ -93,9 +105,25 @@ const svgWhiteList_ = {
93
105
  munder: [],
94
106
  munderover: [],
95
107
  none: [],
96
- semantics: []
108
+ semantics: [],
109
+
110
+ // HTML Elements for use in a foreignObject
111
+ div: [],
112
+ p: [],
113
+ li: [],
114
+ pre: [],
115
+ ol: [],
116
+ ul: [],
117
+ span: [],
118
+ hr: [],
119
+ br: [],
120
+ h1: [],
121
+ h2: [],
122
+ h3: [],
123
+ h4: [],
124
+ h5: [],
125
+ h6: []
97
126
  }
98
- /* eslint-enable max-len */
99
127
 
100
128
  // add generic attributes to all elements of the whitelist
101
129
  Object.keys(svgWhiteList_).forEach((element) => { svgWhiteList_[element] = [...svgWhiteList_[element], ...svgGenericWhiteList] })
package/core/svg-exec.js CHANGED
@@ -144,7 +144,7 @@ const svgToString = (elem, indent) => {
144
144
  out.push(' ')
145
145
  }
146
146
  out.push('<')
147
- out.push(elem.nodeName)
147
+ out.push(elem.localName)
148
148
  if (elem.id === 'svgcontent') {
149
149
  // Process root element separately
150
150
  const res = svgCanvas.getResolution()
@@ -352,7 +352,7 @@ const svgToString = (elem, indent) => {
352
352
  }
353
353
  }
354
354
  out.push('</')
355
- out.push(elem.nodeName)
355
+ out.push(elem.localName)
356
356
  out.push('>')
357
357
  } else {
358
358
  out.push('/>')