【问题标题】:React JoditEditor insert image not workingReact JoditEditor插入图像不起作用
【发布时间】:2021-10-22 11:17:29
【问题描述】:

我使用 JoditEditor 在我的代码中插入图像。但是当我尝试插入图像时,我无法将图像 URL 放入 URL 字段并且“插入”按钮不起作用。有人可以帮我吗?截图和我的代码如下:

const editor = useRef(null);
const config = {
readonly: false, // all options from https://xdsoft.net/jodit/doc/};

const [content, setContent] = useState("");
<JoditEditor
            ref={editor}
            value={content}
            config={config}
            tabIndex={1}
            onBlur={(newContent) => setContent(newContent)}
            onChange={(newContent) => {}}
          />

Screenshot

【问题讨论】:

    标签: reactjs rich-text-editor


    【解决方案1】:

    我猜你正在使用模态。我遇到了同样的问题,这就是我通过添加 disableEnforceFocus 道具在 material-ui Modal 中修复它的方法。

      <Modal open={true} disableEnforceFocus>
        <JoditEditor
            ref={editor}
            value={content}
            config={config}
            tabIndex={1}
            onBlur={(newContent) => setContent(newContent)}
            onChange={(newContent) => {}}
          />
      </Modal>
    

    【讨论】:

    • 我尝试了您的建议,但没有奏效 - 是否有等效的引导模式?
    猜你喜欢
    • 2013-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    相关资源
    最近更新 更多