#103 textContent get issue
parent
203af05cd5
commit
7a3c2a0b58
|
@ -325,7 +325,8 @@ class LayersPanel {
|
|||
* @returns {void}
|
||||
*/
|
||||
layerRename() {
|
||||
const oldName = document.querySelector("#layerlist tr.layersel td.layername").textContent;
|
||||
const ele = document.querySelector("#layerlist tr.layersel td.layername");
|
||||
const oldName = (ele) ? ele.textContent : '';
|
||||
const newName = prompt(this.editor.i18next.t('notification.enterNewLayerName'), "");
|
||||
if (!newName) {
|
||||
return;
|
||||
|
@ -425,7 +426,8 @@ class LayersPanel {
|
|||
const elements = $id('layerlist').querySelectorAll("td.layervis");
|
||||
Array.from(elements).forEach(function(element) {
|
||||
element.addEventListener('click', function(evt) {
|
||||
const name = evt.currentTarget.parentNode.querySelector("td.layername").textContent;
|
||||
const ele = evt.currentTarget.parentNode.querySelector("td.layername");
|
||||
const name = (ele)? ele.textContent : '';
|
||||
const vis = evt.currentTarget.classList.contains("layerinvis");
|
||||
self.editor.svgCanvas.setLayerVisibility(name, vis);
|
||||
evt.currentTarget.classList.toggle("layerinvis");
|
||||
|
|
|
@ -722,7 +722,7 @@ export const getTextMethod = function () {
|
|||
const selectedElements = elemContext_.getSelectedElements();
|
||||
const selected = selectedElements[0];
|
||||
if (isNullish(selected)) { return ''; }
|
||||
return selected.textContent;
|
||||
return (selected) ? selected.textContent : '';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -294,7 +294,7 @@ export class ChangeElementCommand extends Command {
|
|||
this.oldValues = attrs;
|
||||
for (const attr in attrs) {
|
||||
if (attr === '#text') {
|
||||
this.newValues[attr] = elem.textContent;
|
||||
this.newValues[attr] = (elem) ? elem.textContent : '';
|
||||
} else if (attr === '#href') {
|
||||
this.newValues[attr] = getHref(elem);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue