We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Section or paragraph as ready only in document editor

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. 

Thank you, 
Aditya.

6 Replies 1 reply marked as answer

KM Kavitha Muralitharan Syncfusion Team March 7, 2023 02:38 PM UTC

Hi Sai,


Currently, we are checking this scenario and will update details by March 9, 2023.


Regards,

Kavitha M



KM Kavitha Muralitharan Syncfusion Team March 9, 2023 05:23 AM UTC

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.


Marked as answer

SA Sai March 10, 2023 04:54 AM UTC

Thank you for the update. We will try and let you know.



KM Kavitha Muralitharan Syncfusion Team March 10, 2023 05:35 AM UTC

Thank you for your update, Sai   

  

We will wait until hear from you. 



SA Sai March 10, 2023 06:13 PM UTC

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.



KM Kavitha Muralitharan Syncfusion Team March 13, 2023 02:46 PM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon