fix linter issues
parent
69e485352a
commit
613e33da33
|
@ -166,19 +166,19 @@ describe('use various parts of svg-edit', function () {
|
||||||
it('check tool_text_decoration_underline', function () {
|
it('check tool_text_decoration_underline', function () {
|
||||||
cy.get('#svg_1').click({ force: true })
|
cy.get('#svg_1').click({ force: true })
|
||||||
cy.get('#tool_text_decoration_underline')
|
cy.get('#tool_text_decoration_underline')
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
testSnapshot()
|
testSnapshot()
|
||||||
})
|
})
|
||||||
it('check tool_text_decoration_linethrough', function () {
|
it('check tool_text_decoration_linethrough', function () {
|
||||||
cy.get('#svg_1').click({ force: true })
|
cy.get('#svg_1').click({ force: true })
|
||||||
cy.get('#tool_text_decoration_linethrough')
|
cy.get('#tool_text_decoration_linethrough')
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
testSnapshot()
|
testSnapshot()
|
||||||
})
|
})
|
||||||
it('check tool_text_decoration_overline', function () {
|
it('check tool_text_decoration_overline', function () {
|
||||||
cy.get('#svg_1').click({ force: true })
|
cy.get('#svg_1').click({ force: true })
|
||||||
cy.get('#tool_text_decoration_overline')
|
cy.get('#tool_text_decoration_overline')
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
testSnapshot()
|
testSnapshot()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -96,7 +96,7 @@ class TopPanel {
|
||||||
break
|
break
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'a': {
|
case 'a': {
|
||||||
// Look for common styles
|
// Look for common styles
|
||||||
const childs = this.selectedElement.getElementsByTagName('*')
|
const childs = this.selectedElement.getElementsByTagName('*')
|
||||||
let gWidth = null
|
let gWidth = null
|
||||||
for (i = 0, len = childs.length; i < len; i++) {
|
for (i = 0, len = childs.length; i < len; i++) {
|
||||||
|
@ -753,14 +753,14 @@ class TopPanel {
|
||||||
* @param value The text decoration value
|
* @param value The text decoration value
|
||||||
* @returns {boolean} false
|
* @returns {boolean} false
|
||||||
*/
|
*/
|
||||||
clickTextDecoration(value) {
|
clickTextDecoration (value) {
|
||||||
if(this.editor.svgCanvas.hasTextDecoration(value)) {
|
if (this.editor.svgCanvas.hasTextDecoration(value)) {
|
||||||
this.editor.svgCanvas.removeTextDecoration(value)
|
this.editor.svgCanvas.removeTextDecoration(value)
|
||||||
} else {
|
} else {
|
||||||
this.editor.svgCanvas.addTextDecoration(value)
|
this.editor.svgCanvas.addTextDecoration(value)
|
||||||
}
|
}
|
||||||
this.updateContextPanel();
|
this.updateContextPanel()
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -598,15 +598,15 @@ export const setBoldMethod = function (b) {
|
||||||
* @returns {boolean} Indicates whether or not element has the text decoration value
|
* @returns {boolean} Indicates whether or not element has the text decoration value
|
||||||
*/
|
*/
|
||||||
export const hasTextDecorationMethod = function (value) {
|
export const hasTextDecorationMethod = function (value) {
|
||||||
const selectedElements = svgCanvas.getSelectedElements();
|
const selectedElements = svgCanvas.getSelectedElements()
|
||||||
const selected = selectedElements[0];
|
const selected = selectedElements[0]
|
||||||
|
|
||||||
if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) {
|
if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) {
|
||||||
const attribute = selected.getAttribute('text-decoration') || '';
|
const attribute = selected.getAttribute('text-decoration') || ''
|
||||||
return attribute.includes(value);
|
return attribute.includes(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -615,10 +615,10 @@ export const hasTextDecorationMethod = function (value) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export const addTextDecorationMethod = function (value) {
|
export const addTextDecorationMethod = function (value) {
|
||||||
const selectedElements = svgCanvas.getSelectedElements();
|
const selectedElements = svgCanvas.getSelectedElements()
|
||||||
const selected = selectedElements[0];
|
const selected = selectedElements[0]
|
||||||
if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) {
|
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())
|
svgCanvas.changeSelectedAttribute('text-decoration', (oldValue + ' ' + value).trim())
|
||||||
}
|
}
|
||||||
if (selectedElements.length > 0 && !selectedElements[0].textContent) {
|
if (selectedElements.length > 0 && !selectedElements[0].textContent) {
|
||||||
|
@ -632,10 +632,10 @@ export const addTextDecorationMethod = function (value) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export const removeTextDecorationMethod = function (value) {
|
export const removeTextDecorationMethod = function (value) {
|
||||||
const selectedElements = svgCanvas.getSelectedElements();
|
const selectedElements = svgCanvas.getSelectedElements()
|
||||||
const selected = selectedElements[0];
|
const selected = selectedElements[0]
|
||||||
if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) {
|
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())
|
svgCanvas.changeSelectedAttribute('text-decoration', actualValues.replace(value, '').trim())
|
||||||
}
|
}
|
||||||
if (selectedElements.length > 0 && !selectedElements[0].textContent) {
|
if (selectedElements.length > 0 && !selectedElements[0].textContent) {
|
||||||
|
|
Loading…
Reference in New Issue