Page 1 of 1

Refresh document after "Replace All"

Posted: Thu Jul 20, 2023 12:05 pm
by Isabelle
Hello,

We used the version 25.0.0.0 of oxygen sdk.

After modification in an element, we add a blue horizontal bar next to the element thanks to css.
But when user made modifications in elements thanks to "Replace All" action, document is updated but css is not refresh and we don't see the blue bar.
Is it possible to force refresh css after a "Replace All" action ?
Thanks,

Regards,
Isabelle

Re: Refresh document after "Replace All"

Posted: Thu Jul 20, 2023 3:05 pm
by Radu
Hi Isabelle,

I will need more details.
we add a blue horizontal bar next to the element thanks to css.
How does the CSS selector look like?
document is updated but css is not refresh and we don't see the blue bar.
I'm not sure what you mean by that. Do you dynamically modify on disk the CSS used for visual editing?

Regards,
Radu

Re: Refresh document after "Replace All"

Posted: Thu Jul 20, 2023 3:29 pm
by Isabelle
Hello,

When user modify an element (add new element'child, change text or attribute value),
a specific attribut (changeMark) is set on the element like this :

Before modification :

Code: Select all

<element>
   <para>First para</para>
</element>
After modification :

Code: Select all

<element>
   <para>First para</para>
   <para changeMark="1">New para</para>
</element>
A blue vertical line is displayed when changeMark is set to 1.

When we use "Replace All" button on search box, the changeMark attribut is well set but the css vertical line is not displayed.

Regards,
Isabelle

Re: Refresh document after "Replace All"

Posted: Fri Jul 21, 2023 8:30 am
by Radu
Hi Isabelle,
I assume that "Replace All" button you are discussing is from your own find/replace functionality as Oxygen's Find/Replace dialog does not allow chancing attributes.
When you change attributes in the Author visual editor you must always use this method:
https://www.oxygenxml.com/InstData/Edit ... orElement-
so do not set the attribute directly on the AuthorElement, use the AuthorDocumentController to set the attribute, this should properly update the document and make undo/redo properly work.
Regards,
Radu

Re: Refresh document after "Replace All"

Posted: Fri Jul 21, 2023 10:09 am
by Isabelle
Hi Radu,
Radu wrote: Fri Jul 21, 2023 8:30 am I assume that "Replace All" button you are discussing is from your own find/replace functionality as Oxygen's Find/Replace dialog does not allow chancing attributes.
No, it is from Oxygen's Find/Replace dialog.
We add changeMark attribute thanks to our own AuthorDocumentFilter, and we already use AuthorDocumentController.setAttribute function.

Regards,
Isabelle

Re: Refresh document after "Replace All"

Posted: Fri Jul 21, 2023 11:22 am
by Radu
Hi Isabelle,
I'm not sure why this does not work, I would need to see some sample Java code from where in the AuthorDocumentFilter you are setting the attribute plus the CSS selector which matches the attribute and adds a border.
So after the replace all, if you save the XML and re-open it the border is shown right?
Regards,
Radu

Re: Refresh document after "Replace All"

Posted: Fri Jul 21, 2023 11:27 am
by Isabelle
Radu,
Radu wrote: Fri Jul 21, 2023 11:22 am Hi Isabelle,
I'm not sure why this does not work, I would need to see some sample Java code from where in the AuthorDocumentFilter you are setting the attribute plus the CSS selector which matches the attribute and adds a border.
I understand and I will try to provide you an exemple asap.
Radu wrote: Fri Jul 21, 2023 11:22 am So after the replace all, if you save the XML and re-open it the border is shown right?
Yes, as the changeMarker are set, when re-open the document, the border are displayed.

Regards,
Isabelle