English 中文(简体)
can t play video in react quill
原标题:

I can t play video in react quill when I set resize picture in react quill, every time I add a video it gets resized like a photo, and can t play. So does anyone have a way.

this is my code

type here
import React, { useState, useEffect } from "react";
import { useQuill } from "react-quilljs";
import "quill/dist/quill.snow.css";
import BlotFormatter from "quill-blot-formatter/dist/BlotFormatter";


function HtmlEditor() {
  
  // const { quill, quillRef } = useQuill();
  const { quill, quillRef, Quill } = useQuill({
    modules: { blotFormatter: {} },
  });
  if (Quill && !quill) {
    Quill.register("modules/blotFormatter", BlotFormatter);
  }
  //==========================================================

  const [value, setValue] = useState();

  //b2
  useEffect(() => {
    if (quill) {
      quill.on("text-change", (delta, oldContents) => {
        console.log(quillRef.current.firstChild.innerHTML);
        setValue(quillRef.current.firstChild.innerHTML);

        let currrentContents = quill.getContents();
        console.log(currrentContents.diff(oldContents));
      });
    }
  }, [quill, Quill]);

  // console.log(value);
  console.log(JSON.stringify(value));
  // console.log(quillRef);
  return (
    <div>
      <div className="mt-[50px] mx-auto " style={{ width: 1500, height: 1300 }}>
        <div ref={quillRef} />
      </div>
    </div>
  );
}
export default HtmlEditor;

Thank you for your help.

问题回答

You can consider this code:

import Quill from "quill";
import { Video } from "quill-video-resize";
import "quill-video-resize/dist/quill-video-resize.css";

Quill.register({ "formats/video": Video });

const { quill, quillRef } = useQuill({
  modules: {
    blotFormatter: {},
    toolbar: {
      container: "#toolbar",
      handlers: {
        // Your custom handlers here
      },
    },
  },
});

quill.root.quill = quill;
quill.insertEmbed(index, "video", src, "user");




相关问题
can t play video in react quill

I can t play video in react quill when I set resize picture in react quill, every time I add a video it gets resized like a photo, and can t play. So does anyone have a way. this is my code type here ...

• 如何在接下来的JS获得参考价值?

我正在使用下司法学院的路线,但当我试图使用文件时。 我的法典中的指使者没有回报任何价值。 我如何解决这一问题?

拆除月度边界(实际大型日历)

采用大型反应日历的Im, 并想要清除包罗日历的边界。 以及如何改变日记栏和日记的颜色? 如何使其发挥作用?

表中未显示的元数据

我将元件定义为如下文所示,但是在我的剪辑中,它没有显示“当地:3000/#home”。 我的所有jsx档案都有“用户”bc。

NextJS 13 Data Fetching

Is there anyway of custom baseURL for their fetch method? For example in axios: const instance = axios.create({ baseURL: https://some-domain.com/api/ , timeout: 1000, headers: { X-Custom-Header ...

热门标签