Giter Club home page Giter Club logo

sharedb-codemirror's People

Contributors

aslakhellesoy avatar chanhyeong avatar ejones avatar jbpros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sharedb-codemirror's Issues

how to set the language

i am a newbie. I am trying to modify the example into IDE. But whatever i do it is being displayed as plain text and not highlighting the syntax (colors)

Stuck in an endless loop

Hi, I have used this in React Framework.
In my test file, I wrote like this:

import React, {Component} from 'react';

import otText from 'ot-text'
import shareDB from 'sharedb/lib/client'
import shareDBCodeMirror from 'sharedb-codemirror'
import CodeMirror from 'codemirror'
require('codemirror/theme/eclipse.css');
require('codemirror/mode/clike/clike');

shareDB.types.map['json0'].registerSubtype(otText.type);


class CollaberateView extends Component
{
    constructor(props){
        super(props);
        this._refs={}
    }

    componentDidMount(){

        this.editor = CodeMirror.fromTextArea(this._refs.textArea,{mode:"text/x-c++src",lineNumbers:"true",theme:"eclipse"});

        this.shareConnection = new shareDB.Connection(new WebSocket("ws://localhost:8080/share/e83b2e2695c940008195cc6375b815cf"));

        this.doc = this.shareConnection.get('example', 'textarea');
         
        try{
            shareDBCodeMirror.attachDocToCodeMirror(this.doc, this.editor, {
                key: 'content',
                verbose: true
             });
        }catch(err){
            console.log("attach doc error:"+err);
        }
        console.log("finish")
    }

    render(){
        return (
            <div className="container">
                <textarea ref={e => this._refs.textArea=e}>  </textarea>
            </div>
        )
    }
}
export default CollaberateView;

However, once this page was opened and I input some words, it will stuck in an endless loop like this:
image

Consider use of JSON0 text type?

Greetings,

Thank you for your work on this library.

I'd like to use sharedb-codemirror to add code editing functionality to an existing ShareDB application. However, the existing application uses the JSON0 text type (text0) for strings. Since sharedb-codemirror uses the text OT type, I am not able to use it in the existing application (without modifying the existing application to use the text type).

Would you be open to accepting a PR that adds an option to use the text0 OT type? It seems like it would be pretty straightforward to do by modifying all the places where OPs are generated. Thank you.

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.