logseq / docs

Logseq documentation
https://docs.logseq.com
MIT License
124 stars 90 forks source link

enhance: Add [[Undo and Redo]] ft documentation #97

Closed Bad3r closed 1 year ago

Bad3r commented 1 year ago

Demo page: https://dev.unsigned.sh/logseq-docs/#/page/undo%20and%20redo

related discussion on Discord: https://discord.com/channels/725182569297215569/1096271273400746045/1099039820581445732

Bader β€” 13/04/2023 23:10
Undo/redo Docs πŸ”„
Bader β€” 13/04/2023 23:10
🧡
Bader β€” 13/04/2023 23:18
Currently, there is no dedicated page for undo/redo behavior. Should one be added? Do you have a preference for the title?

related PR:
https://github.com/logseq/logseq/pull/9048

There is the undo/redo of block indent as well:
https://github.com/logseq/logseq/pull/8228

I think there is another PR related to this change but I am not sure which one.
Bader β€” 13/04/2023 23:31
there is multiple old PRs related to improving and fixing undo/redo but I don't think they add any more information
Bader
 changed the channel name: 
Undo/redo Docs πŸ”„
 β€” 14/04/2023 00:04
Ramses β€” 14/04/2023 07:22
If you want to write it, I'd happily accept the pull request for the docs repo @Bader. Although I'd hope our engineers to write the technical docs 😬
cldwalker β€” 14/04/2023 09:52
9048 is the main one I was thinking of as it adds a new mode to undo/redo. A new feature page for it would be great. https://docs.logseq.com/#/page/copy%20and%20paste is a similar page for a general editing feature
cldwalker β€” 14/04/2023 10:04
Fwiw I asked Bader for help on these. Agreed it'd be nice if the team wrote them. Unfortunately I'm the sole engineer consistently writing them and we're moving fast. I don't mind asking for help as long as the contributions aren't more work than doing it myself
Ramses β€” 14/04/2023 10:46
Good to know, thanks for context! @Bader the page that Gabriel linked to is a good template. Maybe it's an idea to have a page with this template for easy reuse
And please ping me on Discord if you have a pull request for the docs. I don't check GitHub that often 😬
Bader β€” 14/04/2023 11:03
yeah I agree having a base template to follow is great. Mentally I usually always start with Overview, Usage, Functionality.
Here is the template I plan to use for undo/redo (subject to change)
## Undo and Redo

### Introduction
   - Overview of the undo and redo feature
   - Purpose and benefits

### Usage
   - Keyboard shortcuts
   - Undo and redo behavior in different scenarios
      - Text input
      - Page navigation
      - Page renaming
      - Block indenting
      - Restoring the right sidebar
   - Examples of using undo and redo in common scenarios

### Functionality
   - Restoring UI state
   - Page-only mode
   - Unlimited undo/redo history
   - Cursor state restoration
   - Interaction with other Logseq features?

### Limitations and Known Issues
   - Support for flashcards
   - Support for editing in page/block preview
   - Behavior when working with external files and syncing
   - Performance impact with extensive undo/redo history
   - Any other limitations or issues

Bader β€” 14/04/2023 12:41
Revision 2 with extra context:
## Logseq Undo and Redo Feature Documentation

### Introduction
   - The Logseq undo and redo feature allows users to revert or reapply changes made during their editing sessions. It aims to enhance the user experience by providing a convenient way to correct mistakes and explore alternative edits.
   - Purpose and benefits include providing context for previous operations, supporting page-only mode, allowing unlimited undo/redo history, and restoring cursor state.

### Usage
   - Keyboard shortcuts:
      - Undo: Press `modKey` + `z` (`modKey` is "Control" on Windows/Linux, "Command" on macOS).
      - Redo: Press `modKey` + `Shift` + `z`.
   - Undo and redo behavior in different scenarios:
      - Text input: Undoing and redoing typed text. For example, typing 'text 1' and then undoing it will remove 'text 1' from the page, while redoing it will make 'text 1' reappear.
      - Page navigation: Navigate to the corresponding pages on undo, including navigating back to the last page visited. For instance, after creating a new page and navigating to it, pressing undo will bring you back to the previous page.
      - Page renaming: Preserving undo/redo actions for renamed pages and navigating to the page on undo. For example, renaming a page and then undoing the rename action will return to the original page name, while redoing it will apply the new name again.
      - Working with blocks: Undoing and redoing block operations, such as creating, editing, indenting, and deleting blocks.
      - Restoring the right sidebar: Restoring both the route and blocks in the right sidebar to provide context for any previous operations and reduce the risk of undoing something users haven't noticed.
   - The undo and redo feature works seamlessly with other Logseq features, such as creating, renaming, and navigating pages.

### Functionality
   - Restoring UI state: Restores the route and blocks in the right sidebar to provide context for any previous operations.
   - Page-only mode: Supports page-only mode (mod+shift+p and search toggle undo redo mode).
   - Unlimited undo/redo history: Allows undo/redo history to grow without limitations.
   - Cursor state restoration: Restores the cursor state after undoing or redoing an action.
   - Interaction with other Logseq features: The undo and redo feature works seamlessly with other Logseq features, such as creating, renaming, and navigating pages.

### Limitations and Known Issues
   - Support for flashcards: Currently, the undo and redo behavior for flashcards is unavailable.
   - Support for editing in page/block preview: Currently, the undo and redo behavior for page/block preview is unavailable.
   - Behavior when working with external files and syncing: The behavior of undo and redo when working with external files or syncing with external services may differ.
   - Performance impact with extensive undo/redo history: A significant undo/redo history might impact performance, although this is not confirmed.
   - Any other limitations or issues: Future updates might address the current limitations and improve the undo and redo functionality.

cldwalker β€” Yesterday at 10:03
Looks promising. PR would be great
Bader β€” Yesterday at 10:06
sounds great. I just moved to a new apartment so I have been busy. I'll be able to push it before Monday. 
Btw this is kinda related 

https://github.com/logseq/logseq/pull/9181
GitHub
fix: cannot undo redo in codemirror editor by situ2001 Β· Pull Reque...
Background: fix #9036
This bug was introduced in src/main/frontend/modules/shortcut/config.cljs in PR #7786 because it placed :editor/undo and :editor/redo into global-prevent-default. It causes co...
fix: cannot undo redo in codemirror editor by situ2001 Β· Pull Reque...
Bader β€” Today at 14:31
@cldwalker I am working on connecting the undo and redo pages to their respective previous changelogs, enabling users to view all associated PRs and changes for this feature. This process will involve modifying some older changelog files; is that acceptable? Additionally, I noticed that the terms 'undo and redo,' 'undo/redo,' and 'undo && redo' are used interchangeably. Would you like me to standardize these as undo and redo, or should I add the various aliases to the page instead?
https://github.com/logseq/docs/compare/master...Bad3r:logseq-docs:add-undo-redo?expand=1

note; when I did find and replace my formatter removed trailing spaces from the files
Bader β€” Today at 14:52
since changing the undo and redo require accessing the command palette; this might be a good place to ask if the command palette will have its own page?
I found this todo in the docs:
TODO Resolve confusion between [[Commands]], [[Macros]], [[Advanced commands]] and commands in command palette #docs

related PRs: