upgrade eslint and associated fixes

don't keep ie() by the way
This commit is contained in:
JFH
2020-12-19 20:42:18 +01:00
parent dca89321d4
commit 047e55c7be
25 changed files with 346 additions and 352 deletions

View File

@@ -168,6 +168,7 @@ export class ExplorerButton extends HTMLElement {
)).join('');
await this.updateLib(lib[0]);
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}
break;
@@ -307,6 +308,7 @@ export class ExplorerButton extends HTMLElement {
return `<se-button data-shape="${key}"src="data:image/svg+xml;base64,${encoded}"></se-button>`;
}).join('');
} catch (error) {
// eslint-disable-next-line no-console
console.error(`could not read file:${libDir}${lib}.json`, error);
}
}

View File

@@ -1,6 +1,5 @@
/* eslint-disable node/no-unpublished-import */
import 'elix/define/Dialog.js';
import {isValidUnit} from '../../common/units.js';
const template = document.createElement('template');
template.innerHTML = `
@@ -485,7 +484,7 @@ export class SeEditPrefsDialog extends HTMLElement {
*/
connectedCallback () {
const onCancelHandler = (ev) => {
const closeEvent = new CustomEvent('change', { detail: {
const closeEvent = new CustomEvent('change', {detail: {
dialog: 'closed'
}});
this.dispatchEvent(closeEvent);

View File

@@ -344,7 +344,7 @@ export class SeImgPropDialog extends HTMLElement {
if (this.$imageOptRef.getAttribute('checked') === 'true') {
saveOpt = 'ref';
}
const closeEvent = new CustomEvent('change', { detail: {
const closeEvent = new CustomEvent('change', {detail: {
title: this.$canvasTitle.value,
w: this.$canvasWidth.value,
h: this.$canvasHeight.value,
@@ -357,7 +357,7 @@ export class SeImgPropDialog extends HTMLElement {
this.dispatchEvent(closeEvent);
};
const onCancelHandler = (ev) => {
const closeEvent = new CustomEvent('change', { detail: {
const closeEvent = new CustomEvent('change', {detail: {
dialog: 'closed'
}});
this.$canvasWidth.removeAttribute('disabled');

View File

@@ -1,2 +1,2 @@
import './imagePropertiesDialog.js';
import './editorPreferencesDialog.js';
import './editorPreferencesDialog.js';

View File

@@ -641,10 +641,8 @@ export default {
},
toolButtonStateUpdate (opts) {
const button = document.getElementById('mode_connect');
if (opts.nostroke) {
if (button.pressed === true) {
svgEditor.clickSelect();
}
if (opts.nostroke && button.pressed === true) {
svgEditor.clickSelect();
}
button.disabled = opts.nostroke;
}

View File

@@ -8,7 +8,7 @@
*/
export default {
name: 'overview_window',
init ({$, isChrome, isIE}) {
init ({$, isChrome}) {
const overviewWindowGlobals = {};
// Disabled in Chrome 48-, see https://github.com/SVG-Edit/svgedit/issues/26 and
// https://code.google.com/p/chromium/issues/detail?id=565120.
@@ -77,18 +77,8 @@ export default {
const viewWidth = $('#svgroot').attr('width');
const viewHeight = $('#svgroot').attr('height');
let viewX = 640;
let viewY = 480;
if (isIE()) {
// This has only been tested with Firefox 10 and IE 9 (without chrome frame).
// I am not sure if if is Firefox or IE that is being non compliant here.
// Either way the one that is noncompliant may become more compliant later.
// TAG:HACK
// TAG:VERSION_DEPENDENT
// TAG:BROWSER_SNIFFING
viewX = 0;
viewY = 0;
}
const viewX = 640;
const viewY = 480;
const svgWidthOld = $('#overviewMiniView').attr('width');
const svgHeightNew = viewHeight / viewWidth * svgWidthOld;

View File

@@ -143,5 +143,4 @@ try { // try clause to avoid js to complain if XDOMAIN undefined
// eslint-disable-next-line no-console
console.info('xdomain config activated');
}
} catch (error) {
}
} catch (error) {}

View File

@@ -616,10 +616,10 @@ export default function jQueryPluginJGraduate ($) {
this.value = 1.0;
}
if (!(attr[0] === 'f' && !showFocus)) {
if ((isRadial && curType === 'radialGradient') || (!isRadial && curType === 'linearGradient')) {
curGradient.setAttribute(attr, this.value);
}
if (!(attr[0] === 'f' &&
!showFocus) &&
((isRadial && curType === 'radialGradient') || (!isRadial && curType === 'linearGradient'))) {
curGradient.setAttribute(attr, this.value);
}
const $elem = isRadial

View File

@@ -398,16 +398,11 @@ editor.init = () => {
const blurval = svgCanvas.getBlur(elem) * 10;
$id('blur').value = blurval;
if (svgCanvas.addedNew) {
if (elname === 'image' && svgCanvas.getMode() === 'image') {
// Prompt for URL if not a data URL
if (!svgCanvas.getHref(elem).startsWith('data:')) {
/* await */ promptImgURL({cancelDeletes: true});
}
}
/* else if (elname == 'text') {
// TODO: Do something here for new text
} */
if (svgCanvas.addedNew &&
elname === 'image' &&
svgCanvas.getMode() === 'image' &&
!svgCanvas.getHref(elem).startsWith('data:')) {
/* await */ promptImgURL({cancelDeletes: true});
}
if (!isNode && currentMode !== 'pathedit') {
@@ -493,11 +488,9 @@ editor.init = () => {
$('#g_panel').show();
}
if (elem.parentNode.tagName === 'a') {
if (!$(elem).siblings().length) {
$('#a_panel').show();
linkHref = svgCanvas.getHref(elem.parentNode);
}
if (elem.parentNode.tagName === 'a' && !$(elem).siblings().length) {
$('#a_panel').show();
linkHref = svgCanvas.getHref(elem.parentNode);
}
// Hide/show the make_link buttons
@@ -1283,14 +1276,8 @@ editor.init = () => {
// if elems[1] is present, then we have more than one element
selectedElement = (elems.length === 1 || Utils.isNullish(elems[1]) ? elems[0] : null);
multiselected = (elems.length >= 2 && !Utils.isNullish(elems[1]));
if (!Utils.isNullish(selectedElement)) {
// unless we're already in always set the mode of the editor to select because
// upon creation of a text element the editor is switched into
// select mode and this event fires - we need our UI to be in sync
if (!isNode) {
updateToolbar();
}
if (!Utils.isNullish(selectedElement) && !isNode) {
updateToolbar();
} // if (!Utils.isNullish(elem))
// Deal with pathedit mode
@@ -1546,11 +1533,9 @@ editor.init = () => {
}
let cbCalled = false;
if (ext.langReady) {
if (editor.langChanged) { // We check for this since the "lang" pref could have been set by storage
const lang = editor.pref('lang');
await ext.langReady({lang});
}
if (ext.langReady && editor.langChanged) { // We check for this since the "lang" pref could have been set by storage
const lang = editor.pref('lang');
await ext.langReady({lang});
}
/**