Radu wrote:
I cannot quite reproduce the behavior on my side.
So you are referring to the Author mode, right?
That´s right.
Radu wrote:
Did you create some kind of custom Attributes view which uses our AuthorDocumentController API to set attributes to the current XML element?
Yes we have our own properties view for all properties in our CMS.
And in case the properties are the attributes of an AuthorNode in the Editor they are modified by the AuthorDocumentController API.
So your guess is right.
Radu wrote:
Are you sure that the custom code you added for setting the attribute does not request focus in the document at some point?
Because of the fact that modifing conref attributes and all other attributes have the same implementation, it must be the conrefs fault that the focus is gained. When we modify other attributes the editor does not gain the focus.
Other reason is that when I turn off the preference for resolving conrefs everything works just fine.
So resolving conrefs and the focus problem must be somehow connected.
Here is the code, which I use to modify the attributes.
Code: Select all
if (authorNode instanceof AuthorElement) {
AuthorElement authorElement = (AuthorElement) authorNode;
AuthorDocumentController documentController = getDocumentController();
if (documentController != null) {
AttrValue attrValue = new AttrValue(value.toString());
if (id instanceof CIAttribute) {
String attrName = ((CIAttribute) id).getName();
if ("".equals(value)) { //$NON-NLS-1$
documentController.removeAttribute(attrName,
authorElement);
} else {
documentController.setAttribute(attrName, attrValue,
authorElement);
}
}
if (id instanceof String) {
if ("".equals(value)) { //$NON-NLS-1$
documentController.removeAttribute(id.toString(),
authorElement);
} else {
AttrValue oldAttrValue = authorElement.getAttribute(id
.toString());
// check if the change is really new
if (!attrValue.equals(oldAttrValue)) {
documentController.setAttribute(id.toString(),
attrValue, authorElement);
}
}
}
}
}
Best regards
Simon