How can I disable inline editing of a tag's text while still allowing oxy_editor support?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
micah.hainline
Posts: 3
Joined: Fri Apr 12, 2013 11:19 pm

How can I disable inline editing of a tag's text while still allowing oxy_editor support?

Post by micah.hainline »

I have a tag in oxygen Author that I want to edit using a combo. I can do this, and I can also hide the text with the following css:

Code: Select all


mytag {
visibility:-oxy-collapse-text;
content: oxy_editor(type, combo,
edit, "#text",
values, "value1, value2",
labels, "my label one, my label two"
editable, false);
}

mytag:before {
content: "choose mytag value: ";
}
Unfortunately, the cursor can still be placed after the combo, and text can be typed there. How can I disable the ability for the user to type, while retaining the ability to update the text using the combo?
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: How can I disable inline editing of a tag's text while still allowing oxy_editor support?

Post by alex_jitianu »

Hi,

I suggest implementing an ro.sync.ecss.extensions.api.AuthorSchemaAwareEditingHandlerAdapter. On methods handleTyping() and handlePasteFragment() you should reject the edit in "mytag" element, something like:

Code: Select all


try {
AuthorNode nodeAtOffset = authorAccess.getDocumentController().getNodeAtOffset(offset);
if ("mytag".equals(nodeAtOffset.getDisplayName())) {
throw new InvalidEditException("Reject", "Allow edit only through form controls.", false);
}
} catch (BadLocationException e1) {
e1.printStackTrace();
}
Best regards,
Alex
Post Reply