updated form utils
This commit is contained in:
parent
7ce0f09382
commit
da160bf227
4 changed files with 55 additions and 42 deletions
|
|
@ -13,22 +13,14 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="sdpi-wrapper">
|
||||
<!--TODOZ: add one of each control from pi-samples to test FormUtils & CSS -->
|
||||
<form id="property-inspector">
|
||||
<div class="sdpi-item">
|
||||
<div data-localize class="sdpi-item-label">Name</div>
|
||||
<input
|
||||
class="sdpi-item-value"
|
||||
name="name"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<input class="sdpi-item-value" name="name" type="text" value="" />
|
||||
</div>
|
||||
|
||||
<div type="textarea" class="sdpi-item">
|
||||
<div class="sdpi-item-label up20" data-localize>
|
||||
Message
|
||||
</div>
|
||||
<div class="sdpi-item-label up20" data-localize>Message</div>
|
||||
<div class="sdpi-item-value textarea">
|
||||
<textarea
|
||||
name="message"
|
||||
|
|
|
|||
|
|
@ -2,23 +2,24 @@
|
|||
/// <reference path="../../../libs/js/utils.js" />
|
||||
|
||||
StreamDeck.onConnected((jsn) => {
|
||||
StreamDeck.loadLocalization('../../../');
|
||||
StreamDeck.loadLocalization('../../../');
|
||||
|
||||
const form = document.querySelector('#property-inspector');
|
||||
const {actionInfo, appInfo, connection, messageType, port, uuid} = jsn;
|
||||
const {payload, context} = actionInfo;
|
||||
const {settings} = payload;
|
||||
const form = document.querySelector('#property-inspector');
|
||||
const { actionInfo, appInfo, connection, messageType, port, uuid } = jsn;
|
||||
const { payload, context } = actionInfo;
|
||||
const { settings } = payload;
|
||||
|
||||
Utils.setFormValue(settings, form);
|
||||
Utils.setFormValue(settings, form);
|
||||
|
||||
form.addEventListener(
|
||||
'input',
|
||||
Utils.debounce(150, () => {
|
||||
const value = Utils.getFormValue(form);
|
||||
StreamDeck.sendToPlugin(value, context);
|
||||
StreamDeck.setSettings(value);
|
||||
})
|
||||
);
|
||||
form.addEventListener(
|
||||
'input',
|
||||
Utils.debounce(150, () => {
|
||||
const value = Utils.getFormValue(form);
|
||||
StreamDeck.sendToPlugin(value, context);
|
||||
StreamDeck.setSettings(value);
|
||||
console.log(value);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -26,9 +27,9 @@ StreamDeck.onConnected((jsn) => {
|
|||
* (this can be removed if the external window is not used)
|
||||
*/
|
||||
window.sendToInspector = (data) => {
|
||||
console.log(data);
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
document.querySelector('#open-external').addEventListener('click', () => {
|
||||
window.open('../../../external.html');
|
||||
window.open('../../../external.html');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue