• monaco代码编辑器


    首先我简单介绍下这是个代码编辑器,不过远没有VScode那么强大,不过github上面给的东西实在实在实在本人看不太懂,并且邀了好多人也不是很懂.

    总结了我自己用到的几个小玩意,如果你没有用到这个,建议你不要继续往下看了,浪费时间

    monacoEditor = monaco.editor.create(document.getElementById('container'), {

            value: "<div>我是插入的代码</div>",
            language: 'html',
            wrappingColumn: 0,
            wrappingIndent: "indent"
        });
    if (monacoEditor) {
            monacoEditor.layout();
        }

    如果你也有需要最大化代码编辑器的功能那么红色的代码是你需要的,
    下面是我们经尝试不得已使用的格式化代码的方法,
    codeJson是你的所有代码,
     
     
    this.codeJson = this.sbIns.output()
    this.model = monaco.editor.getModels()[0]
    const timer = setInterval(() => {
    if (this.model.getValueLength() > 0) {
    clearInterval(timer)
    this.editor.getAction('editor.action.formatDocument').run()
    setTimeout(() => {
    this.fullScreenLoading = false
    }, 300)
    }
    }, 1000)
    this.editor.setValue(JSON.stringify(this.codeJson))
    绿色的是每次去检查代码的长度看是否执行方法将他格式化{{{{{{这个方法其实是代码上去之后,鼠标右击,这个插件写了个方法,出了个白色div里面有个formatdom方法点了
    之后就可以将代码格式化了,在这里我们直接检查代码长度,达到格式化的目的}}}}}
  • 相关阅读:
    hdu1209(Clock)
    [NodeJS]使用Node.js写一个简单的在线聊天室
    UVa 11168 Airport , 凸包
    【数据结构与算法】(二) c 语言链表的简单操作
    Struts简单介绍
    bzoj3931【CQOI2015】网络吞吐量
    python爬虫解决百度贴吧登陆验证码问题
    TNS-01251: Cannot set trace/log directory under ADR
    Oracle 监听器日志文件过大导致监听异常
    RHEL7
  • 原文地址:https://www.cnblogs.com/MDGE/p/11200765.html
Copyright © 2020-2023  润新知