fix lint issues
parent
d98af1489b
commit
0aba04316d
|
@ -112,7 +112,8 @@ export default {
|
||||||
* @param {ImageLibMetaMessage|ImageLibMessage|string} cfg.data String is deprecated when parsed to JSON `ImageLibMessage`
|
* @param {ImageLibMetaMessage|ImageLibMessage|string} cfg.data String is deprecated when parsed to JSON `ImageLibMessage`
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
async function onMessage({ origin, data: response }) {
|
async function onMessage({ origin, data }) {
|
||||||
|
let response = data;
|
||||||
if (!response || ![ 'string', 'object' ].includes(typeof response)) {
|
if (!response || ![ 'string', 'object' ].includes(typeof response)) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
return;
|
return;
|
||||||
|
@ -129,7 +130,7 @@ export default {
|
||||||
}
|
}
|
||||||
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
||||||
// Todo: Surface this error to user?
|
// Todo: Surface this error to user?
|
||||||
console.log(`Origin ${origin} not whitelisted for posting to ${window.origin}`);
|
console.error(`Origin ${origin} not whitelisted for posting to ${window.origin}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const hasName = 'name' in response;
|
const hasName = 'name' in response;
|
||||||
|
|
|
@ -96,7 +96,8 @@ export default {
|
||||||
|
|
||||||
svgEditor.setCustomHandlers({
|
svgEditor.setCustomHandlers({
|
||||||
save (win, data) {
|
save (win, data) {
|
||||||
const svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data, // Firefox doesn't seem to know it is UTF-8 (no matter whether we use or skip the clientDownload code) despite the Content-Disposition header containing UTF-8, but adding the encoding works
|
// Firefox doesn't seem to know it is UTF-8 (no matter whether we use or skip the clientDownload code) despite the Content-Disposition header containing UTF-8, but adding the encoding works
|
||||||
|
const svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,
|
||||||
filename = getFileNameFromTitle();
|
filename = getFileNameFromTitle();
|
||||||
|
|
||||||
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;charset=UTF-8;base64,' + encode64(svg))) {
|
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;charset=UTF-8;base64,' + encode64(svg))) {
|
||||||
|
|
|
@ -414,7 +414,7 @@ class LayersPanel {
|
||||||
element.addEventListener('mouseup', (evt) => {
|
element.addEventListener('mouseup', (evt) => {
|
||||||
self.toggleHighlightLayer(evt.currentTarget.textContent);
|
self.toggleHighlightLayer(evt.currentTarget.textContent);
|
||||||
});
|
});
|
||||||
element.addEventListener('mouseout', (evt) => {
|
element.addEventListener('mouseout', (_evt) => {
|
||||||
self.toggleHighlightLayer();
|
self.toggleHighlightLayer();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -86,7 +86,8 @@ let editorContext_ = null;
|
||||||
* Object with the following keys/values.
|
* Object with the following keys/values.
|
||||||
* @typedef {PlainObject} module:path.SVGElementJSON
|
* @typedef {PlainObject} module:path.SVGElementJSON
|
||||||
* @property {string} element - Tag name of the SVG element to create
|
* @property {string} element - Tag name of the SVG element to create
|
||||||
* @property {PlainObject<string, string>} attr - Has key-value attributes to assign to the new element. An `id` should be set so that {@link module:utilities.EditorContext#addSVGElementFromJson} can later re-identify the element for modification or replacement.
|
* @property {PlainObject<string, string>} attr - Has key-value attributes to assign to the new element.
|
||||||
|
* An `id` should be set so that {@link module:utilities.EditorContext#addSVGElementFromJson} can later re-identify the element for modification or replacement.
|
||||||
* @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first
|
* @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first
|
||||||
* @property {module:path.SVGElementJSON[]} [children] - Data objects to be added recursively as children
|
* @property {module:path.SVGElementJSON[]} [children] - Data objects to be added recursively as children
|
||||||
* @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace
|
* @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace
|
||||||
|
@ -99,7 +100,8 @@ let editorContext_ = null;
|
||||||
/**
|
/**
|
||||||
* @function module:path.EditorContext#call
|
* @function module:path.EditorContext#call
|
||||||
* @param {"selected"|"changed"} ev - String with the event name
|
* @param {"selected"|"changed"} ev - String with the event name
|
||||||
* @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function. If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed.
|
* @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function.
|
||||||
|
* If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue