fix linter issues

master
JFH 2022-01-04 16:22:17 -03:00
parent 69e485352a
commit 613e33da33
3 changed files with 19 additions and 19 deletions

View File

@ -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()
})
})

View File

@ -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
}
/**

View File

@ -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) {