Comments (3)
@BitPhinix, thank you. That was an excellent suggestion and worked beautifully.
I can't think of a good reason why one would want remote changes to creep into their local history. I wish there was an easy way to add this to slate-jys
, but it feels wrong to require slate-history
in slate-yjs
even though I bet a large majority of people using slate-yjs
use slate-history
as well. Below is the code I added after creating the editor for anyone else who is interested:
const { apply } = editor
editor.apply = (...args) => {
if (YjsEditor.isRemote(editor)) {
HistoryEditor.withoutSaving(editor, () => {
apply.apply(editor, args)
})
} else {
apply.apply(editor, args)
}
}
from slate-yjs.
Hi @SamDuvall,
Another way you could solve this is by wrapping editor.apply
with a handler that checks if YjsEditor.isRemote(editor)
is true and then wrapping the next call with HistoryEditor.withoutSaving
I haven't actually tested it, but it should work 😄
from slate-yjs.
Awesome, glad I could help!
I haven't yet added this to slate-yjs
because I'm planning to add another history handling plugin based on Y.UndoManager
to have proper Yjs history support. I'm really busy at the moment but will get back to it in the coming months
from slate-yjs.
Related Issues (20)
- Error: Can't resolve 'use-sync-external-store/shim/with-selector' in '/../node_modules/@slate-yjs/react/dist' HOT 6
- The operating error HOT 3
- useRemoteCursorOverlayPositions in react 18 does not work HOT 11
- Awareness Update before State Update HOT 5
- hocuspocus is no longer open source HOT 2
- Undo after replacing selected text with mark is bringing back mark incorrectly and throws exceptions afterwards HOT 3
- Content duplication in Slate-Yjs offline syncing
- An empty line is added when the user opens or reloads the the document . HOT 3
- `Cannot read properties of null (reading 'parent')` during `flushLocalChanges`
- Empty text node added when replacing the doc content with the new content HOT 2
- applyRemoteEvents breaks on text and inline void combination HOT 1
- #applySlateOp doesn't properly adjust indices for move_node operations HOT 1
- Need an example for testing addition of text data in editor for yjs websocket backend HOT 2
- Path doesn't match yText, yTarget spans multiple nodes HOT 5
- absolutePositionToSlatePoint returns null for inline elements
- Nextjs - Firefox can’t establish a connection to the server at ws://127.0.0.1:1234/. HOT 1
- CursorEditor sending cursor position not working
- Expose Yjs -> Slate / Slate -> Yjs function transformations
- Path doesn't match yText, yTarget spans multiple nodes on 'false' attribute values HOT 5
- when using slate-yjs and y-indexeddb,Data duplication on server restart
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 slate-yjs.