提问人:gby 提问时间:10/30/2023 最后编辑:gby 更新时间:10/31/2023 访问量:37
如何使用 tailwindcss 将 summernote 嵌入到 asp.net 项目中
How to embed summernote to a asp.net project with tailwindcss
问:
我正在尝试将 summernote 嵌入到我的项目中,并且我正在使用 tailwindcss。我按照指南将 summernote 安装到项目中,但它仍然不起作用。
我将这些行添加到标记下的 _Layout.cshtml 中:'<head>
<link href="/node_modules/summernote/dist/summernote.css" rel="stylesheet">
<script src="/node_modules/summernote/dist/summernote.js"></script>
然后在我的 Index.cshtml 中,我尝试使用 javascript 初始化 summernote:
<script>
$(document).ready(function () {
$('#proposed').summernote
});
</script>
然后为我的标签制作了一个 ID:'<textarea>
<div class="mx-2" >
<textarea id="proposed" class="resize-none w-full h-52 p-2 mb-2 border-2 border-gray-200"></textarea>
</div>
但是没有用,这是来自 YouTube 的指南,即使我从这里尝试了指南
它不起作用,因为它是用于 bootstrap 的。
有没有办法嵌入 summernote?
答:
1赞
gby
10/31/2023
#1
由于我没有使用 bootstrap,因此我找到了一种将 summernote 嵌入到 asp.net 项目中的方法,并且通过使用并且我必须将其添加到我的库中。summernote-lite.js
summernote-lite.css
然后将以下行添加到 _Layout.cshtml 中的标记:'<head>'
<link href="summernote-bs5.css" rel="stylesheet">
<script src="summernote-bs5.js"></script>
然后手动将此脚本添加到索引/视图页面:
$('#proposed').summernote({
tabsize: 2,
height: 120,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']]
]
});
使用这种方法,它在使用 tailwindcss 时对我有用
评论