-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Tidy 5e Rewrite Compatibility #148
Comments
I'm happy with either of the approaches - the functions that the sheet wrappers call are already exposed via an API, so there is always the fallback of that if either of the other two don't work. I would probably lean towards the api registration - that would work well, and lends itself well to having multiple tools able to bind themselves to the portrait etc |
At last, I will be able to start working on this. Thank you for working with me on this! |
Here is a near-final draft of portrait menu command registration: Hooks.once("tidy5e-sheet.ready", (api) => {
api.actorPortrait.registerMenuCommands([
{
label: "Test",
iconClass: "fa-solid fa-flask",
tooltip: "Click for test result",
enabled: (params) => params.actor.type !== "vehicle",
execute: (params) => {
console.log(params);
ui.notifications.info(
"Hello, Test Portrait Menu Command for " + params.actor.name
);
},
},
]);
}); |
Here is the hook in action: Hooks.on('tidy5e-sheet.preOpenActorPortraitFilePicker', (actor, event) => {
// Do something else
return false; // prevent the portrait file picker from opening
}); This is set up to trigger for all actors when the user left-clicks / taps on the actor portrait. I'm packaging up the release for this and will post it here when ready. |
Tidy v0.2.9 has been released with the new API function and the hook described above. |
On the |
What is the prop path on that usually? Is it like I can provide the entire actor sheet context a la |
Update: I have released v0.2.11 with the actor sheet |
Thank you, and out in v4.2.12 |
Thank you again for this! |
Ah, one last thing: I realized I did not update the I am updating that hook call to include the full context. So, if a user posts an issue requesting the original left-click behavior on the portrait to open Tokenizer, the This is just in case. And thanks again! 🍻 |
I am the author of the Tidy 5e Sheets rewrite. The rewritten sheets run on svelte and have some significant differences from the default sheets and even original Tidy. With that in mind, I am requesting to work with you on a way to restore compatibility with Tokenizer.
Details
At present, the incompatibility is with my actor sheet portraits. They are using
mousedown
instead of click, and they do not have the[data-edit="img"]
attribute in place. These are implementation details of my rewrite, but as an exercise, I lined things up as expected to see how far that would get me. I found that, because it's wired with svelte and not jQuery,$(element).off("click")
doesn't affect my event bindings. As a result, shift+clicking causes 2 file pickers to appear: my original one and the one from theelse
case when the module decides whether to launch tokenizer.One idea I have is to use a
pre
hook:Like dnd5e's
preUseItem
hook, I could provide a hook that essentially provides the ability to hook into and prevent the default behavior when someone interacts with a sheet portrait, one hook for actors and one for items. Something liketidy5e-sheet.preOpenActorPortraitFilePicker
with params(actor, event, ...)
. I'm not 100% on the name or the params and am open to any suggestions.Another idea I have is to use a command registration API:
I present this as an extra option in addition to or in place of other options, in case you are interested.
My portraits have additional options shown as buttons when right-clicking the portrait. I could add an API function for registering commands of your own to the portrait commands. In this case, registering "Open Tokenizer" or just "Tokenizer" as an option that appears to the user. Like any of my command registration API functions (example), this one would feature optional callbacks for when someone executes the command and whether it should be enabled. While they are rendered as buttons right now, they may eventually become context menu options, and a command registration API would ensure that the registered content is data-driven so that I can seamlessly change the button to a context menu option without you having to make any changes on your side.
In any case, I have created an inconvenience because of going off the beaten path in Foundry sheets development, but I would like to collaborate to create intentional compatibility between us.
I hope to hear your thoughts. Thanks for reading.
The text was updated successfully, but these errors were encountered: