AdobeXD/plugin-samples

ui-context-menu throws error when closing dialog

Closed this issue · 1 comments

The sample contains this code which runs when clicking the "Done" button:

        function onsubmit(e) {
            let values = {
                horizontal: horizontal.value,
                vertical: vertical.value
            };
            console.log("submit: " + JSON.stringify(values))
            dialog.close();
        }

However, the variables horizontal and vertical don't exist (left over from a 'button padding' sample plugin maybe?). So if you run the plugin and click "Done," you get this JS error:

/develop/ui-context-menu/main.js:246: Uncaught TypeError: Cannot read property 'value' of undefined
/develop/ui-context-menu/main.js:8
                horizontal: horizontal.value,
                                       ^
Plugin TypeError: Cannot read property 'value' of undefined
    at onsubmit (/develop/ui-context-menu/main.js:8:40)
    at b.onclick (/develop/ui-context-menu/main.js:40:86)

addressed: 7336eb1