你好。我这里还同步了点击框,代表 协同的人编辑到哪里,会把那一个单元格加一个对应颜色的边框,测试下来,似乎这种操作也执行了刷新
- /**
- * 标记选中的单元格
- */
- function markClickedCells() {
- //对旧的激活单元格进行清除
- let defaultType = new GC.Spread.Sheets.CellTypes.Text()
- Object.keys(CacheClickedCells).forEach((userName) => {
- let info = CacheClickedCells[userName]
- sheet.setCellType(info.row, info.col, defaultType)
- })
- Object.keys(ClickedCells).forEach((userName) => {
- let info = ClickedCells[userName]
- const color = '#' + userColorMap[userName].color ?? '000'
- const id = "userId_" + userName + "_upperborder"
- if (info.col !== -1 && info.row !== -1) {
- let cellType = new ClickedCell(color)
- cellType.userName = userName
- sheet.setCellType(info.row, info.col, cellType)
- CacheClickedCells = {
- ...CacheClickedCells,
- [userName]: {
- row: info.row,
- col: info.col,
- },
- }
- const hideRow = hiddenRowRef.current
- if (!hideRow.includes(info.row)) {
- //存在才会去生成
- CoopFloatingObject.showCoopFloatingObject(sheet, info.row, info.col, 0, 0, id, userName, color)
- } else {
- CoopFloatingObject.removeFloatingObject(sheet, id)
- }
- } else {
- clearClickedCellsStyle(id, info)
- }
- })
- }
复制代码
这种也会让焦点失去或者我监听了编辑结束,
- //单元格修改=
- case 'end_edit': {
- const { row, col, value, hideRow, unHideRow, startRow } = msg
- onRowVisibleChange(msg)
- if (checkFormulaType(value)) {
- sheet.setFormula(row, col, value, GC.Spread.Sheets.SheetArea.viewport);
- } else {
- if (msg.hasOwnProperty('value')) {
- sheet.setValue(row, col, value);
- }
- }
- break;
- }
复制代码
setValue也会失去 |