微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

monaco-editor 基于浏览器的代码编辑器

程序名称:monaco-editor

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

monaco-editor 介绍

Monaco Editor 是微软开源的基于 VS Code
代码编辑器,运行在浏览器环境中。编辑器提供代码提示,智能建议等功能。供开发人员远程更方便的编写代码。描述代码编辑器功能页面这里

安装:

npm install monaco-editor

你将会得到

  • inside dev: bundled, not minified

  • inside min: bundled, and minified

  • inside min-maps: source maps for min

  • monaco.d.ts: this specifies the API of the editor

集成

这里是嵌入编辑器最基本的HTML页面,更多的示例可在monaco-editor-
samples
找到

<!DOCTYPE html>
<html>
<head>
    <Meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <Meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>

<div id="container"  ="width:800px;height:600px;border:1px solid grey"></div>

<script src="monaco-editor/min/vs/loader.js"></script><script>    require.config({ paths: { 'vs': 'monaco-editor/min/vs' }});    require(['vs/editor/editor.main'], function() {        var editor = monaco.editor.create(document.getElementById('container'), {            value: [                'function x() {',                '\tconsole.log("Hello world!");',                '}'            ].join('\n'),            language: 'javascript'        });    });</script></body>
</html>

monaco-editor 官网

https://microsoft.github.io/monaco-editor/index.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