Add document title in topbar and allow params with user extensions (#720)

* use document title to display the current file
* add document title in top bar
This commit is contained in:
JFH
2022-01-31 23:36:57 +01:00
committed by GitHub
parent 5d1ba0205b
commit db8522fcb7
12 changed files with 654 additions and 507 deletions

View File

@@ -1,4 +1,7 @@
# SVG-Edit CHANGES # SVG-Edit CHANGES
## 7.1.2
- add the current document title in the toolbar
- allow user extensions to define optional parameters
## 7.1.1 ## 7.1.1
- Fix an issue when moving a text with an existing transformation (issue #689) - Fix an issue when moving a text with an existing transformation (issue #689)
## 7.1.0 ## 7.1.0

147
package-lock.json generated
View File

@@ -11,12 +11,12 @@
"dependencies": { "dependencies": {
"@babel/polyfill": "7.12.1", "@babel/polyfill": "7.12.1",
"browser-fs-access": "0.24.0", "browser-fs-access": "0.24.0",
"canvg": "3.0.9", "canvg": "3.0.10",
"core-js": "3.20.3", "core-js": "3.20.3",
"elix": "15.0.1", "elix": "15.0.1",
"html2canvas": "1.4.1", "html2canvas": "1.4.1",
"i18next": "21.6.7", "i18next": "21.6.10",
"jspdf": "2.5.0", "jspdf": "2.5.1",
"pathseg": "1.2.1", "pathseg": "1.2.1",
"regenerator-runtime": "0.13.9", "regenerator-runtime": "0.13.9",
"rollup-plugin-polyfill-node": "0.8.0", "rollup-plugin-polyfill-node": "0.8.0",
@@ -36,16 +36,16 @@
"@rollup/plugin-replace": "3.0.1", "@rollup/plugin-replace": "3.0.1",
"@rollup/plugin-url": "6.1.0", "@rollup/plugin-url": "6.1.0",
"@web/dev-server": "0.1.29", "@web/dev-server": "0.1.29",
"@web/dev-server-rollup": "0.3.14", "@web/dev-server-rollup": "0.3.15",
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.3", "babel-plugin-transform-object-rest-spread": "7.0.0-beta.3",
"copyfiles": "2.4.1", "copyfiles": "2.4.1",
"core-js-bundle": "3.20.3", "core-js-bundle": "3.20.3",
"cp-cli": "2.0.0", "cp-cli": "2.0.0",
"cypress": "9.3.1", "cypress": "9.4.1",
"cypress-multi-reporters": "1.5.0", "cypress-multi-reporters": "1.5.0",
"cypress-plugin-snapshots": "1.4.4", "cypress-plugin-snapshots": "1.4.4",
"jamilih": "0.54.0", "jamilih": "0.54.0",
"jsdoc": "3.6.9", "jsdoc": "3.6.10",
"node-static": "0.7.11", "node-static": "0.7.11",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"nyc": "15.1.0", "nyc": "15.1.0",
@@ -56,10 +56,10 @@
"remark-cli": "10.0.1", "remark-cli": "10.0.1",
"remark-lint-ordered-list-marker-value": "3.1.1", "remark-lint-ordered-list-marker-value": "3.1.1",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rollup": "2.66.0", "rollup": "2.66.1",
"rollup-plugin-copy": "3.4.0", "rollup-plugin-copy": "3.4.0",
"rollup-plugin-filesize": "9.1.2", "rollup-plugin-filesize": "9.1.2",
"rollup-plugin-html": "^0.2.1", "rollup-plugin-html": "0.2.1",
"rollup-plugin-node-polyfills": "0.2.1", "rollup-plugin-node-polyfills": "0.2.1",
"rollup-plugin-progress": "1.1.2", "rollup-plugin-progress": "1.1.2",
"rollup-plugin-re": "1.0.7", "rollup-plugin-re": "1.0.7",
@@ -4442,16 +4442,16 @@
} }
}, },
"node_modules/@web/dev-server-rollup": { "node_modules/@web/dev-server-rollup": {
"version": "0.3.14", "version": "0.3.15",
"resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.14.tgz", "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz",
"integrity": "sha512-nx55QXh0e3ZtEFQcQ17n2nWIK1H7uGG0OC1S1PnT1akg0eCYMwHgeJe35hKnXecw8YVY93KsvgS/aKAV+on5Iw==", "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@rollup/plugin-node-resolve": "^11.0.1", "@rollup/plugin-node-resolve": "^11.0.1",
"@web/dev-server-core": "^0.3.16", "@web/dev-server-core": "^0.3.16",
"nanocolors": "^0.2.1", "nanocolors": "^0.2.1",
"parse5": "^6.0.1", "parse5": "^6.0.1",
"rollup": "^2.58.0", "rollup": "^2.66.1",
"whatwg-url": "^11.0.0" "whatwg-url": "^11.0.0"
}, },
"engines": { "engines": {
@@ -6072,9 +6072,9 @@
} }
}, },
"node_modules/canvg": { "node_modules/canvg": {
"version": "3.0.9", "version": "3.0.10",
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.9.tgz", "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.10.tgz",
"integrity": "sha512-rDXcnRPuz4QHoCilMeoTxql+fvGqNAxp+qV/KHD8rOiJSAfVjFclbdUNHD2Uqfthr+VMg17bD2bVuk6F07oLGw==", "integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@types/raf": "^3.4.0", "@types/raf": "^3.4.0",
@@ -7211,9 +7211,9 @@
"dev": true "dev": true
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "9.3.1", "version": "9.4.1",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.3.1.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.4.1.tgz",
"integrity": "sha512-BODdPesxX6bkVUnH8BVsV8I/jn57zQtO1FEOUTiuG2us3kslW7g0tcuwiny7CKCmJUZz8S/D587ppC+s58a+5Q==", "integrity": "sha512-+JgMG9uT+QFx97JU9kOHE3jO3+0UdkQ9H1oCBiC7A74qme7Jkdy2sYDBCPjjGczutnWnGUTMRlwiNMP/Uq6LrQ==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@@ -7254,10 +7254,10 @@
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
"request-progress": "^3.0.0", "request-progress": "^3.0.0",
"semver": "^7.3.2",
"supports-color": "^8.1.1", "supports-color": "^8.1.1",
"tmp": "~0.2.1", "tmp": "~0.2.1",
"untildify": "^4.0.0", "untildify": "^4.0.0",
"url": "^0.11.0",
"yauzl": "^2.10.0" "yauzl": "^2.10.0"
}, },
"bin": { "bin": {
@@ -7506,6 +7506,21 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/cypress/node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/cypress/node_modules/supports-color": { "node_modules/cypress/node_modules/supports-color": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
@@ -10548,9 +10563,23 @@
} }
}, },
"node_modules/i18next": { "node_modules/i18next": {
"version": "21.6.7", "version": "21.6.10",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.6.7.tgz", "resolved": "https://registry.npmjs.org/i18next/-/i18next-21.6.10.tgz",
"integrity": "sha512-26dTDa2gBz+vMk6WPf1pxTx3S5HIAptbyODmni/JsN6R1W2WNkGVFXBusUK7T6y1wLeJi5CIrqmQ2gl18vdh3A==", "integrity": "sha512-Xw+tEGQ61BF6SXtBlFffhM/YhJKHZf2cyDrcNK/l2dE6yVbkPkSasC3VhkAsHXX30vUJ0yG04WIUtf7UvwjOxg==",
"funding": [
{
"type": "individual",
"url": "https://locize.com"
},
{
"type": "individual",
"url": "https://locize.com/i18next.html"
},
{
"type": "individual",
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
}
],
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.0" "@babel/runtime": "^7.12.0"
} }
@@ -11654,11 +11683,10 @@
"dev": true "dev": true
}, },
"node_modules/jsdoc": { "node_modules/jsdoc": {
"version": "3.6.9", "version": "3.6.10",
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.9.tgz", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz",
"integrity": "sha512-bVrM2DT2iLmv6jd2IdTRk67tC4iaSDUicD+47y+cNCYlE8dccd4xZnlANG4M+OmGyV389bABSTKKfoPCOofbKw==", "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==",
"dev": true, "dev": true,
"hasInstallScript": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.9.4", "@babel/parser": "^7.9.4",
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
@@ -11861,9 +11889,9 @@
} }
}, },
"node_modules/jspdf": { "node_modules/jspdf": {
"version": "2.5.0", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.0.tgz", "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz",
"integrity": "sha512-XT0E2m8A9P1xl7ItA2OUbmhokzbDQEyZEdWQZD2olADiTiBEZGDRiK1J1zWxBRUG2KezQJOZq//GYZTkvEZuJg==", "integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.0", "@babel/runtime": "^7.14.0",
"atob": "^2.1.2", "atob": "^2.1.2",
@@ -18456,9 +18484,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "2.66.0", "version": "2.66.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.0.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.1.tgz",
"integrity": "sha512-L6mKOkdyP8HK5kKJXaiWG7KZDumPJjuo1P+cfyHOJPNNTK3Moe7zCH5+fy7v8pVmHXtlxorzaBjvkBMB23s98g==", "integrity": "sha512-crSgLhSkLMnKr4s9iZ/1qJCplgAgrRY+igWv8KhG/AjKOJ0YX/WpmANyn8oxrw+zenF3BXWDLa7Xl/QZISH+7w==",
"bin": { "bin": {
"rollup": "dist/bin/rollup" "rollup": "dist/bin/rollup"
}, },
@@ -26746,16 +26774,16 @@
} }
}, },
"@web/dev-server-rollup": { "@web/dev-server-rollup": {
"version": "0.3.14", "version": "0.3.15",
"resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.14.tgz", "resolved": "https://registry.npmjs.org/@web/dev-server-rollup/-/dev-server-rollup-0.3.15.tgz",
"integrity": "sha512-nx55QXh0e3ZtEFQcQ17n2nWIK1H7uGG0OC1S1PnT1akg0eCYMwHgeJe35hKnXecw8YVY93KsvgS/aKAV+on5Iw==", "integrity": "sha512-hhxvBmNIY19vXeocYB1IBOuhpVpy1L7jbwBarmvC0QJKZsgkxssNTzXJ8iga70c2+H0c/rBz1xUaKuAcov0uOA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@rollup/plugin-node-resolve": "^11.0.1", "@rollup/plugin-node-resolve": "^11.0.1",
"@web/dev-server-core": "^0.3.16", "@web/dev-server-core": "^0.3.16",
"nanocolors": "^0.2.1", "nanocolors": "^0.2.1",
"parse5": "^6.0.1", "parse5": "^6.0.1",
"rollup": "^2.58.0", "rollup": "^2.66.1",
"whatwg-url": "^11.0.0" "whatwg-url": "^11.0.0"
}, },
"dependencies": { "dependencies": {
@@ -28049,9 +28077,9 @@
"dev": true "dev": true
}, },
"canvg": { "canvg": {
"version": "3.0.9", "version": "3.0.10",
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.9.tgz", "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.10.tgz",
"integrity": "sha512-rDXcnRPuz4QHoCilMeoTxql+fvGqNAxp+qV/KHD8rOiJSAfVjFclbdUNHD2Uqfthr+VMg17bD2bVuk6F07oLGw==", "integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==",
"requires": { "requires": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@types/raf": "^3.4.0", "@types/raf": "^3.4.0",
@@ -28977,9 +29005,9 @@
} }
}, },
"cypress": { "cypress": {
"version": "9.3.1", "version": "9.4.1",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.3.1.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.4.1.tgz",
"integrity": "sha512-BODdPesxX6bkVUnH8BVsV8I/jn57zQtO1FEOUTiuG2us3kslW7g0tcuwiny7CKCmJUZz8S/D587ppC+s58a+5Q==", "integrity": "sha512-+JgMG9uT+QFx97JU9kOHE3jO3+0UdkQ9H1oCBiC7A74qme7Jkdy2sYDBCPjjGczutnWnGUTMRlwiNMP/Uq6LrQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.10",
@@ -29019,10 +29047,10 @@
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
"request-progress": "^3.0.0", "request-progress": "^3.0.0",
"semver": "^7.3.2",
"supports-color": "^8.1.1", "supports-color": "^8.1.1",
"tmp": "~0.2.1", "tmp": "~0.2.1",
"untildify": "^4.0.0", "untildify": "^4.0.0",
"url": "^0.11.0",
"yauzl": "^2.10.0" "yauzl": "^2.10.0"
}, },
"dependencies": { "dependencies": {
@@ -29156,6 +29184,15 @@
"integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==",
"dev": true "dev": true
}, },
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"supports-color": { "supports-color": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
@@ -31654,9 +31691,9 @@
} }
}, },
"i18next": { "i18next": {
"version": "21.6.7", "version": "21.6.10",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.6.7.tgz", "resolved": "https://registry.npmjs.org/i18next/-/i18next-21.6.10.tgz",
"integrity": "sha512-26dTDa2gBz+vMk6WPf1pxTx3S5HIAptbyODmni/JsN6R1W2WNkGVFXBusUK7T6y1wLeJi5CIrqmQ2gl18vdh3A==", "integrity": "sha512-Xw+tEGQ61BF6SXtBlFffhM/YhJKHZf2cyDrcNK/l2dE6yVbkPkSasC3VhkAsHXX30vUJ0yG04WIUtf7UvwjOxg==",
"requires": { "requires": {
"@babel/runtime": "^7.12.0" "@babel/runtime": "^7.12.0"
} }
@@ -32503,9 +32540,9 @@
"dev": true "dev": true
}, },
"jsdoc": { "jsdoc": {
"version": "3.6.9", "version": "3.6.10",
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.9.tgz", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz",
"integrity": "sha512-bVrM2DT2iLmv6jd2IdTRk67tC4iaSDUicD+47y+cNCYlE8dccd4xZnlANG4M+OmGyV389bABSTKKfoPCOofbKw==", "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/parser": "^7.9.4", "@babel/parser": "^7.9.4",
@@ -32672,9 +32709,9 @@
} }
}, },
"jspdf": { "jspdf": {
"version": "2.5.0", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.0.tgz", "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz",
"integrity": "sha512-XT0E2m8A9P1xl7ItA2OUbmhokzbDQEyZEdWQZD2olADiTiBEZGDRiK1J1zWxBRUG2KezQJOZq//GYZTkvEZuJg==", "integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==",
"requires": { "requires": {
"@babel/runtime": "^7.14.0", "@babel/runtime": "^7.14.0",
"atob": "^2.1.2", "atob": "^2.1.2",
@@ -37608,9 +37645,9 @@
} }
}, },
"rollup": { "rollup": {
"version": "2.66.0", "version": "2.66.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.0.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.66.1.tgz",
"integrity": "sha512-L6mKOkdyP8HK5kKJXaiWG7KZDumPJjuo1P+cfyHOJPNNTK3Moe7zCH5+fy7v8pVmHXtlxorzaBjvkBMB23s98g==", "integrity": "sha512-crSgLhSkLMnKr4s9iZ/1qJCplgAgrRY+igWv8KhG/AjKOJ0YX/WpmANyn8oxrw+zenF3BXWDLa7Xl/QZISH+7w==",
"requires": { "requires": {
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
}, },

View File

@@ -83,12 +83,12 @@
"dependencies": { "dependencies": {
"@babel/polyfill": "7.12.1", "@babel/polyfill": "7.12.1",
"browser-fs-access": "0.24.0", "browser-fs-access": "0.24.0",
"canvg": "3.0.9", "canvg": "3.0.10",
"core-js": "3.20.3", "core-js": "3.20.3",
"elix": "15.0.1", "elix": "15.0.1",
"html2canvas": "1.4.1", "html2canvas": "1.4.1",
"i18next": "21.6.7", "i18next": "21.6.10",
"jspdf": "2.5.0", "jspdf": "2.5.1",
"pathseg": "1.2.1", "pathseg": "1.2.1",
"regenerator-runtime": "0.13.9", "regenerator-runtime": "0.13.9",
"rollup-plugin-polyfill-node": "0.8.0", "rollup-plugin-polyfill-node": "0.8.0",
@@ -108,16 +108,16 @@
"@rollup/plugin-replace": "3.0.1", "@rollup/plugin-replace": "3.0.1",
"@rollup/plugin-url": "6.1.0", "@rollup/plugin-url": "6.1.0",
"@web/dev-server": "0.1.29", "@web/dev-server": "0.1.29",
"@web/dev-server-rollup": "0.3.14", "@web/dev-server-rollup": "0.3.15",
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.3", "babel-plugin-transform-object-rest-spread": "7.0.0-beta.3",
"copyfiles": "2.4.1", "copyfiles": "2.4.1",
"core-js-bundle": "3.20.3", "core-js-bundle": "3.20.3",
"cp-cli": "2.0.0", "cp-cli": "2.0.0",
"cypress": "9.3.1", "cypress": "9.4.1",
"cypress-multi-reporters": "1.5.0", "cypress-multi-reporters": "1.5.0",
"cypress-plugin-snapshots": "1.4.4", "cypress-plugin-snapshots": "1.4.4",
"jamilih": "0.54.0", "jamilih": "0.54.0",
"jsdoc": "3.6.9", "jsdoc": "3.6.10",
"node-static": "0.7.11", "node-static": "0.7.11",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"nyc": "15.1.0", "nyc": "15.1.0",
@@ -128,10 +128,10 @@
"remark-cli": "10.0.1", "remark-cli": "10.0.1",
"remark-lint-ordered-list-marker-value": "3.1.1", "remark-lint-ordered-list-marker-value": "3.1.1",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rollup": "2.66.0", "rollup": "2.66.1",
"rollup-plugin-copy": "3.4.0", "rollup-plugin-copy": "3.4.0",
"rollup-plugin-filesize": "9.1.2", "rollup-plugin-filesize": "9.1.2",
"rollup-plugin-html": "^0.2.1", "rollup-plugin-html": "0.2.1",
"rollup-plugin-node-polyfills": "0.2.1", "rollup-plugin-node-polyfills": "0.2.1",
"rollup-plugin-progress": "1.1.2", "rollup-plugin-progress": "1.1.2",
"rollup-plugin-re": "1.0.7", "rollup-plugin-re": "1.0.7",

View File

@@ -351,6 +351,7 @@ export default class ConfigObj {
const cached = this.editor.storage.getItem(name) const cached = this.editor.storage.getItem(name)
if (cached) { if (cached) {
this.editor.loadFromString(cached) this.editor.loadFromString(cached)
this.editor.topPanel.updateTitle(this.editor.storage.getItem(`title-${name}`) ?? 'untitled.svg')
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -630,7 +630,7 @@ class EditorStartup {
) )
// load user extensions (given as pathNames) // load user extensions (given as pathNames)
await Promise.all( await Promise.all(
this.configObj.curConfig.userExtensions.map(async (extPathName) => { this.configObj.curConfig.userExtensions.map(async ({ pathName, config }) => {
/** /**
* @tutorial ExtensionDocs * @tutorial ExtensionDocs
* @typedef {PlainObject} module:SVGthis.ExtensionObject * @typedef {PlainObject} module:SVGthis.ExtensionObject
@@ -641,12 +641,12 @@ class EditorStartup {
/** /**
* @type {module:SVGthis.ExtensionObject} * @type {module:SVGthis.ExtensionObject}
*/ */
const imported = await import(encodeURI(extPathName)) const imported = await import(encodeURI(pathName))
const { name, init: initfn } = imported.default const { name, init: initfn } = imported.default
return this.addExtension(name, (initfn && initfn.bind(this)), {}) return this.addExtension(name, (initfn && initfn.bind(this, config)), {})
} catch (err) { } catch (err) {
// Todo: Add config to alert any errors // Todo: Add config to alert any errors
console.error('Extension failed to load: ' + extPathName + '; ', err) console.error('Extension failed to load: ' + pathName + '; ', err)
return undefined return undefined
} }
}) })

View File

@@ -138,6 +138,7 @@ export default {
svgEditor.zoomImage() svgEditor.zoomImage()
svgEditor.layersPanel.populateLayers() svgEditor.layersPanel.populateLayers()
svgEditor.topPanel.updateContextPanel() svgEditor.topPanel.updateContextPanel()
svgEditor.topPanel.updateTitle('untitled.svg')
svgEditor.svgCanvas.runExtensions('onNewDocument') svgEditor.svgCanvas.runExtensions('onNewDocument')
} }
@@ -160,6 +161,7 @@ export default {
await svgEditor.loadSvgString(svgContent) await svgEditor.loadSvgString(svgContent)
svgEditor.updateCanvas() svgEditor.updateCanvas()
handle = blob.handle handle = blob.handle
svgEditor.topPanel.updateTitle(blob.name)
svgEditor.svgCanvas.runExtensions('onOpenedDocument', { svgEditor.svgCanvas.runExtensions('onOpenedDocument', {
name: blob.name, name: blob.name,
lastModified: blob.lastModified, lastModified: blob.lastModified,
@@ -192,7 +194,7 @@ export default {
* *
* @returns {void} * @returns {void}
*/ */
const clickSave = async function (type, _) { const clickSave = async function (type) {
const $editorDialog = $id('se-svg-editor-dialog') const $editorDialog = $id('se-svg-editor-dialog')
const editingsource = $editorDialog.getAttribute('dialog') === 'open' const editingsource = $editorDialog.getAttribute('dialog') === 'open'
if (editingsource) { if (editingsource) {
@@ -222,15 +224,16 @@ export default {
if (type === 'save' && handle !== null) { if (type === 'save' && handle !== null) {
const throwIfExistingHandleNotGood = false const throwIfExistingHandleNotGood = false
handle = await fileSave(blob, { handle = await fileSave(blob, {
fileName: 'icon.svg', fileName: 'untitled.svg',
extensions: ['.svg'] extensions: ['.svg']
}, handle, throwIfExistingHandleNotGood) }, handle, throwIfExistingHandleNotGood)
} else { } else {
handle = await fileSave(blob, { handle = await fileSave(blob, {
fileName: 'icon.svg', fileName: svgEditor.title,
extensions: ['.svg'] extensions: ['.svg']
}) })
} }
svgEditor.topPanel.updateTitle(handle.name)
svgCanvas.runExtensions('onSavedDocument', { svgCanvas.runExtensions('onSavedDocument', {
name: handle.name, name: handle.name,
kind: handle.kind kind: handle.kind

View File

@@ -17,7 +17,7 @@
* and `imagePath`, but other currently used config in the extensions) * and `imagePath`, but other currently used config in the extensions)
* @todo We might provide control of storage settings through the UI besides the * @todo We might provide control of storage settings through the UI besides the
* initial (or URL-forced) dialog. * * initial (or URL-forced) dialog. *
*/ */
import './storageDialog.js' import './storageDialog.js'
/** /**
@@ -32,8 +32,9 @@ const removeStoragePrefCookie = () => {
* @param {string} cookie * @param {string} cookie
* @returns {void} * @returns {void}
*/ */
const expireCookie = (cookie) => { const expireCookie = cookie => {
document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' document.cookie =
encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT'
} }
/** /**
@@ -42,12 +43,16 @@ const expireCookie = (cookie) => {
* @returns {void} * @returns {void}
* @todo Replace the string manipulation with `searchParams.set` * @todo Replace the string manipulation with `searchParams.set`
*/ */
const replaceStoragePrompt = (val) => { const replaceStoragePrompt = val => {
val = val ? 'storagePrompt=' + val : '' val = val ? 'storagePrompt=' + val : ''
const loc = top.location // Allow this to work with the embedded editor as well const loc = top.location // Allow this to work with the embedded editor as well
if (loc.href.includes('storagePrompt=')) { if (loc.href.includes('storagePrompt=')) {
loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) { loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (
return (val ? n1 : '') + val + (!val && amp ? n1 : (amp || '')) n0,
n1,
amp
) {
return (val ? n1 : '') + val + (!val && amp ? n1 : amp || '')
}) })
} else { } else {
loc.href += (loc.href.includes('?') ? '&' : '?') + val loc.href += (loc.href.includes('?') ? '&' : '?') + val
@@ -87,21 +92,29 @@ export default {
// manage the change in the storageDialog // manage the change in the storageDialog
storageBox.addEventListener('change', (e) => { storageBox.addEventListener('change', e => {
storageBox.setAttribute('dialog', 'close') storageBox.setAttribute('dialog', 'close')
if (e?.detail?.trigger === 'ok') { if (e?.detail?.trigger === 'ok') {
if (e?.detail?.select !== 'noPrefsOrContent') { if (e?.detail?.select !== 'noPrefsOrContent') {
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt') const storagePrompt = new URL(top.location).searchParams.get(
document.cookie = 'svgeditstore=' + encodeURIComponent(e.detail.select) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT' 'storagePrompt'
)
document.cookie =
'svgeditstore=' +
encodeURIComponent(e.detail.select) +
'; expires=Fri, 31 Dec 9999 23:59:59 GMT'
if (storagePrompt === 'true' && e?.detail?.checkbox) { if (storagePrompt === 'true' && e?.detail?.checkbox) {
replaceStoragePrompt() replaceStoragePrompt()
return return
} }
} else { } else {
removeStoragePrefCookie() removeStoragePrefCookie()
if (svgEditor.configObj.curConfig.emptyStorageOnDecline && e?.detail?.checkbox) { if (
this.setSvgContentStorage('') svgEditor.configObj.curConfig.emptyStorageOnDecline &&
Object.keys(svgEditor.curPrefs).forEach((name) => { e?.detail?.checkbox
) {
setSvgContentStorage('')
Object.keys(svgEditor.curPrefs).forEach(name => {
name = 'svg-edit-' + name name = 'svg-edit-' + name
if (svgEditor.storage) { if (svgEditor.storage) {
svgEditor.storage.removeItem(name) svgEditor.storage.removeItem(name)
@@ -125,46 +138,49 @@ export default {
/** /**
* Sets SVG content as a string with "svgedit-" and the current * Sets SVG content as a string with "svgedit-" and the current
* canvas name as namespace. * canvas name as namespace.
* @param {string} val * @param {string} svgString
* @returns {void} * @returns {void}
*/ */
function setSvgContentStorage (val) { const setSvgContentStorage = (svgString) => {
if (storage) { const name = `svgedit-${svgEditor.configObj.curConfig.canvasName}`
const name = 'svgedit-' + svgEditor.configObj.curConfig.canvasName if (!svgString) {
if (!val) { storage.removeItem(name)
storage.removeItem(name) storage.removeItem(`${name}-title`)
} else { } else {
storage.setItem(name, val) storage.setItem(name, svgString)
} storage.setItem(`title-${name}`, svgEditor.title)
} }
} }
/** /**
* Listen for unloading: If and only if opted in by the user, set the content * Listen for unloading: If and only if opted in by the user, set the content
* document and preferences into storage: * document and preferences into storage:
* 1. Prevent save warnings (since we're automatically saving unsaved * 1. Prevent save warnings (since we're automatically saving unsaved
* content into storage) * content into storage)
* 2. Use localStorage to set SVG contents (potentially too large to allow in cookies) * 2. Use localStorage to set SVG contents (potentially too large to allow in cookies)
* 3. Use localStorage (where available) or cookies to set preferences. * 3. Use localStorage (where available) or cookies to set preferences.
* @returns {void} * @returns {void}
*/ */
function setupBeforeUnloadListener () { function setupBeforeUnloadListener () {
window.addEventListener('beforeunload', function () { window.addEventListener('beforeunload', function () {
// Don't save anything unless the user opted in to storage // Don't save anything unless the user opted in to storage
if (!(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/).test(document.cookie)) { if (
!/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/.test(
document.cookie
)
) {
return return
} }
if ((/(?:^|;\s*)svgeditstore=prefsAndContent/).test(document.cookie)) { if (/(?:^|;\s*)svgeditstore=prefsAndContent/.test(document.cookie)) {
setSvgContentStorage(svgCanvas.getSvgString()) setSvgContentStorage(svgCanvas.getSvgString())
} }
svgEditor.setConfig({ no_save_warning: true }) // No need for explicit saving at all once storage is on svgEditor.setConfig({ no_save_warning: true }) // No need for explicit saving at all once storage is on
// svgEditor.showSaveWarning = false;
const { curPrefs } = svgEditor.configObj const { curPrefs } = svgEditor.configObj
Object.entries(curPrefs).forEach(([key, val]) => { Object.entries(curPrefs).forEach(([key, val]) => {
const store = (val !== undefined) const store = val !== undefined
key = 'svg-edit-' + key key = 'svg-edit-' + key
if (!store) { if (!store) {
return return
@@ -175,7 +191,11 @@ export default {
window.widget.setPreferenceForKey(val, key) window.widget.setPreferenceForKey(val, key)
} else { } else {
val = encodeURIComponent(val) val = encodeURIComponent(val)
document.cookie = encodeURIComponent(key) + '=' + val + '; expires=Fri, 31 Dec 9999 23:59:59 GMT' document.cookie =
encodeURIComponent(key) +
'=' +
val +
'; expires=Fri, 31 Dec 9999 23:59:59 GMT'
} }
}) })
}) })
@@ -185,7 +205,9 @@ export default {
return { return {
name: 'storage', name: 'storage',
callback () { callback () {
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt') const storagePrompt = new URL(top.location).searchParams.get(
'storagePrompt'
)
// No need to run this one-time dialog again just because the user // No need to run this one-time dialog again just because the user
// changes the language // changes the language
if (loaded) { if (loaded) {
@@ -197,22 +219,23 @@ export default {
// set to false; to avoid any chance of storage, avoid this // set to false; to avoid any chance of storage, avoid this
// extension! (and to avoid using any prior storage, set the // extension! (and to avoid using any prior storage, set the
// config option "noStorageOnLoad" to true). // config option "noStorageOnLoad" to true).
if (!forceStorage && ( if (
!forceStorage &&
// If the URL has been explicitly set to always prompt the // If the URL has been explicitly set to always prompt the
// user (e.g., so one can be pointed to a URL where one // user (e.g., so one can be pointed to a URL where one
// can alter one's settings, say to prevent future storage)... // can alter one's settings, say to prevent future storage)...
storagePrompt === 'true' || (storagePrompt === 'true' ||
(
// ...or...if the URL at least doesn't explicitly prevent a // ...or...if the URL at least doesn't explicitly prevent a
// storage prompt (as we use for users who // storage prompt (as we use for users who
// don't want to set cookies at all but who don't want // don't want to set cookies at all but who don't want
// continual prompts about it)... // continual prompts about it)...
storagePrompt !== 'false' && (storagePrompt !== 'false' &&
// ...and this user hasn't previously indicated a desire for storage // ...and this user hasn't previously indicated a desire for storage
!(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/).test(document.cookie) !/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/.test(
) document.cookie
)))
// ...then show the storage prompt. // ...then show the storage prompt.
)) { ) {
const options = Boolean(storage) const options = Boolean(storage)
// Open select-with-checkbox dialog // Open select-with-checkbox dialog
// From svg-editor.js // From svg-editor.js

View File

@@ -142,23 +142,6 @@ export class SeStorageDialog extends HTMLElement {
svgEditor.$click(this.$okBtn, (evt) => onSubmitHandler(evt, 'ok')) svgEditor.$click(this.$okBtn, (evt) => onSubmitHandler(evt, 'ok'))
svgEditor.$click(this.$cancelBtn, (evt) => onSubmitHandler(evt, 'cancel')) svgEditor.$click(this.$cancelBtn, (evt) => onSubmitHandler(evt, 'cancel'))
} }
/**
* Sets SVG content as a string with "svgedit-" and the current
* canvas name as namespace.
* @param {string} val
* @returns {void}
*/
setSvgContentStorage (val) {
if (this.storage) {
const name = 'svgedit-' + this.configObj.curConfig.canvasName
if (!val) {
this.storage.removeItem(name)
} else {
this.storage.setItem(name, val)
}
}
}
} }
// Register // Register

View File

@@ -1,4 +1,7 @@
<div id="tools_top"> <div id="tools_top">
<div id="title_panel">
<p>untitled.svg</p>
</div> <!-- title panel -->
<div id="editor_panel"> <div id="editor_panel">
<div class="tool_sep"></div> <div class="tool_sep"></div>
<se-button id="tool_source" title="tools.tool_source" shortcut="U" src="source.svg"></se-button> <se-button id="tool_source" title="tools.tool_source" shortcut="U" src="source.svg"></se-button>

View File

@@ -26,14 +26,16 @@ class TopPanel {
*/ */
displayTool (className) { displayTool (className) {
// default display is 'none' so removing the property will make the panel visible // default display is 'none' so removing the property will make the panel visible
$qa(`.${className}`).map((el) => el.style.removeProperty('display')) $qa(`.${className}`).map(el => el.style.removeProperty('display'))
} }
/** /**
* @type {module} * @type {module}
*/ */
hideTool (className) { hideTool (className) {
$qa(`.${className}`).forEach((el) => { el.style.display = 'none' }) $qa(`.${className}`).forEach(el => {
el.style.display = 'none'
})
} }
/** /**
@@ -72,9 +74,12 @@ class TopPanel {
this.svgCanvas.setStrokeAttr('stroke-' + pre, val) this.svgCanvas.setStrokeAttr('stroke-' + pre, val)
} }
opt.classList.add('current') opt.classList.add('current')
const elements = Array.prototype.filter.call(opt.parentNode.children, function (child) { const elements = Array.prototype.filter.call(
return child !== opt opt.parentNode.children,
}) function (child) {
return child !== opt
}
)
Array.from(elements).forEach(function (element) { Array.from(elements).forEach(function (element) {
element.classList.remove('current') element.classList.remove('current')
}) })
@@ -87,7 +92,10 @@ class TopPanel {
* @returns {void} * @returns {void}
*/ */
update () { update () {
let i; let len let i
let len
// set title
$qa('#title_panel > p')[0].textContent = this.editor.title
if (this.selectedElement) { if (this.selectedElement) {
switch (this.selectedElement.tagName) { switch (this.selectedElement.tagName) {
case 'use': case 'use':
@@ -109,15 +117,17 @@ class TopPanel {
} }
} }
$id('stroke_width').value = (gWidth === null ? '' : gWidth) $id('stroke_width').value = gWidth === null ? '' : gWidth
this.editor.bottomPanel.updateColorpickers(true) this.editor.bottomPanel.updateColorpickers(true)
break break
} }
default: { default: {
this.editor.bottomPanel.updateColorpickers(true) this.editor.bottomPanel.updateColorpickers(true)
$id('stroke_width').value = this.selectedElement.getAttribute('stroke-width') || 1 $id('stroke_width').value =
$id('stroke_style').value = this.selectedElement.getAttribute('stroke-dasharray') || 'none' this.selectedElement.getAttribute('stroke-width') || 1
$id('stroke_style').value =
this.selectedElement.getAttribute('stroke-dasharray') || 'none'
$id('stroke_style').setAttribute('value', $id('stroke_style').value) $id('stroke_style').setAttribute('value', $id('stroke_style').value)
let attr = let attr =
@@ -226,13 +236,14 @@ class TopPanel {
if (['line', 'circle', 'ellipse'].includes(elname)) { if (['line', 'circle', 'ellipse'].includes(elname)) {
this.hideTool('xy_panel') this.hideTool('xy_panel')
} else { } else {
let x; let y let x
let y
// Get BBox vals for g, polyline and path // Get BBox vals for g, polyline and path
if (['g', 'polyline', 'path'].includes(elname)) { if (['g', 'polyline', 'path'].includes(elname)) {
const bb = this.editor.svgCanvas.getStrokedBBox([elem]) const bb = this.editor.svgCanvas.getStrokedBBox([elem])
if (bb) { if (bb) {
({ x, y } = bb) ;({ x, y } = bb)
} }
} else { } else {
x = elem.getAttribute('x') x = elem.getAttribute('x')
@@ -244,19 +255,13 @@ class TopPanel {
y = convertUnit(y) y = convertUnit(y)
} }
$id('selected_x').value = (x || 0) $id('selected_x').value = x || 0
$id('selected_y').value = (y || 0) $id('selected_y').value = y || 0
this.displayTool('xy_panel') this.displayTool('xy_panel')
} }
// Elements in this array cannot be converted to a path // Elements in this array cannot be converted to a path
if ([ if (['image', 'text', 'path', 'g', 'use'].includes(elname)) {
'image',
'text',
'path',
'g',
'use'
].includes(elname)) {
this.hideTool('tool_topath') this.hideTool('tool_topath')
} else { } else {
this.displayTool('tool_topath') this.displayTool('tool_topath')
@@ -266,11 +271,13 @@ class TopPanel {
} else { } else {
this.hideTool('tool_reorient') this.hideTool('tool_reorient')
} }
$id('tool_reorient').disabled = (angle === 0) $id('tool_reorient').disabled = angle === 0
} else { } else {
const point = this.path.getNodePoint() const point = this.path.getNodePoint()
$id('tool_add_subpath').pressed = false; $id('tool_add_subpath').pressed = false
(!this.path.canDeleteNodes) ? $id('tool_node_delete').classList.add('disabled') : $id('tool_node_delete').classList.remove('disabled') !this.path.canDeleteNodes
? $id('tool_node_delete').classList.add('disabled')
: $id('tool_node_delete').classList.remove('disabled')
// Show open/close button based on selected point // Show open/close button based on selected point
// setIcon('#tool_openclose_path', path.closed_subpath ? 'open_path' : 'close_path'); // setIcon('#tool_openclose_path', path.closed_subpath ? 'open_path' : 'close_path');
@@ -281,10 +288,10 @@ class TopPanel {
point.x = convertUnit(point.x) point.x = convertUnit(point.x)
point.y = convertUnit(point.y) point.y = convertUnit(point.y)
} }
$id('path_node_x').value = (point.x) $id('path_node_x').value = point.x
$id('path_node_y').value = (point.y) $id('path_node_y').value = point.y
if (point.type) { if (point.type) {
segType.value = (point.type) segType.value = point.type
segType.removeAttribute('disabled') segType.removeAttribute('disabled')
} else { } else {
segType.value = 4 segType.value = 4
@@ -316,9 +323,12 @@ class TopPanel {
} }
// siblings // siblings
if (elem.parentNode) { if (elem.parentNode) {
const selements = Array.prototype.filter.call(elem.parentNode.children, function (child) { const selements = Array.prototype.filter.call(
return child !== elem elem.parentNode.children,
}) function (child) {
return child !== elem
}
)
if (elem.parentNode.tagName === 'a' && !selements.length) { if (elem.parentNode.tagName === 'a' && !selements.length) {
this.displayTool('a_panel') this.displayTool('a_panel')
linkHref = this.editor.svgCanvas.getHref(elem.parentNode) linkHref = this.editor.svgCanvas.getHref(elem.parentNode)
@@ -339,7 +349,7 @@ class TopPanel {
const curPanel = panels[tagName] const curPanel = panels[tagName]
this.displayTool(tagName + '_panel') this.displayTool(tagName + '_panel')
curPanel.forEach((item) => { curPanel.forEach(item => {
let attrVal = elem.getAttribute(item) let attrVal = elem.getAttribute(item)
if (this.editor.configObj.curConfig.baseUnit !== 'px' && elem[item]) { if (this.editor.configObj.curConfig.baseUnit !== 'px' && elem[item]) {
const bv = elem[item].baseVal.value const bv = elem[item].baseVal.value
@@ -352,16 +362,31 @@ class TopPanel {
this.displayTool('text_panel') this.displayTool('text_panel')
$id('tool_italic').pressed = this.editor.svgCanvas.getItalic() $id('tool_italic').pressed = this.editor.svgCanvas.getItalic()
$id('tool_bold').pressed = this.editor.svgCanvas.getBold() $id('tool_bold').pressed = this.editor.svgCanvas.getBold()
$id('tool_text_decoration_underline').pressed = this.editor.svgCanvas.hasTextDecoration('underline') $id(
$id('tool_text_decoration_linethrough').pressed = this.editor.svgCanvas.hasTextDecoration('line-through') 'tool_text_decoration_underline'
$id('tool_text_decoration_overline').pressed = this.editor.svgCanvas.hasTextDecoration('overline') ).pressed = this.editor.svgCanvas.hasTextDecoration('underline')
$id('tool_font_family').setAttribute('value', elem.getAttribute('font-family')) $id(
$id('tool_text_anchor').setAttribute('value', elem.getAttribute('text-anchor')) 'tool_text_decoration_linethrough'
).pressed = this.editor.svgCanvas.hasTextDecoration('line-through')
$id(
'tool_text_decoration_overline'
).pressed = this.editor.svgCanvas.hasTextDecoration('overline')
$id('tool_font_family').setAttribute(
'value',
elem.getAttribute('font-family')
)
$id('tool_text_anchor').setAttribute(
'value',
elem.getAttribute('text-anchor')
)
$id('font_size').value = elem.getAttribute('font-size') $id('font_size').value = elem.getAttribute('font-size')
$id('tool_letter_spacing').value = elem.getAttribute('letter-spacing') ?? 0 $id('tool_letter_spacing').value =
$id('tool_word_spacing').value = elem.getAttribute('word-spacing') ?? 0 elem.getAttribute('letter-spacing') ?? 0
$id('tool_word_spacing').value =
elem.getAttribute('word-spacing') ?? 0
$id('tool_text_length').value = elem.getAttribute('textLength') ?? 0 $id('tool_text_length').value = elem.getAttribute('textLength') ?? 0
$id('tool_length_adjust').value = elem.getAttribute('lengthAdjust') ?? 0 $id('tool_length_adjust').value =
elem.getAttribute('lengthAdjust') ?? 0
$id('text').value = elem.textContent $id('text').value = elem.textContent
if (this.editor.svgCanvas.addedNew) { if (this.editor.svgCanvas.addedNew) {
// Timeout needed for IE9 // Timeout needed for IE9
@@ -375,16 +400,14 @@ class TopPanel {
tagName === 'image' && tagName === 'image' &&
this.editor.svgCanvas.getMode() === 'image' this.editor.svgCanvas.getMode() === 'image'
) { ) {
this.editor.svgCanvas.setImageURL( this.editor.svgCanvas.setImageURL(this.editor.svgCanvas.getHref(elem))
this.editor.svgCanvas.getHref(elem)
)
// image // image
} else if (tagName === 'g' || tagName === 'use') { } else if (tagName === 'g' || tagName === 'use') {
this.displayTool('container_panel') this.displayTool('container_panel')
const title = this.editor.svgCanvas.getTitle() const title = this.editor.svgCanvas.getTitle()
const label = $id('g_title') const label = $id('g_title')
label.value = title label.value = title
$id('g_title').disabled = (tagName === 'use') $id('g_title').disabled = tagName === 'use'
} }
} }
menuItems.setAttribute( menuItems.setAttribute(
@@ -393,7 +416,7 @@ class TopPanel {
) )
menuItems.setAttribute( menuItems.setAttribute(
(tagName === 'g' || !this.multiselected ? 'dis' : 'en') + (tagName === 'g' || !this.multiselected ? 'dis' : 'en') +
'ablemenuitems', 'ablemenuitems',
'#group' '#group'
) )
@@ -463,7 +486,9 @@ class TopPanel {
fcRules.setAttribute('id', 'wireframe_rules') fcRules.setAttribute('id', 'wireframe_rules')
document.getElementsByTagName('head')[0].appendChild(fcRules) document.getElementsByTagName('head')[0].appendChild(fcRules)
} else { } else {
while (wfRules.firstChild) { wfRules.removeChild(wfRules.firstChild) } while (wfRules.firstChild) {
wfRules.removeChild(wfRules.firstChild)
}
} }
this.editor.updateWireFrame() this.editor.updateWireFrame()
} }
@@ -513,8 +538,10 @@ class TopPanel {
* @type {module} * @type {module}
*/ */
changeRotationAngle (e) { changeRotationAngle (e) {
this.editor.svgCanvas.setRotationAngle(e.target.value); this.editor.svgCanvas.setRotationAngle(e.target.value)
(Number.parseInt(e.target.value) === 0) ? $id('tool_reorient').classList.add('disabled') : $id('tool_reorient').classList.remove('disabled') ;(Number.parseInt(e.target.value) === 0)
? $id('tool_reorient').classList.add('disabled')
: $id('tool_reorient').classList.remove('disabled')
} }
/** /**
@@ -655,8 +682,8 @@ class TopPanel {
* @returns {void} * @returns {void}
*/ */
linkControlPoints () { linkControlPoints () {
$id('tool_node_link').pressed = !($id('tool_node_link').pressed) $id('tool_node_link').pressed = !$id('tool_node_link').pressed
const linked = !!($id('tool_node_link').pressed) const linked = !!$id('tool_node_link').pressed
this.path.linkControlPoints(linked) this.path.linkControlPoints(linked)
} }
@@ -806,11 +833,11 @@ class TopPanel {
} }
/** /**
* Set a selected image's URL. * Set a selected image's URL.
* @function module:SVGthis.setImageURL * @function module:SVGthis.setImageURL
* @param {string} url * @param {string} url
* @returns {void} * @returns {void}
*/ */
setImageURL (url) { setImageURL (url) {
const { editor } = this const { editor } = this
if (!url) { if (!url) {
@@ -828,24 +855,39 @@ class TopPanel {
// eslint-disable-next-line promise/catch-or-return // eslint-disable-next-line promise/catch-or-return
promised promised
// eslint-disable-next-line promise/always-return // eslint-disable-next-line promise/always-return
.then(() => { .then(
// switch into "select" mode if we've clicked on an element () => {
editor.svgCanvas.setMode('select') // switch into "select" mode if we've clicked on an element
editor.svgCanvas.selectOnly(editor.svgCanvas.getSelectedElements(), true) editor.svgCanvas.setMode('select')
}, (error) => { editor.svgCanvas.selectOnly(
console.error('error =', error) editor.svgCanvas.getSelectedElements(),
seAlert(editor.i18next.t('tools.no_embed')) true
editor.svgCanvas.deleteSelectedElements() )
}) },
error => {
console.error('error =', error)
seAlert(editor.i18next.t('tools.no_embed'))
editor.svgCanvas.deleteSelectedElements()
}
)
this.displayTool('image_url') this.displayTool('image_url')
} }
} }
/** /**
* @param {boolean} editmode *
* @param {module:svgcanvas.SvgCanvas#event:selected} elems */
* @returns {void} updateTitle (title) {
*/ if (title) this.editor.title = title
const titleElement = $qa('#title_panel > p')[0]
if (titleElement) titleElement.textContent = this.editor.title
}
/**
* @param {boolean} editmode
* @param {module:svgcanvas.SvgCanvas#event:selected} elems
* @returns {void}
*/
togglePathEditMode (editMode, elems) { togglePathEditMode (editMode, elems) {
if (editMode) { if (editMode) {
this.displayTool('path_node_panel') this.displayTool('path_node_panel')
@@ -883,6 +925,7 @@ class TopPanel {
) )
newSeEditorDialog.setAttribute('id', 'se-svg-editor-dialog') newSeEditorDialog.setAttribute('id', 'se-svg-editor-dialog')
this.editor.$container.append(newSeEditorDialog) this.editor.$container.append(newSeEditorDialog)
this.updateTitle()
newSeEditorDialog.init(i18next) newSeEditorDialog.init(i18next)
$id('tool_link_url').setAttribute('title', i18next.t('tools.set_link_url')) $id('tool_link_url').setAttribute('title', i18next.t('tools.set_link_url'))
// register action to top panel buttons // register action to top panel buttons
@@ -954,7 +997,7 @@ class TopPanel {
'image_height', 'image_height',
'path_node_x', 'path_node_x',
'path_node_y' 'path_node_y'
].forEach((attrId) => ].forEach(attrId =>
$id(attrId).addEventListener('change', this.attrChanger.bind(this)) $id(attrId).addEventListener('change', this.attrChanger.bind(this))
) )
} }

View File

@@ -33,6 +33,13 @@
height: 100%; height: 100%;
} }
#title_panel > p {
color: white;
padding-left: 5px;
padding-right: 3px;
font-weight: bold;
}
/* on smaller screen, allow 2 lines for the toolbar */ /* on smaller screen, allow 2 lines for the toolbar */
@media screen and (max-width:1250px) { @media screen and (max-width:1250px) {
.svg_editor { .svg_editor {
@@ -42,7 +49,7 @@
/* class to open the right panel */ /* class to open the right panel */
.svg_editor.open { .svg_editor.open {
grid-template-columns: 34px 15px 50px 1fr 150px; grid-template-columns: 34px 15px 50px 1fr 220px;
} }
#svgroot { #svgroot {
@@ -179,6 +186,8 @@ hr {
#selLayerNames { #selLayerNames {
display: block; display: block;
top: -8px;
position: relative;
} }
/* Main button /* Main button