dream-num / univer.ai

Documentation for Univer
https://univer.ai
Other
9 stars 7 forks source link

The permissions are now normal, but the text within the selected area has also been cleared. #266

Closed 352038019 closed 2 months ago

352038019 commented 2 months ago

Hello, After selecting a specified range and adding non-editable permissions, the text that should have been displayed within that range disappeared... The permissions are now normal, but the text within the selected area has also been cleared. ` mypermissionId.value = generateTimestampWithRandomString(); const injector = univerRef.value?.getUniver().__getInjector(); const univerInstanceService = injector.get(IUniverInstanceService); const commandService = injector.get(ICommandService); const sheetSelectionManagerService = injector.get(SheetsSelectionsService); const workbook = univerInstanceService.getCurrentUnitForType( UniverInstanceType.UNIVER_SHEET );

if (!workbook) { return; }

const target = getSheetCommandTarget(univerInstanceService); if (!target) { return; } const { unitId, subUnitId } = target; const ranges = sheetSelectionManagerService .getCurrentSelections() .map((selection) => selection.range); console.log(AddRangeProtectionMutation.id); commandService.executeCommand(AddRangeProtectionMutation.id, { unitId, subUnitId, rules: [ { permissionId: mypermissionId.value, name: "sheet-01", unitType: 3, unitId, subUnitId, ranges, id: "rule1", viewStatus: "othersCanView", }, ], });`