我试图安装QuillJS与Symfony-Encore。不知何故,工具栏的SVG图标没有按预期加载。
输出只显示SVG的路径:
<span class="ql-formats">
<button type="button" class="ql-bold">/build/images/bold.89e9c638.svg</button>
<button type="button" class="ql-italic">/build/images/italic.b802b8f9.svg</button>
</span>
我如何解析这个路径并嵌入或链接相应的svg-icon?我猜是某种加载器配置丢失了或者像这样的smth。
I将Quill作为单独组件嵌入:
import Quill from 'quill/core';
// ... more quill packages
编辑:
我添加了HTML-Loader来将svg内嵌到我的HTML中,配置如下:
{
test: /\.svg$/,
use: [{
loader: 'html-loader',
options: {
minimize: true
}
}]
}
我现在收到这个错误。
找不到这些相关模块:
- 第一次访问时,您将看到一个页面,其中包含了一个页面名称。
- 我的意思是说,如果你想在一个新的环境中工作,那么你可以在这个新的环境中工作。
- 我的意思是说,如果你有一个新的用户,你就可以使用它了。
- 我的朋友们,我的朋友们......
- ......“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”
路径主题是正确的。我完全不知道这里出了什么问题。
感谢您的帮助:-)
5条答案
按热度按时间hmae6n7t1#
如果您的问题与Laravel Mix有关:on GitHub there is a discussion关于Mix本身的问题,以及涉及修改webpack.mix.js文件的解决方案,如下所示:
pxyaymoc2#
您需要通过添加
.disableImagesLoader()
来禁用标准的图像加载器,并添加您自己的图像加载器,这将排除Quill资产。ijxebb2r3#
您是否将svg添加到webpack配置中允许的文件扩展名中?
dfty9e194#
我在这里找到了解决方案https://www.kohrvid.com/blog/posts/using-quilljs-with-rails-6
只需使用
svg-inline-loader
wnvonmuf5#
只需将import语句替换为
import Quill from 'quill'
即可。我遇到了同样的问题,问题是使用
import Quill from 'quill/core'
(在我的例子中是import Quill from 'quill/quill'
)并没有导入所有必要的模块和资产,而在您的例子中只是导入Quill核心。