Page 1 of 1

Missing pseudo-classes after redo (Ctrl+Y)

Posted: Mon Apr 24, 2023 7:53 am
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.

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

Posted: Mon Apr 24, 2023 12:11 pm
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?

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

Posted: Mon Apr 24, 2023 12:14 pm
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?

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

Posted: Mon Apr 24, 2023 12:53 pm
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.

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

Posted: Mon Apr 24, 2023 2:34 pm
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.

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

Posted: Mon Apr 24, 2023 3:40 pm
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.

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

Posted: Mon Apr 24, 2023 5:55 pm
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().

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

Posted: Mon Apr 24, 2023 7:21 pm
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;
}

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

Posted: Tue Apr 25, 2023 9:20 am
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

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

Posted: Tue Apr 25, 2023 12:09 pm
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.

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

Posted: Tue Apr 25, 2023 1:00 pm
by shikhar_472
Can we get to know till when it will be available or is there any workaround?

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

Posted: Tue Apr 25, 2023 3:55 pm
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).

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

Posted: Mon Jun 12, 2023 5:58 pm
by shikhar_472
Hi Dumitru,

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

Thanks

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

Posted: Tue Jun 13, 2023 7:10 pm
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

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

Posted: Wed Jun 14, 2023 12:13 pm
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

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

Posted: Wed Jun 14, 2023 2:22 pm
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.

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

Posted: Thu Jun 15, 2023 11:43 am
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

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

Posted: Thu Jun 15, 2023 1:15 pm
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

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

Posted: Mon Jun 19, 2023 9:31 am
by shikhar_472
yes

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

Posted: Mon Jun 19, 2023 11:44 am
by cristi_talau
Hello,
I suspect this happens because you use "setPseudoClassUndoable". If you use "setPseudoClass", this will not happen.
Best,
Cristian

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

Posted: Tue Oct 17, 2023 9:39 am
by shikhar_472
Hi Team,

Does this issue got resolved in the latest oxygen release

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

Posted: Tue Oct 17, 2023 10:12 am
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