Skip to content

feat(quickTools): replace checkbox with height select & dynamic toggler#2278

Merged
bajrangCoder merged 11 commits into
mainfrom
ajit/improve-quicktools
Jun 17, 2026
Merged

feat(quickTools): replace checkbox with height select & dynamic toggler#2278
bajrangCoder merged 11 commits into
mainfrom
ajit/improve-quicktools

Conversation

@deadlyjack

@deadlyjack deadlyjack commented Jun 17, 2026

Copy link
Copy Markdown
Member
  • Replace quickTools true/false checkbox with Off/Compact/Full (0/1/2) height selector
  • Move floatingButton and quickTools settings into dedicated "Quick Tools" settings category
  • Manage $toggler element dynamically via appendOuter/remove instead of CSS class toggle (hide-floating-button)
  • Add 4 translation keys ("compact", "off", "quick tools height", "quick tools toggler") across all 32 language files
  • Update default quicktoolsItems ordering

Bug fixes:

  • Cancel pending .hide timeout before re-appending toggler to prevent race condition removal after re-connect

  • Remove .hide class on re-append to prevent invisible toggler (opacity: 0 !important)

  • Coerce legacy boolean quickTools values to number for select handler

  • fix state sync on settings page in search mode

  • fix search panel behaviour on switching the tab

  • Keep undo/redo disabled when there is nothing to undo/redo

  • add paste command to add in quicktools

- Replace quickTools true/false checkbox with Off/Compact/Full (0/1/2)
  height selector
- Move floatingButton and quickTools settings into dedicated
  "Quick Tools" settings category
- Manage $toggler element dynamically via appendOuter/remove instead of
  CSS class toggle (hide-floating-button)
- Add 4 translation keys ("compact", "off", "quick tools height",
  "quick tools toggler") across all 32 language files
- Update default quicktoolsItems ordering

Bug fixes:
- Cancel pending .hide timeout before re-appending toggler to prevent
  race condition removal after re-connect
- Remove .hide class on re-append to prevent invisible toggler
  (opacity: 0 !important)
- Coerce legacy boolean quickTools values to number for select handler
@github-actions github-actions Bot added the translations Anything related to Translations Whether a Issue or PR label Jun 17, 2026
@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the binary quickTools checkbox with a three-way height selector (Off / Compact / Full), moves floatingButton and quick-tools settings into a dedicated "Quick Tools" category, and migrates toggler visibility management from CSS class toggling to DOM append/remove with a 300 ms hide animation. It also introduces disabled undo/redo buttons that reflect actual editor history depth.

  • Toggler lifecycle: $toggler is now conditionally appended via appendOuter at init and on floatingButton changes, with clearTimeout guards preventing a race between the hide animation and re-attachment.
  • Search state preservation: A new activeSearchState module variable captures the footer's pre-search layout so height changes made while search is open are deferred and applied correctly on close.
  • History buttons: undoDepth/redoDepth from @codemirror/commands drive new disabled + aria-disabled attributes on undo/redo items, updated on editor-state-changed, switch-file, and quicktoolsItems events.

Confidence Score: 4/5

Mostly safe to merge; the undo/redo button state can be incorrect after closing a search-replace session, but it is self-correcting on the next document change.

The undo/redo disabled state is not refreshed when the search bar is dismissed and the quick-tools rows are re-inserted into the footer. A replace operation during search leaves the undo button silently stuck in its pre-search state until the user types again. All other changes — toggler lifecycle, height coercion, search state deferral, and settings persistence — look correct.

src/handlers/quickTools.js — the search-bar action stack callback that restores footer content should call updateHistoryButtons() after putting the rows back.

Important Files Changed

