Skip to content
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

Make Vue 2 nodeViewProps compatible with @vue/composition-api #4123

Merged
merged 3 commits into from
Jul 10, 2023
Merged

Make Vue 2 nodeViewProps compatible with @vue/composition-api #4123

merged 3 commits into from
Jul 10, 2023

Conversation

FloEdelmann
Copy link
Contributor

@FloEdelmann FloEdelmann commented Jun 13, 2023

Please describe your changes

This PR introduces vue-ts-types as a dependency for the @tiptap/vue-2 package, and uses it to specify the nodeViewProps. This makes them compatible with the @vue/composition-api package and Vue 2.7.

See #3507 for more context.

How did you accomplish your changes

  1. cd packages/vue-2; npm install vue-ts-types
  2. Manually replaced prop types in packages/vue-2/src/VueNodeViewRenderer.ts using vue-ts-types.

How have you tested your changes

With vue v2.6.14 and @vue/composition-api v1.7.1 installed, I created a file with the following contents:

<template>
    <div>{{ node.attrs.label }}</div>
</template>

<script lang="ts">
import { nodeViewProps } from '@tiptap/vue-2'
import { defineComponent } from '@vue/composition-api'

export default defineComponent({
    name: 'WysiwygEditorVariable',
    props: nodeViewProps,
})
</script>

Without my changes, a TypeScript error was reported for props property, saying that the types are incompatible. With my changes, there is no TypeScript error and the node prop in the template has the correct Node type.

How can we verify your changes

  1. Create a project with vue v2.6.14, @vue/composition-api v1.7.1, and the latest versions of Tiptap and TypeScript.
  2. Follow the same steps as I did locally above.

Remarks

The vue-ts-types package is created by me and extensively tested to be compatible with Vue 2.6 + @vue/composition-api and Vue 2.7 and Vue 3.2.

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

Closes #3507.

@netlify
Copy link

netlify bot commented Jun 13, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 2533e05
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64ac077385ef5f0008a0cec0
😎 Deploy Preview https://deploy-preview-4123--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 site configuration.

@bdbch
Copy link
Contributor

bdbch commented Jul 7, 2023

Hey @FloEdelmann, thanks for this improvement! It seems like our package.json's updated already since your change – could you take some time to merge your branch with the most recent develop branch?

@FloEdelmann
Copy link
Contributor Author

@bdbch I've updated the branch now.

@bdbch bdbch merged commit c305944 into ueberdosis:develop Jul 10, 2023
14 checks passed
@FloEdelmann FloEdelmann deleted the vue-2-node-view-props branch July 10, 2023 14:38
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.

nodeViewProps from @tiptap/vue-2 are not compatible with @vue/composition-api
2 participants