ejones / sharedb-codemirror Goto Github PK
View Code? Open in Web Editor NEWCodeMirror bindings for ShareDB
License: MIT License
CodeMirror bindings for ShareDB
License: MIT License
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)
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:
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.