如何在节点红色的点击事件上覆盖完成(节点对话框确定)按钮?

How to override Done (node-dialog-ok) button on click event in node-red?

我目前有一个我创建的自定义节点。

我需要的是,当从 编辑器中单击 Done (id: node-dialog-ok) 按钮时做一些事情-tray-toolbar 而不是默认功能。

是否可以覆盖按钮的 onclick 事件?

或者,如果我只是在单击 Done 按钮时打印 alert,我该如何在我的节点中使用它?我对此还是个新手,所以请裸露,因为我很晦涩。

如有任何帮助,我们将不胜感激。谢谢!

您希望在节点 HTML 文件中返回 oneditsave 回调。

创建 HTML 文件的文档是 here

oneditsave: (function) called when the edit dialog is okayed. See custom edit behaviour.

<script type="text/javascript">
    RED.nodes.registerType('node-type',{
        // node definition
        oneditsave: function() {
            ....
        }
    });
</script>