vuejs-ace-editor

ace editor for vuejs
57,841 2
Install
npm install vuejs-ace-editor
Latest Version:1.0.1
License:ISC
Last Updated:Dec 6, 2021
Links: GitHub  ·  npm
Maintainer: chuvu138

vuejs-ace-editor

npm

A packaging of ace

Demo here: https://github.com/chairuosen/vue-ace-editor-demo/tree/vue2

How to use

  1. Install

    npm install vuejs-ace-editor
    
  2. Require it in components of Vue options

    import AceEditor from 'vuejs-ace-editor';
    export default {
        ...
        components: {
            AceEditor
        },
        ...
    }
    
  3. Require the editor's mode/theme module in custom methods

    export default {
        ...
        methods: {
            dataSumit() {
                //code here
            },
            editorInit: function () {
                require('brace/ext/language_tools') //language extension prerequsite...
                require('brace/mode/html')                
                require('brace/mode/javascript')    //language
                require('brace/mode/less')
                require('brace/theme/monokai')
                require('brace/snippets/javascript') //snippet
            }
        },
        ...
    }
    
  4. Use the component in template

    <AceEditor 
        v-model="content" 
        @init="editorInit" 
        lang="javascript" 
        theme="monokai" 
        width="100%" 
        height="200px"
        :options="{
            enableBasicAutocompletion: true,
            enableLiveAutocompletion: true,
            fontSize: 14,
            highlightActiveLine: true,
            enableSnippets: true,
            showLineNumbers: true,
            tabSize: 2,
            showPrintMargin: false,
            showGutter: true,
        }"
        :commands="[
            {
                name: 'save',
                bindKey: { win: 'Ctrl-s', mac: 'Command-s' },
                exec: dataSumit,
                readOnly: true,
            },
        ]"
        />
    

    prop v-model is required

    prop lang and theme is same as ace-editor's doc

    prop height and width could be one of these: 200, 200px, 50%

Related Packages

vue2-code-editor

Vue2-code-editor is a front-end code editor for vue development based on ace.

21,529 2
@codemirror/lang-vue

Vue template support for the CodeMirror code editor

71,371,417 29
bd-editor

ace编辑器

513
vue-editor-ace

Ace Editor Of Vue.

1,106 3
vue-cm

CodeMirror component for Vue.js

969 45

Version History

Version Released License
1.0.1 ISC
1.0.0 ISC