[Bug]: Content other than text can't be part of a simulated paste within an insertContent command #5150
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Affected Packages
core
Version(s)
2.3.2
Bug Description
As of #5046, users can apply paste rules to the
insertContent
command, which is really helpful! Unfortunately, if the content the user inserts is anObject
rather than astring
, the paste rule fails because there is nolength
property ofObjects
. We can simply convert thetext
property of thesimulatedPasteMeta
to a string in order to get a more accurate representation of the state.Browser Used
Firefox
Code Example URL
No response
Expected Behavior
When
appendTransaction()
is called, it callsprocessEvent()
, which withinrun()
callsstate.doc.nodesBetween()
. In the case where non-string Content is passed toinsertContent
, no paste rules will be applied sinceto
isNaN
(seetiptap/packages/core/src/PasteRule.ts
Line 118 in ef7d195
Additional Context (Optional)
No response
Dependency Updates
The text was updated successfully, but these errors were encountered: