Skip to content
Snippets Groups Projects
text-field.ts 604 B
Newer Older
  • Learn to ignore specific revisions
  • rhenck's avatar
    rhenck committed
    import { Node, mergeAttributes } from '@tiptap/core';
    
    import { ElementFactory } from '../util/element.factory';
    
    rhenck's avatar
    rhenck committed
    
    const TextFieldExtension =
      Node.create({
        group: 'inline',
        inline: true,
        name: 'TextField',
    
        addAttributes() {
          return {
    
            model: {
    
              default: ElementFactory.createElement('text-field')
    
    rhenck's avatar
    rhenck committed
            }
          };
        },
    
        parseHTML() {
    
          return [{ tag: 'aspect-nodeview-text-field' }];
    
    rhenck's avatar
    rhenck committed
        },
        renderHTML({ HTMLAttributes }) {
    
          return ['aspect-nodeview-text-field', mergeAttributes(HTMLAttributes)];
    
    rhenck's avatar
    rhenck committed
        }
      });
    
    export default TextFieldExtension;