monaco-editor是一款非常好用的web代码编辑器,那么如何把他加到自己的项目中呢。
1.下载插件
npm install monaco-editor@0.8.3
2.初始化编辑器值
1
2
|
<!--要绑定的对象--> < div id="container"></ div >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
var monacoEditor;
//设置插件路径 require.config({ paths: { 'vs' : '/Scripts/monaco/min/vs' } });
//绑定对象并赋值 require([ 'vs/editor/editor.main' ], function () {
//container为要绑定的对象
monacoEditor = monaco.editor.create(document.getElementById( 'container' ), {
value: "<div>我是插入的代码</div>" ,
language: 'html' ,
wrappingColumn: 0,
wrappingIndent: "indent"
});
}); //自适应宽度 window.onresize = function () {
if (monacoEditor) {
monacoEditor.layout();
}
}; |
3.获取编辑器值
1
|
monacoEditor.getValue(); |
4.替换编辑器值
1
2
3
4
5
6
7
8
9
10
11
|
//移除原有对象 $( "#container" ).children().remove();
//重新绑定对象并赋新值 require([ 'vs/editor/editor.main' ], function () {
monacoEditor = monaco.editor.create(document.getElementById( 'container' ), {
value: '<span>nenewnew</span>' ,
language: 'html' ,
wrappingColumn: 0,
wrappingIndent: "indent"
});
});
|
相关推荐
tui-editor1.3.3/tui-editor/tui-editor死活下载不了
vue3.0+vue-quill-editor+element富文本编辑引入可直接使用 可上传图片调整图片大小
使用教程(注意细看总结部分,写了几点,希望有所帮助): 1、安装插件:npm install vue-quill-editor 2、安装插件依赖:npm install quill 3、main.js文件中引入: import Vue from 'vue' import VueQuillEditor ...
cnpm i vue-quill-editor cnpm i quill cnpm i quill-video-image-module 使用说明 import 'quill/dist/quill.core.css' // import styles import 'quill/dist/quill.snow.css' // for snow theme import '...
项目中用到 tui-editor 1.3.3 的依赖,可是 npm、cnpm 怎么都装不下来,看报错应该是 github 被墙了的原因,上传一份,希望能帮到大家(下下来直接放到 node_modules 目录里即可)
vue3 v-md-editor markdown编辑器(VMdEditor)和预览组件(VMdPreview )的使用
UnitySetup-Windows-Support-for-Editor-5.3.8f2.exe 下载
vue富文本编辑器vue-quill-editor.js ...vue-quill-editor富文本编辑器使用方法,最全,含部分源码解读,含图片上传,如果页面有多个富文本,图片上传解决方案 https://blog.csdn.net/cplvfx/article/details/125557966
UnitySetup-Android-Support-for-Editor-5.3.5f1UnitySetup-Android-Support-for-Editor-5.3.5f1UnitySetup-Android-Support-for-Editor-5.3.5f1UnitySetup-Android-Support-for-Editor-5.3.5f1
视频编辑分割格式改小软件RD-Video-Editor_63.exe 视频编辑,视频分割,视频格式改小,视频编辑软件,RD-Video-Editor
react-monaco-editor摩纳哥的React编辑器-源码,案例可以借鉴
主要介绍了富文本编辑器vue2-editor实现全屏功能,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值 ,需要的朋友可以参考下
Laravel开发-laravel-u-editor 适用于Laravel5。支持i18n.ueditor是百度的富文本网页编辑器。融为一体
四、使用auto-editor自动剪辑软件 第一种剪辑方法: auto-editor C:/Users/PC-2020/Desktop/123456.mp4 第二种剪辑方法:(推荐) auto-editor C:/Users/PC-2020/Desktop/123456.mp4 --export_to_premiere auto-...
UnitySetup-Android-Support-for-Editor-5.3.4f1
UnitySetup-Android-Support-for-Editor-5.5.6f1
fuxa-editor.min.js
本人博客文章--富文本编辑器 vue-html5-editor的集成与使用源代码