你指的是server端的startServer这个方法吗,这个方法需要提前内置内容才可以吧,我想实现的在编辑器开启协同之后,通过外部接口或者其他地方获取的数据渲染到编辑器中,如果使用服务端的方法,该如何动态传递给他 @big-camel
api清除掉编辑内的所有内容,然后再插入内容,这个该如何操作 @big-camel
import startServer from '@editablejs/yjs-websocket/server' startServer({ initialValue: { children: [ // 启用标题插件下的默认值 { type: 'title', children: [{ text: '' }], }, { type: 'paragraph', children: [{ text: '' }], }, ], }, })
你可以看下api或者源代码
这一段看到了,这一段是在服务端的😂,没找到在编辑器段可以直接修改的api
先设置 selection 为全选,可以调用删除相关的api(deleteForward deleteBackward) 或者 insertFragment 插入新的
如何主动获取到协同编辑的所有协作者的信息,有api可以使用吗
const remoteClients = useRemoteStates<CursorData>(editor)
Activity
big-camel commentedon Jan 22, 2024
Jedi1820 commentedon Jan 22, 2024
你指的是server端的startServer这个方法吗,这个方法需要提前内置内容才可以吧,我想实现的在编辑器开启协同之后,通过外部接口或者其他地方获取的数据渲染到编辑器中,如果使用服务端的方法,该如何动态传递给他 @big-camel
Jedi1820 commentedon Jan 22, 2024
api清除掉编辑内的所有内容,然后再插入内容,这个该如何操作 @big-camel
big-camel commentedon Jan 22, 2024
你可以看下api或者源代码
Jedi1820 commentedon Jan 22, 2024
这一段看到了,这一段是在服务端的😂,没找到在编辑器段可以直接修改的api
big-camel commentedon Jan 22, 2024
先设置 selection 为全选,可以调用删除相关的api(deleteForward deleteBackward) 或者 insertFragment 插入新的
Jedi1820 commentedon Jan 22, 2024
如何主动获取到协同编辑的所有协作者的信息,有api可以使用吗
big-camel commentedon Jan 22, 2024
const remoteClients = useRemoteStates<CursorData>(editor)