Question

How to have undeleteable text or words in rich text editor

We have requirement where we have mail template for which we are using correspondence, we have to give access to the end user to edit the template. The template contains some text which can be editable by the user and some which can’t deleteable by the user.please suggest me if there is any approach to achieve this.

I have tried by setting contenteditable ="false" but it works only if i have the text which can't be editable by the user. but it's not working if i have both editable and non editable text. for instance,

<p><span contenteditable="false">Pega </span></p>

<p><span>pdn</span></p>

for the above instance, if i place the cursor between pega and pdn , i am able to delete the pega text by clicking backspace and delete button. but my requirement is pega text shouldn't be deletable even if i click backspace and delete button i should be able to edit only the pdn text.

please let me know if any approach by which i can achieve this.

Thanks

Comments

Keep up to date on this post and subscribe to comments

Pega
October 22, 2019 - 8:41am

When you say 'undeletable' - do you mean (for instance) a fixed header or footer?
If so: would a post-save Data Transform do the trick? (That is: check any saved text to see if the required text is already present, and if not - add it in?)

 

 

October 22, 2019 - 9:22am

You can completely disable the tool bar of the Rich text editor -- but that will render itself completely readOnly. If your template has multiple parts, then display the only the one that needs to be edited inside of the RTE. The rest can be displayed as a "Readonly" RTE. An example of ReadOnly RTE can be found in the UI Gallery

October 22, 2019 - 3:24pm
Response to Krithiga_GCS

@Krithiga_GCS, Thank you for your reply.

yes template is having multiple parts followed by both editable and non-editable parts but displaying the only one which is needs to be edited would be the final approach as the requirement is to give access to the entire mail template to the user. if i have only non-editable content then going for Read-Only RTE would be the best option but requirement is to have both read and write content within same RTE. Please let me know if we can achieve this within the same RTE.

Pega
October 22, 2019 - 9:36am

Hi,

You can add the below styles only for the text which you want to be read only.

Like if you have a text like "test word" and if you want the "test" to be read only then follow the below changes,

<p> test</p> <p>word</p>

you can modify like

<pcontenteditable=false> test</p> <p>word</p>

Hope this helps!

Thanks,

Geeda.

October 22, 2019 - 2:22pm
Response to GeedA

 

 

This works only if I have text which can’t be deleteable but it’s doesn’t work if I have both editable and non editable (undeleteable text ). For instance,

<p contenteditable=“false”>Text</p>
<p>words</p> 
 
if I place the cursor between text and words or at the end of the words , and press backspace or delete then I am able to delete the text words which I should not be able to. It works fine if I have only a text which can be non edittable.