Comments (2)
I tried this
...
import { TiptapTransformer } from '@hocuspocus/transformer'
...
async onChange(data) {
const prosemirrorJSON = TiptapTransformer.fromYdoc(data.document);
console.log(prosemirrorJSON)
},
crash came out
[onChange] item.toDelta is not a function
file:///xxxx/hocuspocus/node_modules/y-prosemirror/src/lib.js:331
const delta = item.toDelta()
^
TypeError: item.toDelta is not a function
at serialize (file:///xxxx/hocuspocus/node_modules/y-prosemirror/src/lib.js:331:26)
at Array.map (<anonymous>)
at yXmlFragmentToProsemirrorJSON (file:///xxxx/hocuspocus/node_modules/y-prosemirror/src/lib.js:375:20)
at yDocToProsemirrorJSON (file:///xxxx/hocuspocus/node_modules/y-prosemirror/src/lib.js:308:10)
at Prosemirror.fromYdoc (file:///xxxx/hocuspocus/node_modules/@hocuspocus/transformer/dist/hocuspocus-transformer.esm.js:2625:20)
at Tiptap.fromYdoc (file:///xxxx/hocuspocus/node_modules/@hocuspocus/transformer/dist/hocuspocus-transformer.esm.js:2667:39)
at Object.onChange (file:///xxxx/hocuspocus/index.js:14:47)
at file:///xxxx/hocuspocus/node_modules/@hocuspocus/server/dist/hocuspocus-server.esm.js:2806:109
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
from hocuspocus.
Sorry, I located my mistakes:
On the backend, I used a get instead of getArray, and data.document.toJSON() is deprecated.
console.log('tasks', data.document.**getArray**('tasks').toJSON()) // logs: tasks [ 'buy milk' ]
from hocuspocus.
Related Issues (20)
- Server crashed when webhook receives 400 status code response HOT 3
- Inaccurate document type check in onLoadDocument
- use lexical TypeError: The encoded data was not valid for encoding utf-8 HOT 1
- Updates made using openDirectConnection are not synchronizing changes across different Redis instances. HOT 9
- provider.destroy will reopen connection HOT 5
- About the actual storage size of documents during collaborative editing HOT 8
- An authentication token is required, but you didn’t send one - but token was actually included HOT 7
- Connections to doc are possible while `onLoadDocument` is still in progress
- unsyncedChanges may get out of sync
- DirectConnection causing document state corruption HOT 3
- DirectConnection transact context not passed to document lifecycle hooks
- hocuspocus-server fails to launch in local environments via npx HOT 2
- How to implement document versioning on Hocuspocus HOT 1
- Maxdebounce causing client-id to change
- Memory leak in direct connection
- onLoadDocument hook called without document HOT 1
- Call applyUpdate duplicatedly when using hocuspocus-database HOT 1
- awareness.clientID out of sync with document.clientID HOT 1
- Root shared objects have AbstractType type on the server
- extension-redis memory leak with frequent doc updates
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 hocuspocus.