diff --git a/.eslintignore b/.eslintignore index fe24ce3b..25b883b4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -31,6 +31,5 @@ src/editor/jspdf/underscore-min.js src/editor/extensions/ext-mathjax/mathjax # jquery files -src/editor/svgicons/jQuery.svgIcons.js src/editor/jgraduate/jQuery.jPicker.js diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg index be9c44c0..b49bd7f3 100644 --- a/badges/coverage-badge.svg +++ b/badges/coverage-badge.svg @@ -1 +1 @@ -Statements 47.22%Statements 47.22%Branches 34.88%Branches 34.88%Lines 48.21%Lines 48.21%Functions 54.19%Functions 54.19% +Statements 47.48%Statements 47.48%Branches 34.93%Branches 34.93%Lines 48.44%Lines 48.44%Functions 54.91%Functions 54.91% diff --git a/badges/tests-badge.svg b/badges/tests-badge.svg index 4663ec02..86c5b390 100644 --- a/badges/tests-badge.svg +++ b/badges/tests-badge.svg @@ -1 +1 @@ -TestsTests141/143141/143 \ No newline at end of file +TestsTests131/143131/143 \ No newline at end of file diff --git a/cypress/integration/unit/select.js b/cypress/integration/unit/select.js index 8b965f9a..a599402e 100644 --- a/cypress/integration/unit/select.js +++ b/cypress/integration/unit/select.js @@ -37,13 +37,13 @@ describe('select', function () { element: 'svg', attr: {id: 'svgroot'} }); - svgcontent = svgroot.appendChild( - mockFactory.createSVGElement({ - element: 'svg', - attr: {id: 'svgcontent'} - }) - ); - /* const rect = */ svgcontent.appendChild( + svgcontent = mockFactory.createSVGElement({ + element: 'svg', + attr: {id: 'svgcontent'} + }); + + svgroot.append(svgcontent); + /* const rect = */ svgcontent.append( mockFactory.createSVGElement({ element: 'rect', attr: { diff --git a/cypress/integration/unit/svgtransformlist.js b/cypress/integration/unit/svgtransformlist.js index b380e01d..f5a35859 100644 --- a/cypress/integration/unit/svgtransformlist.js +++ b/cypress/integration/unit/svgtransformlist.js @@ -26,10 +26,13 @@ describe('svgtransformlist', function () { svgroot.style.visibility = 'hidden'; document.body.append(svgroot); - svgcontent = svgroot.appendChild(document.createElementNS(NS.SVG, 'svg')); - rect = svgcontent.appendChild(document.createElementNS(NS.SVG, 'rect')); + svgcontent = document.createElementNS(NS.SVG, 'svg'); + svgroot.append(svgcontent); + rect = document.createElementNS(NS.SVG, 'rect'); + svgcontent.append(rect); rect.id = 'r'; - circle = svgcontent.appendChild(document.createElementNS(NS.SVG, 'circle')); + circle = document.createElementNS(NS.SVG, 'circle'); + svgcontent.append(circle); circle.id = 'c'; }); diff --git a/package-lock.json b/package-lock.json index a6873351..f77f2d2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2180,9 +2180,9 @@ } }, "@cypress/code-coverage": { - "version": "3.8.8", - "resolved": "https://registry.npmjs.org/@cypress/code-coverage/-/code-coverage-3.8.8.tgz", - "integrity": "sha512-QgO7mcy39dhoin1yzHF6YT+gC4u4+/3+xd0aJiWfNWElrQ+DVk3TKLC06Sk1c8BwhCXP/GYXs+CRFZH2lQpMzA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@cypress/code-coverage/-/code-coverage-3.9.0.tgz", + "integrity": "sha512-rwMoHZVZum8ACNxVM5PmfUT4RxN1HCeT0mmhMdM2XqFL3FB6yvPag0vVOupZtYj5xPdYML2q3G+6OyBtCIHAlw==", "dev": true, "requires": { "@cypress/browserify-preprocessor": "3.0.1", @@ -2615,9 +2615,9 @@ "dev": true }, "import-fresh": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", - "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -7354,9 +7354,9 @@ "dev": true }, "copyfiles": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.0.tgz", - "integrity": "sha512-yGjpR3yjQdxccW8EcJ4a7ZCA6wGER6/Q2Y+b7bXbVxGeSHBf93i9d7MzTsx+VV1CpMKQa3v4ThZfXBcltMzl0w==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", + "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", "dev": true, "requires": { "glob": "^7.0.5", @@ -7365,14 +7365,93 @@ "noms": "0.0.0", "through2": "^2.0.1", "untildify": "^4.0.0", - "yargs": "^15.3.1" + "yargs": "^16.1.0" }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true } } }, @@ -7870,9 +7949,9 @@ } }, "cypress": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.2.0.tgz", - "integrity": "sha512-m/rkcogYM9MTy8rbsZgyS5wT2L/J+B5V2bY2ztkDNMyqhk/oZgUF4KTWVLzkW2I+scg0iAddca95tLlt7XnAtw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.2.1.tgz", + "integrity": "sha512-OYkSgzA4J4Q7eMjZvNf5qWpBLR4RXrkqjL3UZ1UzGGLAskO0nFTi/RomNTG6TKvL3Zp4tw4zFY1gp5MtmkCZrA==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "^0.4.1", @@ -8507,9 +8586,9 @@ } }, "dompurify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.12.tgz", - "integrity": "sha512-Fl8KseK1imyhErHypFPA8qpq9gPzlsJ/EukA6yk9o0gX23p1TzC+rh9LqNg1qvErRTc0UNMYlKxEGSfSh43NDg==", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.2.6.tgz", + "integrity": "sha512-7b7ZArhhH0SP6W2R9cqK6RjaU82FZ2UPM7RO8qN1b1wyvC/NY1FNWcX1Pu00fFOAnzEORtwXe4bPaClg6pUybQ==", "optional": true }, "domutils": { @@ -8586,9 +8665,9 @@ "dev": true }, "elix": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/elix/-/elix-14.1.1.tgz", - "integrity": "sha512-o+6YAp1qhn0Itz2LzEAQtzi9se43eiXdrdSVvXpTrj3bsp4p/c1bY6VVeYfdaJy9a8QRnMkH9WrLGdFbRcFsuA==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/elix/-/elix-14.1.2.tgz", + "integrity": "sha512-j+zHVrw/1G5UVdS5qFwCFlgr6j35FvNpiBDv3OriT5GYWoJrC/Srb4pL8IN9KaJfrb/ZxSbSAldmUkFTUkLD+A==", "dev": true }, "elliptic": { @@ -8916,9 +8995,9 @@ } }, "eslint": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.16.0.tgz", - "integrity": "sha512-iVWPS785RuDA4dWuhhgXTNrGxHHK3a8HLSMBgbbU59ruJDubUraXN8N5rn7kb8tG6sjg74eE0RA3YWT51eusEw==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.17.0.tgz", + "integrity": "sha512-zJk08MiBgwuGoxes5sSQhOtibZ75pz0J35XTRlZOk9xMffhpA9BTbQZxoXZzOl5zMbleShbGwtw+1kGferfFwQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -9109,9 +9188,9 @@ "dev": true }, "import-fresh": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", - "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -9227,9 +9306,9 @@ } }, "eslint-config-ash-nazg": { - "version": "22.10.0", - "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-22.10.0.tgz", - "integrity": "sha512-eZJBH1/9DXR8JbsobnzmhLzmcAl86bo5facsAxwY3F4sR+kniUDXqkHvVrOgF8C0PDrszyXGXIoXLMrBt0FAQw==", + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-23.0.0.tgz", + "integrity": "sha512-05125LmboFzeF5/TdpK2VrF4AShSDNq4b7Ikljkykzec0vKL9GoQhOUyL58IMYBzIdALn8nWQDSjp4ps1Gor9g==", "dev": true }, "eslint-config-standard": { @@ -9492,9 +9571,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "30.7.9", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.9.tgz", - "integrity": "sha512-qMM0fNx7/6OCnIh3jRpIrEBAhTG1THNXXbr3yfJ8yqLrDbzJR98xsstX25xt9GCPlrjNc/bBpTHfJQOvn7nVMA==", + "version": "30.7.13", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.13.tgz", + "integrity": "sha512-YM4WIsmurrp0rHX6XiXQppqKB8Ne5ATiZLJe2+/fkp9l9ExXFr43BbAbjZaVrpCT+tuPYOZ8k1MICARHnURUNQ==", "dev": true, "requires": { "comment-parser": "^0.7.6", @@ -9693,9 +9772,9 @@ "dev": true }, "eslint-plugin-unicorn": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-24.0.0.tgz", - "integrity": "sha512-NfLjIZas/ZUwc3S+pUtbTRqgCkODxPEkJBJ5ZR8wIu90BmX4jmXp10hoOZMScR2CR1NYTtrx0OX4BQvBnbzZzA==", + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-25.0.1.tgz", + "integrity": "sha512-MEyEWoyou/qhJH6rEER9YHACtCsQT+eewc6Fdxbi2eiTvsGrBR8JZMA6qaeof3oMQeRxOpaERoBKzU7R5c4A/w==", "dev": true, "requires": { "ci-info": "^2.0.0", @@ -9901,15 +9980,23 @@ } }, "eslint-template-visitor": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.2.1.tgz", - "integrity": "sha512-q3SxoBXz0XjPGkUpwGVAwIwIPIxzCAJX1uwfVc8tW3v7u/zS7WXNH3I2Mu2MDz2NgSITAyKLRaQFPHu/iyKxDQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.2.2.tgz", + "integrity": "sha512-SkcLjzKw3JjKTWHacRDeLBa2gxb600zbCKTkXj/V97QnZ9yxkknoPL8vc8PFueqbFXP7mYNTQzjCjcMpTRdRaA==", "dev": true, "requires": { "babel-eslint": "^10.1.0", - "eslint-visitor-keys": "^1.3.0", + "eslint-visitor-keys": "^2.0.0", "esquery": "^1.3.1", "multimap": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + } } }, "eslint-utils": { @@ -10527,9 +10614,9 @@ "dev": true }, "font-family-papandreou": { - "version": "0.2.0-patch1", - "resolved": "https://registry.npmjs.org/font-family-papandreou/-/font-family-papandreou-0.2.0-patch1.tgz", - "integrity": "sha512-l6WMbeh7+Zd4TTu3yUUPR5KOepiuGLd/QAPfTIoX8ipTko0IF7PU6dsM4YM2zCDToEPIPSyCBKEJnKlSdYMgaA==" + "version": "0.2.0-patch2", + "resolved": "https://registry.npmjs.org/font-family-papandreou/-/font-family-papandreou-0.2.0-patch2.tgz", + "integrity": "sha512-l/YiRdBSH/eWv6OF3sLGkwErL+n0MqCICi9mppTZBOCL5vixWGDqCYvRcuxB2h7RGCTzaTKOHT2caHvCXQPRlw==" }, "for-in": { "version": "1.0.2", @@ -11757,9 +11844,9 @@ "dev": true }, "import-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-modules/-/import-modules-2.0.0.tgz", - "integrity": "sha512-iczM/v9drffdNnABOKwj0f9G3cFDon99VcG1mxeBsdqnbd+vnQ5c2uAiCHNQITqFTOPaEvwg3VjoWCur0uHLEw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-modules/-/import-modules-2.1.0.tgz", + "integrity": "sha512-8HEWcnkbGpovH9yInoisxaSoIg9Brbul+Ju3Kqe2UsYDUBJD/iQjSgEj0zPcTDPKfPp2fs5xlv1i+JSye/m1/A==", "dev": true }, "imurmurhash": { @@ -12858,16 +12945,17 @@ "dev": true }, "jspdf": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.1.1.tgz", - "integrity": "sha512-aEZmTr8SgR7Dy2zjFLu6pbg93urA7nZdbS3MIAXs8PSXn1ee7LSpm0JVMYZ+0qS6ZIUI5NriFSTdpVI4QArAXQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.2.0.tgz", + "integrity": "sha512-kz6blXdM+wQ0vWMDJsa7GW9Ya79DHQBWQL14urVsbr6mk9nsJCSqZuIgE1CPZ78i5Yih2uW4tqOTiLf5xSpT9Q==", "requires": { "atob": "^2.1.2", "btoa": "^1.2.1", "canvg": "^3.0.6", "core-js": "^3.6.0", - "dompurify": "^2.0.12", - "html2canvas": "^1.0.0-rc.5" + "dompurify": "^2.2.0", + "html2canvas": "^1.0.0-rc.5", + "pako": "^1.0.11" } }, "jsprim": { @@ -16569,8 +16657,7 @@ "pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "parent-module": { "version": "1.0.1", @@ -17777,6 +17864,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -17933,9 +18026,9 @@ } }, "rollup": { - "version": "2.35.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.35.1.tgz", - "integrity": "sha512-q5KxEyWpprAIcainhVy6HfRttD9kutQpHbeqDTWnqAFNJotiojetK6uqmcydNMymBEtC4I8bCYR+J3mTMqeaUA==", + "version": "2.36.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.36.1.tgz", + "integrity": "sha512-eAfqho8dyzuVvrGqpR0ITgEdq0zG2QJeWYh+HeuTbpcaXk8vNFc48B7bJa1xYosTCKx0CuW+447oQOW8HgBIZQ==", "requires": { "fsevents": "~2.1.2" }, @@ -19212,9 +19305,9 @@ "integrity": "sha512-TAAvLNSE3fEhyl/Da19JWfMAdhSXTYeviXsLSoDT1UM76ADj5ndwAPX1FKQEgB/gFMPavOy6tOqfalXKUiXrow==" }, "svg2pdf.js": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/svg2pdf.js/-/svg2pdf.js-2.0.0.tgz", - "integrity": "sha512-UjcCVMdem0apsq1QePJXUrSxBB5xTxPNjUeU9KmOLSScsi5f0fhsiRj27LC5Uqpwl1yXzen+1iKoGVv4jyMrQw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/svg2pdf.js/-/svg2pdf.js-2.1.0.tgz", + "integrity": "sha512-jai/P6F1IsMcoVUx9Rlnua9YHzaIjo/2enxJ+Xb5e8/m3UF5YDsFSyqIbTVoUZXgmmSI5wZWAtEz1QY4XzSPew==", "requires": { "cssesc": "^3.0.0", "font-family-papandreou": "^0.2.0-patch1", @@ -19270,32 +19363,32 @@ } }, "systemjs": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.8.2.tgz", - "integrity": "sha512-YknH4S+Xq7Rlwdnvyj4QKHWm5YQGPJnnkVXFQLC/Wl/O21nZ+NrV9IjwUQQ0Pl0Jh0Wgf91IeGzSHGELsv5kkA==", + "version": "6.8.3", + "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.8.3.tgz", + "integrity": "sha512-UcTY+FEA1B7e+bpJk1TI+a9Na6LG7wFEqW7ED16cLqLuQfI/9Ri0rsXm3tKlIgNoHyLHZycjdAOijzNbzelgwA==", "dev": true }, "table": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.4.tgz", - "integrity": "sha512-sBT4xRLdALd+NFBvwOz8bw4b15htyythha+q+DVZqy2RS08PPC8O2sZFgJYEY7bJvbCFKccs+WIZ/cd+xxTWCw==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", "dev": true, "requires": { - "ajv": "^6.12.4", + "ajv": "^7.0.2", "lodash": "^4.17.20", "slice-ansi": "^4.0.0", "string-width": "^4.2.0" }, "dependencies": { "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", + "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, @@ -19323,6 +19416,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", diff --git a/package.json b/package.json index 2f349a23..f2aa16a0 100644 --- a/package.json +++ b/package.json @@ -138,18 +138,18 @@ "@web/dev-server-rollup": "0.3.1", "canvg": "3.0.7", "core-js": "3.8.2", - "jspdf": "2.1.1", + "jspdf": "2.2.0", "pathseg": "1.2.0", "regenerator-runtime": "0.13.7", "rollup-plugin-polyfill-node": "^0.4.1", - "svg2pdf.js": "2.0.0" + "svg2pdf.js": "2.1.0" }, "devDependencies": { "@babel/core": "7.12.10", "@babel/preset-env": "7.12.11", "@babel/register": "7.12.10", "@babel/runtime-corejs3": "7.12.5", - "@cypress/code-coverage": "3.8.8", + "@cypress/code-coverage": "3.9.0", "@cypress/fiddle": "1.19.0", "@fintechstudios/eslint-plugin-chai-as-promised": "3.0.2", "@hkdobrev/run-if-changed": "0.3.1", @@ -163,19 +163,19 @@ "@web/dev-server": "0.1.3", "axe-core": "4.1.1", "babel-plugin-transform-object-rest-spread": "7.0.0-beta.3", - "copyfiles": "2.4.0", + "copyfiles": "2.4.1", "core-js-bundle": "3.8.2", "coveradge": "0.6.0", "cp-cli": "2.0.0", "cross-var": "1.1.0", - "cypress": "6.2.0", + "cypress": "6.2.1", "cypress-axe": "0.12.0", "cypress-multi-reporters": "1.4.0", "cypress-plugin-snapshots": "1.4.4", "deparam": "git+https://github.com/brettz9/deparam.git#updates", - "elix": "^14.1.1", - "eslint": "7.16.0", - "eslint-config-ash-nazg": "22.10.0", + "elix": "^14.1.2", + "eslint": "7.17.0", + "eslint-config-ash-nazg": "23.0.0", "eslint-config-standard": "16.0.2", "eslint-plugin-array-func": "3.1.7", "eslint-plugin-chai-expect": "2.2.0", @@ -186,7 +186,7 @@ "eslint-plugin-eslint-comments": "3.2.0", "eslint-plugin-html": "6.1.1", "eslint-plugin-import": "2.22.1", - "eslint-plugin-jsdoc": "30.7.9", + "eslint-plugin-jsdoc": "30.7.13", "eslint-plugin-markdown": "1.0.2", "eslint-plugin-mocha": "8.0.0", "eslint-plugin-mocha-cleanup": "1.9.1", @@ -196,7 +196,7 @@ "eslint-plugin-promise": "4.2.1", "eslint-plugin-sonarjs": "0.5.0", "eslint-plugin-standard": "4.1.0", - "eslint-plugin-unicorn": "24.0.0", + "eslint-plugin-unicorn": "25.0.1", "husky": "4.3.6", "imageoptim-cli": "3.0.2", "jamilih": "0.53.2", @@ -219,7 +219,7 @@ "remark-lint-ordered-list-marker-value": "2.0.1", "requirejs": "2.3.6", "rimraf": "3.0.2", - "rollup": "2.35.1", + "rollup": "2.36.1", "rollup-plugin-copy": "3.3.0", "rollup-plugin-filesize": "9.1.0", "rollup-plugin-node-polyfills": "0.2.1", @@ -227,7 +227,7 @@ "rollup-plugin-re": "1.0.7", "rollup-plugin-terser": "7.0.2", "stackblur-canvas": "2.4.0", - "systemjs": "6.8.2", + "systemjs": "6.8.3", "typescript": "4.1.3", "underscore": "1.12.0" } diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index e86417cb..eef3c0fc 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -617,7 +617,7 @@ class EditorStartup { * @param {Event} e * @returns {void} */ - let editorObj = this; + const editorObj = this; const importImage = function (e) { document.getElementById('se-prompt-dialog').title = editorObj.uiStrings.notification.loadingImage; e.stopPropagation(); diff --git a/src/editor/components/PaintBox.js b/src/editor/components/PaintBox.js index e5979386..0eac2765 100644 --- a/src/editor/components/PaintBox.js +++ b/src/editor/components/PaintBox.js @@ -19,7 +19,8 @@ class PaintBox { ); let docElem = svgdocbox.documentElement; - docElem = container.appendChild(document.importNode(docElem, true)); + docElem = document.importNode(docElem, true); + container.append(docElem); this.rect = docElem.firstElementChild; this.defs = docElem.getElementsByTagName('defs')[0]; @@ -46,7 +47,8 @@ class PaintBox { case 'linearGradient': case 'radialGradient': { this.grad.remove(); - this.grad = this.defs.appendChild(paint[ptype]); + this.grad = paint[ptype]; + this.defs.append(this.grad); const id = this.grad.id = 'gradbox_' + this.type; fillAttr = 'url(#' + id + ')'; break; diff --git a/src/editor/components/jgraduate/jQuery.jGraduate.js b/src/editor/components/jgraduate/jQuery.jGraduate.js index 81f3d84a..79b9b204 100644 --- a/src/editor/components/jgraduate/jQuery.jGraduate.js +++ b/src/editor/components/jgraduate/jQuery.jGraduate.js @@ -1,3 +1,4 @@ +/* eslint-disable unicorn/prefer-dom-node-append */ /** * @file jGraduate 0.4 * diff --git a/src/editor/components/seButton.js b/src/editor/components/seButton.js index 99ab5ad4..e05f9c83 100644 --- a/src/editor/components/seButton.js +++ b/src/editor/components/seButton.js @@ -54,7 +54,7 @@ export class ToolButton extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); // locate the component this.$div = this._shadowRoot.querySelector('div'); this.$img = this._shadowRoot.querySelector('img'); diff --git a/src/editor/components/seColorPicker.js b/src/editor/components/seColorPicker.js index 727445fd..3c462390 100644 --- a/src/editor/components/seColorPicker.js +++ b/src/editor/components/seColorPicker.js @@ -59,7 +59,7 @@ export class SeColorPicker extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$logo = this._shadowRoot.getElementById('logo'); this.$label = this._shadowRoot.getElementById('label'); this.$block = this._shadowRoot.getElementById('block'); diff --git a/src/editor/components/seExplorerButton.js b/src/editor/components/seExplorerButton.js index 5afc384b..0944e809 100644 --- a/src/editor/components/seExplorerButton.js +++ b/src/editor/components/seExplorerButton.js @@ -109,7 +109,7 @@ export class ExplorerButton extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); // locate the component this.$button = this._shadowRoot.querySelector('.menu-button'); this.$overall = this._shadowRoot.querySelector('.overall'); diff --git a/src/editor/components/seFlyingButton.js b/src/editor/components/seFlyingButton.js index b2343d49..1a93fa3a 100644 --- a/src/editor/components/seFlyingButton.js +++ b/src/editor/components/seFlyingButton.js @@ -91,7 +91,7 @@ export class FlyingButton extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); // locate the component this.$button = this._shadowRoot.querySelector('.menu-button'); this.$handle = this._shadowRoot.querySelector('.handle'); diff --git a/src/editor/components/seInput.js b/src/editor/components/seInput.js index 7655f36c..9380dd38 100644 --- a/src/editor/components/seInput.js +++ b/src/editor/components/seInput.js @@ -31,7 +31,7 @@ export class SEInput extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); // locate the component this.$img = this._shadowRoot.querySelector('img'); this.$label = this.shadowRoot.getElementById('label'); diff --git a/src/editor/components/seList.js b/src/editor/components/seList.js index 22cbaffb..66bbfd17 100644 --- a/src/editor/components/seList.js +++ b/src/editor/components/seList.js @@ -32,7 +32,7 @@ export class SeList extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$dropdown = this._shadowRoot.querySelector('elix-dropdown-list'); this.$label = this._shadowRoot.querySelector('label'); } diff --git a/src/editor/components/seListItem.js b/src/editor/components/seListItem.js index f460a410..846d4e76 100644 --- a/src/editor/components/seListItem.js +++ b/src/editor/components/seListItem.js @@ -20,7 +20,7 @@ export class SeListItem extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$menuitem = this._shadowRoot.querySelector('elix-menu-item'); } /** diff --git a/src/editor/components/seMenu.js b/src/editor/components/seMenu.js index 03ce7b58..98ab449c 100644 --- a/src/editor/components/seMenu.js +++ b/src/editor/components/seMenu.js @@ -39,7 +39,7 @@ export class SeMenu extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$menu = this._shadowRoot.querySelector('elix-menu-button'); this.$label = this.$menu.shadowRoot.querySelector('#popupToggle').shadowRoot; } diff --git a/src/editor/components/seMenuItem.js b/src/editor/components/seMenuItem.js index d270d411..75f412ef 100644 --- a/src/editor/components/seMenuItem.js +++ b/src/editor/components/seMenuItem.js @@ -24,7 +24,7 @@ export class SeMenuItem extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$img = this._shadowRoot.querySelector('img'); this.$label = this._shadowRoot.querySelector('span'); this.$menuitem = this._shadowRoot.querySelector('elix-menu-item'); diff --git a/src/editor/components/sePalette.js b/src/editor/components/sePalette.js index b5c2d73b..4c1097ed 100644 --- a/src/editor/components/sePalette.js +++ b/src/editor/components/sePalette.js @@ -40,14 +40,14 @@ export class SEPalette extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$strip = this._shadowRoot.querySelector('elix-centered-strip'); palette.forEach((rgb) => { const newDiv = document.createElement('div'); newDiv.classList.add('square'); newDiv.style.backgroundColor = rgb; newDiv.dataset.rgb = rgb; - this.$strip.appendChild(newDiv); + this.$strip.append(newDiv); }); } diff --git a/src/editor/components/seSpinInput.js b/src/editor/components/seSpinInput.js index 78ebc01c..5eb54c26 100644 --- a/src/editor/components/seSpinInput.js +++ b/src/editor/components/seSpinInput.js @@ -34,7 +34,7 @@ export class SESpinInput extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); // locate the component this.$img = this._shadowRoot.querySelector('img'); this.$label = this.shadowRoot.getElementById('label'); diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index b47a5458..4610a858 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -128,7 +128,7 @@ export class SeCMenuDialog extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this._workarea = document.getElementById('workarea'); this.$dialog = this._shadowRoot.querySelector('#cmenu_canvas'); this.$copyLink = this._shadowRoot.querySelector('#se-copy'); diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 0623662f..0f0a494b 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -81,7 +81,7 @@ export class SeCMenuLayerDialog extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.source = ''; this._workarea = undefined; this.$sidePanels = document.getElementById('sidepanels'); diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index e8a6b167..569d39be 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -243,7 +243,7 @@ export class SeEditPrefsDialog extends HTMLElement { // create the shadowDom and insert the template this.colorBlocks = ['#FFF', '#888', '#000', 'chessboard']; this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$dialog = this._shadowRoot.querySelector('#svg_prefs'); this.$saveBtn = this._shadowRoot.querySelector('#tool_prefs_save'); this.$cancelBtn = this._shadowRoot.querySelector('#tool_prefs_cancel'); diff --git a/src/editor/dialogs/imagePropertiesDialog.js b/src/editor/dialogs/imagePropertiesDialog.js index 02763e4b..1ce72117 100644 --- a/src/editor/dialogs/imagePropertiesDialog.js +++ b/src/editor/dialogs/imagePropertiesDialog.js @@ -129,7 +129,7 @@ export class SeImgPropDialog extends HTMLElement { // create the shadowDom and insert the template this.eventlisten = false; this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$saveBtn = this._shadowRoot.querySelector('#tool_docprops_save'); this.$cancelBtn = this._shadowRoot.querySelector('#tool_docprops_cancel'); this.$resolution = this._shadowRoot.querySelector('#resolution'); diff --git a/src/editor/dialogs/svgSourceDialog.js b/src/editor/dialogs/svgSourceDialog.js index 6f48b539..8298752f 100644 --- a/src/editor/dialogs/svgSourceDialog.js +++ b/src/editor/dialogs/svgSourceDialog.js @@ -83,7 +83,7 @@ export class SeSvgSourceEditorDialog extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$dialog = this._shadowRoot.querySelector('#svg_source_editor'); this.$copyBtn = this._shadowRoot.querySelector('#copy_save_done'); this.$saveBtn = this._shadowRoot.querySelector('#tool_source_save'); diff --git a/src/editor/extensions/ext-connector/ext-connector.js b/src/editor/extensions/ext-connector/ext-connector.js index 5215040a..6b39b5ce 100644 --- a/src/editor/extensions/ext-connector/ext-connector.js +++ b/src/editor/extensions/ext-connector/ext-connector.js @@ -28,8 +28,6 @@ export default { const {$, svgroot} = S, addElem = svgCanvas.addSVGElementFromJson, selManager = S.selectorManager, - connSel = '.se_connector', - // connect_str = '-SE_CONNECT-', elData = $.data; let startX, @@ -191,7 +189,7 @@ export default { * @returns {void} */ function findConnectors (elems = selElems) { - const connectors = $(svgcontent).find(connSel); + const connectors = $(svgcontent).find('.se_connector'); connections = []; // Loop through connectors to see if one is connected to the element @@ -310,7 +308,7 @@ export default { const gse = svgCanvas.groupSelectedElements; svgCanvas.groupSelectedElements = function (...args) { - svgCanvas.removeFromSelection($(connSel).toArray()); + svgCanvas.removeFromSelection($('.se_connector').toArray()); return gse.apply(this, args); }; @@ -334,7 +332,7 @@ export default { $(svgcontent).find('*').each(function () { const conn = this.getAttributeNS(seNs, 'connector'); if (conn) { - this.setAttribute('class', connSel.substr(1)); + this.setAttribute('class', 'se_connector'); const connData = conn.split(' '); const sbb = svgCanvas.getStrokedBBox([getElem(connData[0])]); const ebb = svgCanvas.getStrokedBBox([getElem(connData[1])]); @@ -500,7 +498,7 @@ export default { const connStr = startId + ' ' + endId; const altStr = endId + ' ' + startId; // Don't create connector if one already exists - const dupe = $(svgcontent).find(connSel).filter(function () { + const dupe = $(svgcontent).find('.se_connector').filter(function () { const conn = this.getAttributeNS(seNs, 'connector'); if (conn === connStr || conn === altStr) { return true; } return false; @@ -524,7 +522,7 @@ export default { .data('end_bb', bb); seNs = svgCanvas.getEditorNS(true); curLine.setAttributeNS(seNs, 'se:connector', connStr); - curLine.setAttribute('class', connSel.substr(1)); + curLine.setAttribute('class', 'se_connector'); curLine.setAttribute('opacity', 1); svgCanvas.addToSelection([curLine]); svgCanvas.moveToBottomSelectedElement(); @@ -538,7 +536,7 @@ export default { }, selectedChanged (opts) { // TODO: Find better way to skip operations if no connectors are in use - if (!$(svgcontent).find(connSel).length) { return; } + if (!$(svgcontent).find('.se_connector').length) { return; } if (svgCanvas.getMode() === 'connector') { svgCanvas.setMode('select'); @@ -616,7 +614,7 @@ export default { } } // Update line if it's a connector - if (elem.getAttribute('class') === connSel.substr(1)) { + if (elem.getAttribute('class') === 'se_connector') { const start = getElem(elData(elem, 'c_start')); updateConnectors([start]); } else { diff --git a/src/editor/extensions/ext-imagelib/ext-imagelib.js b/src/editor/extensions/ext-imagelib/ext-imagelib.js index 5e48e1d0..98597b89 100644 --- a/src/editor/extensions/ext-imagelib/ext-imagelib.js +++ b/src/editor/extensions/ext-imagelib/ext-imagelib.js @@ -238,7 +238,7 @@ export default { case 's': // Import one if (svgStr) { - svgCanvas.importSvgString(response); + svgEditor.svgCanvas.importSvgString(response); } else if (imgStr) { importImage(response); } diff --git a/src/editor/extensions/ext-storage/storageDialog.js b/src/editor/extensions/ext-storage/storageDialog.js index ec0fc187..aede043f 100644 --- a/src/editor/extensions/ext-storage/storageDialog.js +++ b/src/editor/extensions/ext-storage/storageDialog.js @@ -88,7 +88,7 @@ export class SeStorageDialog extends HTMLElement { super(); // create the shadowDom and insert the template this._shadowRoot = this.attachShadow({mode: 'open'}); - this._shadowRoot.appendChild(template.content.cloneNode(true)); + this._shadowRoot.append(template.content.cloneNode(true)); this.$dialog = this._shadowRoot.querySelector('#dialog_box'); this.$storage = this._shadowRoot.querySelector('#js-storage'); this.$okBtn = this._shadowRoot.querySelector('#storage_ok'); diff --git a/src/svgcanvas/elem-get-set.js b/src/svgcanvas/elem-get-set.js index aee1818d..75b95562 100644 --- a/src/svgcanvas/elem-get-set.js +++ b/src/svgcanvas/elem-get-set.js @@ -372,7 +372,8 @@ export const setGradientMethod = function (type) { // no duplicate found, so import gradient into defs if (!duplicateGrad) { // const origGrad = grad; - grad = defs.appendChild(elemContext_.getDOMDocument().importNode(grad, true)); + grad = elemContext_.getDOMDocument().importNode(grad, true); + defs.append(grad); // get next id and set it on the grad grad.id = elemContext_.getCanvas().getNextId(); } else { // use existing gradient @@ -879,7 +880,7 @@ export const setBackgroundMethod = function (color, url) { 'R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+' + 'gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);' }); - bgPattern.appendChild(div); + bgPattern.append(div); bg.append(bgPattern); } } else if (bgPattern) { diff --git a/src/svgcanvas/path-actions.js b/src/svgcanvas/path-actions.js index 5d141944..41d70bec 100644 --- a/src/svgcanvas/path-actions.js +++ b/src/svgcanvas/path-actions.js @@ -361,7 +361,7 @@ export const pathActionsMethod = (function () { 'stroke-width': '0.5', fill: 'none' }); - stretchy = getElem('selectorParentGroup').appendChild(stretchy); + getElem('selectorParentGroup').append(stretchy); } stretchy.setAttribute('display', 'inline'); diff --git a/src/svgcanvas/path-method.js b/src/svgcanvas/path-method.js index ff8114b4..37a90ef1 100644 --- a/src/svgcanvas/path-method.js +++ b/src/svgcanvas/path-method.js @@ -134,7 +134,8 @@ export const getGripContainerMethod = function () { let c = getElem('pathpointgrip_container'); if (!c) { const parentElement = getElem('selectorParentGroup'); - c = parentElement.appendChild(document.createElementNS(NS.SVG, 'g')); + c = document.createElementNS(NS.SVG, 'g'); + parentElement.append(c); c.id = 'pathpointgrip_container'; } return c; @@ -171,7 +172,7 @@ export const addPointGripMethod = function (index, x, y) { atts['xlink:title'] = uiStrings.pathNodeTooltip; } assignAttributes(pointGrip, atts); - pointGrip = pointGripContainer.appendChild(pointGrip); + pointGripContainer.append(pointGrip); const grip = $('#pathpointgrip_' + index); grip.dblclick(function () { diff --git a/src/svgcanvas/select.js b/src/svgcanvas/select.js index 0f2e898b..82d03b42 100644 --- a/src/svgcanvas/select.js +++ b/src/svgcanvas/select.js @@ -45,20 +45,19 @@ export class Selector { }); // this holds a reference to the path rect - this.selectorRect = this.selectorGroup.appendChild( - svgFactory_.createSVGElement({ - element: 'path', - attr: { - id: ('selectedBox' + this.id), - fill: 'none', - stroke: '#22C', - 'stroke-width': '1', - 'stroke-dasharray': '5,5', - // need to specify this so that the rect is not selectable - style: 'pointer-events:none' - } - }) - ); + this.selectorRect = svgFactory_.createSVGElement({ + element: 'path', + attr: { + id: ('selectedBox' + this.id), + fill: 'none', + stroke: '#22C', + 'stroke-width': '1', + 'stroke-dasharray': '5,5', + // need to specify this so that the rect is not selectable + style: 'pointer-events:none' + } + }); + this.selectorGroup.append(this.selectorRect); // this holds a reference to the grip coordinates for this selector this.gripCoords = { @@ -342,11 +341,12 @@ export class SelectorManager { $.data(grip, 'dir', dir); $.data(grip, 'type', 'resize'); - this.selectorGrips[dir] = this.selectorGripsGroup.appendChild(grip); + this.selectorGrips[dir] = grip; + this.selectorGripsGroup.append(grip); }); // add rotator elems - this.rotateGripConnector = this.selectorGripsGroup.appendChild( + this.rotateGripConnector = svgFactory_.createSVGElement({ element: 'line', attr: { @@ -354,10 +354,10 @@ export class SelectorManager { stroke: '#22C', 'stroke-width': '1' } - }) - ); + }); + this.selectorGripsGroup.append(this.rotateGripConnector); - this.rotateGrip = this.selectorGripsGroup.appendChild( + this.rotateGrip = svgFactory_.createSVGElement({ element: 'circle', attr: { @@ -368,8 +368,8 @@ export class SelectorManager { 'stroke-width': 2, style: 'cursor:url(' + config_.imgPath + 'rotate.svg) 12 12, auto;' } - }) - ); + }); + this.selectorGripsGroup.append(this.rotateGrip); $.data(this.rotateGrip, 'type', 'rotate'); if ($('#canvasBackground').length) { return; } @@ -477,7 +477,7 @@ export class SelectorManager { */ getRubberBandBox () { if (!this.rubberBandBox) { - this.rubberBandBox = this.selectorParentGroup.appendChild( + this.rubberBandBox = svgFactory_.createSVGElement({ element: 'rect', attr: { @@ -489,8 +489,8 @@ export class SelectorManager { display: 'none', style: 'pointer-events:none' } - }) - ); + }); + this.selectorParentGroup.append(this.rubberBandBox); } return this.rubberBandBox; } diff --git a/src/svgcanvas/selected-elem.js b/src/svgcanvas/selected-elem.js index fb3d74ce..b470ffad 100644 --- a/src/svgcanvas/selected-elem.js +++ b/src/svgcanvas/selected-elem.js @@ -53,10 +53,10 @@ export const init = function (elementContext) { export const moveToTopSelectedElem = function () { const [selected] = elementContext_.getSelectedElements(); if (!isNullish(selected)) { - let t = selected; + const t = selected; const oldParent = t.parentNode; const oldNextSibling = t.nextSibling; - t = t.parentNode.appendChild(t); + t.parentNode.append(t); // If the element actually moved position, add the command and fire the changed // event handler. if (oldNextSibling !== t.nextSibling) { @@ -792,8 +792,7 @@ export const convertToGroup = function (elem) { }); // Give ID for any visible element missing one - const visElems = elementContext_.getVisElems(); - $(g).find(visElems).each(function () { + $(g).find(elementContext_.getVisElems()).each(function () { if (!this.id) { this.id = elementContext_.getNextId(); } }); diff --git a/src/svgcanvas/svg-exec.js b/src/svgcanvas/svg-exec.js index 611712cd..fcb43ba4 100644 --- a/src/svgcanvas/svg-exec.js +++ b/src/svgcanvas/svg-exec.js @@ -679,6 +679,7 @@ function getIssues () { } $.each(issueList, function (sel, descr) { + // eslint-disable-next-line unicorn/no-array-callback-reference if (content.find(sel).length) { issueCodes.push(sel); issues.push(descr); diff --git a/src/svgcanvas/text-actions.js b/src/svgcanvas/text-actions.js index fe2fca19..afa2033e 100644 --- a/src/svgcanvas/text-actions.js +++ b/src/svgcanvas/text-actions.js @@ -81,7 +81,7 @@ export const textActionsMethod = (function () { stroke: '#333', 'stroke-width': 1 }); - cursor = getElem('selectorParentGroup').appendChild(cursor); + getElem('selectorParentGroup').append(cursor); } if (!blinker) {