0.1.5 • Published 4 years ago

vue-ace-editor-valid v0.1.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

vue-ace-editor-valid

npm

ace editor for vue

Feature

  • official syntax validation for 'coffee', 'css', 'html', 'javascript', 'json', 'lua', 'php', 'xml' and 'xquery'
  • only use CDN source

How to use

1. add ace CDN Source to index.html

<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.7/ace.js" integrity="sha256-C7DTYRJLG+B/VEzHGeoPMw699nsTQYPAXHKXZb+q04E=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.7/mode-json.js" integrity="sha256-WH3EjHkUnhbOt45gfu5MvEYSqvYUXE25FwAtxukgi9U=" crossorigin="anonymous"></script>

2. config CDN

// vue.config.js

module.exports = {
  configureWebpack: {
    externals: {
      ace: 'ace'
    }
  }
}

3. install vue-ace-editor-valid

$ npm install --save vue-ace-editor-valid
# or
$ yarn add vue-ace-editor-valid

4. use vue-ace-editor-valid

<template>
    <ace-editor class="editor" v-model="code" />
</template>

<script>
import AceEditor from 'vue-ace-editor-valid'
const welcome = { welcome: { ace: 'hello world' } }

export default {
  name: 'App',
  data: () => ({
    code: JSON.stringify(welcome, null, '\t')
  }),
  components: {
    AceEditor
  }
}
</script>

Documentation

propsdescriptiondefault
v-model(code)content of editor (String)''
optionsoptions of editor (Object) same as ace options{}
languagelanguage of editor (String)'json'
themetheme of editor (String)''
heightheight of editor (Number)'100%'
widthwidth of editor (Number)'100%'
eventdescriptionparams
mountededitor was mountedthe instance of editor
changecontent was changedcontent
validationFailedformat verification failedfailed info

Thanks

Inspired by vue2-ace-editor

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago