Page 1 of 1
How to get list of attributes which can be added to selected tag
Posted: Thu Sep 01, 2022 5:46 pm
by SmitaPatil
Hi Team,
Is there any method using which I can check what are all attribute I can add for selected element and what attributes are required for given element.
Please let me know if there any methods to get it.
Thanks,
Smita
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 8:27 am
by mihaela
Hello,
To get the list of available attributes for a specific node you can use the following API:
ro.sync.ecss.extensions.api.AuthorSchemaManager.whatAttributesCanGoHere(WhatAttributesCanGoHereContext).
To create the context to be passed to the previous method, use the
ro.sync.ecss.extensions.api.AuthorSchemaManager.createWhatAttributesCanGoHereContext(AuthorElement) API.
The
whatAttributesCanGoHere method returns a list of
ro.sync.contentcompletion.xml.CIAttribute.
You can find if one attribute is required by using the
ro.sync.contentcompletion.xml.CIAttribute.isRequired() method.
Please let us know if you need more information.
Best Regards,
Mihaela
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 8:44 am
by SmitaPatil
Hi,
Thank you so much.
Thanks,
Smita
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 11:08 am
by SmitaPatil
Hi Team,
can you please tell is there any method to remove attribute of selected element and also modify it.
Thanks,
Smita
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 11:57 am
by mihaela
Hello,
The
ro.sync.ecss.extensions.api.AuthorDocumentController API class contains methods for modifying the Author document, so here is the place were you can first search when you need a method to modify or remove an element or an attribute.
These are the methods that you need now:
ro.sync.ecss.extensions.api.AuthorDocumentController.setAttribute(String, AttrValue, AuthorElement) and
ro.sync.ecss.extensions.api.AuthorDocumentController.removeAttribute(String, AuthorElement)
Best Regards,
Mihaela
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 2:40 pm
by SmitaPatil
Hi Team,
Thank you.
the method which you have suggested required attribute name.
Actually I wanted to remove all attributes of the element where cursor is present.
Please let me know if something is present to achieve this with caretoffset and element name.
Thanks,
Smita
Re: How to get list of attributes which can be added to selected tag
Posted: Fri Sep 02, 2022 3:39 pm
by mihaela
Hello,
From
ro.sync.ecss.extensions.api.node.AuthorElement you can get all the attributes and then use the ro.sync.ecss.extensions.api.AuthorDocumentController.removeAttribute(String, AuthorElement) API that I mentioned earlier, for each attribute, to remove it.
Best Regards,
Mihaela