Browse Source

Merge pull request #568 from sudosiyang/newHook

Feature: #567 协作消息钩子
master
Dushusir 4 years ago
committed by GitHub
parent
commit
2216484eac
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      docs/guide/config.md
  2. 12
      docs/zh/guide/config.md
  3. 2
      src/controllers/server.js

10
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

12
docs/zh/guide/config.md

@ -1470,6 +1470,18 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Number} [canvasHeight]: 滚动容器的高度
------------
## 协作消息
### cooperativeMessage
- 类型:Function
- 默认值:null
- 作用:接受协作消息,二次开发。拓展协作消息指令集
- 参数:
- {Object} : 收到服务器发送的整个协作消息体对象
## 图片
### imageInsertBefore

2
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;

Loading…
Cancel
Save