javascript - 返回 Time New Roman 字体而不是 quill 编辑器内容字体
问题描述
无论我们在羽毛笔编辑器中粘贴什么格式,它都会自动转换为 Arial,当按下提交按钮以显示编辑器的内容时,输出文本将采用 Time New Roman 格式,我该怎么办?请给我一些解决方案。
HTML!
<!DOCTYPE html>
<html>
<title>Text Editor</title>
<head>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<h2>Text Editor</h2>
<div id="editor">
</div>
<button id="click">Submit</button>
<div id ="output"><p style="display: none;"></p></div>
这是JS代码!
<script>
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[ 'link', 'image', 'video', 'formula' ], // add's image support
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'] // remove formatting button
];
var quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow'
});
阿贾克斯!
$(document).ready(function() {
$("#output p").hide();
$("#click").click(function() {
$("#output p").hide();
var get_html=quill.container.firstChild.innerHTML;
console.log(get_html);
var text1 = quill.getText();
$.ajax({
type: "POST",
url: 'save.php',
data: {
editor_data:get_html
},
success: function(data)
{
$("#output p").html(get_html);
$("#output p").show();
}
});
});
});
当我单击提交按钮时,它总是返回 Time New Roman。我想要什么类型的字体我粘贴到 Quill 编辑器中,它总是在提交单击时返回相同的字体类型。
解决方案
推荐阅读
- python - 这是对“yield”语句的错误使用吗?
- python-3.x - 'opts = self.remote_field.model._meta' 'AttributeError: 'str' 对象没有属性 '_meta''
- python - 如何在当前选项卡上打开页面?
- node.js - 如何在 EJS 模板中单击/添加事件侦听器?
- visual-studio-2019 - 我找不到适用于 mac 的代码片段管理器 Visual Studio 2019
- intellij-idea - IntelliJ 项目设置问题:如何正确删除项目
- wikipedia-api - 维基词典 API:获取单词的标签,并指定语言
- c++ - 尝试将模板与堆栈相结合,以访问文本文件并组织
- python - 我有一个 json 格式的数据文件。如何找到并打印前 20 个 eij_max 值和相关的 pretty_formula?我正在使用蟒蛇
- css - 悬停时标题文本颜色更改