【问题标题】:React Draft Wysiwyg - Using custom toolbar icons instead of standard inline toolbar imagesReact Draft Wysiwyg - 使用自定义工具栏图标而不是标准的内联工具栏图像
【发布时间】:2021-10-29 04:54:10
【问题描述】:

有没有办法用自定义图标(如 React Icons 中的图标)替换内联工具栏图像?

代码(工具栏选项):

import { AiOutlineUnorderedList } from 'react-icons/ai'

export const toolbarOptions = {
  options: ['list', 'link'],
  list: {
    options: ['unordered', 'ordered'],
    unordered: {
      icon: <AiOutlineUnorderedList />, //does not work
      className: undefined,
    },
  },
  link: {
    options: ['link'],
  },
}

我也尝试过使用&lt;img src="./path-to-svg"/&gt;,但是效果不佳...

有什么想法吗?

TIA

【问题讨论】:

    标签: reactjs draftjs react-draft-wysiwyg


    【解决方案1】:

    你只需要提供src或文件路径

    无序:{图标:“../path-to.svg”,类名:未定义},

    【讨论】:

      猜你喜欢
      • 2015-05-07
      • 2021-07-18
      • 1970-01-01
      • 2012-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多