Hello, I am currently trying to restrict editing to certain parts (paragraphs or sections) , like the last paragraph or a particular section of the document in the Document Editor. Is it possible to achieve this using the Document Editor's built-in features?
Or is there a way to identify if the cursor is in a particular paragraph or section, so that I can make the document read only if the user clicks on a certain paragraph.
Hi Sai,
Currently, we are checking this scenario and will update details by March 9, 2023.
Regards,
Kavitha M
Sai, we have attached a simple sample to meet your requirement.
The document has restrictions on the whole content, but we can enable editing for some particular regions by using bookmarks.
The procedure to test is as follows:
1. Open the sample with the default document, which is in read-only mode.
2. Select the last paragraph, which is editable (bookmark added).
3. If you need to edit any other region, you can select the content and click the "EDIT" button to make the selected region editable by adding a bookmark.
You can also modify the code to get the
requirement vice versa (whole document is editable and some particular regions
are non-editable).
Sample Link: https://stackblitz.com/edit/angular-ycwrg6-vhrtwe?file=src%2Fapp.component.ts,src%2Fdata.ts,src%2Fapp.component.html
Please check this at your end and let us know if you need any other assistance.
Thank you for the update. We will try and let you know.
Thank you for your update, Sai
We will wait until hear from you.
Thank you Kavitha, The above solution works.
I have another question. Is there a way to restrict editing after the last paragraph. We should not be able to edit the region after the last paragraph(bookmark). Text can be added only if its entered before the bookmark.
And also if we select all (Ctrl + A) or use this.container.documentEditor.selection.selectAll(), can we skip the bookmarks for getting selected. As for our requirement, the bookmark will be at the last section of the document.
Thank you,
Aditya.
Hi Sai,
#We should not be able to edit the region after the last paragraph(bookmark).
If you need to edit any other region, you can select the content and click the "EDIT" button to make the selected region editable by adding a bookmark.
#if we select all (Ctrl + A) or use this.container.documentEditor.selection.selectAll(), can we skip the bookmarks for getting selected.
No, It is not possible to skip the bookmark while selecting all the content.
Regards,
Kavitha M