fixed crash after renaming a widget (#2216)

This commit is contained in:
ArnoldSmith86 2024-08-18 16:51:03 +02:00 committed by GitHub
parent b455f4cc53
commit 93a8713e6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -35,7 +35,8 @@ class JsonModule extends SidebarModule {
} else {
jeEmpty();
}
$('#jeText').blur();
if(!jeDeltaIsOurs)
$('#jeText').blur();
}
renderModule(target) {
@ -70,7 +71,8 @@ class TreeModule extends SidebarModule {
jeEmpty();
jeCenterSelection();
}
$('#jeText').blur();
if(!jeDeltaIsOurs)
$('#jeText').blur();
}
onStateReceivedWhileActive() {

View File

@ -1483,12 +1483,15 @@ async function jeApplyChanges() {
const currentState = JSON.stringify(jePostProcessObject(completeState));
if(currentStateRaw != jeStateBeforeRaw || jeKeyIsDownDeltas.length) {
const idChanged = JSON.parse(currentState).id != JSON.parse(jeStateBefore).id;
jeDeltaIsOurs = true;
await jeApplyExternalChanges(completeState);
jeStateBeforeRaw = currentStateRaw;
const oldState = jeStateBefore;
jeStateBefore = currentState;
await updateWidget(currentState, oldState); // in editmode.js
if(idChanged)
setSelection([ widgets.get(JSON.parse(currentState).id) ]);
jeDeltaIsOurs = false;
}
}

View File

@ -150,11 +150,9 @@ test('Dynamic expressions', async t => {
.click('#editButton')
.click('#editorToolbar > div > [icon=add]')
.click('#addBasicWidget')
.click('#room',{offsetX: 1, offsetY: 1, modifiers:{ctrl:true}})
.click(Selector('button').withAttribute('icon', 'data_object'))
.typeText('#jeText', button, { replace: true, paste: true })
.rightClick('#w_jyo6')
.rightClick('#w_jyo6')
.click(Selector('button').withAttribute('icon', 'pest_control'))
const log = await Selector('#jeLog').textContent
for (let i=0; i<ops.length; i++) {