Skip to content

How to prevent block splitting in custom nodes? #5785

Closed Answered by ShadiBlitz
ShadiBlitz asked this question in Questions & Help
Discussion options

You must be logged in to vote

To anyone having the same senario, here is the solution:

import { mergeAttributes, Node } from '@tiptap/core';
import { VueNodeViewRenderer } from '@tiptap/vue-2';
import { TextSelection } from '@tiptap/pm/state';
import NoActionGroupComponent from './GroupComponent.vue';

export default Node.create({
  name: 'group',
  group: 'block',
  content: 'block*',
  defining: true,

  addAttributes() {
    return {
      name: { default: '' },
    };
  },

  parseHTML() {
    return [{ tag: 'group' }];
  },

  renderHTML({ HTMLAttributes }) {
    return ['group', mergeAttributes(HTMLAttributes), 0];
  },

  addKeyboardShortcuts() {
    return {
      Enter: ({ editor }) => {
        const { state,

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ShadiBlitz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant