#se-img-prop-dialog error class set changes
parent
375f16e0b2
commit
dbe84d8dc7
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable node/no-unpublished-import */
|
||||
import 'elix/define/Dialog.js';
|
||||
import {isValidUnit} from '../../common/units.js';
|
||||
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = `
|
||||
|
@ -298,6 +299,18 @@ export class SeImgPropDialog extends HTMLElement {
|
|||
};
|
||||
const onSaveHandler = (ev) => {
|
||||
let saveOpt = '';
|
||||
const w = this.$canvasWidth.value;
|
||||
const h = this.$canvasHeight.value;
|
||||
if (w !== 'fit' && !isValidUnit('width', w)) {
|
||||
this.$canvasWidth.parentElement.classList.add('error');
|
||||
} else {
|
||||
this.$canvasWidth.parentElement.classList.remove('error');
|
||||
}
|
||||
if (h !== 'fit' && !isValidUnit('height', w)) {
|
||||
this.$canvasHeight.parentElement.classList.add('error');
|
||||
} else {
|
||||
this.$canvasHeight.parentElement.classList.remove('error');
|
||||
}
|
||||
if (this.$imageOptEmbed.getAttribute('checked') === 'true') {
|
||||
saveOpt = 'embed';
|
||||
}
|
||||
|
|
|
@ -3914,22 +3914,18 @@ editor.init = () => {
|
|||
*/
|
||||
const saveDocProperties = function (e) {
|
||||
// set title
|
||||
const {title, w, h, save} = e.detail;
|
||||
const {title, w, h, save} = e.detail;
|
||||
// set document title
|
||||
svgCanvas.setDocumentTitle(title);
|
||||
|
||||
if (w !== 'fit' && !isValidUnit('width', w)) {
|
||||
// width.parentElement.classList.add('error');
|
||||
/* await */ $.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
return false;
|
||||
}
|
||||
// width.parentElement.classList.remove('error');
|
||||
if (h !== 'fit' && !isValidUnit('height', h)) {
|
||||
// height.parentElement.classList.add('error');
|
||||
/* await */ $.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
return false;
|
||||
}
|
||||
// height.parentElement.classList.remove('error');
|
||||
if (!svgCanvas.setResolution(w, h)) {
|
||||
/* await */ $.alert(uiStrings.notification.noContentToFitTo);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue