我正在尝试将 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>
然后为我的
'<textarea>
标签创建了一个ID:
<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 的指南,尽管我尝试了这里的指南
它不起作用,因为它是用于引导程序。
有没有办法嵌入summernote?
由于我没有使用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 时对我有用