From da4a0f09ed3e76cad9eb44ac4ffc4469acb93e6b Mon Sep 17 00:00:00 2001 From: Kazuki Nakanishi Date: Tue, 23 Jan 2018 08:25:43 +0900 Subject: [PATCH] Add a button to restore user defined icon (#1569) --- editor/js/ui/editor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index a1a1cd4ea..179556716 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -776,6 +776,16 @@ RED.editor = (function() { var fileName = selectIconFile.val(); iconFileHidden.val(fileName); }); + var clear = $('').appendTo(iconForm); + clear.click(function(evt) { + evt.preventDefault(); + var iconPath = RED.utils.getDefaultNodeIcon(node._def, node); + selectIconModule.val(iconPath.module); + moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, true); + selectIconFile.removeClass("input-error"); + selectIconFile.val(iconPath.file); + iconFileHidden.val(iconPath.file); + }); moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, false); var iconFileList = iconSets[selectIconModule.val()];