dream-num / univer

Univer is an open-source productivity tool dev kit helping you integrate spreadsheets, docs and slides into your applications.
https://univer.ai
Apache License 2.0
6.7k stars 581 forks source link

[Feature] How to use permission to create a universalSheet in read-only mode? #2585

Closed Xiangzi529 closed 3 months ago

Xiangzi529 commented 3 months ago

Initial checklist

Problem

看了官网的https://www.univer.ai/zh-CN/guides/sheet/features/permission 但是不太明白 不知道有没有demo可以参考一下 我就是希望全局禁用编辑 就是我的单元格的内容 我就是展示出来 不让改 也不用改 尝试过在onBeforeCommandExecute前面禁用一些id 但是控制台太难看了

Solution

有没有全局制度摸索 不需要引入plugin的解决方案啊

univer-bot[bot] commented 3 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Feature] 如何使用permission来搞一个只读模式的univerSheet ?

Title: [Feature] How to use permission to create a universalSheet in read-only mode?


Initial checklist

Problem

I looked at the official website https://www.univer.ai/zh-CN/guides/sheet/features/permission but I don’t quite understand it. I don’t know if there is a demo that I can refer to. I just want to globally disable editing of the contents of my cells. I just showed it and refused to change it. I tried disabling some IDs in front of onBeforeCommandExecute, but the console was too ugly.

Solution

Is there any solution to explore the global system that does not require the introduction of plugins?

jikkai commented 3 months ago

The key code is located here: https://stackblitz.com/~/github.com/awesome-univer/sheets-permission-demo?file=src/plugins/commands.ts:L34-L47. Additionally, we will consider providing a read-only capability for the workbook through the facade API later on.