Filename Overview
src/handlers/quickTools.js Adds activeSearchState module variable to preserve footer state across height changes while search is open, and updates setHeight to defer changes when search is active. Missing updateHistoryButtons() call after search close leaves undo/redo button states stale.
src/handlers/quickToolsInit.js Adds updateHistoryButtons logic using undoDepth/redoDepth from @codemirror/commands, wired to editor-state-changed, switch-file, and quicktoolsItems events. Disabled state is correctly guarded in onclick, touchstart, and click. Initial append of $toggler is now gated on floatingButton setting.
src/settings/appSettings.js Replaces quickTools checkbox with a 3-way select (0/1/2), moves floatingButton and quickTools settings into a new "Quick Tools" category, and correctly coerces legacy boolean values in both valueText and onChange. The outer await appSettings.update ensures the chosen value is persisted regardless of setHeight behavior.
src/lib/editorFile.js Migrates toggler visibility from CSS class toggle (hide-floating-button) to DOM append/remove with 300ms hide animation, including proper clearTimeout guards on re-entry.
src/lib/applySettings.js Mirrors the same DOM-based toggler visibility logic from editorFile.js for the initial settings application path; correctly clears pending hide timeouts before re-appending.
src/components/searchbar/index.js Adds settings-item-interaction-end listener on the backing item to keep visible search-result clones in sync after a setting value changes. The { once: true } flag ensures the listener is cleaned up after each interaction.
src/components/settingsPage.js Emits a new settings-item-interaction-end custom event on every interaction code path (both cancelled and successful), enabling the search-clone sync mechanism.
src/lib/settings.js Removes tablet-detection default for quickTools and floatingButton, replacing with fixed defaults of 2 (full) and false respectively. Removes now-unused #IS_TABLET private field and updates default quicktoolsItems ordering.
src/lib/editorManager.js Emits editor-state-changed inside the existing docChanged check so undo/redo depth updates are broadcast to subscribers. Correctly placed before the early return.
src/components/quickTools/style.scss Adds :not([disabled]) guard on the .click scale animation, a semi-transparent opacity style for [disabled] buttons, and a font-size adjustment for the new paste item.
src/components/quickTools/items.js Adds paste command item; falls back to strings[id] in description() when no quicktools:-prefixed key exists, needed for the new paste item.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant QuickTools
    participant ActionStack
    participant Footer
    participant AppSettings

    User->>QuickTools: toggleSearch()
    QuickTools->>QuickTools: save activeSearchState
    QuickTools->>Footer: "content = [$searchRow1, $searchRow2]"
    QuickTools->>ActionStack: push("search-bar", restoreAction)

    Note over Footer: $row1/$row2 NOT in footer

    User->>Footer: make replacement (docChanged)
    Footer-->>QuickTools: editor-state-changed
    QuickTools->>Footer: "querySelectorAll([data-id="undo"]) → empty"
    Note over QuickTools: undo/redo buttons NOT updated ⚠️

    User->>QuickTools: close search
    QuickTools->>ActionStack: pop restoreAction()
    QuickTools->>Footer: "content = restoreState.content"
    QuickTools->>QuickTools: "activeSearchState = null"
    Note over QuickTools: updateHistoryButtons() NOT called → stale state

    User->>QuickTools: change quickTools height
    QuickTools->>AppSettings: update quickTools value
    AppSettings->>QuickTools: "setHeight(height, save=false)"
    Note over QuickTools: search active → update activeSearchState, return early
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant QuickTools
    participant ActionStack
    participant Footer
    participant AppSettings

    User->>QuickTools: toggleSearch()
    QuickTools->>QuickTools: save activeSearchState
    QuickTools->>Footer: "content = [$searchRow1, $searchRow2]"
    QuickTools->>ActionStack: push("search-bar", restoreAction)

    Note over Footer: $row1/$row2 NOT in footer

    User->>Footer: make replacement (docChanged)
    Footer-->>QuickTools: editor-state-changed
    QuickTools->>Footer: "querySelectorAll([data-id="undo"]) → empty"
    Note over QuickTools: undo/redo buttons NOT updated ⚠️

    User->>QuickTools: close search
    QuickTools->>ActionStack: pop restoreAction()
    QuickTools->>Footer: "content = restoreState.content"
    QuickTools->>QuickTools: "activeSearchState = null"
    Note over QuickTools: updateHistoryButtons() NOT called → stale state

    User->>QuickTools: change quickTools height
    QuickTools->>AppSettings: update quickTools value
    AppSettings->>QuickTools: "setHeight(height, save=false)"
    Note over QuickTools: search active → update activeSearchState, return early
Loading

Reviews (5): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread src/lib/editorFile.js
Comment thread src/settings/appSettings.js Outdated
…e touchMoveThreshold category

- Wrap clearTimeout/remove-hide/appendOuter inside floatingButton guard
  in editorFile.js else-branch to prevent toggler resurrection race
  when floatingButton is disabled during hide animation
- Move touchMoveThreshold back to categories.interface (it's a global
  touch setting, not quick-tools specific)
@deadlyjack

This comment was marked as outdated.

Ajit Kumar and others added 2 commits June 17, 2026 16:34
… trigger mode display

- Move touchMoveThreshold back to categories.interface and reorder it
  before the Quick Tools section in the settings list
- Add valueText callback for quickToolsTriggerMode to display
  capitalized labels (Click/Touch) in the settings row
bajrangCoder and others added 3 commits June 17, 2026 17:30
…leanup

- Remove isConnected check from toggler hide paths in appSettings,
  applySettings, and editorFile — hide logic now always executes so
  disabling floatingButton reliably hides the toggler
- Replace early return in setHeight() with else branches so rows
  beyond target height are removed (fixes compact mode not reducing
  from full height)
@deadlyjack

This comment was marked as outdated.

Comment thread src/settings/appSettings.js
@bajrangCoder bajrangCoder linked an issue Jun 17, 2026 that may be closed by this pull request
1 task
@bajrangCoder

This comment was marked as outdated.

Comment thread src/settings/appSettings.js
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder merged commit 52732a4 into main Jun 17, 2026
10 checks passed
@bajrangCoder bajrangCoder deleted the ajit/improve-quicktools branch June 17, 2026 15:54
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

Status: Done

2 participants