diff --git a/src/editor/components/index.js b/src/editor/components/index.js
index 38adf0bb..8f16e993 100644
--- a/src/editor/components/index.js
+++ b/src/editor/components/index.js
@@ -1,10 +1,12 @@
import './seButton.js';
import './seFlyingButton.js';
import './seExplorerButton.js';
-import './seDropdown.js';
+import './seZoom.js';
import './seInput.js';
import './seSpinInput.js';
import './sePalette.js';
import './seMenu.js';
import './seMenuItem.js';
+import './seList.js';
+import './seListItem.js';
import './seColorPicker.js';
diff --git a/src/editor/components/seList.js b/src/editor/components/seList.js
new file mode 100644
index 00000000..fbf3e73d
--- /dev/null
+++ b/src/editor/components/seList.js
@@ -0,0 +1,87 @@
+/* eslint-disable node/no-unpublished-import */
+import 'elix/define/DropdownList.js';
+
+const template = document.createElement('template');
+template.innerHTML = `
+
+
+
+
+
+
+`;
+/**
+ * @class SeList
+ */
+export class SeList extends HTMLElement {
+ /**
+ * @function constructor
+ */
+ constructor () {
+ super();
+ // create the shadowDom and insert the template
+ this._shadowRoot = this.attachShadow({mode: 'open'});
+ this._shadowRoot.appendChild(template.content.cloneNode(true));
+ this.$dropdown = this._shadowRoot.querySelector('elix-dropdown-list');
+ this.$label = this._shadowRoot.querySelector('label');
+ }
+ /**
+ * @function observedAttributes
+ * @returns {any} observed
+ */
+ static get observedAttributes () {
+ return ['label'];
+ }
+
+ /**
+ * @function attributeChangedCallback
+ * @param {string} name
+ * @param {string} oldValue
+ * @param {string} newValue
+ * @returns {void}
+ */
+ attributeChangedCallback (name, oldValue, newValue) {
+ if (oldValue === newValue) return;
+ switch (name) {
+ case 'label':
+ this.$label.textContent = newValue;
+ break;
+ default:
+ // eslint-disable-next-line no-console
+ console.error(`unknown attribute: ${name}`);
+ break;
+ }
+ }
+ /**
+ * @function get
+ * @returns {any}
+ */
+ get label () {
+ return this.getAttribute('label');
+ }
+
+ /**
+ * @function set
+ * @returns {void}
+ */
+ set label (value) {
+ this.setAttribute('label', value);
+ }
+ /**
+ * @function connectedCallback
+ * @returns {void}
+ */
+ connectedCallback () {
+ this.$dropdown.addEventListener('change', (e) => {
+ e.preventDefault();
+ const selectedItem = e?.detail?.closeResult;
+ if (selectedItem !== undefined && selectedItem?.id !== undefined) {
+ document.getElementById(selectedItem.id).click();
+ }
+ });
+ }
+}
+
+// Register
+customElements.define('se-list', SeList);
diff --git a/src/editor/components/seListItem.js b/src/editor/components/seListItem.js
new file mode 100644
index 00000000..f460a410
--- /dev/null
+++ b/src/editor/components/seListItem.js
@@ -0,0 +1,71 @@
+/* eslint-disable node/no-unpublished-import */
+import 'elix/define/Option.js';
+
+const template = document.createElement('template');
+template.innerHTML = `
+
+
+
+
+`;
+/**
+ * @class SeMenu
+ */
+export class SeListItem extends HTMLElement {
+ /**
+ * @function constructor
+ */
+ constructor () {
+ super();
+ // create the shadowDom and insert the template
+ this._shadowRoot = this.attachShadow({mode: 'open'});
+ this._shadowRoot.appendChild(template.content.cloneNode(true));
+ this.$menuitem = this._shadowRoot.querySelector('elix-menu-item');
+ }
+ /**
+ * @function observedAttributes
+ * @returns {any} observed
+ */
+ static get observedAttributes () {
+ return ['option'];
+ }
+
+ /**
+ * @function attributeChangedCallback
+ * @param {string} name
+ * @param {string} oldValue
+ * @param {string} newValue
+ * @returns {void}
+ */
+ attributeChangedCallback (name, oldValue, newValue) {
+ if (oldValue === newValue) return;
+ switch (name) {
+ case 'option':
+ this.$menuitem.setAttribute('option', newValue);
+ break;
+ default:
+ // eslint-disable-next-line no-console
+ console.error(`unknown attribute: ${name}`);
+ break;
+ }
+ }
+ /**
+ * @function get
+ * @returns {any}
+ */
+ get option () {
+ return this.getAttribute('option');
+ }
+
+ /**
+ * @function set
+ * @returns {void}
+ */
+ set option (value) {
+ this.setAttribute('option', value);
+ }
+}
+
+// Register
+customElements.define('se-list-item', SeListItem);
diff --git a/src/editor/components/seMenu.js b/src/editor/components/seMenu.js
index 27436fa9..a02623e9 100644
--- a/src/editor/components/seMenu.js
+++ b/src/editor/components/seMenu.js
@@ -1,6 +1,5 @@
/* eslint-disable node/no-unpublished-import */
import 'elix/define/MenuButton.js';
-import 'elix/define/MenuItem.js';
const template = document.createElement('template');
template.innerHTML = `
diff --git a/src/editor/components/seMenuItem.js b/src/editor/components/seMenuItem.js
index 288ea17e..43edfc11 100644
--- a/src/editor/components/seMenuItem.js
+++ b/src/editor/components/seMenuItem.js
@@ -1,5 +1,4 @@
/* eslint-disable node/no-unpublished-import */
-import 'elix/define/Menu.js';
import 'elix/define/MenuItem.js';
const template = document.createElement('template');
diff --git a/src/editor/components/seDropdown.js b/src/editor/components/seZoom.js
similarity index 98%
rename from src/editor/components/seDropdown.js
rename to src/editor/components/seZoom.js
index 447d4cc7..7f5602a5 100644
--- a/src/editor/components/seDropdown.js
+++ b/src/editor/components/seZoom.js
@@ -8,7 +8,7 @@ import {templateFrom, fragmentFrom} from 'elix/src/core/htmlLiterals.js';
/**
* @class Dropdown
*/
-class Dropdown extends ListComboBox {
+class Zoom extends ListComboBox {
/**
* @function get
* @returns {PlainObject}
@@ -157,7 +157,7 @@ class Dropdown extends ListComboBox {
}
// Register
-customElements.define('se-dropdown', Dropdown);
+customElements.define('se-zoom', Zoom);
/*
{TODO
diff --git a/src/editor/dialogs/index.js b/src/editor/dialogs/index.js
index 821f09ca..8201da2a 100644
--- a/src/editor/dialogs/index.js
+++ b/src/editor/dialogs/index.js
@@ -5,5 +5,6 @@ import './cmenuDialog.js';
import './cmenuLayersDialog.js';
import './seSelectDialog.js';
import './seConfirmDialog.js';
+import './sePromptDialog.js';
import './seAlertDialog.js';
import './storageDialog.js';
diff --git a/src/editor/dialogs/seAlertDialog.js b/src/editor/dialogs/seAlertDialog.js
index 6d417f22..2d178ee8 100644
--- a/src/editor/dialogs/seAlertDialog.js
+++ b/src/editor/dialogs/seAlertDialog.js
@@ -1,59 +1,11 @@
// eslint-disable-next-line node/no-unpublished-import
import AlertDialog from 'elix/define/AlertDialog.js';
-/**
- * @class SeAlertDialog
- */
-export class SeAlertDialog extends HTMLElement {
- /**
- * @function constructor
- */
- constructor () {
- super();
- // create the shadowDom and insert the template
- this._shadowRoot = this.attachShadow({mode: 'open'});
- this.dialog = new AlertDialog();
- }
- /**
- * @function observedAttributes
- * @returns {any} observed
- */
- static get observedAttributes () {
- return ['title'];
- }
- /**
- * @function attributeChangedCallback
- * @param {string} name
- * @param {string} oldValue
- * @param {string} newValue
- * @returns {void}
- */
- attributeChangedCallback (name, oldValue, newValue) {
- switch (name) {
- case 'title':
- this.dialog.textContent = newValue;
- this.dialog.open();
- break;
- default:
- console.error('unkonw attr for:', name, 'newValue =', newValue);
- break;
- }
- }
- /**
- * @function get
- * @returns {any}
- */
- get title () {
- return this.getAttribute('title');
- }
- /**
- * @function set
- * @returns {void}
- */
- set title (value) {
- this.setAttribute('title', value);
- }
-}
+const dialog = new AlertDialog();
+const seAlert = (type, text) => {
+ dialog.textContent = text;
+ dialog.choices = (type === 'alert') ? ['Ok'] : ['Cancel'];
+ dialog.open();
+};
-// Register
-customElements.define('se-alert-dialog', SeAlertDialog);
+window.seAlert = seAlert;
diff --git a/src/editor/dialogs/sePromptDialog.js b/src/editor/dialogs/sePromptDialog.js
new file mode 100644
index 00000000..10fdf802
--- /dev/null
+++ b/src/editor/dialogs/sePromptDialog.js
@@ -0,0 +1,83 @@
+// eslint-disable-next-line node/no-unpublished-import
+import AlertDialog from 'elix/define/AlertDialog.js';
+/**
+ * @class SePromptDialog
+ */
+export class SePromptDialog extends HTMLElement {
+ /**
+ * @function constructor
+ */
+ constructor () {
+ super();
+ // create the shadowDom and insert the template
+ this._shadowRoot = this.attachShadow({mode: 'open'});
+ this.dialog = new AlertDialog();
+ }
+ /**
+ * @function observedAttributes
+ * @returns {any} observed
+ */
+ static get observedAttributes () {
+ return ['title', 'close'];
+ }
+ /**
+ * @function attributeChangedCallback
+ * @param {string} name
+ * @param {string} oldValue
+ * @param {string} newValue
+ * @returns {void}
+ */
+ attributeChangedCallback (name, oldValue, newValue) {
+ switch (name) {
+ case 'title':
+ if (this.dialog.opened) {
+ this.dialog.close();
+ }
+ this.dialog.textContent = newValue;
+ this.dialog.choices = ['Cancel'];
+ this.dialog.open();
+ break;
+ case 'close':
+ if (this.dialog.opened) {
+ this.dialog.close();
+ }
+ break;
+ default:
+ console.error('unkonw attr for:', name, 'newValue =', newValue);
+ break;
+ }
+ }
+ /**
+ * @function get
+ * @returns {any}
+ */
+ get title () {
+ return this.getAttribute('title');
+ }
+
+ /**
+ * @function set
+ * @returns {void}
+ */
+ set title (value) {
+ this.setAttribute('title', value);
+ }
+ /**
+ * @function get
+ * @returns {any}
+ */
+ get close () {
+ return this.getAttribute('close');
+ }
+
+ /**
+ * @function set
+ * @returns {void}
+ */
+ set close (value) {
+ this.setAttribute('close', value);
+ }
+}
+
+// Register
+customElements.define('se-prompt-dialog', SePromptDialog);
diff --git a/src/editor/extensions/ext-imagelib/ext-imagelib.js b/src/editor/extensions/ext-imagelib/ext-imagelib.js
index e9931c16..10af6e74 100644
--- a/src/editor/extensions/ext-imagelib/ext-imagelib.js
+++ b/src/editor/extensions/ext-imagelib/ext-imagelib.js
@@ -1,3 +1,4 @@
+/* globals seConfirm */
/**
* @file ext-imagelib.js
*
@@ -181,11 +182,9 @@ export default {
const message = uiStrings.notification.retrieving.replace('%s', name);
if (mode !== 'm') {
- await $.process_cancel(message);
+ await seConfirm(message, [uiStrings.common.cancel]);
transferStopped = true;
// Should a message be sent back to the frame?
-
- $('#dialog_box').hide();
} else {
entry = $('
').text(message).data('id', curMeta.id);
preview.append(entry);
diff --git a/src/editor/extensions/ext-imagelib/index.js b/src/editor/extensions/ext-imagelib/index.js
index 2e48c220..3bbe9047 100644
--- a/src/editor/extensions/ext-imagelib/index.js
+++ b/src/editor/extensions/ext-imagelib/index.js
@@ -1,4 +1,4 @@
-/* globals jQuery */
+/* globals jQuery seAlert */
const $ = jQuery;
$('a').click(function () {
const {href} = this;
@@ -32,7 +32,7 @@ $('a').click(function () {
data = canvas.toDataURL();
} catch (err) {
// This fails in Firefox with `file:///` URLs :(
- document.getElementById('se-alert-dialog').title = 'Data URL conversion failed: ' + err;
+ seAlert('alert', 'Data URL conversion failed: ' + err);
data = '';
}
post({href, data});
diff --git a/src/editor/extensions/ext-imagelib/openclipart.js b/src/editor/extensions/ext-imagelib/openclipart.js
index d66b3e84..d724528a 100644
--- a/src/editor/extensions/ext-imagelib/openclipart.js
+++ b/src/editor/extensions/ext-imagelib/openclipart.js
@@ -1,3 +1,4 @@
+/* globals seAlert */
// eslint-disable-next-line node/no-unpublished-import
import {jml, body, nbsp} from 'jamilih';
// eslint-disable-next-line node/no-unpublished-import
@@ -39,7 +40,7 @@ async function processResults (url) {
// console.log('json', json);
if (!json || json.msg !== 'success') {
- document.getElementById('se-alert-dialog').title = 'There was a problem downloading the results';
+ seAlert('alert', 'There was a problem downloading the results');
return;
}
const {payload, info: {
diff --git a/src/editor/extensions/ext-mathjax/ext-mathjax.js b/src/editor/extensions/ext-mathjax/ext-mathjax.js
index 85687cbe..c7a304b5 100644
--- a/src/editor/extensions/ext-mathjax/ext-mathjax.js
+++ b/src/editor/extensions/ext-mathjax/ext-mathjax.js
@@ -1,4 +1,4 @@
-/* globals MathJax */
+/* globals MathJax seAlert */
/**
* @file ext-mathjax.js
*
@@ -202,8 +202,7 @@ export default {
});
} catch (e) {
console.log('Failed loading MathJax.'); // eslint-disable-line no-console
- // eslint-disable-next-line max-len
- document.getElementById('se-alert-dialog').title = 'Failed loading MathJax. You will not be able to change the mathematics.';
+ seAlert('alert', 'Failed loading MathJax. You will not be able to change the mathematics.');
}
}
}
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 be51a83a..9249ed84 100644
--- a/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js
+++ b/src/editor/extensions/ext-server_moinsave/ext-server_moinsave.js
@@ -1,3 +1,4 @@
+/* globals seAlert */
/**
* @file ext-server_moinsave.js
*
@@ -64,7 +65,7 @@ export default {
`).appendTo('body')
.submit().remove();
- document.getElementById('se-alert-dialog').title = strings.saved;
+ seAlert('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 5310aca4..0ec8b68c 100644
--- a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js
+++ b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js
@@ -1,3 +1,4 @@
+/* globals seConfirm */
/**
* @file ext-server_opensave.js
*
@@ -245,9 +246,8 @@ export default {
form.submit();
rebuildInput(form);
- await $.process_cancel(strings.uploading);
+ await seConfirm(strings.uploading, ['Cancel']);
cancelled = true;
- $('#dialog_box').hide();
}
if (form[0] === openSvgForm[0]) {
diff --git a/src/editor/extensions/ext-webappfind/ext-webappfind.js b/src/editor/extensions/ext-webappfind/ext-webappfind.js
index 176b226a..d878130c 100644
--- a/src/editor/extensions/ext-webappfind/ext-webappfind.js
+++ b/src/editor/extensions/ext-webappfind/ext-webappfind.js
@@ -1,3 +1,4 @@
+/* globals seAlert */
/**
* Depends on Firefox add-on and executables from
* {@link https://github.com/brettz9/webappfind}.
@@ -63,7 +64,7 @@ export default {
} */
break;
case 'save-end':
- document.getElementById('se-alert-dialog').title = `save complete for pathID ${pathID}!`;
+ seAlert('alert', `save complete for pathID ${pathID}!`);
break;
default:
throw new Error('Unexpected WebAppFind event type');
diff --git a/src/editor/images/linejoin_mitter.svg b/src/editor/images/linejoin_miter.svg
similarity index 100%
rename from src/editor/images/linejoin_mitter.svg
rename to src/editor/images/linejoin_miter.svg
diff --git a/src/editor/index.html b/src/editor/index.html
index d0361171..7fdf03cb 100644
--- a/src/editor/index.html
+++ b/src/editor/index.html
@@ -127,15 +127,23 @@
title="Change rotation angle">
+
+ Align Left
+ Align Center
+ Align Right
+ Align Top
+ Align Middle
+ Align Bottom
+
-
-
-
-
+
+
+
+
@@ -154,33 +162,30 @@
-
+
+ selected objects
+ largest object
+ smallest object
+ page
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -236,25 +239,16 @@
-
+
+ Sans-serif
+ Serif
+ Cursive
+ Fantasy
+ Monospace
+ Courier
+ Helvetica
+ Times
+
@@ -286,8 +280,8 @@
-
-
+
+
-
-
diff --git a/src/editor/panels/LayersPanel.js b/src/editor/panels/LayersPanel.js
index 400a3bd8..3a2a7e27 100644
--- a/src/editor/panels/LayersPanel.js
+++ b/src/editor/panels/LayersPanel.js
@@ -1,5 +1,5 @@
/* eslint-disable no-alert */
-/* globals $ */
+/* globals $ seAlert */
import SvgCanvas from '../../svgcanvas/svgcanvas.js';
const SIDEPANEL_MAXWIDTH = 300;
@@ -156,7 +156,7 @@ class LayersPanel {
const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, uniqName);
if (!newName) { return; }
if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) {
- document.getElementById('se-alert-dialog').title = this.uiStrings.notification.dupeLayerName;
+ seAlert('alert', this.uiStrings.notification.dupeLayerName);
return;
}
this.svgCanvas.createLayer(newName);
@@ -190,7 +190,7 @@ class LayersPanel {
const newName = prompt(this.uiStrings.notification.enterUniqueLayerName, name);
if (!newName) { return; }
if (this.svgCanvas.getCurrentDrawing().hasLayer(newName)) {
- document.getElementById('se-alert-dialog').title = this.uiStrings.notification.dupeLayerName;
+ seAlert('alert', this.uiStrings.notification.dupeLayerName);
return;
}
this.svgCanvas.cloneLayer(newName);
@@ -235,7 +235,7 @@ class LayersPanel {
const newName = prompt(this.uiStrings.notification.enterNewLayerName, '');
if (!newName) { return; }
if (oldName === newName || this.svgCanvas.getCurrentDrawing().hasLayer(newName)) {
- document.getElementById('se-alert-dialog').title = this.uiStrings.notification.layerHasThatName;
+ seAlert('alert', this.uiStrings.notification.layerHasThatName);
return;
}
this.svgCanvas.renameCurrentLayer(newName);
diff --git a/src/editor/panels/TopPanelHandlers.js b/src/editor/panels/TopPanelHandlers.js
index 2dac9259..70045f66 100644
--- a/src/editor/panels/TopPanelHandlers.js
+++ b/src/editor/panels/TopPanelHandlers.js
@@ -1,4 +1,4 @@
-/* globals $ */
+/* globals $ seAlert */
import SvgCanvas from '../../svgcanvas/svgcanvas.js';
import {isValidUnit, getTypeMap, convertUnit} from '../../common/units.js';
@@ -403,20 +403,20 @@ class TopPanelHandlers {
if (!valid) {
e.target.value = this.selectedElement().getAttribute(attr);
- document.getElementById('se-alert-dialog').title = this.uiStrings.notification.invalidAttrValGiven;
+ seAlert('alert', this.uiStrings.notification.invalidAttrValGiven);
return false;
}
if (attr !== 'id' && attr !== 'class') {
if (isNaN(val)) {
val = this.svgCanvas.convertToNum(attr, val);
- } else if (this.configObj.curConfig.baseUnit !== 'px') {
+ } else if (this.editor.configObj.curConfig.baseUnit !== 'px') {
// Convert unitless value to one with given unit
const unitData = getTypeMap();
if (this.selectedElement[attr] || this.svgCanvas.getMode() === 'pathedit' || attr === 'x' || attr === 'y') {
- val *= unitData[this.configObj.curConfig.baseUnit];
+ val *= unitData[this.editor.configObj.curConfig.baseUnit];
}
}
}
diff --git a/src/editor/svgedit.css b/src/editor/svgedit.css
index 79282d4f..ce37d056 100644
--- a/src/editor/svgedit.css
+++ b/src/editor/svgedit.css
@@ -379,25 +379,6 @@ hr {
/*—————————————————————————————*/
-.tool_button:hover,
-.push_button:hover,
-.buttonup:hover,
-.buttondown,
-.tool_button_current,
-.push_button_pressed
-{
- background-color: #ffc !important;
-}
-
-.tool_button_current,
-.push_button_pressed,
-.buttondown {
- background-color: #f4e284 !important;
- -webkit-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
- -moz-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
- box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
-}
-
#tools_top {
position: absolute;
left: 108px;
@@ -405,7 +386,6 @@ hr {
top: 2px;
height: 40px;
border-bottom: none;
- overflow: auto;
}
#tools_top .tool_sep {
@@ -515,12 +495,6 @@ input[type=text] {
padding: 2px;
}
-#tools_left .tool_button,
-#tools_left .tool_button_current {
- position: relative;
- z-index: 11;
-}
-
.dropdown {
position: relative;
}
@@ -592,21 +566,6 @@ input[type=text] {
margin-right: 0;
}
-.tool_button,
-.push_button,
-.tool_button_current,
-.push_button_pressed
-{
- height: 24px;
- width: 24px;
- margin: 2px 2px 4px 2px;
- padding: 3px;
- box-shadow: inset 1px 1px 2px white, 1px 1px 1px rgba(0,0,0,0.3);
- background-color: #E8E8E8;
- cursor: pointer;
- border-radius: 3px;
-}
-
#main_menu li#tool_open, #main_menu li#tool_import {
position: relative;
overflow: hidden;
@@ -683,10 +642,6 @@ input[type=text] {
float: right;
}
-.dropdown li.tool_button {
- width: 24px;
-}
-
#stroke_expand {
width: 0;
overflow: hidden;
diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js
index 167e12ee..3027f885 100644
--- a/src/editor/svgedit.js
+++ b/src/editor/svgedit.js
@@ -1,5 +1,5 @@
/* eslint-disable no-alert */
-/* globals jQuery seSelect */
+/* globals jQuery seSelect seAlert seConfirm */
/**
* The main module for the visual SVG Editor.
*
@@ -230,6 +230,10 @@ editor.init = () => {
const storageBox = document.createElement('se-storage-dialog');
storageBox.setAttribute('id', 'se-storage-dialog');
document.body.append(storageBox);
+ // promptDialog added to DOM
+ const promptBox = document.createElement('se-prompt-dialog');
+ promptBox.setAttribute('id', 'se-prompt-dialog');
+ document.body.append(promptBox);
} catch (err) {}
editor.configObj.load();
@@ -460,7 +464,7 @@ editor.init = () => {
editor.pref('save_notice_done', 'all');
}
if (done !== 'part') {
- document.getElementById('se-alert-dialog').title = note;
+ seAlert('alert', note);
}
}
};
@@ -477,7 +481,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) {
- document.getElementById('se-alert-dialog').title = uiStrings.notification.popupWindowBlocked;
+ seAlert('alert', uiStrings.notification.popupWindowBlocked);
return;
}
@@ -793,7 +797,7 @@ editor.init = () => {
}
if (editor.configObj.urldata.storagePrompt !== true && editor.storagePromptState === 'ignore') {
- $('#dialog_box').hide();
+ document.getElementById('se-prompt-dialog').setAttribute('close', true);
}
};
@@ -1296,7 +1300,7 @@ editor.init = () => {
// fired when user wants to move elements to another layer
let promptMoveLayerOnce = false;
- $('#selLayerNames').change( async(evt) => {
+ $('#selLayerNames').change(async (evt) => {
const destLayer = evt.currentTarget.options[evt.currentTarget.selectedIndex].value;
const confirmStr = uiStrings.notification.QmoveElemsToLayer.replace('%s', destLayer);
/**
@@ -1314,7 +1318,7 @@ editor.init = () => {
if (promptMoveLayerOnce) {
moveToLayer(true);
} else {
- const ok = await seConfirm(confirmStr, [uiStrings.common.ok, uiStrings.common.cancel]);
+ const ok = await window.seConfirm(confirmStr, [uiStrings.common.ok, uiStrings.common.cancel]);
if (ok === uiStrings.common.cancel) {
return;
}
@@ -1673,9 +1677,9 @@ editor.init = () => {
* @fires module:svgcanvas.SvgCanvas#event:ext_onNewDocument
* @returns {void}
*/
- const clickClear = async() => {
+ const clickClear = async () => {
const [x, y] = editor.configObj.curConfig.dimensions;
- const cancel = await seConfirm(uiStrings.notification.QwantToClear, [uiStrings.common.ok, uiStrings.common.cancel]);
+ const cancel = await window.seConfirm(uiStrings.notification.QwantToClear, [uiStrings.common.ok, uiStrings.common.cancel]);
if (cancel === uiStrings.common.cancel) {
return;
}
@@ -1865,7 +1869,8 @@ editor.init = () => {
};
if (!svgCanvas.setSvgString(e.detail.value)) {
- const resp = await seConfirm(uiStrings.notification.QerrorsRevertToSource, [uiStrings.common.ok, uiStrings.common.cancel]);
+ const resp =
+ await window.seConfirm(uiStrings.notification.QerrorsRevertToSource, [uiStrings.common.ok, uiStrings.common.cancel]);
if (resp === uiStrings.common.cancel) {
return;
}
@@ -1906,17 +1911,16 @@ editor.init = () => {
const {title, w, h, save} = e.detail;
// set document title
svgCanvas.setDocumentTitle(title);
-
if (w !== 'fit' && !isValidUnit('width', w)) {
- document.getElementById('se-alert-dialog').title = uiStrings.notification.invalidAttrValGiven;
+ seAlert('alert', uiStrings.notification.invalidAttrValGiven);
return false;
}
if (h !== 'fit' && !isValidUnit('height', h)) {
- document.getElementById('se-alert-dialog').title = uiStrings.notification.invalidAttrValGiven;
+ seAlert('alert', uiStrings.notification.invalidAttrValGiven);
return false;
}
if (!svgCanvas.setResolution(w, h)) {
- document.getElementById('se-alert-dialog').title = uiStrings.notification.noContentToFitTo;
+ seAlert('alert', uiStrings.notification.noContentToFitTo);
return false;
}
// Set image save option
@@ -1963,7 +1967,6 @@ editor.init = () => {
* @returns {void} Resolves to `undefined`
*/
const cancelOverlays = async (e) => {
- $('#dialog_box').hide();
const $editorDialog = document.getElementById('se-svg-editor-dialog');
const editingsource = $editorDialog.getAttribute('dialog') === 'open';
if (!editingsource && !docprops && !preferences) {
@@ -1976,7 +1979,8 @@ editor.init = () => {
if (editingsource) {
const origSource = svgCanvas.getSvgString();
if (origSource !== e.detail.value) {
- const resp = await seConfirm(uiStrings.notification.QignoreSourceChanges, [uiStrings.common.ok, uiStrings.common.cancel]);
+ const resp =
+ await window.seConfirm(uiStrings.notification.QignoreSourceChanges, [uiStrings.common.ok, uiStrings.common.cancel]);
if (resp === uiStrings.common.ok) {
hideSourceEditor();
}
@@ -2106,7 +2110,7 @@ editor.init = () => {
});
$('#url_notice').click(() => {
- document.getElementById('se-alert-dialog').title = this.title;
+ seAlert('alert', this.title);
});
$('#stroke_width').val(editor.configObj.curConfig.initStroke.width);
@@ -2577,13 +2581,13 @@ editor.init = () => {
* @returns {void}
*/
const importImage = function (e) {
- $.process_cancel(uiStrings.notification.loadingImage);
+ document.getElementById('se-prompt-dialog').title = uiStrings.notification.loadingImage;
e.stopPropagation();
e.preventDefault();
$('#main_menu').hide();
const file = (e.type === 'drop') ? e.dataTransfer.files[0] : this.files[0];
if (!file) {
- $('#dialog_box').hide();
+ document.getElementById('se-prompt-dialog').setAttribute('close', true);
return;
}
@@ -2604,7 +2608,7 @@ editor.init = () => {
svgCanvas.alignSelectedElements('c', 'page');
// highlight imported element, otherwise we get strange empty selectbox
svgCanvas.selectOnly([newElement]);
- $('#dialog_box').hide();
+ document.getElementById('se-prompt-dialog').setAttribute('close', true);
};
reader.readAsText(file);
} else {
@@ -2634,7 +2638,7 @@ editor.init = () => {
svgCanvas.alignSelectedElements('m', 'page');
svgCanvas.alignSelectedElements('c', 'page');
editor.topPanelHandlers.updateContextPanel();
- $('#dialog_box').hide();
+ document.getElementById('se-prompt-dialog').setAttribute('close', true);
};
// create dummy img so we know the default dimensions
let imgWidth = 100;
@@ -2662,7 +2666,7 @@ editor.init = () => {
if (!ok) { return; }
svgCanvas.clear();
if (this.files.length === 1) {
- $.process_cancel(uiStrings.notification.loadingImage);
+ document.getElementById('se-prompt-dialog').title = uiStrings.notification.loadingImage;
const reader = new FileReader();
reader.onloadend = async function ({target}) {
await loadSvgString(target.result);
@@ -2828,7 +2832,7 @@ editor.loadFromURL = function (url, {cache, noAlert} = {}) {
dataType: 'text',
cache: Boolean(cache),
beforeSend () {
- $.process_cancel(uiStrings.notification.loadingImage);
+ document.getElementById('se-prompt-dialog').title = uiStrings.notification.loadingImage;
},
success (str) {
loadSvgString(str, {noAlert});
@@ -2842,11 +2846,11 @@ editor.loadFromURL = function (url, {cache, noAlert} = {}) {
reject(new Error('URLLoadFail'));
return;
}
- document.getElementById('se-alert-dialog').title = uiStrings.notification.URLLoadFail + ': \n' + err;
+ seAlert('alert', uiStrings.notification.URLLoadFail + ': \n' + err);
resolve();
},
complete () {
- $('#dialog_box').hide();
+ document.getElementById('se-prompt-dialog').setAttribute('close', true);
}
});
});