From 2ccd72d2f333991c50708226e5f9f5a2a096ec16 Mon Sep 17 00:00:00 2001 From: susiyang Date: Thu, 11 Mar 2021 11:39:24 +0800 Subject: [PATCH] =?UTF-8?q?Feature:=20#567=20=E5=8D=8F=E4=BD=9C=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/config.md | 10 ++++++++++ docs/zh/guide/config.md | 12 ++++++++++++ src/controllers/server.js | 2 ++ 3 files changed, 24 insertions(+) diff --git a/docs/guide/config.md b/docs/guide/config.md index f847327..c03224f 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -1169,6 +1169,16 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura ------------ +## Cooperative + +### cooperativeMessage + +- Type:Function +- Default:null +- Usage:Receive the cooperation message, secondary development. Expanding cooperative message instruction set +- Params: + - {Object} : Receives the entire collaboration message body object sent by the server + ## Image ### imageInsertBefore diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index d48cbed..7afef3f 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -1444,6 +1444,18 @@ Luckysheet开放了更细致的自定义配置选项,分别有 - {Number} [canvasHeight]: 滚动容器的高度 ------------ + + +## 协作消息 + +### cooperativeMessage + +- 类型:Function +- 默认值:null +- 作用:接受协作消息,二次开发。拓展协作消息指令集 +- 参数: + - {Object} : 收到服务器发送的整个协作消息体对象 + ## 图片 ### imageInsertBefore diff --git a/src/controllers/server.js b/src/controllers/server.js index 8bdfbc3..4d228fa 100644 --- a/src/controllers/server.js +++ b/src/controllers/server.js @@ -20,6 +20,7 @@ import dayjs from "dayjs"; import json from '../global/json'; import luckysheetConfigsetting from './luckysheetConfigsetting'; import {customImageUpdate} from './imageUpdateCtrl'; +import method from '../global/method'; const server = { gridKey: null, @@ -199,6 +200,7 @@ const server = { _this.websocket.onmessage = function(result){ Store.result = result let data = new Function("return " + result.data)(); + method.createHookFunction('cooperativeMessage', data) console.info(data); let type = data.type; let {message,id} = data;