How to use @tiptap/extension-image - 1 common examples

To help you get started, we’ve selected a few @tiptap/extension-image examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gitlabhq / gitlabhq / app / assets / javascripts / content_editor / extensions / image.js View on Github external
import { Image } from '@tiptap/extension-image';
import { defaultMarkdownSerializer } from 'prosemirror-markdown/src/to_markdown';

const ExtendedImage = Image.extend({
  addAttributes() {
    return {
      ...this.parent?.(),
      src: {
        default: null,
        /*
         * GitLab Flavored Markdown provides lazy loading for rendering images. As
         * as result, the src attribute of the image may contain an embedded resource
         * instead of the actual image URL. The image URL is moved to the data-src
         * attribute.
         */
        parseHTML: (element) => {
          const img = element.querySelector('img');

          return {
            src: img.dataset.src || img.getAttribute('src'),

@tiptap/extension-image

image extension for tiptap

MIT
Latest version published 3 days ago

Package Health Score

89 / 100
Full package analysis

Popular @tiptap/extension-image functions