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

officejs_support_request_ui: support Ctrl+S in discussion view editor

form_discussion_view embeds an editor, but it did not expose notifySubmit
method to child gadgets. Because using Ctrl+S in the editor calls
notifySubmit on parent gadget, Ctrl+S was causing a page crash.

Expose such a method that would submit a comment when called.
parent a928abd2
...@@ -63,6 +63,10 @@ ...@@ -63,6 +63,10 @@
return gadget.changeState(state_dict); return gadget.changeState(state_dict);
}); });
}) })
// editor gadget call this acquired method on Ctrl+S
.declareMethod("triggerSubmit", function triggerSubmit(e) {
return this.submitPostComment(e);
})
.onStateChange(function () { .onStateChange(function () {
var gadget = this; var gadget = this;
// render the erp5 form // render the erp5 form
......
...@@ -256,8 +256,8 @@ ...@@ -256,8 +256,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1594840751.27</float> <float>1610600799.71</float>
<string>UTC</string> <string>GMT+1</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -216,6 +216,45 @@ and check that the relative time was updated. ...@@ -216,6 +216,45 @@ and check that the relative time was updated.
<td>a few seconds ago</td> <td>a few seconds ago</td>
</tr> </tr>
<!-- Ctrl+S can also be used as a shortcut to post message -->
<tal:block tal:define="text_content string:Post test 4">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
</tal:block>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>controlKeyDown</td>
<td></td>
<td></td>
</tr>
<tr>
<td>keyDown</td>
<td>//body</td>
<td>S</td>
</tr>
<tr>
<td>controlKeyUp</td>
<td></td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//ol[@id="post_list"]//li[3]/p</td>
<td>Post test 4</td>
</tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </html>
\ No newline at end of file
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