Account for a transaction.getMeta("drop") within Plugins?

Hi,

I have made a plugin that initializes marks on paragraphs via filterTransaction and currently can enforce pasting something into the editor VIA tr.getMeta("paste") but I believe I am unable to validate if the transaction UIEvent is a “drop” (VIA drag n drop). It seems tr.meta is private so I am unable to do something like tr.meta.uiEvent === "drop" - even though debugging will showcase this as “true”… it also appears that doing tr.getMeta(“drop”) yields undefined for me, so I was wondering if there is a different string or way to identify if the transaction can identify if a drag and drop is occuring within the Plugin?

I looked into this and it seems like tr.getMeta("paste") was the outcome of the discussion - curious if something similar can occur for “drop”?

What’s wrong with tr.getMeta("uiEvent") == "drop"?

There isn’t! Thank you for pointing this out to me. Strangely, I was unaware (didn’t think about) the idea of using uiEvent as the string parameter.

For what it is worth, I was looking for documentation on potential values / arguments to pass in for getMeta() (common default values that are not custom defined VIA setMeta()) but I wasn’t able to find much other than the following description of transaction.

Either way, this is a perfect solution, thank you again!

1 Like