codemirror-editor-vue3 编辑器只要换行保存就会有小红点


先看示例

 

 找了篇博客写的贼详细 https://blog.csdn.net/xujingyiss/article/details/118992763

只要设置这二个

 

 

       let content = ""; 可以写你需要的样式
配置如下
  const cmOptions = {
         mode: 'text/x-mysql', // //语言模式
         theme: 'neo', // 主题
         lineNumbers: false, // 显示行号
         smartIndent: true, //智能缩进
         indentUnit: 4, // 智能缩进单元长度为 4 个空格
         foldGutter: true, // 代码折叠
         styleActiveLine: true, // 显示选中行的样式
         matchBrackets: true, //每当光标位于匹配的方括号旁边时,都会使其高亮显示
         autofocus: true,
         showCursorWhenSelecting: true,
         autocorrect: true,
         spellcheck: true,
         specialChars: /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,
         specialCharPlaceholder: function (ch) {
            let token = document.createElement("span");
            let content = "";
            token.className = "cm-invalidchar";
            if (typeof content == "string") {
               token.appendChild(document.createTextNode(content));
            }
            token.title = "\\u" + ch.charCodeAt(0).toString(16);
            token.setAttribute("aria-label", token.title);
            return token
         },
         // 代码折叠
         gutters: [
            "CodeMirror-lint-markers",
            "CodeMirror-linenumbers",
            "CodeMirror-foldgutter"
         ],
         foldGutter: true, // 启用行槽中的代码折叠
      }

可以看下上面的博客里面或许有你们需要的

改完之后就是下面这样

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM