Fix roomId and eventId inputs not saving field type correctly for get-event node

This commit is contained in:
Skylar Sadlier 2025-02-07 20:27:19 -07:00
parent 913f5dfcb9
commit 093d59893e

View File

@ -19,14 +19,18 @@
}, },
oneditprepare: function() { oneditprepare: function() {
$("#node-input-roomId").typedInput({ $("#node-input-roomId").typedInput({
type: this.roomIdType, types: ['msg','flow','global','str'],
types:['msg','flow','global','str'], typeField: "#node-input-roomId"
}).typedInput('value', this.roomIdValue); });
$("#node-input-roomId").typedInput("type", this.roomIdType || "msg");
$("#node-input-roomId").typedInput("value", this.roomIdValue || "topic");
$("#node-input-eventId").typedInput({ $("#node-input-eventId").typedInput({
type: this.eventIdType, types: ['msg','flow','global','str'],
types:['msg','flow','global','str'], typeField: "#node-input-eventId"
}).typedInput('value', this.eventIdValue); });
$("#node-input-eventId").typedInput("type", this.eventIdType || "msg");
$("#node-input-eventId").typedInput("value", this.eventIdValue || "eventId");
}, },
oneditsave: function() { oneditsave: function() {
this.roomIdType = $("#node-input-roomId").typedInput('type'); this.roomIdType = $("#node-input-roomId").typedInput('type');
@ -58,18 +62,6 @@
<label for="node-input-eventId"><i class="fa fa-file"></i> Event ID</label> <label for="node-input-eventId"><i class="fa fa-file"></i> Event ID</label>
<input type="text" id="node-input-eventId"> <input type="text" id="node-input-eventId">
</div> </div>
<script type="text/javascript">
$(function(){
$("#node-input-roomId").on("keyup", function() {
if($(this).val() && !$(this).val().startsWith("!")) {
$("#node-input-roomId-error").html(`Room IDs start with exclamation point "!"<br />Example: !OGEhHVWSdvArJzumhm:matrix.org`).show();
} else {
$("#node-input-roomId-error").hide();
}
}).trigger('keyup');
});
</script>
</script> </script>
<script type="text/html" data-help-name="matrix-get-event"> <script type="text/html" data-help-name="matrix-get-event">