reactjs - Quill 工具栏未呈现(显示图标路径而不是呈现)

标签 reactjs quill

我正在尝试在 React 中运行原生 Quill。我遵循 quill 的快速入门,但不幸的是工具栏渲染存在问题(见下文)。显示图标路径而不是渲染。请给我相同的指示:)

enter image description here

羽毛笔组件:

import Quill from 'quill/core';
import Toolbar from 'quill/modules/toolbar';
import Snow from 'quill/themes/snow';
import Bold from 'quill/formats/bold';
import Italic from 'quill/formats/italic';
import React, { Component, Fragment } from 'react';
import Header from 'quill/formats/header';


Quill.register({
  'modules/toolbar': Toolbar,
  'themes/snow': Snow,
});


class MyQuill extends Component {

  constructor(props) {
    super(props);
  }


  componentDidMount(props) {
    var quill = new Quill('#editor', {
      theme: 'snow'
    });
  }

  render() {
    return (
      <div id="editor">
        <p>Hello World!</p>
        <p>Some initial <strong>bold</strong> text</p>
      </div>
    );
  }
}
export default MyQuill;

最佳答案

我终于能够修复它(见下文)。遗憾的是,如此出色的工具的文档却如此糟糕。

更改自:

从 'quill/core' 导入 Quill;

从 'quill/dist/quill.js' 导入 Quill;

来自:

Quill.register({
  'themes/snow': Snow,
});

Quill.register({
  'themes/snow.js': Snow,
});

关于reactjs - Quill 工具栏未呈现(显示图标路径而不是呈现),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60223428/

相关文章:

reactjs - 如何使用 JSX/HTML5 设置图像位置?

javascript - 如何在 Ionic React 5 中触发反向重定向?

javascript - 使用combineReducers "Error: Reducer "assetReducer时出错“初始化期间返回未定义”。

reactjs - componentDidCatch 与渲染中的 try/catch 有何不同?

quill - 是否可以使用 Quill 打印或导出为 PDF?

javascript - 如何创建仅包含时间而不包含日期的 moment 对象?

javascript - 如何在 React-Quill 中设置字符长度

vue.js - 尝试将表格插入鹅毛笔编辑器时出现错误 "[Parchment] Unable to create table blot"

javascript - 无法访问模块函数中的 quill 实例

javascript - 什么、如何以及何时在自定义印迹上使用静态格式、格式和格式?