red-axe / am-editor

A rich text editor that supports collaborative editing and allows for the free use of front-end common libraries such as React and Vue to extend and define plugins.
https://editor.aomao.com
MIT License
937 stars 197 forks source link

非常迫切需要vue版本的协作demo #284

Closed l54808821 closed 1 year ago

l54808821 commented 1 year ago

我按照教程,配置了协作的server和client,但是没有编辑器没有成功。很需要这个demo https://editor.aomao.com/zh-CN/config/ot

image

代码: //实例化协作编辑客户端,需要传入当前编辑器实例 const ot = new OTClient(engineInstance); // 这里不再需要使用 engine.setValue。只需要在连接的时候把 value 传给 OTClient。在连接到服务端后,如果服务端没有该文档将以默认值创建,否则就返回服务端的最新文档数据 // 连接协同服务端,如果服务端没有对应docId的文档,将使用 defaultValue 初始化 // url 服务端ws链接 // docId 文档的唯一识别id // defaultValue 在服务端如果docId对应的文档不存在,将会以这个值创建一个新文档 const url = "ws://localhost:8080"; const docId = "test"; ot.connect(url, docId, value); ot.on("ready", (member) => { console.log("OT Ready"); });

big-camel commented 1 year ago

给个复现仓库吧

l54808821 commented 1 year ago

@big-camel https://gitee.com/tuzikuaipao/am-vue3-demo

big-camel commented 1 year ago

@big-camel https://gitee.com/tuzikuaipao/am-vue3-demo const url = "ws://localhost:8080";

你前端项目地址是 localhost:8080 ,你都没有启动 ot-server 项目吧?那肯定连不上啊

big-camel commented 1 year ago

你可以把 ot-server 复制出来,他是一个 nodejs 项目,你需要启动他

l54808821 commented 1 year ago

您好,ot-server我是已经启动的,看了一下他的默认url就是localhost:8080吧

image
big-camel commented 1 year ago

你前端项目也是 8080 那不是冲突了吗?

l54808821 commented 1 year ago

demo中的端口我改成8082啦

image
l54808821 commented 1 year ago

@big-camel 很感动,可以这么快的回复,这个可能是个私人问题,可以进行赞助私人聊么。我的QQ 237371257