Preserve Beat Prompt state on reload
This commit is contained in:
@@ -205,9 +205,9 @@ function normalizeState(value) {
|
||||
|
||||
function readState(node) {
|
||||
return normalizeState(
|
||||
node._dh3bpState
|
||||
node.properties?.[STATE_PROPERTY]
|
||||
|| findWidget(node, HIDDEN_INPUT_NAME)?.value
|
||||
|| node.properties?.[STATE_PROPERTY]
|
||||
|| node._dh3bpState
|
||||
|| ""
|
||||
);
|
||||
}
|
||||
@@ -236,9 +236,9 @@ function writeState(node, state) {
|
||||
}
|
||||
|
||||
function syncStateFromNode(node) {
|
||||
const widgetValue = findWidget(node, HIDDEN_INPUT_NAME)?.value;
|
||||
const propertyValue = node.properties?.[STATE_PROPERTY];
|
||||
const source = node._dh3bpState || widgetValue || propertyValue || "";
|
||||
const widgetValue = findWidget(node, HIDDEN_INPUT_NAME)?.value;
|
||||
const source = propertyValue || widgetValue || node._dh3bpState || "";
|
||||
writeState(node, source);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user