diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg index c3f8392e..1a70a667 100644 --- a/badges/coverage-badge.svg +++ b/badges/coverage-badge.svg @@ -1 +1 @@ -Statements 52.95%Statements 52.95%Branches 41.89%Branches 41.89%Lines 53.76%Lines 53.76%Functions 60.47%Functions 60.47% +Statements 47.23%Statements 47.23%Branches 34.77%Branches 34.77%Lines 48.3%Lines 48.3%Functions 53%Functions 53% diff --git a/badges/tests-badge.svg b/badges/tests-badge.svg index 515cd6b9..8d05fb3d 100644 --- a/badges/tests-badge.svg +++ b/badges/tests-badge.svg @@ -1 +1 @@ -TestsTests144/144144/144 \ No newline at end of file +TestsTests140/143140/143 \ No newline at end of file diff --git a/cypress.json b/cypress.json index e76775b3..f13b80a0 100644 --- a/cypress.json +++ b/cypress.json @@ -8,6 +8,7 @@ "ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"], "defaultCommandTimeout": 10000, "pageLoadTimeout": 120000, + "includeShadowDom": true, "cypress-plugin-snapshots": { "autoCleanUp": true, "prettier": true, diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 00000000..da18d935 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} \ No newline at end of file diff --git a/cypress/integration/ui/__snapshots__/scenario.js.snap b/cypress/integration/ui/__snapshots__/scenario.js.snap index 99c631c3..afd7c8bf 100644 --- a/cypress/integration/ui/__snapshots__/scenario.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario.js.snap @@ -880,8 +880,8 @@ exports[`use various parts of svg-edit > check tool_text_anchor_middle #0`] = ` strokecolor="#000000" strokewidth="5" fill-opacity="1" - stroke="none" stroke-opacity="1" + stroke="none" > check tool_text_anchor_end #0`] = ` strokecolor="#000000" strokewidth="5" fill-opacity="1" - stroke="none" stroke-opacity="1" + stroke="none" > check tool_text_anchor_end #0`] = ` strokecolor="none" strokewidth="5" fill-opacity="1" - stroke="none" stroke-opacity="1" + stroke="none" > { - visitAndApproveStorage(); - }); - - it('should set rectangle selection after click', function () { - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.get('#tools_rect_show') - .trigger('mousedown', {force: true}) - .wait(100) // this delay seems necessary - .trigger('mouseup', {force: true}) - .should((button) => { - expect(button).to.have.class('tool_button_current'); - }); - }); -}); diff --git a/cypress/integration/ui/issues/issue-407.js b/cypress/integration/ui/issues/issue-407.js index a67f2f0b..ad4a699f 100644 --- a/cypress/integration/ui/issues/issue-407.js +++ b/cypress/integration/ui/issues/issue-407.js @@ -20,7 +20,7 @@ describe('Fix issue 407', function () { hello - `, {parseSpecialCharSequences: false}); + `, {force: true, parseSpecialCharSequences: false}); cy.get('#tool_source_save').click(); cy.get('#svg_1').click().dblclick(); cy.get('#a_text').should('exist'); @@ -30,6 +30,6 @@ describe('Fix issue 407', function () { .dblclick({force: true}); // svgedit use the #text text field to capture the text cy.get('#text').type('1234', {force: true}); - cy.get('#a_text').should('have.text', 'he1234llo'); + cy.get('#a_text').should('have.text', 'hell1234o'); }); }); diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js index 47f9a874..b7524235 100644 --- a/cypress/integration/ui/issues/issue-408.js +++ b/cypress/integration/ui/issues/issue-408.js @@ -20,7 +20,7 @@ describe('Fix issue 408', function () { - `, {parseSpecialCharSequences: false}); + `, {force: true, parseSpecialCharSequences: false}); cy.get('#tool_source_save').click(); cy.get('#svg_6').click().dblclick(); // change context cy.get('#tool_source').click(); // reopen tool_source diff --git a/cypress/integration/ui/scenario.js b/cypress/integration/ui/scenario.js index bdd23209..c68c8d7e 100644 --- a/cypress/integration/ui/scenario.js +++ b/cypress/integration/ui/scenario.js @@ -41,7 +41,6 @@ describe('use various parts of svg-edit', function () { .trigger('mousedown', 'center', {force: true}) .trigger('mouseup', {force: true}); // svgedit use the #text text field to capture the text - // cy.get('#text').type('1234', {force: true}); cy.get('#text').type('B', {force: true}); testSnapshot(); }); diff --git a/cypress/integration/ui/tool-selection.js b/cypress/integration/ui/tool-selection.js index e8c24166..d96d37b2 100644 --- a/cypress/integration/ui/tool-selection.js +++ b/cypress/integration/ui/tool-selection.js @@ -8,13 +8,10 @@ describe('UI - Tool selection', function () { }); it('should set rectangle selection by click', function () { - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.get('#tools_rect_show') - .trigger('mousedown', {force: true}) - .wait(100) // this delay seems necessary - .trigger('mouseup', {force: true}) - .should((button) => { - expect(button).to.have.class('tool_button_current'); - }); + cy.get('#tools_rect') + .should('not.have.attr', 'pressed'); + cy.get('#tools_rect') + .trigger('click', {force: true}) + .should('have.attr', 'pressed'); }); }); diff --git a/cypress/integration/unit/coords.js b/cypress/integration/unit/coords.js index 54ccea26..51dd7ee0 100644 --- a/cypress/integration/unit/coords.js +++ b/cypress/integration/unit/coords.js @@ -1,7 +1,7 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; import * as coords from '../../../instrumented/svgcanvas/coords.js'; describe('coords', function () { diff --git a/cypress/integration/unit/history.js b/cypress/integration/unit/history.js index 8cfdb984..aa84368c 100644 --- a/cypress/integration/unit/history.js +++ b/cypress/integration/unit/history.js @@ -1,8 +1,8 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as transformlist from '../../../instrumented/common/svgtransformlist.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; +import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; import * as hstory from '../../../instrumented/svgcanvas/history.js'; describe('history', function () { diff --git a/cypress/integration/unit/math.js b/cypress/integration/unit/math.js index 9063b470..3852a2a0 100644 --- a/cypress/integration/unit/math.js +++ b/cypress/integration/unit/math.js @@ -1,7 +1,7 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as math from '../../../instrumented/common/math.js'; +import * as math from '../../../instrumented/svgcanvas/math.js'; describe('math', function () { const svg = document.createElementNS(NS.SVG, 'svg'); diff --git a/cypress/integration/unit/path.js b/cypress/integration/unit/path.js index ae823cc4..2c82c12e 100644 --- a/cypress/integration/unit/path.js +++ b/cypress/integration/unit/path.js @@ -4,7 +4,7 @@ import 'pathseg'; import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; import * as pathModule from '../../../instrumented/svgcanvas/path.js'; import {Path, Segment} from '../../../instrumented/svgcanvas/path-method.js'; import {init as unitsInit} from '../../../instrumented/common/units.js'; diff --git a/cypress/integration/unit/recalculate.js b/cypress/integration/unit/recalculate.js index f9147fe9..c1f3b0b1 100644 --- a/cypress/integration/unit/recalculate.js +++ b/cypress/integration/unit/recalculate.js @@ -1,7 +1,7 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; import * as coords from '../../../instrumented/svgcanvas/coords.js'; import * as recalculate from '../../../instrumented/svgcanvas/recalculate.js'; diff --git a/cypress/integration/unit/svgtransformlist.js b/cypress/integration/unit/svgtransformlist.js index 97fa686b..b380e01d 100644 --- a/cypress/integration/unit/svgtransformlist.js +++ b/cypress/integration/unit/svgtransformlist.js @@ -1,7 +1,7 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as transformlist from '../../../instrumented/common/svgtransformlist.js'; +import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js'; import {disableSupportsNativeTransformLists} from '../../../instrumented/common/browser.js'; import almostEqualsPlugin from '../../support/assert-almostEquals.js'; diff --git a/cypress/integration/unit/utilities-bbox.js b/cypress/integration/unit/utilities-bbox.js index 09ca6642..7f6d051b 100644 --- a/cypress/integration/unit/utilities-bbox.js +++ b/cypress/integration/unit/utilities-bbox.js @@ -4,9 +4,9 @@ import 'pathseg'; import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; -import * as transformlist from '../../../instrumented/common/svgtransformlist.js'; -import * as math from '../../../instrumented/common/math.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; +import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js'; +import * as math from '../../../instrumented/svgcanvas/math.js'; import * as path from '../../../instrumented/svgcanvas/path.js'; import setAssertionMethods from '../../support/assert-close.js'; diff --git a/cypress/integration/unit/utilities-performance.js b/cypress/integration/unit/utilities-performance.js index 6db47d1e..5eed6e93 100644 --- a/cypress/integration/unit/utilities-performance.js +++ b/cypress/integration/unit/utilities-performance.js @@ -3,9 +3,9 @@ import 'pathseg'; import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; -import * as transformlist from '../../../instrumented/common/svgtransformlist.js'; -import * as math from '../../../instrumented/common/math.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; +import * as transformlist from '../../../instrumented/svgcanvas/svgtransformlist.js'; +import * as math from '../../../instrumented/svgcanvas/math.js'; describe('utilities performance', function () { let currentLayer, groupWithMatrixTransform, textWithMatrixTransform; diff --git a/cypress/integration/unit/utilities.js b/cypress/integration/unit/utilities.js index a5c46755..6c00c9ac 100644 --- a/cypress/integration/unit/utilities.js +++ b/cypress/integration/unit/utilities.js @@ -2,7 +2,7 @@ import '../../../instrumented/editor/jquery.min.js'; import * as browser from '../../../instrumented/common/browser.js'; -import * as utilities from '../../../instrumented/common/utilities.js'; +import * as utilities from '../../../instrumented/svgcanvas/utilities.js'; import {NS} from '../../../instrumented/common/namespaces.js'; describe('utilities', function () { diff --git a/cypress/support/ui-test-helper.js b/cypress/support/ui-test-helper.js index 0c57c3aa..ef5b9b3c 100644 --- a/cypress/support/ui-test-helper.js +++ b/cypress/support/ui-test-helper.js @@ -1,5 +1,6 @@ export const approveStorage = () => { - return cy.get('#dialog_buttons > input[type=button][data-ok]') + // JFH will need to be chnaged when dialog is changed... + cy.get('elix-alert-dialog').shadow().find('#choiceButtonContainer > plain-border-button-0:nth-child(1)') .click(); }; @@ -9,7 +10,7 @@ export const visitAndApproveStorage = () => { }; export const openMainMenu = () => { - return cy.get('#main_icon').click(); + return cy.get('#main_button').click(); }; export const openEditorPreferences = () => { diff --git a/src/common/browser.js b/src/common/browser.js index 83be6b7a..5ad51503 100644 --- a/src/common/browser.js +++ b/src/common/browser.js @@ -6,9 +6,6 @@ * @copyright 2010 Jeff Schiller, 2010 Alexis Deveria */ -// Dependencies: -// 1) jQuery (for $.alert()) - import 'pathseg'; import {NS} from './namespaces.js'; diff --git a/src/editor/LayersPanel.js b/src/editor/LayersPanel.js index fb0e7a6b..1e8d08d1 100644 --- a/src/editor/LayersPanel.js +++ b/src/editor/LayersPanel.js @@ -1,3 +1,4 @@ +/* eslint-disable no-alert */ /* globals $ */ /** @@ -27,17 +28,17 @@ class LayersPanel { /** * @returns {void} */ - async newLayer () { + newLayer () { let uniqName; let i = this.svgCanvas.getCurrentDrawing().getNumLayers(); do { uniqName = this.uiStrings.layers.layer + ' ' + (++i); } while (this.svgCanvas.getCurrentDrawing().hasLayer(uniqName)); - const newName = await $.prompt(this.uiStrings.notification.enterUniqueLayerName, uniqName); + const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, uniqName); if (!newName) { return; } if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.dupeLayerName); + alert(this.uiStrings.notification.dupeLayerName); return; } this.svgCanvas.createLayer(newName); @@ -63,15 +64,15 @@ class LayersPanel { /** * - * @returns {Promise} + * @returns {void} */ - async cloneLayer () { + cloneLayer () { const name = this.svgCanvas.getCurrentDrawing().getCurrentLayerName() + ' copy'; - const newName = await $.prompt(this.uiStrings.notification.enterUniqueLayerName, name); + const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, name); if (!newName) { return; } if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.dupeLayerName); + alert(this.uiStrings.notification.dupeLayerName); return; } this.svgCanvas.cloneLayer(newName); @@ -110,13 +111,13 @@ class LayersPanel { /** * @returns {void} */ - async layerRename () { + layerRename () { // const curIndex = $('#layerlist tr.layersel').prevAll().length; // Currently unused const oldName = $('#layerlist tr.layersel td.layername').text(); - const newName = await $.prompt(this.uiStrings.notification.enterNewLayerName, ''); + const newName = prompt(this.uiStrings.notification.enterNewLayerName, ''); if (!newName) { return; } if (oldName === newName || this.svgCanvas.getCurrentDrawing().hasLayer(newName)) { - /* await */ $.alert(this.uiStrings.notification.layerHasThatName); + alert(this.uiStrings.notification.layerHasThatName); return; } this.svgCanvas.renameCurrentLayer(newName); diff --git a/src/editor/components/PaintBox.js b/src/editor/components/PaintBox.js index b4cbce3d..eb2a89e2 100644 --- a/src/editor/components/PaintBox.js +++ b/src/editor/components/PaintBox.js @@ -138,22 +138,6 @@ class PaintBox { this.setPaint(paint); return (paint); } - - /** - * @returns {void} - */ - prep () { - const ptype = this.paint.type; - - switch (ptype) { - case 'linearGradient': - case 'radialGradient': { - const paint = new $.jGraduate.Paint({copy: this.paint}); - this.setPaint(this.type, paint); - break; - } - } - } } PaintBox.ctr = 0; diff --git a/src/editor/components/jgraduate/jQuery.jGraduate.js b/src/editor/components/jgraduate/jQuery.jGraduate.js index 8b571617..81f3d84a 100644 --- a/src/editor/components/jgraduate/jQuery.jGraduate.js +++ b/src/editor/components/jgraduate/jQuery.jGraduate.js @@ -283,7 +283,8 @@ export default function jQueryPluginJGraduate ($) { const $wc = (selector) => $($shadowRoot.querySelectorAll(selector)); if (!idref) { - /* await */ $.alert('Container element must have an id attribute to maintain unique id strings for sub-elements.'); + // eslint-disable-next-line no-alert + alert('Container element must have an id attribute to maintain unique id strings for sub-elements.'); return; } diff --git a/src/editor/components/seMenuItem.js b/src/editor/components/seMenuItem.js index 48112456..288ea17e 100644 --- a/src/editor/components/seMenuItem.js +++ b/src/editor/components/seMenuItem.js @@ -8,7 +8,7 @@ template.innerHTML = ` - + diff --git a/src/editor/components/seSpinInput.js b/src/editor/components/seSpinInput.js index 9a8b0d9f..78ebc01c 100644 --- a/src/editor/components/seSpinInput.js +++ b/src/editor/components/seSpinInput.js @@ -18,7 +18,7 @@ template.innerHTML = ` padding: 0px; } - + label `; diff --git a/src/editor/dialogs/cmenuDialog.js b/src/editor/dialogs/cmenuDialog.js index 6d6750ef..b47a5458 100644 --- a/src/editor/dialogs/cmenuDialog.js +++ b/src/editor/dialogs/cmenuDialog.js @@ -184,7 +184,7 @@ export class SeCMenuDialog extends HTMLElement { }); break; default: - super.attributeChangedCallback(name, oldValue, newValue); + // super.attributeChangedCallback(name, oldValue, newValue); break; } } diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 94707834..0623662f 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -115,7 +115,7 @@ export class SeCMenuLayerDialog extends HTMLElement { } break; default: - super.attributeChangedCallback(name, oldValue, newValue); + // super.attributeChangedCallback(name, oldValue, newValue); break; } } diff --git a/src/editor/dialogs/editorPreferencesDialog.js b/src/editor/dialogs/editorPreferencesDialog.js index f693a334..e8a6b167 100644 --- a/src/editor/dialogs/editorPreferencesDialog.js +++ b/src/editor/dialogs/editorPreferencesDialog.js @@ -194,11 +194,11 @@ template.innerHTML = ` Grid - + Snapping on/off - + Snapping Step-Size: diff --git a/src/editor/dialogs/index.js b/src/editor/dialogs/index.js index faa5f538..5e22a5af 100644 --- a/src/editor/dialogs/index.js +++ b/src/editor/dialogs/index.js @@ -3,3 +3,4 @@ import './editorPreferencesDialog.js'; import './svgSourceDialog.js'; import './cmenuDialog.js'; import './cmenuLayersDialog.js'; +import './seSelectDialog.js'; diff --git a/src/editor/dialogs/seSelectDialog.js b/src/editor/dialogs/seSelectDialog.js new file mode 100644 index 00000000..a02caf03 --- /dev/null +++ b/src/editor/dialogs/seSelectDialog.js @@ -0,0 +1,13 @@ +// eslint-disable-next-line node/no-unpublished-import +import AlertDialog from 'elix/define/AlertDialog.js'; + +const dialog = new AlertDialog(); +const seSelect = async (text, choices) => { + dialog.textContent = text; + dialog.choices = choices; + dialog.open(); + const response = await dialog.whenClosed(); + return response.choice; +}; + +window.seSelect = seSelect; diff --git a/src/editor/extensions/ext-foreignobject/ext-foreignobject.js b/src/editor/extensions/ext-foreignobject/ext-foreignobject.js index 175a9954..60cc0b64 100644 --- a/src/editor/extensions/ext-foreignobject/ext-foreignobject.js +++ b/src/editor/extensions/ext-foreignobject/ext-foreignobject.js @@ -196,11 +196,12 @@ export default { // Create source save/cancel buttons /* const save = */ $('#tool_source_save').clone() .hide().attr('id', 'foreign_save').unbind() - .appendTo('#tool_source_back').click(async function () { + .appendTo('#tool_source_back').click(function () { if (!editingforeign) { return; } if (!setForeignString($('#svg_source_textarea').val())) { - const ok = await $.confirm('Errors found. Revert to original?'); + // eslint-disable-next-line no-alert + const ok = confirm('Errors found. Revert to original?'); if (!ok) { return; } endChanges(); } else { diff --git a/src/editor/extensions/ext-helloworld/ext-helloworld.js b/src/editor/extensions/ext-helloworld/ext-helloworld.js index a6bce133..a88c2e95 100644 --- a/src/editor/extensions/ext-helloworld/ext-helloworld.js +++ b/src/editor/extensions/ext-helloworld/ext-helloworld.js @@ -78,7 +78,7 @@ export default { }); // Show the text using the custom alert function - $.alert(text); + alert(text); // eslint-disable-line no-alert } } }; diff --git a/src/editor/extensions/ext-imagelib/ext-imagelib.js b/src/editor/extensions/ext-imagelib/ext-imagelib.js index bef9756f..87c38b46 100644 --- a/src/editor/extensions/ext-imagelib/ext-imagelib.js +++ b/src/editor/extensions/ext-imagelib/ext-imagelib.js @@ -223,7 +223,7 @@ export default { } else { pending[id].entry.remove(); } - // await $.alert('Unexpected data was returned: ' + response, function() { + // await alert('Unexpected data was returned: ' + response, function() { // if (mode !== 'm') { // closeBrowser(); // } else { diff --git a/src/editor/extensions/ext-markers/ext-markers.js b/src/editor/extensions/ext-markers/ext-markers.js index 5c303b11..92e8700c 100644 --- a/src/editor/extensions/ext-markers/ext-markers.js +++ b/src/editor/extensions/ext-markers/ext-markers.js @@ -404,12 +404,13 @@ export default { /** * @param {"start"|"mid"|"end"} pos - * @returns {Promise} Resolves to `undefined` + * @returns {void} Resolves to `undefined` */ - async function showTextPrompt (pos) { + function showTextPrompt (pos) { let def = $('#' + pos + '_marker').val(); if (def.substr(0, 1) === '\\') { def = ''; } - const txt = await $.prompt('Enter text for ' + pos + ' marker', def); + // eslint-disable-next-line no-alert + const txt = prompt('Enter text for ' + pos + ' marker', def); if (txt) { triggerTextEntry(pos, txt); } diff --git a/src/editor/extensions/ext-mathjax/ext-mathjax.js b/src/editor/extensions/ext-mathjax/ext-mathjax.js index 562d222f..133c2375 100644 --- a/src/editor/extensions/ext-mathjax/ext-mathjax.js +++ b/src/editor/extensions/ext-mathjax/ext-mathjax.js @@ -202,7 +202,8 @@ export default { }); } catch (e) { console.log('Failed loading MathJax.'); // eslint-disable-line no-console - $.alert('Failed loading MathJax. You will not be able to change the mathematics.'); + // eslint-disable-next-line no-alert + alert('Failed loading MathJax. You will not be able to change the mathematics.'); } } } diff --git a/src/editor/extensions/ext-polygon/ext-polygon.js b/src/editor/extensions/ext-polygon/ext-polygon.js index dfc96ae8..415cb644 100644 --- a/src/editor/extensions/ext-polygon/ext-polygon.js +++ b/src/editor/extensions/ext-polygon/ext-polygon.js @@ -133,7 +133,7 @@ export default { // Todo: Uncomment the setItexString() function above and handle ajaxEndpoint? /* if (!setItexString($('#svg_source_textarea').val())) { - const ok = await $.confirm('Errors found. Revert to original?', function (ok) { + const ok = confirm('Errors found. Revert to original?', function (ok) { if (!ok) { return false; } diff --git a/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js b/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js index 879c28da..a0bf4b38 100644 --- a/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js +++ b/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js @@ -64,7 +64,8 @@ export default { `).appendTo('body') .submit().remove(); - $.alert(strings.saved); + // eslint-disable-next-line no-alert + alert(strings.saved); top.window.location = '/' + name; } }); diff --git a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js index 0d56a321..5310aca4 100644 --- a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js +++ b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js @@ -146,7 +146,8 @@ export default { } if (note.length) { - await $.alert(note); + // eslint-disable-next-line no-alert + alert(note); } const filename = getFileNameFromTitle(); diff --git a/src/editor/extensions/ext-storage/ext-storage.js b/src/editor/extensions/ext-storage/ext-storage.js index 3121e623..dddadd53 100644 --- a/src/editor/extensions/ext-storage/ext-storage.js +++ b/src/editor/extensions/ext-storage/ext-storage.js @@ -1,3 +1,4 @@ +/* globals seSelect */ /** * @file ext-storage.js * @@ -181,9 +182,9 @@ export default { const storagePrompt = new URL(top.location).searchParams.get('storagePrompt'); const strings = await loadExtensionTranslation(svgEditor.pref('lang')); const { - message, storagePrefsAndContent, storagePrefsOnly, + message /* , storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, - rememberLabel, rememberTooltip + rememberLabel, rememberTooltip */ } = strings; // No need to run this one-time dialog again just because the user @@ -213,6 +214,7 @@ export default { ) // ...then show the storage prompt. )) { + /* const options = []; if (storage) { options.unshift( @@ -226,20 +228,13 @@ export default { {value: 'noPrefsOrContent', text: storageNoPrefs} ); } - - // Hack to temporarily provide a wide and high enough dialog - const oldContainerWidth = $('#dialog_container')[0].style.width, - oldContainerMarginLeft = $('#dialog_container')[0].style.marginLeft, - oldContentHeight = $('#dialog_content')[0].style.height, - oldContainerHeight = $('#dialog_container')[0].style.height; - $('#dialog_content')[0].style.height = '120px'; - $('#dialog_container')[0].style.height = '170px'; - $('#dialog_container')[0].style.width = '800px'; - $('#dialog_container')[0].style.marginLeft = '-400px'; + */ + const options = storage ? ['prefsAndContent', 'prefsOnly', 'noPrefsOrContent'] : ['prefsOnly', 'noPrefsOrContent']; // Open select-with-checkbox dialog // From svg-editor.js svgEditor.storagePromptState = 'waiting'; + /* JFH !!!!! const {response: pref, checked} = await $.select( message, options, @@ -251,6 +246,8 @@ export default { tooltip: rememberTooltip } ); + */ + const pref = await seSelect(message, options); if (pref && pref !== 'noPrefsOrContent') { // Regardless of whether the user opted // to remember the choice (and move to a URL which won't @@ -263,7 +260,7 @@ export default { // the user does indicate a wish to store their info, we // don't want ask them again upon page refresh so move // them instead to a URL which does not always prompt - if (storagePrompt === 'true' && checked) { + if (storagePrompt === 'true' /* && checked */) { replaceStoragePrompt(); return; } @@ -274,19 +271,13 @@ export default { ) { emptyStorage(); } - if (pref && checked) { + if (pref /* && checked */) { // Open a URL which won't set storage and won't prompt user about storage replaceStoragePrompt('false'); return; } } - // Reset width/height of dialog (e.g., for use by Export) - $('#dialog_container')[0].style.width = oldContainerWidth; - $('#dialog_container')[0].style.marginLeft = oldContainerMarginLeft; - $('#dialog_content')[0].style.height = oldContentHeight; - $('#dialog_container')[0].style.height = oldContainerHeight; - // It should be enough to (conditionally) add to storage on // beforeunload, but if we wished to update immediately, // we might wish to try setting: diff --git a/src/editor/extensions/ext-webappfind/ext-webappfind.js b/src/editor/extensions/ext-webappfind/ext-webappfind.js index 219b6ee6..9a4cf89a 100644 --- a/src/editor/extensions/ext-webappfind/ext-webappfind.js +++ b/src/editor/extensions/ext-webappfind/ext-webappfind.js @@ -63,7 +63,8 @@ export default { } */ break; case 'save-end': - $.alert(`save complete for pathID ${pathID}!`); + // eslint-disable-next-line no-alert + alert(`save complete for pathID ${pathID}!`); break; default: throw new Error('Unexpected WebAppFind event type'); diff --git a/src/editor/images/netlify-dark.svg b/src/editor/images/netlify-dark.svg new file mode 100644 index 00000000..b45b6c18 --- /dev/null +++ b/src/editor/images/netlify-dark.svg @@ -0,0 +1,17 @@ + + + + netlify-callout-vertical-dark + Created with Sketch. + + + + + + + + + + + + \ No newline at end of file diff --git a/src/editor/index.html b/src/editor/index.html index d0dd7287..69e97553 100644 --- a/src/editor/index.html +++ b/src/editor/index.html @@ -74,7 +74,7 @@ L a y e r s - + @@ -86,7 +86,7 @@ - diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index 1ba3bc77..08c661a4 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -1,4 +1,5 @@ -/* globals jQuery */ +/* eslint-disable no-alert */ +/* globals jQuery seSelect */ /** * The main module for the visual SVG Editor. * @@ -24,11 +25,7 @@ import { } from './contextmenu.js'; import SvgCanvas from '../svgcanvas/svgcanvas.js'; - import jQueryPluginJSHotkeys from './js-hotkeys/jquery.hotkeys.min.js'; -import jQueryPluginContextMenu from './contextmenu/jQuery.contextMenu.js'; -import jQueryPluginDBox from '../svgcanvas/dbox.js'; - import ConfigObj from './ConfigObj.js'; import LayersPanel from './LayersPanel.js'; @@ -69,8 +66,8 @@ const editor = { setStrings }; -const $ = [jQueryPluginJSHotkeys, jQueryPluginContextMenu].reduce((jq, func) => func(jq), jQuery); - +// JFH hotkey is used for text input. +const $ = [jQueryPluginJSHotkeys].reduce((jq, func) => func(jq), jQuery); const homePage = 'https://github.com/SVG-Edit/svgedit'; const callbacks = []; @@ -97,7 +94,6 @@ let svgCanvas, const loadSvgString = (str, {noAlert} = {}) => { const success = svgCanvas.setSvgString(str) !== false; if (success) return; - // eslint-disable-next-line no-alert if (!noAlert) window.alert(uiStrings.notification.errorLoadingSVG); throw new Error('Error loading SVG'); }; @@ -260,9 +256,6 @@ editor.init = () => { const {langParam, langData} = await editor.putLocale(editor.pref('lang'), goodLangs); await setLang(langParam, langData); - const {ok, cancel} = uiStrings.common; - jQueryPluginDBox($, {ok, cancel}); - $id('svg_container').style.visibility = 'visible'; try { @@ -718,7 +711,7 @@ editor.init = () => { editor.pref('save_notice_done', 'all'); } if (done !== 'part') { - $.alert(note); + alert(note); } } }; @@ -735,7 +728,7 @@ editor.init = () => { exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one if (!exportWindow || exportWindow.closed) { - /* await */ $.alert(uiStrings.notification.popupWindowBlocked); + alert(uiStrings.notification.popupWindowBlocked); return; } @@ -852,12 +845,12 @@ editor.init = () => { /** * @param {PlainObject} [opts={}] * @param {boolean} [opts.cancelDeletes=false] - * @returns {Promise} Resolves to `undefined` + * @returns {void} Resolves to `undefined` */ - async function promptImgURL ({cancelDeletes = false} = {}) { + function promptImgURL ({cancelDeletes = false} = {}) { let curhref = svgCanvas.getHref(selectedElement); curhref = curhref.startsWith('data:') ? '' : curhref; - const url = await $.prompt(uiStrings.notification.enterNewImgURL, curhref); + const url = prompt(uiStrings.notification.enterNewImgURL, curhref); if (url) { setImageURL(url); } else if (cancelDeletes) { @@ -1514,15 +1507,6 @@ editor.init = () => { updateTitle(); }; - /** - * Makes sure the current selected paint is available to work with. - * @returns {void} - */ - const prepPaints = () => { - $id('fill_color').prep(); - $id('stroke_color').prep(); - }; - /** * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:extension_added} ext @@ -1666,7 +1650,7 @@ editor.init = () => { exportWindow = window.open('', exportWindowName); // A hack to get the window via JSON-able name without opening a new one } if (!exportWindow || exportWindow.closed) { - /* await */ $.alert(uiStrings.notification.popupWindowBlocked); + alert(uiStrings.notification.popupWindowBlocked); return; } exportWindow.location.href = data.output; @@ -1772,7 +1756,7 @@ editor.init = () => { // fired when user wants to move elements to another layer let promptMoveLayerOnce = false; - $('#selLayerNames').change(async (evt) => { + $('#selLayerNames').change((evt) => { const destLayer = evt.currentTarget.options[evt.currentTarget.selectedIndex].value; const confirmStr = uiStrings.notification.QmoveElemsToLayer.replace('%s', destLayer); /** @@ -1790,7 +1774,7 @@ editor.init = () => { if (promptMoveLayerOnce) { moveToLayer(true); } else { - const ok = await $.confirm(confirmStr); + const ok = confirm(confirmStr); if (!ok) { return; } @@ -1834,7 +1818,7 @@ editor.init = () => { if (!valid) { e.target.value = selectedElement.getAttribute(attr); - /* await */ $.alert(uiStrings.notification.invalidAttrValGiven); + alert(uiStrings.notification.invalidAttrValGiven); return false; } @@ -1872,7 +1856,7 @@ editor.init = () => { if (!valid) { evt.currentTarget.value = selectedElement.getAttribute(attr); - /* await */ $.alert(uiStrings.notification.invalidAttrValGiven); + alert(uiStrings.notification.invalidAttrValGiven); return false; } @@ -2403,11 +2387,11 @@ editor.init = () => { /** * - * @returns {Promise} Resolves to `undefined` + * @returns {void} Resolves to `undefined` */ - const makeHyperlink = async () => { + const makeHyperlink = () => { if (!isNullish(selectedElement) || multiselected) { - const url = await $.prompt(uiStrings.notification.enterNewLinkURL, 'http://'); + const url = prompt(uiStrings.notification.enterNewLinkURL, 'http://'); if (url) { svgCanvas.makeHyperlink(url); } @@ -2512,11 +2496,11 @@ editor.init = () => { /** * @fires module:svgcanvas.SvgCanvas#event:ext_onNewDocument - * @returns {Promise} Resolves to `undefined` + * @returns {void} */ - const clickClear = async () => { + const clickClear = () => { const [x, y] = configObj.curConfig.dimensions; - const ok = await $.confirm(uiStrings.notification.QwantToClear); + const ok = confirm(uiStrings.notification.QwantToClear); if (!ok) { return; } @@ -2527,7 +2511,6 @@ editor.init = () => { zoomImage(); layersPanel.populateLayers(); updateContextPanel(); - prepPaints(); svgCanvas.runExtensions('onNewDocument'); }; @@ -2581,24 +2564,13 @@ editor.init = () => { * @returns {Promise} Resolves to `undefined` */ const clickExport = async () => { - const imgType = await $.select('Select an image type for export: ', [ + const imgType = await seSelect('Select an image type for export: ', [ // See http://kangax.github.io/jstests/toDataUrl_mime_type_test/ for a useful list of MIME types and browser support // 'ICO', // Todo: Find a way to preserve transparency in SVG-Edit if not working presently and do full packaging for x-icon; then switch back to position after 'PNG' 'PNG', 'JPEG', 'BMP', 'WEBP', 'PDF' - ], () => { - const sel = $(this); - if (sel.val() === 'JPEG' || sel.val() === 'WEBP') { - if (!$('#image-slider').length) { - $(`${uiStrings.ui.quality} - - `).appendTo(sel.parent()); - } - } else { - $('#image-slider').parent().remove(); - } - }); // todo: replace hard-coded msg with uiStrings.notification. + ]); + if (!imgType) { return; } @@ -2646,7 +2618,7 @@ editor.init = () => { if (!customExportImage) { openExportWindow(); } - const quality = Number.parseInt($('#image-slider').val()) / 100; + const quality = 1; // JFH !!! Number.parseInt($('#image-slider').val()) / 100; /* const results = */ await svgCanvas.rasterExport(imgType, quality, exportWindowName); } }; @@ -2824,9 +2796,9 @@ editor.init = () => { /** * @param {Event} e - * @returns {Promise} Resolves to `undefined` + * @returns {void} Resolves to `undefined` */ - const saveSourceEditor = async (e) => { + const saveSourceEditor = (e) => { if (!editingsource) { return; } const saveChanges = () => { svgCanvas.clearSelection(); @@ -2834,11 +2806,10 @@ editor.init = () => { zoomImage(); layersPanel.populateLayers(); updateTitle(); - prepPaints(); }; if (!svgCanvas.setSvgString(e.detail.value)) { - const ok = await $.confirm(uiStrings.notification.QerrorsRevertToSource); + const ok = confirm(uiStrings.notification.QerrorsRevertToSource); if (!ok) { return; } @@ -2881,15 +2852,15 @@ editor.init = () => { svgCanvas.setDocumentTitle(title); if (w !== 'fit' && !isValidUnit('width', w)) { - /* await */ $.alert(uiStrings.notification.invalidAttrValGiven); + alert(uiStrings.notification.invalidAttrValGiven); return false; } if (h !== 'fit' && !isValidUnit('height', h)) { - /* await */ $.alert(uiStrings.notification.invalidAttrValGiven); + alert(uiStrings.notification.invalidAttrValGiven); return false; } if (!svgCanvas.setResolution(w, h)) { - /* await */ $.alert(uiStrings.notification.noContentToFitTo); + alert(uiStrings.notification.noContentToFitTo); return false; } // Set image save option @@ -2933,9 +2904,9 @@ editor.init = () => { /** * @param {Event} e - * @returns {Promise} Resolves to `undefined` + * @returns {void} Resolves to `undefined` */ - const cancelOverlays = async (e) => { + const cancelOverlays = (e) => { $('#dialog_box').hide(); if (!editingsource && !docprops && !preferences) { if (curContext) { @@ -2946,7 +2917,7 @@ editor.init = () => { if (editingsource) { if (origSource !== e.detail.value) { - const ok = await $.confirm(uiStrings.notification.QignoreSourceChanges); + const ok = confirm(uiStrings.notification.QignoreSourceChanges); if (ok) { hideSourceEditor(); } @@ -2977,7 +2948,7 @@ editor.init = () => { }); $('#url_notice').click(() => { - /* await */ $.alert(this.title); + alert(this.title); }); $('#change_image_url').click(promptImgURL); @@ -3571,7 +3542,7 @@ editor.init = () => { if (undoMgr.getUndoStackSize() === 0) { return true; } - return $.confirm(uiStrings.notification.QwantToOpen); + return confirm(uiStrings.notification.QwantToOpen); }; /** @@ -3883,7 +3854,7 @@ editor.loadFromURL = function (url, {cache, noAlert} = {}) { reject(new Error('URLLoadFail')); return; } - $.alert(uiStrings.notification.URLLoadFail + ': \n' + err); + alert(uiStrings.notification.URLLoadFail + ': \n' + err); resolve(); }, complete () { diff --git a/src/svgcanvas/clear.js b/src/svgcanvas/clear.js index 29fa3137..e7045d7a 100644 --- a/src/svgcanvas/clear.js +++ b/src/svgcanvas/clear.js @@ -5,7 +5,7 @@ * @license MIT * @copyright 2011 Jeff Schiller */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; +import jQueryPluginSVG from './jQuery.attr.js'; import {NS} from '../common/namespaces.js'; const $ = jQueryPluginSVG(jQuery); diff --git a/src/svgcanvas/copy-elem.js b/src/svgcanvas/copy-elem.js index 9ad31323..ef247fba 100644 --- a/src/svgcanvas/copy-elem.js +++ b/src/svgcanvas/copy-elem.js @@ -1,6 +1,6 @@ /* globals jQuery */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` import {isWebkit} from '../common/browser.js'; import {convertPath} from './path.js'; import {preventClickDefault} from './utilities.js'; diff --git a/src/svgcanvas/dbox.js b/src/svgcanvas/dbox.js deleted file mode 100644 index 5d3a1968..00000000 --- a/src/svgcanvas/dbox.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * @module jQueryPluginDBox - */ -/** -* @param {external:jQuery} $ -* @param {PlainObject} [strings] -* @param {PlainObject} [strings.ok] -* @param {PlainObject} [strings.cancel] -* @returns {external:jQuery} -*/ -export default function jQueryPluginDBox ($, { - ok: okString = 'Ok', - cancel: cancelString = 'Cancel' -} = {}) { - // This sets up alternative dialog boxes. They mostly work the same way as - // their UI counterparts, expect instead of returning the result, a callback - // needs to be included that returns the result as its first parameter. - // In the future we may want to add additional types of dialog boxes, since - // they should be easy to handle this way. - $('#dialog_container').draggable({ - cancel: '#dialog_content, #dialog_buttons *', - containment: 'window' - }).css('position', 'absolute'); - - const box = $('#dialog_box'), - btnHolder = $('#dialog_buttons'), - dialogContent = $('#dialog_content'); - - /** - * @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject - * @property {string|true} response - * @property {boolean} checked - */ - - /** - * Resolves to `false` (if cancelled), for prompts and selects - * without checkboxes, it resolves to the value of the form control. For other - * types without checkboxes, it resolves to `true`. For checkboxes, it resolves - * to an object with the `response` key containing the same value as the previous - * mentioned (string or `true`) and a `checked` (boolean) property. - * @typedef {Promise} module:jQueryPluginDBox.ResultPromise - */ - /** - * @typedef {PlainObject} module:jQueryPluginDBox.SelectOption - * @property {string} text - * @property {string} value - */ - /** - * @typedef {PlainObject} module:jQueryPluginDBox.CheckboxInfo - * @property {string} label Label for the checkbox - * @property {string} value Value of the checkbox - * @property {string} tooltip Tooltip on the checkbox label - * @property {boolean} checked Whether the checkbox is checked by default - */ - /** - * Triggered upon a change of value for the select pull-down. - * @callback module:jQueryPluginDBox.SelectChangeListener - * @returns {void} - */ - /** - * Creates a dialog of the specified type with a given message - * and any defaults and type-specific metadata. Returns a `Promise` - * which resolves differently depending on whether the dialog - * was cancelled or okayed (with the response and any checked state). - * @param {"alert"|"prompt"|"select"|"process"} type - * @param {string} msg - * @param {string} [defaultVal] - * @param {module:jQueryPluginDBox.SelectOption[]} [opts] - * @param {module:jQueryPluginDBox.SelectChangeListener} [changeListener] - * @param {module:jQueryPluginDBox.CheckboxInfo} [checkbox] - * @returns {jQueryPluginDBox.ResultPromise} - */ - function dbox (type, msg, defaultVal, opts, changeListener, checkbox) { - dialogContent.html('' + msg.replace(/\n/g, '') + '') - .toggleClass('prompt', (type === 'prompt')); - btnHolder.empty(); - - const ok = $('').appendTo(btnHolder); - - return new Promise((resolve, reject) => { // eslint-disable-line promise/avoid-new - if (type !== 'alert') { - $('') - .appendTo(btnHolder) - .click(function () { - box.hide(); - resolve(false); - }); - } - - let ctrl, chkbx; - if (type === 'prompt') { - ctrl = $('').prependTo(btnHolder); - ctrl.val(defaultVal || ''); - ctrl.bind('keydown', 'return', function () { ok.click(); }); - } else if (type === 'select') { - const div = $(''); - ctrl = $(``).appendTo(div); - if (checkbox) { - const label = $('').text(checkbox.label); - chkbx = $('').appendTo(label); - chkbx.val(checkbox.value); - if (checkbox.tooltip) { - label.attr('title', checkbox.tooltip); - } - chkbx.prop('checked', Boolean(checkbox.checked)); - div.append($('').append(label)); - } - $.each(opts || [], function (opt, val) { - if (typeof val === 'object') { - ctrl.append($('').val(val.value).html(val.text)); - } else { - ctrl.append($('').html(val)); - } - }); - dialogContent.append(div); - if (defaultVal) { - ctrl.val(defaultVal); - } - if (changeListener) { - ctrl.bind('change', 'return', changeListener); - } - ctrl.bind('keydown', 'return', function () { ok.click(); }); - } else if (type === 'process') { - ok.hide(); - } - - box.show(); - - ok.click(function () { - box.hide(); - const response = (type === 'prompt' || type === 'select') ? ctrl.val() : true; - if (chkbx) { - resolve({response, checked: chkbx.prop('checked')}); - return; - } - resolve(response); - }).focus(); - - if (type === 'prompt' || type === 'select') { - ctrl.focus(); - } - }); - } - - /** - * @param {string} msg Message to alert - * @returns {jQueryPluginDBox.ResultPromise} - */ - $.alert = function (msg) { - return dbox('alert', msg); - }; - /** - * @param {string} msg Message for which to ask confirmation - * @returns {jQueryPluginDBox.ResultPromise} - */ - $.confirm = function (msg) { - return dbox('confirm', msg); - }; - /** - * @param {string} msg Message to indicate upon cancelable indicator - * @returns {jQueryPluginDBox.ResultPromise} - */ - $.process_cancel = function (msg) { - return dbox('process', msg); - }; - /** - * @param {string} msg Message to accompany the prompt - * @param {string} [defaultText=""] The default text to show for the prompt - * @returns {jQueryPluginDBox.ResultPromise} - */ - $.prompt = function (msg, defaultText = '') { - return dbox('prompt', msg, defaultText); - }; - $.select = function (msg, opts, changeListener, txt, checkbox) { - return dbox('select', msg, txt, opts, changeListener, checkbox); - }; - return $; -} diff --git a/src/svgcanvas/elem-get-set.js b/src/svgcanvas/elem-get-set.js index d74fc73d..aee1818d 100644 --- a/src/svgcanvas/elem-get-set.js +++ b/src/svgcanvas/elem-get-set.js @@ -6,7 +6,7 @@ */ import * as hstry from './history.js'; -import jQueryPluginSVG from '../common/jQuery.attr.js'; +import jQueryPluginSVG from './jQuery.attr.js'; import {NS} from '../common/namespaces.js'; import { getVisibleElements, getStrokedBBoxDefaultVisible, findDefs, diff --git a/src/svgcanvas/event.js b/src/svgcanvas/event.js index 13462db6..c2303e33 100644 --- a/src/svgcanvas/event.js +++ b/src/svgcanvas/event.js @@ -5,7 +5,7 @@ * @license MIT * @copyright 2011 Jeff Schiller */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute import { assignAttributes, cleanupElement, getElem, getRotationAngle, snapToGrid, walkTree, getBBox as utilsGetBBox, isNullish, preventClickDefault, setHref diff --git a/src/common/jQuery.attr.js b/src/svgcanvas/jQuery.attr.js similarity index 100% rename from src/common/jQuery.attr.js rename to src/svgcanvas/jQuery.attr.js diff --git a/src/svgcanvas/paste-elem.js b/src/svgcanvas/paste-elem.js index a95ee064..392eb6ba 100644 --- a/src/svgcanvas/paste-elem.js +++ b/src/svgcanvas/paste-elem.js @@ -1,6 +1,6 @@ /* globals jQuery */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` import { getStrokedBBoxDefaultVisible } from './utilities.js'; diff --git a/src/svgcanvas/recalculate.js b/src/svgcanvas/recalculate.js index 18100a41..3617887c 100644 --- a/src/svgcanvas/recalculate.js +++ b/src/svgcanvas/recalculate.js @@ -5,7 +5,7 @@ * @license MIT */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` import {NS} from '../common/namespaces.js'; import {convertToNum} from '../common/units.js'; import {isWebkit} from '../common/browser.js'; diff --git a/src/svgcanvas/selected-elem.js b/src/svgcanvas/selected-elem.js index 20a0d5f3..fb3d74ce 100644 --- a/src/svgcanvas/selected-elem.js +++ b/src/svgcanvas/selected-elem.js @@ -6,7 +6,7 @@ * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute import {NS} from '../common/namespaces.js'; import * as hstry from './history.js'; import * as pathModule from './path.js'; diff --git a/src/svgcanvas/selection.js b/src/svgcanvas/selection.js index 79847c75..f7d69f0d 100644 --- a/src/svgcanvas/selection.js +++ b/src/svgcanvas/selection.js @@ -11,7 +11,7 @@ import { isNullish, getBBox as utilsGetBBox, getStrokedBBoxDefaultVisible } from './utilities.js'; import {transformPoint, transformListToTransform, rectsIntersect} from './math.js'; -import jQueryPluginSVG from '../common/jQuery.attr.js'; +import jQueryPluginSVG from './jQuery.attr.js'; import { getTransformList } from './svgtransformlist.js'; diff --git a/src/svgcanvas/svg-exec.js b/src/svgcanvas/svg-exec.js index 6a739683..611712cd 100644 --- a/src/svgcanvas/svg-exec.js +++ b/src/svgcanvas/svg-exec.js @@ -8,7 +8,7 @@ import {jsPDF} from 'jspdf/dist/jspdf.es.min.js'; import 'svg2pdf.js/dist/svg2pdf.es.js'; -import jQueryPluginSVG from '../common/jQuery.attr.js'; +import jQueryPluginSVG from './jQuery.attr.js'; import * as hstry from './history.js'; import { text2xml, cleanupElement, findDefs, getHref, preventClickDefault, diff --git a/src/svgcanvas/svgcanvas.js b/src/svgcanvas/svgcanvas.js index 846db4a6..d8a5a38f 100644 --- a/src/svgcanvas/svgcanvas.js +++ b/src/svgcanvas/svgcanvas.js @@ -17,8 +17,7 @@ import {Canvg as canvg} from 'canvg'; import 'pathseg'; -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` -import jQueryPluginDBox from './dbox.js'; +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` import * as pathModule from './path.js'; import * as hstry from './history.js'; @@ -117,7 +116,7 @@ import { init as clearInit } from './clear.js'; -let $ = jQueryPluginSVG(jQuery); +const $ = jQueryPluginSVG(jQuery); const { MoveElementCommand, InsertElementCommand, RemoveElementCommand, ChangeElementCommand, BatchCommand @@ -1741,7 +1740,6 @@ class SvgCanvas { */ this.setUiStrings = function (strs) { Object.assign(uiStrings, strs.notification); - $ = jQueryPluginDBox($, strs.common); pathModule.setUiStrings(strs); }; diff --git a/src/svgcanvas/text-actions.js b/src/svgcanvas/text-actions.js index 6b74330f..fe2fca19 100644 --- a/src/svgcanvas/text-actions.js +++ b/src/svgcanvas/text-actions.js @@ -6,7 +6,7 @@ * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; +import jQueryPluginSVG from './jQuery.attr.js'; import {NS} from '../common/namespaces.js'; import { transformPoint, getMatrix @@ -263,15 +263,6 @@ export const textActionsMethod = (function () { return out; } - /* -// Not currently in use -function hideCursor () { -if (cursor) { -cursor.setAttribute('visibility', 'hidden'); -} -} -*/ - /** * * @param {Event} evt diff --git a/src/svgcanvas/utilities.js b/src/svgcanvas/utilities.js index c7e68de5..6b7fd484 100644 --- a/src/svgcanvas/utilities.js +++ b/src/svgcanvas/utilities.js @@ -7,7 +7,7 @@ * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */ -import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` +import jQueryPluginSVG from './jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr` import {NS} from '../common/namespaces.js'; import {getTransformList} from './svgtransformlist.js'; import {setUnitAttr, getTypeMap} from '../common/units.js';
' + msg.replace(/\n/g, '
') + '