select text of input fields when focused
- the content of input fields of relevant sheets and dialogs are now selected upon focus - autofocus the Gamemaster roll modifier in the roll dialog
This commit is contained in:
parent
a8158894dd
commit
0b1c342ecf
2 changed files with 19 additions and 1 deletions
|
@ -133,3 +133,21 @@ Hooks.once("setup", function () {
|
|||
Hooks.once("ready", function () {
|
||||
migration.migrate();
|
||||
});
|
||||
|
||||
/**
|
||||
* Select the text of input elements in given sheets via onfocus listener.
|
||||
* The hook names are of the form "render"+sheet_superclassname and are called within
|
||||
* the render() method of the foundry Application class.
|
||||
* Note: The render hooks of all classes in the class hierarchy are called,
|
||||
* so e.g. for a Dialog, both "renderDialog" and "renderApplication" are called
|
||||
* (in this order).
|
||||
*/
|
||||
["renderApplication", "renderActorSheet", "renderItemSheet"].forEach((hookName: string) => {
|
||||
Hooks.on(hookName, (app: Dialog, html: JQueryStatic, data: any) => {
|
||||
$(html)
|
||||
.find("input")
|
||||
.on("focus", (ev: JQuery.FocusEvent<HTMLInputElement>) => {
|
||||
ev.currentTarget.select();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<label for="ctv">{{localize "DS4.RollDialogTargetLabel"}}</label>
|
||||
<input id="ctv" data-type="Number" type="number" name="ctv" value="{{checkTargetValue}}" />
|
||||
<label for="gmmod">{{localize "DS4.RollDialogModifierLabel"}}</label>
|
||||
<input id="gmmod" data-type="Number" type="number" name="gmmod" value="0" />
|
||||
<input id="gmmod" data-type="Number" type="number" name="gmmod" value="0" autofocus />
|
||||
<label for="maxcoup">{{localize "DS4.RollDialogCoupLabel"}}</label>
|
||||
<input id="maxcoup" data-type="Number" type="number" name="maxcoup" value="{{maxCritSuccess}}" />
|
||||
<label for="minfumble">{{localize "DS4.RollDialogFumbleLabel"}}</label>
|
||||
|
|
Loading…
Reference in a new issue