Skip to content
Discussion options

You must be logged in to vote

I was looking for the same and wondered how nobody provided an example although probably nobody uses the browser prompt. So here is how I solved it (for those looking for a possible solution).

Assuming you have already a modal component you just need to create a new button component that triggers the open/closed state of the modal and inserts the image:

import React, { useState } from 'react'
import {
  focusEditor,
  getPluginType,
  someNode,
  useEventPlateId,
  usePlateEditorState,
} from '@udecode/plate-core'
import { ToolbarButton, ToolbarButtonProps } from '@udecode/plate-ui-toolbar'
import ImageUrlInputModal from 'components/common/modals/ImageUrlInputModal'
import { ELEMENT_IMAGE, 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zbeyens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants