Skip to main content
November 29, 2009
Question

Protected (non-editable) text

  • November 29, 2009
  • 1 reply
  • 443 views

Hi everyone,

what would be the cleanest way to mark a portion of inline text as non-editable? I didn't find anything in the API. Typical usage scenarios in text editors would be showing a "¶" character at the end of a paragraph, or showing an index reference. I need this functionality for personalization placeholders (similar to a "mail merge" function).

Is there a declarative way to do this, or do I have to intercept all editing events?

Thanks for any hints!

Best regards,

Andreas

This topic has been closed for replies.

1 reply

November 29, 2009

BTW, maybe another solution for my problem would be to intercept the rendering process and insert the additional text. Is this possible?

Adobe Employee
November 30, 2009

One approach would be to add a user style to the text you want to prevent editing on, and then add a flowOperationBegin event listener. You can look at the operations as they come through, and operations that will change the non-editable text could be cancelled.If the user types  between the non-editable span and an editable span, you will have to do something to force the text to be inserted in the editable span. This will require either moving the text after its been inserted, via a flowOperationEnd listener, or putting it in the editable span to begin with, which would require overriding the operation with your own code to do the insert (you could supply your own InsertTextOperation that inserts only into the editable span, and substitute yours for the original operation.

The other aproach you mention, adding the non-editable text in afterwards, is also possible but more tricky.Basically I think you would have to create your own TextLines with the non-editable text, and add them in yourself, possibly adjusting the location of other TextLines. I don't think that will be easier.

Hope this helps,

- robin