All Projects β†’ cnu4 β†’ Vue Codemirror Lite

cnu4 / Vue Codemirror Lite

Licence: mit
Lightweight Codemirror Component for Vue.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Codemirror Lite

Md2pdf
Offline markdown to pdf, choose -> edit -> transform πŸ₯‚
Stars: ✭ 632 (+159.02%)
Mutual labels:  codemirror
Saite
Interactive document creation for exploratory graphics and visualizations. 咲いて (in bloom). Built on top of hanami vega/vega-lite library with CodeMirror and self hosted ClojureScript
Stars: ✭ 89 (-63.52%)
Mutual labels:  codemirror
Codemirror Graphql
GraphQL mode and helpers for CodeMirror.
Stars: ✭ 147 (-39.75%)
Mutual labels:  codemirror
Codemirror Swiftui
CodeMirror-SwiftUI is a lightweight wrapper of CodeMirror for macOS and iOS packaged for SwiftUI.
Stars: ✭ 30 (-87.7%)
Mutual labels:  codemirror
Kodeweave
HTML/CSS/JS and Markdown Playground For Web Designers and Developers
Stars: ✭ 87 (-64.34%)
Mutual labels:  codemirror
Flok
Web-based P2P collaborative editor for live coding sounds and images
Stars: ✭ 119 (-51.23%)
Mutual labels:  codemirror
Angular Admin
πŸ”Admin client for surmon.me blog powered by @angular and Bootstrap4
Stars: ✭ 352 (+44.26%)
Mutual labels:  codemirror
Markdown Edit
online markdown editor/viewer
Stars: ✭ 188 (-22.95%)
Mutual labels:  codemirror
Code Mirror Themes
πŸ“ A large collection of Code Mirror themes for your coding pleasure
Stars: ✭ 87 (-64.34%)
Mutual labels:  codemirror
React Codemirror
CodeMirror component for React. @codemirror https://uiwjs.github.io/react-codemirror/
Stars: ✭ 142 (-41.8%)
Mutual labels:  codemirror
Gorilla Notebook
A clojure/clojurescript notebook application/-library based on Gorilla-REPL
Stars: ✭ 73 (-70.08%)
Mutual labels:  codemirror
Hypermd
A WYSIWYG Markdown Editor for browsers. Break the Wall between writing and previewing.
Stars: ✭ 1,258 (+415.57%)
Mutual labels:  codemirror
Droppy
**ARCHIVED** Self-hosted file storage
Stars: ✭ 1,564 (+540.98%)
Mutual labels:  codemirror
Codemirror Facade
Facade for the codemirror
Stars: ✭ 8 (-96.72%)
Mutual labels:  codemirror
Vue Codemirror
⌨️ @codemirror component for @vuejs
Stars: ✭ 2,115 (+766.8%)
Mutual labels:  codemirror
Graviton App
πŸš€ A modern-looking Code Editor
Stars: ✭ 601 (+146.31%)
Mutual labels:  codemirror
Qlens
QLens is an electron app which dynamically generates GraphQL Schemas and Mongo Schema visualization. QLens significantly cuts development time by automating the formation of their GraphQL schemas based on information fetched from their non-relational database.
Stars: ✭ 110 (-54.92%)
Mutual labels:  codemirror
Ngx Codemirror
Codemirror Wrapper for Angular
Stars: ✭ 192 (-21.31%)
Mutual labels:  codemirror
Yii2 Podium
Yii 2 forum module project
Stars: ✭ 172 (-29.51%)
Mutual labels:  codemirror
Editor.md
The open source embeddable online markdown editor (component).
Stars: ✭ 11,741 (+4711.89%)
Mutual labels:  codemirror

Vue-Codemirror-Lite

CodeMirror Component For Vue.js (support 1.x and 2.x).

δΈ­ζ–‡ζ–‡ζ‘£

Lightweight

By default (to optimise bundle size) all modes and addons are not included. To enable them, see Using Language Modes and Addons.

Demo

Live Demo: https://cnu4.github.io/vue-codemirror-lite

To run the demo locally, run

npm install && npm run dev

View demo in browser on JSFiddle

Installation

npm

npm install vue-codemirror-lite

// Install the plugin
var Vue = require('vue')
var VueCodeMirror = require('vue-codemirror-lite')

Vue.use(VueCodeMirror)

// Or use as component (ES6)
import Vue from 'vue'
import { codemirror } from 'vue-codemirror-lite'

export default {
  components: {
    codemirror
  }
}

browser

Include in the page

<script src="https://unpkg.com/vue-codemirror-lite/dist/vuecodemirror.min.js"></script>

install into vue

Vue.use(VueCodeMirror)

or use as components

Vue.component('codemirror', VueCodeMirror.codemirror)

CodeMirror itself was built into vuecodemirror.min.js, get CodeMirror by

window.CodeMirror = VueCodeMirror.CodeMirror

View demo in browser on JSFiddle

Usage

Usage in Component

<!-- simple -->
<codemirror :value="code"></codemirror>

<!-- simple (with bindings in Vue1.x) -->
<codemirror :value.sync="code"></codemirror>

<!-- simple (with bindings in Vue2.x) -->
<codemirror v-model="code"></codemirror>

<!-- advanced -->
<codemirror
  :value="code"
  :options="editorOption"
  ref="myEditor"
  @change="yourCodeChangeMethod">
</codemirror>
export default {
  data () {
    return {
      code: 'const str = "hello world"'
    }
  },
  computed: {
    editor() {
      // get current editor object
      return this.$refs.myEditor.editor
    }
  },
  mounted() {
    // use editor object...
    this.editor.focus()
    console.log('this is current editor object', this.editor)
  }
}

Properties

  • value String the editor value
  • options Object (newValue) options passed to the CodeMirror instance

See the CodeMirror Configuration for the available options.

Using Language Modes and Addons

Several language modes are included with CodeMirror.

By default (to optimise bundle size) all modes and addons are not included. To enable:

  • install vue-codemirror-lite
  • require the language modes or addons after you require vue-codemirror-lite itself (If use browser version, you need to include necessary script file of mode and addons. View demo in browser on JSFiddle)
  • set the mode option in the options object
<template>
  <codemirror :options="{
    mode: 'javascript',
    extraKeys: {'Ctrl-Space': 'autocomplete'}
  }"></codemirror>
</template>

<script>
  import { codemirror } from 'vue-codemirror-lite'
  require('codemirror/mode/javascript/javascript')
  require('codemirror/mode/vue/vue')

  require('codemirror/addon/hint/show-hint.js')
  require('codemirror/addon/hint/show-hint.css')
  require('codemirror/addon/hint/javascript-hint.js')

  export default {
    ...
  }
</script>

See the demo source which implement JavaScript and vue syntax highlighting and JavaScript hint addon.

See the CodeMirror Manual for the more modes and addons.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].