tiptap 编辑器显示源码

    showSource() {
      let _this = this
      _this.isHTML = !_this.isHTML
      let _source = this.editor.getHTML()

      if (_this.isHTML) {
        _source = _source.replace(/</g, "<").replace(/>/g, ">").replace(/ /g, " ")
      } else {
        _source = _source.replace(/</ig, "<").replace(/>/ig, ">").replace(/ /ig, " ")
      }
      _source = _source.replace(/<p><p>/ig,'<p>').replace(/<\/p><\/p>/ig,'</p>')
      this.editor.commands.setContent(_source);
      
    }
isHTML = false;
上一篇:JDBC_JAVA数据库连接


下一篇:REPLACE函数的使用