Question T22444
Visible to All Users

Undo/Redo on the JSON Editor

created 11 days ago

I see that in previous versions there were undo and redo options in the JSON editor. I'm wondering why those features were removed and would you consider reimplementing them.

Thanks!

Comments (2)

    Hi Adam,
    The Undo and Redo options were not available within the JSON Editor. You may wish to check the following demo for v1.12.27: View CodeSandbox.

    Clipboard-File-1.png

    Please let me know if you have additional questions.

    AS AS
    Adam Skoczylas 10 days ago

      Jane:

      I am referring to Undo and redo issues in JSON Editor tab | surveyjs Support in which it shows and discusses and undo and redo feature for the JSON Editor. I understand that undo/redo is not available at this time. But it seems a very useful capability. I am wondering why it was removed and if you would consider adding it as a feature.

      Thanks,

      Adam

      Answers approved by surveyjs Support

      created 10 days ago

      Hello Adam,
      Thank you for the update. Unfortunately, the Undo / Redo creator options were never available within the JSON Editor tab. In the ticket you referenced, we fix the issue and hide the Undo/Redo buttons to make them unavailable in the JSON Editor.

      You may know that we use the Ace Editor within the JSON Editor tab. To enable the Ace Editor, install the ace-builds package and import Ace dependencies to your creator component. Once you enable the Ace Editor, you may undo and redo changes within the Ace Editor using the Ctrl+Z (undo) and Ctrl+Y (redo) key combinations. You may test this in the following demo: View Demo.

      Let me know if those key combinations work for you.

      For the record: if you wish to enable special Undo/Redo buttons to perform those operations, register custom toolbar actions and obtain the Ace Editor to perform the Undo and Redo actions using the Ace Editor API. To obtain the Ace Editor, call the creator.getPlugin("editor") function to obtain the JSON Editor plugin and obtain an Ace Editor instance via editor.model.aceEditor.

      JavaScript
      const editor = creator.getPlugin("editor"); editor.model.aceEditor.selection.clearSelection();

      I hope this information helps. Should you have any further questions, let us know.