GithubHelp home page GithubHelp logo

gerhobbelt / codemirror-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jagthedrummer/codemirror-ui

0.0 2.0 0.0 1.42 MB

A simple UI for the CodeMirror text editor.

License: MIT License

codemirror-ui's Introduction

CodeMirror UI

CodeMirrorUI is a simple interface written by Jeremy Green to act as a wrapper around the CodeMirror text editor widget by Marijn Haverbeke. CodeMirror is a syntax highlighter and formatter that makes it much easier to edit source code in a browser. CodeMirrorUI is a wrapper that adds interface functionality for many functions that are already built into CodeMirror itself. Functionality includes undo, redo, jump to line, reindent selection, and reindent entire document. Two options for find/replace are also available. It is based on the MirrorFrame example that Marijn included with CodeMirror.

Demo

http://www.octolabs.com/javascripts/codemirror-ui/index.html

Upgrading

Note Starting with version 0.0.17 CodeMirror-UI upgraded to CodeMirror-2.3. The find and replace functionality relies on the searchcursor add-on for CodeMirror. Make sure to add the searchcursor line from the installation instructions if the search/replace is not working.

Easily Configurable

It's easy to configure an editor with something like this:

//first set up some variables
var textarea = document.getElementById('code1');
var uiOptions = { path : 'js/', searchMode: 'popup' }
var codeMirrorOptions = {
    mode: "javascript" // all your normal CodeMirror options go here
}

//then create the editor
var editor = new CodeMirrorUI(textarea,uiOptions,codeMirrorOptions);

Installation

// First the CodeMirror stuff
<script src="lib/CodeMirror-2.3/lib/codemirror.js" type="text/javascript"></script>
<script src="lib/CodeMirror-2.3/lib/util/searchcursor.js" type="text/javascript"></script>
<link rel="stylesheet" href="lib/CodeMirror-2.3/lib/codemirror.css">
<script src="lib/CodeMirror-2.3/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="lib/CodeMirror-2.3/mode/javascript/javascript.css">

//Then the CodeMirrorUI stuff
<script src="js/codemirror-ui.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/codemirror-ui.css" type="text/css" media="screen" />

You'll probably need to adjust the paths to fit your situation.

Please see index.html for examples and many additional details.

Acknowledgements

Thanks to Marijn Haverbeke for creating and releasing CodeMirror in the first place.
Without his excellent contribution to the community this project would have no reason to exist.

Thanks to Mark James of famfamfam.com for his Silk Icons.

License

CodeMirror UI is provided under the MIT License. See the LICENSE file for full details.

codemirror-ui's People

Contributors

ekhaled avatar jagthedrummer avatar mpassell avatar nichtich avatar saschpe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.