Comments (8)
Wouldn't it be easier to do realtime editing on the underlying markdown value as it's just plain text
I think that would likely come undone once you got into the details - doing OT on the Slate structure would allow keeping selection and cursor positions for example. Considering there is a wider effort in the Slate ecosystem to enable realtime it would be good to participate in thatβ¦
from rich-markdown-editor.
@ShiroYacha If you put in a pr that exposes value
and updates the editorValue internally when the prop changes I'd be happy to accept.
from rich-markdown-editor.
The editor isn't designed for this usecase yet, you'd probably need to be able to show other users cursors too at a minimum. As it stands it would be relatively easy to allow though and a welcome improvement
from rich-markdown-editor.
In my use-case, there are multiple editors in one screen (actually there might be another issue with the toolbar...) and the user should be able to get realtime update when the value of an editor is changed by another person. Further, if possible I would like to enable collaboration when an editor is in edit mode.
Now I'm doing it using the ref which is a extremly ugly hack... Something like:
render() {
if (this.editorRef.current && checkRemoteContent()) {
const value = MarkdownSerializer.deserialize(this.state.remoteContent);
this.editorRef.current.setState({ editorValue: value });
}
return (<Editor
...
ref={this.editorRef}
... />);
}
In this way, at least the updates will be in real-time, however, I haven't find a way to effectively merge the content of each user so you won't lose the cursor when an update arrives...
Ideally, if the editor exposes the value prop of the editor it would be pretty easy to inject the incoming content. To be more inline with the current structure, we can probably wrap a valueOverride
prop that gets deserialized and overrides the editorValue state inside componentWillReceiveProps
?
from rich-markdown-editor.
Wouldn't it be easier to do realtime editing on the underlying markdown value as it's just plain text? To me that seems way easier to implement server and client-side than mutations on the complex json document especially when merging different states. Additionally you can use well-known algorithms for this (https://en.wikipedia.org/wiki/Operational_transformation).
from rich-markdown-editor.
BTW if you are interested to contribute this back (or fork), I am really interested in this as well.
from rich-markdown-editor.
Hey, actually originally I just wanted a way to feed the editor value back from remote. I am not really doing real collaboration editing...The slate editor already has an issue open on this subject and has supported to some level OT check ianstormtaylor/slate#259. I am not sure if it will be easier to operate on markdown text as opposed to the slate objects..
from rich-markdown-editor.
I'm closing this issue β the editor has been rebuilt to be based on Prosemirror, which makes adding realtime editing much easier through their plugins architecture. However the work to do so will not be included as part of this project.
from rich-markdown-editor.
Related Issues (20)
- Clicking on webpage outside the editor does not dismiss style popup
- Blinking cursor should always be on after cursor movement HOT 3
- Shift+Enter in code fence could preserve indentation
- Create link with '/' command will cause Uncaught TypeError: assert_1.default is not a function HOT 4
- `/` command does not create new line, it rewrites the above or next line HOT 1
- Menu icon is not hidden after collapsing an heading in the editor
- Toggle todolist in new line with text after HOT 1
- composing lost when select multi lines
- Content of an info notice spills outside container when content includes a code snippet HOT 1
- Table will break if you click on table row action other than the first one HOT 2
- Editor does not show nested lists correctly (bulleted in ordered) HOT 2
- Editor crashes when feeding custom searchLinks HOT 2
- NextJS fails to compile due to global CSS dependency in node modules HOT 1
- Hyperlinks are posted between < >'s HOT 3
- onChange called on init when view == null HOT 1
- onBlur is called on first mount
- Editor state does not update when new value is an empty string
- Double characters being inserted at every line beginning - Firefox Mobile
- whole project crashing and getting `duplicate use of selection JSON ID cell` error HOT 3
- First table row gets converted into table header
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rich-markdown-editor.