How do I use sdkjs dynamically to set the document read-only

I hope that the implementation can judge whether the user can edit according to the number of lines in the word document where the user’s mouse is located.
Now I can get the line number of the user, as shown below


Please tell me the api to set document read-only, thanks a lot

Hi @hufei

Please describe the issue in more details.

You can see all Advanced parameters (clickable)
https://api.onlyoffice.com/editors/advanced
and Document Permissions (edit)
https://api.onlyoffice.com/editors/config/document/permissions#edit

I don’t mean the server document.
I pulled web-apps and sdkjs from github and now I can’t find the api available in sdkjs, for example read only

Hi @hufei

Please point me to the guide which you used. Your final goal isn’t clear for us at the moment. As mentioned before ‘Read’ mode is related to editor initialization config file.

var docEditor = new DocsAPI.DocEditor("placeholder", config);

Disable the editor using docEditor

OMG, I can’t believe I got a reply. I modified the source code to fix the problem.

How to implement it? I am also looking for it, but I haven’t found any relevant APIs yet

  • How to contact? There’s a delay in the message

Chinese people ?

yeah, I am.

Hello @huzedong2022 and @hufei
I’m not entirely sure that I’m following the situation, so please update the status of your case. I’m trying to understand the final goal of your actions.

@Alexandre okay, I have a Word document, and when there are multiple users editing it simultaneously, I need to assign specific areas to specific users. For instance, if Heading 1 is assigned to the admin, then he can only edit Heading 1, and the rest is read-only. Sometimes, I may need to specify that an area is not visible. The above was the help I sought in March. However, I have already implemented this, apart from the part about hiding specific areas. As for hiding specific areas, I have read through the code of sdkjs and webapps, and I believe I can do it. Lastly, what I want to say is that I have also submitted bug-fixing code to you and it has been accepted. This was my first time, and I feel very happy.:hugs:

1 Like

Thank you for provided details and we are glad that your submitted code was accepted. We appreciate any help with bugs detection from the community!

I need to assign specific areas to specific users. For instance, if Heading 1 is assigned to the admin, then he can only edit Heading 1, and the rest is read-only. Sometimes, I may need to specify that an area is not visible.

We are working on this feature right now, I have added your request and will update this thread when we have something to share.

However, I have already implemented this, apart from the part about hiding specific areas.

You can create a pull request on GitHub, if you want to share your code and experience: GitHub - ONLYOFFICE/DocumentServer: ONLYOFFICE Docs is a free collaborative online office suite comprising viewers and editors for texts, spreadsheets and presentations, forms and PDF, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.

It seems this is a slightly different case (hiding content control for certain users). However, we are working on the both cases.