Log the transactions

Is there anyway I can log and see the transactions associated with a diagram. I want to see the log of the transactions happened so that I can deal with the undo class.

Have you seen Update Demo GoJS Sample ?

In general, look for a ChangedEvent.isTransactionComplete. Read more at GoJS Changed Events -- Northwoods Software

Thanks! That saved my time.

One more question on this, I have a texteditor and when adding text it is recorded as two transactions. When I do undo I need to click twice the undo button to remove the text. Is it like text editing will count as two transactions?

It’s not the case that the TextEditingTool normally produces two transactions when the user finishes editing some text. Certainly I cannot reproduce that behavior in the samples, even ones with custom text editors. Could you tell us how to reproduce this behavior?

In my case, I start typing and i manually do a transaction using start and commit transaction.
I figured that there is a stop text editing happening in-between, and my start/commit transaction. So it is two transactions now. Can I merge the two, because I can’t skip the second(start/commit) because that has a loc change in it.

My goal is start typing and loc change the text and treat the both as one transaction. Is this doable?

When do you call start/commitTransaction?

before stopText editing.
It is like

  1. Start/Commit.
  2. StopTextEditing.

I tried commenting stopTextEditing but without that the text is not capture in the node. Could you suggest an idea to solve this?

I’m sorry, but I really cannot tell what is going on in your app from this information.

Could you describe what editing effect you are trying to achieve in your app, and then how you are implementing it?

In my app,

Scenario.

  1. First inserted a picture.
    2)Second Click on a icon will enable textediting once done it will position the text to a custom location.
    So here I am manually committing a transaction to change the location, and a stop editing is called to stop the text editing.

Now when I do undo on first undo click the text is disappeared. The second click nothing is done the third undo click image disappeared. So when checked the transaction I came to know that image is no1 transaction and for text I can see two transactions. one for the stoptextediting and one my manual transaction. I tried skipping undo in manual transaction but no use. It seems when doing undo it is taking as two clicks for the text.

You should implement the movement of the edited TextBlock in a “TextEdited” DiagramEvent listener. That takes place in the same transaction as the editing of the text.