fix missing semicolumns

master
JFH 2021-05-13 00:46:46 +02:00
parent dc5d9b05a6
commit 9a5292b467
27 changed files with 61 additions and 60 deletions

View File

@ -25,6 +25,7 @@ module.exports = {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"sonarjs/cognitive-complexity": ["warn", 40],
"sonarjs/no-duplicate-string": 0,
"semi" : "error",
},
overrides: [
{

View File

@ -295,7 +295,7 @@ class Editor extends EditorStartup {
'5/Shift+5': 'tools_ellipse'
};
Object.entries(keyAssocs).forEach(([keyval, sel]) => {
const parentsElements = this.getParents($id(sel), $id('main_menu'))
const parentsElements = this.getParents($id(sel), $id('main_menu'));
const menu = (parentsElements.length);
$qa(sel).forEach((element) => {
@ -350,9 +350,9 @@ class Editor extends EditorStartup {
const elements = document.getElementsByClassName("tool_button_current");
Array.from(elements).forEach(function (element) {
element.classList.add('tool_button_current');
element.classList.remove('tool_button')
element.classList.remove('tool_button');
});
$id('tool_select').classList.add('tool_button_current')
$id('tool_select').classList.add('tool_button_current');
$id('tool_select').classList.remove('tool_button');
this.multiselected = false;
if (elems.length) {

View File

@ -53,7 +53,7 @@ class EditorStartup {
constructor () {
this.extensionsAdded = false;
this.messageQueue = [];
this.$svgEditor = $id('svg_editor')
this.$svgEditor = $id('svg_editor');
}
/**
* Auto-run after a Promise microtask.
@ -136,7 +136,7 @@ class EditorStartup {
this.selectedElement = null;
this.multiselected = false;
const aLinks = $id('cur_context_panel').querySelectorAll('a')
const aLinks = $id('cur_context_panel').querySelectorAll('a');
for (const aLink of aLinks) {
aLink.addEventListener('click', (evt) => {
@ -426,16 +426,16 @@ class EditorStartup {
Array.from(elements).forEach(function(element) {
element.addEventListener('mousedown', function(event) {
if (!event.currentTarget.classList.contains('disabled')) {
event.currentTarget.classList.add('push_button_pressed')
event.currentTarget.classList.add('push_button_pressed');
event.currentTarget.classList.remove('push_button');
}
});
element.addEventListener('mouseout', function(event) {
event.currentTarget.classList.add('push_button')
event.currentTarget.classList.add('push_button');
event.currentTarget.classList.remove('push_button_pressed');
});
element.addEventListener('mouseup', function(event) {
event.currentTarget.classList.add('push_button')
event.currentTarget.classList.add('push_button');
event.currentTarget.classList.remove('push_button_pressed');
});
});

View File

@ -305,7 +305,7 @@ class MainMenu {
init() {
// add Top panel
const template = document.createElement("template");
const {i18next} = this.editor
const {i18next} = this.editor;
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = `
<se-menu id="main_button" label="SVG-Edit" src="./images/logo.svg" alt="logo">

View File

@ -1368,7 +1368,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc
if (!that.querySelectorAll('div.jPicker.Container').length) {
document.body.insertBefore(container, document.body.firstChild);
} else {
that.querySelector('div.jPicker.Container:last').insertAdjacentElement('afterend', container)
that.querySelector('div.jPicker.Container:last').insertAdjacentElement('afterend', container);
}
container.addEventListener('mousedown', function () {
container.style.zIndex = 20;
@ -1520,7 +1520,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc
iconAlpha = that.icon.querySelector('.Alpha');
setImg.call(that, iconAlpha, images.clientPath + 'bar-opacity.png');
setAlpha.call(that, iconAlpha, toFixedNumeric(((255 - (!isNullish(all) ? all.a : 0)) * 100) / 255, 4));
iconImage = that.icon.querySelector('.Image')
iconImage = that.icon.querySelector('.Image');
iconImage.style.backgroundImage = 'url(\'' + images.clientPath + images.picker.file + '\')';
iconImage.addEventListener('click', iconImageClicked);
if (win.bindToInput && win.updateInputColor) {

View File

@ -92,6 +92,6 @@ export const dragmove = function(target, handler, parent, onStart, onEnd, onDrag
target.style.left = lastX + "px";
target.style.top = lastY + "px";
});
}
};
export { dragmove as default };

View File

@ -9,7 +9,7 @@
const loadExtensionTranslation = async function (svgEditor) {
let translationModule;
const lang = svgEditor.configObj.pref('lang')
const lang = svgEditor.configObj.pref('lang');
try {
// eslint-disable-next-line no-unsanitized/method
translationModule = await import(`./locale/${encodeURIComponent(lang)}.js`);

View File

@ -79,7 +79,7 @@ export default {
x: midX + lenX * ratio,
y: midY + lenY * ratio
};
}
};
/**
* @param {"start"|"end"} side
@ -92,7 +92,7 @@ export default {
// TODO: Make this number (5) be based on marker width/height
const size = line.getAttribute('stroke-width') * 5;
return giveOffset ? size : 0;
}
};
/**
* @param {boolean} on
@ -108,7 +108,7 @@ export default {
connRules.textContent = (!on ? '' : '#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }');
if ($id('connector_panel'))
$id('connector_panel').style.display = (on) ? 'block' : 'none';
}
};
/**
* @param {Element} elem
@ -144,7 +144,7 @@ export default {
const ptEnd = pts.getItem(pts.numberOfItems - 1);
setPoint(elem, 1, (ptEnd.x + ptStart.x) / 2, (ptEnd.y + ptStart.y) / 2);
}
}
};
/**
* @param {Float} diffX
@ -184,7 +184,7 @@ export default {
const pt2 = getBBintersect(pt.x, pt.y, dataStorage.get(line, altPre + '_bb'), getOffset(altPre, line));
setPoint(line, conn.is_start ? 'end' : 0, pt2.x, pt2.y, true);
}
}
};
/**
*
@ -244,7 +244,7 @@ export default {
}
}
});
}
};
/**
* @param {Element[]} [elems=selElems]
@ -302,7 +302,7 @@ export default {
}
}
}
}
};
// Do once
(function () {
@ -347,7 +347,7 @@ export default {
svgCanvas.getEditorNS(true);
}
});
}
};
const strings = await loadExtensionTranslation(svgEditor.configObj.pref('lang'));
return {
@ -359,7 +359,7 @@ export default {
const buttonTemplate = document.createElement("template");
buttonTemplate.innerHTML = `
<se-button id="mode_connect" title="Connect two objects" src="./images/conn.svg"></se-button>
`
`;
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
$id('mode_connect').addEventListener("click", () => {
svgCanvas.setMode('connector');

View File

@ -71,7 +71,7 @@ export default {
} else {
tool.classList.add('disabled');
}
}
};
return {
name: strings.name,
@ -80,7 +80,7 @@ export default {
const buttonTemplate = document.createElement("template");
buttonTemplate.innerHTML = `
<se-button id="tool_eyedropper" title="Eye Dropper Tool" src="./images/eye_dropper.svg" shortcut="I"></se-button>
`
`;
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
$id('tool_eyedropper').addEventListener("click", () => {
svgCanvas.setMode('eyedropper');

View File

@ -277,7 +277,7 @@ export default {
const attrs = {
width: newFO.getAttribute('width'),
height: newFO.getAttribute('height'),
}
};
const keep = (attrs.width !== '0' || attrs.height !== '0');
svgCanvas.addToSelection([newFO], true);

View File

@ -138,7 +138,7 @@ export default {
gridimg.parentNode.setAttribute('width', bigInt);
gridimg.parentNode.setAttribute('height', bigInt);
svgCanvas.setHref(gridimg, datauri);
}
};
/**
*
@ -150,7 +150,7 @@ export default {
}
$id('canvasGrid').style.display = (showGrid) ? 'block' : 'none';
document.getElementById('view_grid').pressed = showGrid;
}
};
return {
name: strings.name,
zoomChanged (zoom) {
@ -161,7 +161,7 @@ export default {
const buttonTemplate = document.createElement("template");
buttonTemplate.innerHTML = `
<se-button id="view_grid" title="Show grid" src="./images/grid.svg"></se-button>
`
`;
$id('editor_panel').append(buttonTemplate.content.cloneNode(true));
$id('view_grid').addEventListener("click", () => {
svgEditor.configObj.curConfig.showGrid = showGrid = !showGrid;

View File

@ -46,7 +46,7 @@ export default {
const closeBrowser = () => {
$id("imgbrowse_holder").style.display = 'none';
document.activeElement.blur(); // make sure focus is the body to correct issue #417
}
};
/**
* @param {string} url
@ -67,7 +67,7 @@ export default {
svgCanvas.clearSelection();
svgCanvas.addToSelection([newImage]);
svgCanvas.setImageURL(url);
}
};
const pending = {};
@ -290,7 +290,7 @@ export default {
const img = document.createElement("img");
img.src = curMeta.preview_url;
entry.appendChild(img);
entry.appendChild(document.createTextNode(title))
entry.appendChild(document.createTextNode(title));
} else {
entry = document.createElement("img");
entry.src = response;
@ -330,7 +330,7 @@ export default {
const insertAfter = (referenceNode, newNode) => {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
};
const toggleMultiLoop = () => {
multiArr.forEach(function(item, i){
@ -347,7 +347,7 @@ export default {
preview.removeChild(preview.firstChild);
multiArr = [];
$id("imgbrowse_holder").style.display = 'none';
}
};
/**
* @param {boolean} show
@ -375,7 +375,7 @@ export default {
submit.style.display = (show) ? 'block' : 'none';
preview.style.display = (show) ? 'block' : 'none';
}
};
/**
*
@ -496,7 +496,7 @@ export default {
} else {
$id("imgbrowse_holder").style.display = 'block';
}
}
};
return {
svgicons: 'ext-imagelib.xml',

View File

@ -48,5 +48,5 @@ Array.prototype.forEach.call(atags, function (aEle) {
}, 'html'); // 'html' is necessary to keep returned data as a string
}
return false;
})
});
});

View File

@ -123,8 +123,8 @@ export default {
function setIcon (pos, id) {
if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; }
const ci = idPrefix + pos + '_' + id.substr(1);
console.log(ci)
console.log('cur_' + pos + '_marker_list')
console.log(ci);
console.log('cur_' + pos + '_marker_list');
svgEditor.setIcon('cur_' + pos + '_marker_list', $id(ci).children);
$id(ci).classList.add('current');
const siblings = Array.prototype.filter.call($id(ci).parentNode.children, function(child){

View File

@ -119,12 +119,12 @@ export default {
if((el.offsetLeft + el.offsetWidth) > parseFloat(getComputedStyle(parent, null).width.replace("px", ""))){
el.style.left = (parseFloat(getComputedStyle(parent, null).width.replace("px", "")) - el.offsetWidth) + 'px';
} else if(el.offsetLeft < 0){
el.style.left = "0px"
el.style.left = "0px";
}
if((el.offsetTop + el.offsetHeight) > parseFloat(getComputedStyle(parent, null).height.replace("px", ""))){
el.style.top = (parseFloat(getComputedStyle(parent, null).height.replace("px", "")) - el.offsetHeight) + 'px';
} else if(el.offsetTop < 0){
el.style.top = "0px"
el.style.top = "0px";
}
overviewWindowGlobals.viewBoxDragging = false;
updateViewPortFromViewBox();

View File

@ -36,7 +36,7 @@ export default {
} = svgCanvas;
const insertAfter = (referenceNode, newNode) => {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
};
return {
newUI: true,
name: strings.name,

View File

@ -36,7 +36,7 @@ export default {
*/
const showPanel = (on) => {
$id('polygon_panel').style.display = (on) ? 'block' : 'none';
}
};
/**
* @param {string} attr
@ -46,7 +46,7 @@ export default {
const setAttr = (attr, val) => {
svgCanvas.changeSelectedAttribute(attr, val);
svgCanvas.call('changed', selElems);
}
};
/**
* @param {Float} n
@ -73,7 +73,7 @@ export default {
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
</se-flyingbutton>
`
`;
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
}
$id('tool_polygon').addEventListener("click", () => {
@ -90,7 +90,7 @@ export default {
<se-spin-input size="3" id="polySides" min=1 step=1 value=5 label="sides">
</se-spin-input>
</div>
`
`;
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
$id("polygon_panel").style.display = 'none';
$id("polySides").addEventListener("change", (event) => {

View File

@ -30,7 +30,7 @@ export default {
buttonTemplate.innerHTML = `
<se-explorerbutton id="tool_shapelib" title="Shape library" lib="./extensions/ext-shapes/shapelib/"
src="./images/shapelib.svg"></se-explorerbutton>
`
`;
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
$id('tool_shapelib').addEventListener("click", () => {
canv.setMode(modeId);

View File

@ -37,7 +37,7 @@ export default {
*/
const showPanel = (on) => {
$id('star_panel').style.display = (on) ? 'block' : 'none';
}
};
/**
*
@ -48,7 +48,7 @@ export default {
const setAttr = (attr, val) => {
svgCanvas.changeSelectedAttribute(attr, val);
svgCanvas.call('changed', selElems);
}
};
return {
name: strings.name,
@ -63,7 +63,7 @@ export default {
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
</se-flyingbutton>
`
`;
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
}
$id('tool_star').addEventListener("click", () => { showPanel(true);
@ -84,7 +84,7 @@ export default {
<se-spin-input id="radialShift" min=0 step=1 value=0 label="radial shift" title="Change rotation angle">
</se-spin-input>
</div>
`
`;
//add handlers for the panel
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
$id("starNumPoints").addEventListener("change", (event) => {

View File

@ -217,7 +217,7 @@ class BottomPanel {
src="./images/opacity.svg"></se-spin-input>
<se-palette id="palette"></se-palette>
</div> <!-- tools_bottom -->
`
`;
this.editor.$svgEditor.append(template.content.cloneNode(true));
$id('palette').addEventListener('change', this.handlePalette.bind(this));
const {curConfig} = this.editor.configObj;

View File

@ -79,7 +79,7 @@ class LayersPanel {
*/
toggleSidePanel(close) {
const dpr = window.devicePixelRatio || 1;
const w = parseFloat(getComputedStyle($id("sidepanels"), null).width.replace("px", ""))
const w = parseFloat(getComputedStyle($id("sidepanels"), null).width.replace("px", ""));
const isOpened = (dpr < 1 ? w : w / dpr) > 2;
const zoomAdjustedSidepanelWidth =
(dpr < 1 ? 1 : dpr) * SIDEPANEL_OPENWIDTH;

View File

@ -352,7 +352,7 @@ class TopPanel {
if (this.editor.svgCanvas.addedNew) {
// Timeout needed for IE9
setTimeout(() => {
$id("text").focus()
$id("text").focus();
$id("text").select();
}, 100);
}
@ -406,7 +406,7 @@ class TopPanel {
if ((elem && !isNode) || this.multiselected) {
// update the selected elements' layer
$id("selLayerNames").removeAttribute("disabled")
$id("selLayerNames").removeAttribute("disabled");
$id("selLayerNames").value = currentLayerName;
// Enable regular menu options
@ -742,7 +742,7 @@ class TopPanel {
init() {
// add Top panel
const template = document.createElement("template");
const {i18next} = this.editor
const {i18next} = this.editor;
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = `
<div id="tools_top">

View File

@ -41,7 +41,7 @@ export const copyElem = function (el, getNextId) {
});
if (el.dataset.gsvg) {
newEl.dataset.gsvg = newEl.firstChild
newEl.dataset.gsvg = newEl.firstChild;
} else if (el.dataset.symbol) {
const ref = el.dataset.symbol;
newEl.dataset.ref = ref;

View File

@ -428,7 +428,7 @@ export class Segment {
*/
selectCtrls (y) {
document.getElementById('ctrlpointgrip_' + this.index + 'c1').setAttribute('fill', y ? '#0FF' : '#EEE');
document.getElementById('ctrlpointgrip_' + this.index + 'c2').setAttribute('fill', y ? '#0FF' : '#EEE')
document.getElementById('ctrlpointgrip_' + this.index + 'c2').setAttribute('fill', y ? '#0FF' : '#EEE');
}
/**

View File

@ -707,7 +707,7 @@ export const recalculateDimensions = function (selected) {
y1: selected.getAttribute('y1'),
x2: selected.getAttribute('x2'),
y2: selected.getAttribute('y2'),
}
};
// Fallthrough
case 'polyline':
case 'polygon':

View File

@ -733,7 +733,7 @@ export const convertToGroup = function (elem) {
recalculateDimensions(elem);
elementContext_.call('selected', [elem]);
} else if (dataStorage.has($elem, 'symbol')) {
elem = dataStorage.get($elem, 'symbol')
elem = dataStorage.get($elem, 'symbol');
ts = $elem.attr('transform');
const pos = $elem.attr(['x', 'y']);

View File

@ -1140,7 +1140,7 @@ export const getVisibleElements = function (parentElement) {
}
const contentElems = [];
const childrens = parentElement.children
const childrens = parentElement.children;
Array.prototype.forEach.call(childrens, function (elem) {
if (elem.getBBox) {
contentElems.push(elem);