diff --git a/cypress/integration/ui/scenario.js b/cypress/integration/ui/scenario.js index a741635d..bb3f424c 100644 --- a/cypress/integration/ui/scenario.js +++ b/cypress/integration/ui/scenario.js @@ -166,19 +166,19 @@ describe('use various parts of svg-edit', function () { it('check tool_text_decoration_underline', function () { cy.get('#svg_1').click({ force: true }) cy.get('#tool_text_decoration_underline') - .click({ force: true }) + .click({ force: true }) testSnapshot() }) it('check tool_text_decoration_linethrough', function () { cy.get('#svg_1').click({ force: true }) cy.get('#tool_text_decoration_linethrough') - .click({ force: true }) + .click({ force: true }) testSnapshot() }) it('check tool_text_decoration_overline', function () { cy.get('#svg_1').click({ force: true }) cy.get('#tool_text_decoration_overline') - .click({ force: true }) + .click({ force: true }) testSnapshot() }) }) diff --git a/src/editor/panels/TopPanel.js b/src/editor/panels/TopPanel.js index 539f550b..faa84768 100644 --- a/src/editor/panels/TopPanel.js +++ b/src/editor/panels/TopPanel.js @@ -96,7 +96,7 @@ class TopPanel { break case 'g': case 'a': { - // Look for common styles + // Look for common styles const childs = this.selectedElement.getElementsByTagName('*') let gWidth = null for (i = 0, len = childs.length; i < len; i++) { @@ -753,14 +753,14 @@ class TopPanel { * @param value The text decoration value * @returns {boolean} false */ - clickTextDecoration(value) { - if(this.editor.svgCanvas.hasTextDecoration(value)) { + clickTextDecoration (value) { + if (this.editor.svgCanvas.hasTextDecoration(value)) { this.editor.svgCanvas.removeTextDecoration(value) } else { this.editor.svgCanvas.addTextDecoration(value) } - this.updateContextPanel(); - return false; + this.updateContextPanel() + return false } /** diff --git a/src/svgcanvas/elem-get-set.js b/src/svgcanvas/elem-get-set.js index e989ade3..d098ceaa 100644 --- a/src/svgcanvas/elem-get-set.js +++ b/src/svgcanvas/elem-get-set.js @@ -598,15 +598,15 @@ export const setBoldMethod = function (b) { * @returns {boolean} Indicates whether or not element has the text decoration value */ export const hasTextDecorationMethod = function (value) { - const selectedElements = svgCanvas.getSelectedElements(); - const selected = selectedElements[0]; + const selectedElements = svgCanvas.getSelectedElements() + const selected = selectedElements[0] if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { - const attribute = selected.getAttribute('text-decoration') || ''; - return attribute.includes(value); + const attribute = selected.getAttribute('text-decoration') || '' + return attribute.includes(value) } - return false; + return false } /** @@ -615,10 +615,10 @@ export const hasTextDecorationMethod = function (value) { * @returns {void} */ export const addTextDecorationMethod = function (value) { - const selectedElements = svgCanvas.getSelectedElements(); - const selected = selectedElements[0]; + const selectedElements = svgCanvas.getSelectedElements() + const selected = selectedElements[0] if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { - const oldValue = selected.getAttribute('text-decoration') || ''; + const oldValue = selected.getAttribute('text-decoration') || '' svgCanvas.changeSelectedAttribute('text-decoration', (oldValue + ' ' + value).trim()) } if (selectedElements.length > 0 && !selectedElements[0].textContent) { @@ -632,10 +632,10 @@ export const addTextDecorationMethod = function (value) { * @returns {void} */ export const removeTextDecorationMethod = function (value) { - const selectedElements = svgCanvas.getSelectedElements(); - const selected = selectedElements[0]; + const selectedElements = svgCanvas.getSelectedElements() + const selected = selectedElements[0] if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { - const actualValues = selected.getAttribute('text-decoration') || ''; + const actualValues = selected.getAttribute('text-decoration') || '' svgCanvas.changeSelectedAttribute('text-decoration', actualValues.replace(value, '').trim()) } if (selectedElements.length > 0 && !selectedElements[0].textContent) {