Page 1 of 1

Create new element when user types where text is not allowed

Posted: Wed Apr 27, 2016 12:35 am
by tzimnoch
The default behavior of AuthorComponentSampleApplet when the user tries to enter text where text is not allowed is a warning message saying "Text is not allowed in element 'elementName' (element only or empty or fixed content)".

I'd like to customize the behavior in some elements so that a specific child element is automatically created for the user and text is entered in the child element. I would still like the warning message to appear for elements other than the one being customized.

How do I go about doing this if this is possible?

Re: Create new element when user types where text is not allowed

Posted: Wed Apr 27, 2016 11:41 am
by alex_jitianu
Hello,

We have a Java based extension point that you can use to handle this situation. You have to implement an Author Mode Schema Aware Editing Handler. This handler has a handleTyping() callback in which you can identify this case and take the approach you've described.

[/url]Best regards,
Alex

Re: Create new element when user types where text is not allowed

Posted: Wed Apr 27, 2016 10:40 pm
by tzimnoch
Thank you. I have a working implementation of the functionality I wanted.

I really must say that oXygen has been impressively easy to work with given the size of the application. I never know where to start, but once pointed at the right page of documentation it's been easy to see a task to completion.