Missing pseudo-classes after redo (Ctrl+Y)

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi Team,

We are adding a toggle class on click of action in oxygen web author-

actionPerformed(callback) {
jaEditor.getActionsManager().invokeOperation('ro.sync.ecss.extensions.commons.operations.TogglePseudoClassOperation', {
elementLocation: '//cite.query', name: 'collapse', includeAllNodes: 'no'
});
callback();
}

cite\.query:collapse{
-oxy-display-tags:none;
}

So this is the code which i am using to collapse the tag but issue what i am facing is if cite.query is present in side some tag eg.--

<paratext> some test data <cite.query>some test data</cite.query></paratext>

So after collapse it will look like--
<paratext> some test data some test data </paratext>

Now if i select "some test data1" and remove it, it will look like this --
<paratext> some test data </paratext>

Now if i will do undo again so in this case collapse class is not coming into the html, it will become like this --
<paratext> some test data <cite.query>some test data</cite.query></paratext>

But expected scenario is -
<paratext> some test data some test data </paratext>


Thanks,
Shikhar.
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: query on undo operation phesudo classes are not getting back is there any way to resolve this.

Post by Bogdan Dumitru »

Hello Shikhar,

We are a little bit confused because in the post title you are referring "pseudo classes" but from the "expected scenario" we see a difference in the document structure:
it will become like this --
<paratext> some test data <cite.query>some test data</cite.query></paratext>

But expected scenario is -
<paratext> some test data some test data </paratext>
Is there a problem with one of the APIs from the Oxygen SDK or with the undo and/or redo actions?
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: query on undo operation phesudo classes are not getting back is there any way to resolve this.

Post by Bogdan Dumitru »

Or the problem is that if you delete an element and then invoke the undo action to undo the deletion, after undoing the element is added back in the document but without pseudo-classes?
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: query on undo operation phesudo classes are not getting back is there any way to resolve this.

Post by shikhar_472 »

Hi Dumitru,

Or the problem is that if you delete an element and then invoke the undo action to undo the deletion, after undoing the element is added back in the document but without pseudo-classes?

Yes you got it right this is the issue i am facing.

Thanks.
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: query on undo operation phesudo classes are not getting back is there any way to resolve this.

Post by Bogdan Dumitru »

In that case, try using AuthorDocumentController.setPseudoClassUndoable().

In order to invoke that method from an operation you have to define a custom AuthorOperation that calls this method. See this topic.
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi Dumitru,

I tried using this class it is allowing to undo the toggle class.

But after delete a element if i am doing undo toggle class is not getting added.
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by Bogdan Dumitru »

Hi,

Yes, as stated in the documentation of the AuthorDocumentController.setPseudoClassUndoable() method, the pseudo-class is subject to undo/redo, meaning that the Undo Manager will revert/restore the pseudo-classes added with this method.

If you invoke AuthorDocumentController.setPseudoClassUndoable() over an element, delete it manually using either Delete or Backspace, and then invoke the undo action, after undo you should see the pseudo-class on the element.

By the way, if you make multiple changes/edits to the document and you want them to be atomically handled by the Undo Manager, see AuthorDocumentController.beginCompoundEdit() and AuthorDocumentController.endCompoundEdit().
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi Dumitru,
It's not working for me, i am adding the code for the reference,

@Override
public String doOperation(AuthorDocumentModel model, ArgumentsMap args)
throws IllegalArgumentException, AuthorOperationException {
AuthorAccess authorAccess = model.getAuthorAccess();
AuthorDocumentController docCtrl = authorAccess.getDocumentController();
AuthorNode[] paratextNodes = docCtrl.findNodesByXPath("//cite.query", true, true, true);
docCtrl.beginCompoundEdit();
for (AuthorNode citeQueryNode : paratextNodes) {
AuthorElement cQElement = (AuthorElement) citeQueryNode;
docCtrl.setPseudoClassUndoable("collapse", cQElement);
}
docCtrl.endCompoundEdit();
return null;
}
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi,
I have observed that on undo and redo pseudo class is getting added but on deleting the element then if i am doing undo pseudo class is not getting added
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by Bogdan Dumitru »

Hi,

You're right!

It seems that after undo the pseudo-classes are actually NOT present on the restored element. From the first analysis, this seems to be a bug. I've registered an issue on our internal issue tracker for it.
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Can we get to know till when it will be available or is there any workaround?
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by Bogdan Dumitru »

Hi,

Unfortunately, we didn't manage to find a workaround, at least not yet.

Regarding "when it will be available", please help us to understand the impact of this bug on your customization. Do you see this bug as critical or somewhat like nice to have?

We usually consider pseudo-classes as volatile markers on elements, markers that are used to customize element rendering. Even the folding state of the elements relies on pseudo-classes. We also consider it reasonable that the rendering of an element is reset after undo (not ideal but reasonable).
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi Dumitru,

Any idea, till when we can expect the resolution for this.

Thanks
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by cristi_talau »

Hello,

The issue is not currently scheduled for implementation. In order to be able to prioritize this issue better, we need to understand the impact that it has on the experience of your end-users.

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi,

For our user's this is a critical issue we are going soon in production and it is going to make a huge impact across 1000 users who will be using the oxygen.

Thanks
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by cristi_talau »

A solution for the problem you mentioned in the first post is to set the "collapsed" pseudo-class on the root element of the document and modify the CSS rule to something like

Code: Select all

:root:collapsed cite\.query { ... } 
This way, the element that has the pseudo-class is not deleted and the class in not reset.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi,


You're right!

It seems that after undo the pseudo-classes are actually NOT present on the restored element. From the first analysis, this seems to be a bug. I've registered an issue on our internal issue tracker for it.


can i have a solution for this issue
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by cristi_talau »

Hello,
At this point I this thread is very long and I am not sure what your current problem is.

In my understanding, you modified the plugin to set the "collapsed" pseudo-class on the root element. Now if the user invokes the action to collapse some element's tags and then presses undo, the element tags are not collapse anymore. And your expectation is that they are still collapsed.

Is this the problem you described?

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

yes
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by cristi_talau »

Hello,
I suspect this happens because you use "setPseudoClassUndoable". If you use "setPseudoClass", this will not happen.
Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by shikhar_472 »

Hi Team,

Does this issue got resolved in the latest oxygen release
cosminef
Site Admin
Posts: 84
Joined: Wed Aug 30, 2023 2:33 pm

Re: Missing pseudo-classes after redo (Ctrl+Y)

Post by cosminef »

Hello,
This issue has not been resolved in version 26.0 of Oxygen Web Author
As soon as we have a solution, we will notify you in this post.
Best Regards,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
Post Reply