ProseMirror UUID discussion
Hi @Jons. I'd be glad to continue the discussion here. I don't see anything immediately that is related to the
TJSProseMirror
component. The actual editor and such is the Foundry implementation underneath. There are additional plugins and such added, but it's not clear yet if what you are doing in regard to interaction would hit any of the aspects added by TJSProseMirror
Can you more specifically outline the problem that you are seeing and perhaps put some console.log
statements in foundry-esm.js
to verify the UUID being parsed.
The drag and drop of documents into the editor when active should be something completely controlled by the underlying Foundry implementation.8 Replies
Sure. When I drop some Item data into ProseMirror editor I got whis Uncaught Error in console:
The parseUuid function has been called with these params:
Reading the function implementation, it seems that the function expects the string part of uuid as input "Compendium.fabulaultima.conditions.Item.6CQ3nO3ZLl148GMQ", and not a serialized json. That's the problem.
So can you confirm that is all happening inside foundry? (sorry, I'm a experienced developer, but I'm still quite new to foundry development and I still have to understand what belongs to core foundry and what to TJS)
I noticed that a TJS module is involved in the call stack (TJSPasteUUID.js) wich receive that input and pass it into parseUuid function
Some other info:
1. I tried to switch to <TJSTinyMCE> component and it works
2. I'm using foundry v12
The TinyMCE version follows a totally different call stack so I'm a bit confused. I can try to understand if there is something broken in foundry v12
See if you get the same error in a core ProseMirror editor (edit any journal / item description, etc.). Just make sure it's not something specific to the compendium formatting of the UUID. Also just try with world items. Drag and drop from the compendium to a world item then drop from there to the editor.
I'll certainly put a try / catch around the
fromUuidSync
call in the paste plugin just for good measure.
OK.. I have confirmed this is a problem with v12
works fine on v11
. This only seemingly is occurring for compendium dropped items. If you drop the compendium item into a world item then drag the world item to the editor then it works as well. I attached two videos showing dropping from a compendium in v11
/ v12
.Ok, I want to add some other info:
Dropping a compendium item into a journal entry works fine, so I tried to understand what is the difference
It seems that the difference is in this function here from foundry-esm
In case of dropping into a journal entry the array of plugins contains 16 elements, in the other case has only 14 plugins
I don't know if something important is missing there, I will do more digging later
In any case thank you for your response, I will wait for a core update of foundry if that is the problem
The intention behind this plugin is that if you paste (not drop in) in
Item.ID
that it will properly format it as a UUID link.
Here is what #transformUUID receives on each version
On v11: {"type":"Item","uuid":"Compendium.dnd5e.items.Item.3c7JXOzsv55gqJS5"}
On v12: {"type":"Item","uuid":"Compendium.dnd5e.items.Item.3c7JXOzsv55gqJS5"}
So something about fromUuidSync
and the subsequent core parsing changed.
Technically though this plugin is meant to convert Compendium.dnd5e.items.Item.3c7JXOzsv55gqJS5
to a UUID link and not process the strings given above. I need to correct the regex in #transformUUID
to better handle this case / add error checking. I have more than enough info to fix this issue.
You'll soon find especially over Foundry updates that code that you thought was pretty solid can break because the core Foundry API morphs and changes in unexpected ways.Ok, thank you!
I hope your Foundry dev journey is getting off to a good start nonetheless! 😄
yeah, sure, my system development is almost ready, I have to do some data entry and maybe some advanced feature to add later, thank you 🙂
Right on... Jumping into system development is a more difficult route. If you have any other questions do feel free to post them and drop a note when you release your system.
TRL / Svelte library is definitely in a challenging spot. I've been working hard on just hardening the whole framework, but it's gone on a bit longer than expected; quite a bit longer. Normally, things get more complete testing when a new Foundry version comes out, but this time around I only made a small hot patch for the issues reported at the time when v12 dropped. In the future though things will be a bit more streamlined for being able to more immediately respond with a new release when stuff like this pops up. I'm working hard to get the next release out in September.