2

How can I disable inline editing of rich text fields in Experience Editor? I still want the users to be able to click the edit icon in the toolbar popup (leftmost icon in the attached screenshot) so that they can go to the full editor, but I don't want them to be able to insert text directly onto the page.

enter image description here

2

You can execute JavaScript on page load that will set contenteditable attribute to false for all text boxes.

$(".scWebEditInput").attr("contenteditable", false)
| improve this answer | |
  • 1
    Probably want to target $("[scfieldtype='rich text']") rather than all editable fields. – jammykam Aug 16 '18 at 3:58
  • 1
    I put this in document.ready but it didn't change the contenteditable attribute. This is probably because Experience Editor adds the content and functionality after the document is ready, so that when I add my modification, it is overwritten by Experience Editor later. Do you have any tips on which other events I can do this on to not have it overwritten by Experience Editor later? – GTHvidsten Aug 16 '18 at 10:51
  • I ended up using a MutationObserver in my JS to listen for changes to the contenteditable attribute on the $("[scfieldtype='rich text']") elements. Whenever it is changed to something other than false, I forcibly set it back to false. – GTHvidsten Aug 17 '18 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.