I think we had the same behaviour in this case, but the I think the undo is
acting on the structural change (Cut in this case). And the editor seems to
be storing (correctly) the previous state together with the property.
So when the Undo action executes, it restores the node with its property.
Which is what I expected, I think this is correct.
However, if I add the property and I try to undo just the property
addition, standalone, it doesn't work. In fact, I can't, it looks like
nothing is added to the Undo history and the Undo button remains disabled.
I think the first screenshot shows that. So maybe if I pair it with another
XML change like an attribute change, then it will work. Can I hide an
attribute from the interface? Well in that case, I may as well use this
hidden attribute to store my metadata instead of properties...

Carlos



On Fri, Sep 19, 2025 at 7:19 PM Hussein Shafie <[email protected]> wrote:

> Carlos Villegas wrote:
> >
> > We had to switch to a different project and now we are back to keep
> > evaluating the Web edition.
> > We have a question about the Undo/Redo actions.
> > We added some metadata to the XML nodes using the property feature of
> > XMLMind through an extension. That works fine and we can style based on
> the
> > properties, which is great.
> > However, we noticed the property changes are not being recorded (ignored)
> > by the UndoManager.
>
> In theory, this is not possible because the UndoManager always works on
> the original nodes being edited (possibly having custom node properties)
> and not on copies.
>
> This is true for both XXE desktop and Web Edition which use the exact
> same UndoManager (on the server side for Web Edition; like everything
> related to the model).
>
> This, in contrast with XXE clipboard manager which does not serialize
> node properties when you invoke the Copy or Cut commands.
>
>
>
>
> > Is there a way to make the UndoManager work with properties. We're using
> > the <xxe-client> integrated into our React app. The properties are being
> > added by executing a remote command on the extension, which adds the
> > properties on the server side to the XML nodes.
>
> In order to reproduce the issue, I did what follows:
>
> * Added this to "docbook.xxe": pressing F2 adds property "important" to
> implicitly or explicitly selected element.
> ---
>    <binding>
>      <keyPressed code="F2" />
>      <command name="setProperty"
>        parameter="[implicitElement][rebuildView] important true" />
>    </binding>
> ---
>
> * Added this to "docbook.css": elements having an "important" property
> are made bold, red and underlined:
> ---
> *:property(|important) {
>      font-weight: bold;
>      color: red;
>      text-decoration: underline;
> }
> ---
>
> 0) Started xxeserver. Opened "demo/docbook/docbook-table.xml" in
> XXEW/Chrome and clicked inside first para.
>
> 1) Pressed F2 to add property "important" to first para. See attached
> screenshot "1_set_prop_important.png".
>
> 2) Clicked the Cut icon. See attached screenshot
> "2_cut_important_para.png".
>
> 3) Clicked the Undo icon. See attached screenshot "3_after_undo_cut.png".
> Notice that "restored" first para is still bold, red and underlined
> which indicates that property "important" is still there.
>
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to