首页 > 解决方案 > l-blank" data-gramm="false" contenteditable="true" data-placeholder="你的标题...">

问题描述

我在 chrome 中收到此错误,它适用于 firefox。我正在尝试将数据保存到两个数据框中,这是我在某些浏览器上遇到的错误。

编码 -

    <script>

var text = "<div class=\"ql-editor\" data-gramm=\"false\" data-placeholder=\"Your title...\" contenteditable=\"true\"><p>title</p></div><div class=\"ql-clipboard\" tabindex=\"-1\" contenteditable=\"true\"></div><div class=\"ql-tooltip\" style=\"left: -76.9167px; top: 28.2333px; width: 204px;\"><span class=\"ql-tooltip-arrow\"></span><div class=\"ql-tooltip-editor\"><input type=\"text\" data-formula=\"e=mc^2\" data-link=\"https://quilljs.com\" data-video=\"Embed URL\"><a class=\"ql-close\"></a></div><div class=\"ql-toolbar\"><span class=\"ql-formats\"><button type=\"button\" class=\"ql-bold\"><svg viewBox=\"0 0 18 18\"> <path class=\"ql-stroke\" d=\"M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z\"></path> <path class=\"ql-stroke\" d=\"M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z\"></path> </svg></button><button type=\"button\" class=\"ql-italic\"><svg viewBox=\"0 0 18 18\"> <line class=\"ql-stroke\" x1=\"7\" x2=\"13\" y1=\"4\" y2=\"4\"></line> <line class=\"ql-stroke\" x1=\"5\" x2=\"11\" y1=\"14\" y2=\"14\"></line> <line class=\"ql-stroke\" x1=\"8\" x2=\"10\" y1=\"14\" y2=\"4\"></line> </svg></button><button type=\"button\" class=\"ql-link\"><svg viewBox=\"0 0 18 18\"> <line class=\"ql-stroke\" x1=\"7\" x2=\"11\" y1=\"7\" y2=\"11\"></line> <path class=\"ql-even ql-stroke\" d=\"M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z\"></path> <path class=\"ql-even ql-stroke\" d=\"M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z\"></path> </svg></button></span><span class=\"ql-formats\"><button type=\"button\" class=\"ql-header\" value=\"1\"><svg viewBox=\"0 0 18 18\"> <path class=\"ql-fill\" d=\"M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z\"></path> </svg></button><button type=\"button\" class=\"ql-header\" value=\"2\"><svg viewBox=\"0 0 18 18\"> <path class=\"ql-fill\" d=\"M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z\"></path> </svg></button><button type=\"button\" class=\"ql-blockquote\"><svg viewBox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=\"3\" width=\"3\" x=\"4\" y=\"5\"></rect> <rect class=\"ql-fill ql-stroke\" height=\"3\" width=\"3\" x=\"11\" y=\"5\"></rect> <path class=\"ql-even ql-fill ql-stroke\" d=\"M7,8c0,4.031-3,5-3,5\"></path> <path class=\"ql-even ql-fill ql-stroke\" d=\"M14,8c0,4.031-3,5-3,5\"></path> </svg></button></span></div></div>";

var startTag = " contenteditable=\"true\">";
var endTag = "</div><div class=\"ql-clipboard\"";
var start = text.indexOf(startTag);
var end = text.indexOf(endTag);

var titleText = text.substring(start+startTag.length, end);

                var toolbarOptions = [
              // [{ 'font': fonts }],
              // [{ 'header': 1 }, { 'header': 2 }],
              [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
              [{ 'size': ['small', false, 'large', 'huge'] }],
              ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
              ['blockquote', 'code-block'],

              [{ 'list': 'ordered'}, { 'list': 'bullet' }],
              // [{ 'script': 'sub'}, { 'script': 'super' }],
              // [{ 'indent': '-1'}, { 'indent': '+1' }],
              // [{ 'direction': 'rtl' }],

              
              [{ 'color': [] }, { 'background': [] }],
              
              // [{align: []}],
              // [{ 'align': [false, 'right', 'center', 'justify'] }],
              [{align: ''}, {align: 'right'}, {align: 'center'}, {align: 'justify'}],
              ['image', 'video'],
              ['clean'],                                         
              ['fullscreen']
            ];

          var quill = new Quill('#editor-container', {
            debug: 'warn',
            modules: {
              formula: true,
              syntax: true,
              'history': { // Enable with custom configurations
                'delay': 2500,
                'userOnly': true
              },
              toolbar: toolbarOptions,
            },
            placeholder: 'write here...',
            // bounds: '#editor-container',
            theme: 'snow' //bubble / snow
          });


    </script>

如何修复此错误?对不起,我对此有点陌生 - 任何帮助将不胜感激!

标签: javascript

解决方案


推荐阅读