Skip to content

Conversation

@max-nextcloud
Copy link
Contributor

@max-nextcloud max-nextcloud commented Aug 22, 2025

Changes Overview

  • Vue2 requires factory functions for defaults for objects and arrays.
  • class may not be used as prop.

Implementation Approach

Use a factory function.

Testing Done

Checked that it prevents the warning by building text with it:

Invalid default value for prop "PluginKey": Props with type Object/Array must use a factory function to return the default value.

Verification Steps

Actually testing is cumbersome. Vue 3 seems to have dropped the warning. I'm still checking if that actually also means it's not an issue anymore.
Checking the code and checking the docs is probably best (search for 'factory function')

Additional Notes

grafik

I'm still looking into fixing the class reserved name warning.

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable (not applicable).
  • I have followed the project guidelines.
  • I have fixed any lint issues (lint is happy).

Related Issues

Initially came up in nextcloud/text#7537 (comment)

Vue2 requires factory functions for defaults for objects and arrays.

Prevent the warning
> Invalid default value for prop "PluginKey": Props with type Object/Array must use a factory function to return the default value.

Signed-off-by: Max <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Aug 22, 2025

🦋 Changeset detected

Latest commit: a706e4c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 69 packages
Name Type
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/core Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-color Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-font-family Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/pm Patch
@tiptap/react Patch
@tiptap/starter-kit Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-placeholder Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Aug 22, 2025

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit a706e4c
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/68b880f03c923d0008a14b12
😎 Deploy Preview https://deploy-preview-6857--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@max-nextcloud max-nextcloud changed the title fix(drag-handle-vue-2): use factory function for default fix(drag-handle-vue-2): fix warnings Aug 22, 2025
@max-nextcloud
Copy link
Contributor Author

I tried to access class through this.$attrs but turns out it's not included there: https://v2.vuejs.org/v2/api/#vm-attrs

The only ways for fixing the other error I see are:

  • Always using a class="drag-handle" on the div. More classes can be added via attribute fallbacks - but there would be no way to replace that class anymore. So behavior would change.
  • Checking for other classes and removing the drag-handle class to preserve current behavior.
  • Changing the prop name - also breaking the api.

@max-nextcloud max-nextcloud changed the title fix(drag-handle-vue-2): fix warnings fix(drag-handle-vue-2): fix vue2 warnign about objects as default Aug 22, 2025
@bdbch bdbch merged commit 2cb08d3 into ueberdosis:develop Sep 3, 2025
14 checks passed
@mejo-
Copy link
Contributor

mejo- commented Oct 23, 2025

@bdbch thanks for merging the PR. Would you consider to backport it to the v2 branch? So far we're still stuck with Tiptap v2 in the Nextcloud Text editor.

bdbch added a commit that referenced this pull request Oct 23, 2025
)

* fix(drag-handle-vue-2): use factory function for default

Vue2 requires factory functions for defaults for objects and arrays.

Prevent the warning
> Invalid default value for prop "PluginKey": Props with type Object/Array must use a factory function to return the default value.

Signed-off-by: Max <[email protected]>

* Fix prop default handling for Vue 2

---------

Signed-off-by: Max <[email protected]>
Co-authored-by: bdbch <[email protected]>
@bdbch
Copy link
Member

bdbch commented Oct 23, 2025

Released as 2.26.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants