Skip to content

Instantly share code, notes, and snippets.

View marat-dimaev's full-sized avatar

Marat Dimaev marat-dimaev

View GitHub Profile
@marat-dimaev
marat-dimaev / readme.md
Created January 11, 2020 19:55 — forked from slava-vishnyakov/readme.md
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *