Commit a5afdfae authored by Jérome Perrin's avatar Jérome Perrin

core: set state in value during gadget_editor.getContent

To be consistent with what the underlying gadget does.

This is needed if we want this snippet to empty the editor:

// user type something in editor
gadget.getContent().then(content => {gadget.changeState({value: ''})})

otherwise the state's value is considered to be still "" and this
changeState does nothing.
parent e5fb0e66
...@@ -184,6 +184,10 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/ ...@@ -184,6 +184,10 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
}) })
.push(function (editor_gadget) { .push(function (editor_gadget) {
return editor_gadget.getContent.apply(editor_gadget, argument_list); return editor_gadget.getContent.apply(editor_gadget, argument_list);
}).push(function (content) {
// change state in place, like embedded editor does.
gadget.state.value = content[gadget.state.key];
return content;
}) })
.push(unlockGadgetInQueue(gadget), unlockGadgetInFailedQueue(gadget)); .push(unlockGadgetInQueue(gadget), unlockGadgetInFailedQueue(gadget));
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment