返回时间新罗马字体,而不是羽毛笔编辑器内容字体

时间:2018-06-19 14:05:00

标签: javascript ajax 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'
        });

AJAX!

 $(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。并且我想要我在羽毛笔编辑器中粘贴的任何类型的字体,在提交单击时总是返回相同的字体类型。

0 个答案:

没有答案
相关问题