前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ace editor 在线网页版的vscode!代码编辑器

Ace editor 在线网页版的vscode!代码编辑器

作者头像
九霄道长
发布2021-04-25 15:28:51
5.3K0
发布2021-04-25 15:28:51
举报
文章被收录于专栏:九霄道长九霄道长

Ace是一个功能非常强大的编辑器。它实现了语法着色,缩进,代码提示功能。且具有大量的主题,支持大量语言。

20210422154446.png
20210422154446.png

官网地址:https://ace.c9.io/ Github: https://github.com/ajaxorg/ace/ vue版:https://github.com/chairuosen/vue2-ace-editor

代码语言:javascript
复制
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-language_tools.js" 
            type="text/javascript" charset="utf-8"></script>
           <pre id="code" class="ace_editor" style="min-height:400px">
                    <textarea class="ace_text-input"></textarea>
                </pre>

<script>
    //初始化对象
    editor = ace.edit("code");

    //设置风格和语言(更多风格和语言,请到github上相应目录查看)
    theme = "monokai"
    language = "java"
    editor.setTheme("ace/theme/" + theme);
    editor.session.setMode("ace/mode/" + language);

    //字体大小
    editor.setFontSize(18);

    //设置只读(true时只读,用于展示代码)
    editor.setReadOnly(false);

    //自动换行,设置为off关闭
    editor.setOption("wrap", "free")

    //启用提示菜单
    ace.require("ace/mode/java");
    editor.setOptions({
        enableBasicAutocompletion: true,
        enableSnippets: true,
        enableLiveAutocompletion: true
    });
</script>

中文文档:https://www.jianshu.com/p/8a4a5e273538

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021 年 04 月,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档