Give way in narrow windows and use one icon for each action
Phase 5-6. - Side panes give way when the window becomes narrow: the outline below 1100 pixels, the side pane below 800 pixels. They come back when the window grows. A pane that the user opens in a narrow window stays open, and the saved layout keeps the wide-window choice. - One function has one icon. The SDK icon set gets duplicate, template, and tab. The reveal action has one label for each platform (Show in Explorer, Show in Finder, Show in file manager). - The file menu follows one order: open, clipboard, organize, show and copy path, history, then Delete and Delete permanently in the error color after a separator. The tree copies paths through a Copy path submenu, as the tab menu does. - The tree uses the shared chevron. Search hits come in groups by file, with counts and marked matches. Bookmarks show the name, the folder, and a remove button. - All boolean settings use one switch design (src/lib/ui/switch.css). Browser settings apply at once, and the Save button is gone. The Settings window opens with the focus on its search. - Targets of at least 24 pixels: the tab close button, outline rows, switches, and the settings search. - Catalog rows in French, Japanese, and Simplified Chinese. - Docs: UI-052, ui-design.md, and the user guide. Tests: the new layout/panesAndSettings. Tests that closed or opened panes by hand around narrow windows now rely on the new behavior, or wait for the panes to give way before they reopen one. Tests that read the old menu labels or the browser Save button use the new ones.
This commit is contained in:
@@ -965,3 +965,18 @@ Native shell, background image, and desktop acceptance remain open.
|
|||||||
- Evidence: `tests/smoke/layout/keyboardFocus.smoke.mjs`.
|
- Evidence: `tests/smoke/layout/keyboardFocus.smoke.mjs`.
|
||||||
- Replaces / replaced by: The radio rule of [UI-003](#ui-003--quiet-menu-choices). Other parts of UI-003 remain.
|
- Replaces / replaced by: The radio rule of [UI-003](#ui-003--quiet-menu-choices). Other parts of UI-003 remain.
|
||||||
- Limits: The check mark replaces the icon of a radio row. The list of all tabs names pinned tabs in text. Browser checks use desktop service mocks.
|
- Limits: The check mark replaces the icon of a radio row. The list of all tabs names pinned tabs in text. Browser checks use desktop service mocks.
|
||||||
|
|
||||||
|
### UI-052 — Panes that give way, one icon per action, and consistent Settings
|
||||||
|
|
||||||
|
- Type: Rule change
|
||||||
|
- Date: 2026-10-28
|
||||||
|
- Status: Implemented for user review
|
||||||
|
- Decision source: Owner decisions 6 (menu separator and danger color) and 13 (layout and icons, Settings) of 2026-10-27 (interface review issues 9, 11, 13, 19, and 21), stage 5-6.
|
||||||
|
- Previous rule: Side panes kept 260 and 240 pixels in every window, so a 900-pixel window gave the document 44% of its width. The copy icon stood for 7 functions, and one action had two labels ("Show in Explorer" and "Show in system explorer"). Delete sat after Rename with no separator or color. The tree used CSS triangles. Search showed a flat list of paths. Bookmarks were bare paths. Settings had three switch designs, a Save button only for the browser, and the first focus on "Minimize window". Some targets were 22 pixels.
|
||||||
|
- New rule: The outline gives way below 1100 pixels and the side pane below 800 pixels, when the window becomes narrow. They come back when it grows, and a pane that the user opens in a narrow window stays open. One function has one icon (`copy`, `duplicate`, `template`, and `tab`, added to the SDK icon set), and the reveal action has one label for each platform. The file menu follows one order and ends with Delete in the error color after a separator. The tree uses the shared chevron. Search hits come in groups by file, with counts and marked matches. Bookmarks show the name, the folder, and a remove button. All boolean settings use the `rs-switch` design, every setting applies at once, and the Settings window opens with the focus on its search. The tab close button, outline rows, switches, and the settings search are at least 24 pixels.
|
||||||
|
- Reason: A narrow window must leave room for the document. A user must recognize an action by its icon and its label. Settings must behave the same on every page.
|
||||||
|
- Scope: The workbench layout, the file and tab menus, the image and table menus, the left pane views, the outline, and Settings.
|
||||||
|
- Shared implementation: `Workbench.svelte` (the narrow layout), `FileTree.svelte`, `menuTypes.ts` and `actionMenu.ts` (`danger`), `menuItems.ts` (`revealLabel`), `packages/plugin-sdk/src/icons.ts`, `SearchPane.svelte`, `BookmarksPane.svelte`, `TreeNode.svelte`, and `src/lib/ui/switch.css`.
|
||||||
|
- Evidence: `tests/smoke/layout/panesAndSettings.smoke.mjs`.
|
||||||
|
- Replaces / replaced by: The fixed side panes of narrow windows, and the Save button of the browser settings.
|
||||||
|
- Limits: At startup, the saved layout applies as it is, also in a narrow window. Panes give way only when the window becomes narrower. Browser checks use desktop service mocks. The SDK release that publishes the new icon names is a separate step.
|
||||||
|
|||||||
+7
-1
@@ -69,7 +69,7 @@ Do not copy feature-specific colors into a shared control.
|
|||||||
## Controls, corners, and focus
|
## Controls, corners, and focus
|
||||||
|
|
||||||
- Controls, menu rows, and navigation highlights use `--rs-control-radius`. This includes hover, active, and selected states.
|
- Controls, menu rows, and navigation highlights use `--rs-control-radius`. This includes hover, active, and selected states.
|
||||||
- Keep readable labels, visible focus indicators, and comfortable click targets in compact layouts.
|
- Keep readable labels, visible focus indicators, and comfortable click targets in compact layouts. A target is at least 24 by 24 pixels.
|
||||||
- Keyboard focus shows a 2-pixel `--rs-focus` ring outside the control. Menu rows draw the ring inside the row. Hover never shows the ring.
|
- Keyboard focus shows a 2-pixel `--rs-focus` ring outside the control. Menu rows draw the ring inside the row. Hover never shows the ring.
|
||||||
- Hover gets a neutral fill. An active toggle also gets the accent color, the selection fill, and a 2-pixel accent bar, so it differs from hover.
|
- Hover gets a neutral fill. An active toggle also gets the accent color, the selection fill, and a 2-pixel accent bar, so it differs from hover.
|
||||||
- A disabled control uses `--rs-text-dim` at full opacity. Do not fade a control with opacity.
|
- A disabled control uses `--rs-text-dim` at full opacity. Do not fade a control with opacity.
|
||||||
@@ -110,6 +110,8 @@ Use one menu design for context menus, action menus, and their submenus in the h
|
|||||||
- A menu with only text choices omits the icon column. A mixed menu reserves the icon column on every row.
|
- A menu with only text choices omits the icon column. A mixed menu reserves the icon column on every row.
|
||||||
- Shortcut text and submenu arrows use separate trailing columns.
|
- Shortcut text and submenu arrows use separate trailing columns.
|
||||||
- A common text action has the same label, icon, and shortcut in every menu. Build Undo, Redo, the clipboard rows, and the search row with `menuItems.ts`.
|
- A common text action has the same label, icon, and shortcut in every menu. Build Undo, Redo, the clipboard rows, and the search row with `menuItems.ts`.
|
||||||
|
- One function has one icon: `copy` puts content on the clipboard, `duplicate` makes a second file or row, `template` marks template actions, and `tab` opens in a new tab. The action that shows a file in the file manager takes its label from `revealLabel()`.
|
||||||
|
- A file menu follows one order: open, clipboard, organize, show and copy path, history, then Delete. Delete and Delete permanently use `danger`, which gives them the error color.
|
||||||
- Write shortcut labels with `src/lib/ui/shortcuts.ts`: `keys("Mod+Shift+P")` gives Ctrl+Shift+P on Windows and Linux and ⇧⌘P on macOS. A workbench command takes its label from `commandShortcut()` in `workbenchKeys.ts`. Do not write "Ctrl" in interface text or in the catalog. Use a placeholder.
|
- Write shortcut labels with `src/lib/ui/shortcuts.ts`: `keys("Mod+Shift+P")` gives Ctrl+Shift+P on Windows and Linux and ⇧⌘P on macOS. A workbench command takes its label from `commandShortcut()` in `workbenchKeys.ts`. Do not write "Ctrl" in interface text or in the catalog. Use a placeholder.
|
||||||
- Use inset separators between related groups.
|
- Use inset separators between related groups.
|
||||||
- Enabled rows share one hover fill. Keyboard focus adds a 2-pixel ring inside the row.
|
- Enabled rows share one hover fill. Keyboard focus adds a 2-pixel ring inside the row.
|
||||||
@@ -154,6 +156,7 @@ Decisions: [UI-002](design-decisions.md#ui-002--share-the-requested-dropdown-des
|
|||||||
- Document and plugin tabs share the tab bar. The new-tab button follows the tabs. Tabs keep their order and pin state when a plugin replaces its view.
|
- Document and plugin tabs share the tab bar. The new-tab button follows the tabs. Tabs keep their order and pin state when a plugin replaces its view.
|
||||||
- The main window keeps an empty New tab after its last tab closes. A secondary window closes with its last tab. The unsaved-edit and active-terminal confirmations still apply, and Cancel keeps the tab open.
|
- The main window keeps an empty New tab after its last tab closes. A secondary window closes with its last tab. The unsaved-edit and active-terminal confirmations still apply, and Cancel keeps the tab open.
|
||||||
- Sidebar widths and visibility persist across window sessions. A different editor does not restore a hidden outline.
|
- Sidebar widths and visibility persist across window sessions. A different editor does not restore a hidden outline.
|
||||||
|
- Side panes give way when the window becomes narrow: the outline below 1100 pixels, and the side pane below 800 pixels. They come back when the window grows again. A pane that the user opens in a narrow window stays open, and the saved layout keeps the choice of a wide window.
|
||||||
- A detached tab window holds the tab work area and window controls only. It has no side panes, plugin ribbon, or pane switches, and it does not change the main window layout.
|
- A detached tab window holds the tab work area and window controls only. It has no side panes, plugin ribbon, or pane switches, and it does not change the main window layout.
|
||||||
|
|
||||||
Decisions: [UI-004](design-decisions.md#ui-004--detached-tab-work-area), [UI-039](design-decisions.md#ui-039--close-secondary-windows-after-the-last-tab).
|
Decisions: [UI-004](design-decisions.md#ui-004--detached-tab-work-area), [UI-039](design-decisions.md#ui-039--close-secondary-windows-after-the-last-tab).
|
||||||
@@ -162,6 +165,9 @@ Decisions: [UI-004](design-decisions.md#ui-004--detached-tab-work-area), [UI-039
|
|||||||
|
|
||||||
- Follow the Obsidian settings pattern. Navigation pairs icons with labels. Each page uses readable text and ordinary controls.
|
- Follow the Obsidian settings pattern. Navigation pairs icons with labels. Each page uses readable text and ordinary controls.
|
||||||
- Use the `--rs-settings-*` tokens for spacing, control height, headings, and descriptions.
|
- Use the `--rs-settings-*` tokens for spacing, control height, headings, and descriptions.
|
||||||
|
- Every boolean setting uses the one switch design: `<input type="checkbox" role="switch" class="rs-switch">` (`src/lib/ui/switch.css`).
|
||||||
|
- Settings apply at once: a switch or a choice on change, and a text field when it loses focus. No page has a Save button.
|
||||||
|
- The Settings window opens with the focus on its search field.
|
||||||
- Put related plugin metadata and actions in compact rows.
|
- Put related plugin metadata and actions in compact rows.
|
||||||
- Controls wrap at narrow widths, and the content area scrolls. Long navigation must leave room for the selected page.
|
- Controls wrap at narrow widths, and the content area scrolls. Long navigation must leave room for the selected page.
|
||||||
- General offers the interface language through the shared action menu.
|
- General offers the interface language through the shared action menu.
|
||||||
|
|||||||
+4
-4
@@ -40,15 +40,15 @@ To show workspace settings and plugin data in the navigator, turn on **Settings
|
|||||||
| New file | Press Ctrl+N and type the full name with its extension, such as `notes/meeting.md` or `scripts/check.py`. RuneStone does not add an extension. |
|
| New file | Press Ctrl+N and type the full name with its extension, such as `notes/meeting.md` or `scripts/check.py`. RuneStone does not add an extension. |
|
||||||
| New note | Select **New note** in an empty tab, or right-click the navigator and choose **New note**. RuneStone creates a Markdown file. Rename it from the note title. |
|
| New note | Select **New note** in an empty tab, or right-click the navigator and choose **New note**. RuneStone creates a Markdown file. Rename it from the note title. |
|
||||||
| Find a file by path | Press Ctrl+P. |
|
| Find a file by path | Press Ctrl+P. |
|
||||||
| Search all files | Press Ctrl+Shift+F. |
|
| Search all files | Press Ctrl+Shift+F. The results come in groups by file, with the count and the matches marked. |
|
||||||
| Find in the document | Press Ctrl+F. |
|
| Find in the document | Press Ctrl+F. |
|
||||||
| Show or hide the sidebar | Press Ctrl+\. |
|
| Show or hide the sidebar | Press Ctrl+\. |
|
||||||
| Find a command | Press Ctrl+Shift+P, type part of the command name, and press Enter. The list also shows each shortcut and the plugin commands. |
|
| Find a command | Press Ctrl+Shift+P, type part of the command name, and press Enter. The list also shows each shortcut and the plugin commands. |
|
||||||
| Rename | Select an item in the navigator and press F2. RuneStone selects the name without the extension. |
|
| Rename | Select an item in the navigator and press F2. RuneStone selects the name without the extension. |
|
||||||
| Move | Drag files between folders. |
|
| Move | Drag files between folders. |
|
||||||
| Bookmark | Right-click a file and choose **Bookmark**. The Bookmarks pane lists it. |
|
| Bookmark | Right-click a file and choose **Bookmark**. The Bookmarks pane lists it with its folder. Select × beside a bookmark to remove it. |
|
||||||
|
|
||||||
Right-click a file or folder for more actions, such as **Make a copy**, **Copy workspace path**, and **Open in default app**.
|
Right-click a file or folder for more actions, such as **Make a copy**, **Copy path**, and **Open in default app**. **Delete** is last in the menu, in the error color.
|
||||||
With the navigator focused, Ctrl+X, Ctrl+C, and Ctrl+V cut, copy, and paste files.
|
With the navigator focused, Ctrl+X, Ctrl+C, and Ctrl+V cut, copy, and paste files.
|
||||||
The navigator is one Tab stop. Up and Down move between items, and Shift+Up or Shift+Down extends the selection. Right opens a folder or enters it. Left closes a folder or goes to its parent. Home and End go to the first and last item. Type the start of a name to go to it.
|
The navigator is one Tab stop. Up and Down move between items, and Shift+Up or Shift+Down extends the selection. Right opens a folder or enters it. Left closes a folder or goes to its parent. Home and End go to the first and last item. Type the start of a name to go to it.
|
||||||
Ctrl+Z undoes a file move or rename, and Ctrl+Shift+Z or Ctrl+Y repeats it.
|
Ctrl+Z undoes a file move or rename, and Ctrl+Shift+Z or Ctrl+Y repeats it.
|
||||||
@@ -190,7 +190,7 @@ If a write fails, your edits stay in the tab. RuneStone does not lock files, so
|
|||||||
## Change settings
|
## Change settings
|
||||||
|
|
||||||
Select the gear at the bottom of the left ribbon, or press Ctrl+,. Use the search field to find a setting.
|
Select the gear at the bottom of the left ribbon, or press Ctrl+,. Use the search field to find a setting.
|
||||||
Settings apply to all workspaces on this computer and update all open windows.
|
Settings apply at once to all workspaces on this computer and update all open windows. A text field applies when you leave it.
|
||||||
|
|
||||||
| Category | Settings |
|
| Category | Settings |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ export const actionIcons = {
|
|||||||
footnote: '<path d="M4 4h9v16H4ZM7 8h3M7 12h3M16 4l2-1v6M16 9h4"/>',
|
footnote: '<path d="M4 4h9v16H4ZM7 8h3M7 12h3M16 4l2-1v6M16 9h4"/>',
|
||||||
cut: '<circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="m8 8 12 12M8 16 20 4"/>',
|
cut: '<circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="m8 8 12 12M8 16 20 4"/>',
|
||||||
copy: '<rect x="8" y="8" width="12" height="13" rx="2"/><path d="M16 8V3H3v13h5"/>',
|
copy: '<rect x="8" y="8" width="12" height="13" rx="2"/><path d="M16 8V3H3v13h5"/>',
|
||||||
|
duplicate: '<rect x="8" y="8" width="12" height="13" rx="2"/><path d="M16 8V3H3v13h5M14 11.5v6M11 14.5h6"/>',
|
||||||
|
template: '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 9v12"/>',
|
||||||
|
tab: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h7V4"/>',
|
||||||
paste: '<rect x="5" y="5" width="14" height="16" rx="2"/><rect x="9" y="2" width="6" height="5" rx="1"/><path d="m9 14 2 2 4-4"/>',
|
paste: '<rect x="5" y="5" width="14" height="16" rx="2"/><rect x="9" y="2" width="6" height="5" rx="1"/><path d="m9 14 2 2 4-4"/>',
|
||||||
'paste-text': '<rect x="5" y="5" width="14" height="16" rx="2"/><path d="M9 5V2h6v3M8 11h8M12 11v7"/>',
|
'paste-text': '<rect x="5" y="5" width="14" height="16" rx="2"/><path d="M9 5V2h6v3M8 11h8M12 11v7"/>',
|
||||||
format: '<path d="m14 3 7 7-10 10H4v-7ZM11 6l7 7M3 21h18"/>',
|
format: '<path d="m14 3 7 7-10 10H4v-7ZM11 6l7 7M3 21h18"/>',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* Global styles. Each file lives beside the code that uses it. The order of the imports is the cascade order. */
|
/* Global styles. Each file lives beside the code that uses it. The order of the imports is the cascade order. */
|
||||||
@import "./lib/theme/tokens.css";
|
@import "./lib/theme/tokens.css";
|
||||||
@import "./lib/ui/menu.css";
|
@import "./lib/ui/menu.css";
|
||||||
|
@import "./lib/ui/switch.css";
|
||||||
@import "./lib/theme/base.css";
|
@import "./lib/theme/base.css";
|
||||||
@import "./lib/ui/tooltip.css";
|
@import "./lib/ui/tooltip.css";
|
||||||
@import "./lib/layout/reading.css";
|
@import "./lib/layout/reading.css";
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
parent: anchor.closest('dialog') ?? undefined,
|
parent: anchor.closest('dialog') ?? undefined,
|
||||||
items: (profile ? $browserState?.profiles || [] : engines).map(choice => ({ label: choice.name,
|
items: (profile ? $browserState?.profiles || [] : engines).map(choice => ({ label: choice.name,
|
||||||
radio: true, checked: choice.id === (profile ? selected : search),
|
radio: true, checked: choice.id === (profile ? selected : search),
|
||||||
run: () => { if (profile) selected = choice.id; else search = choice.id; } })) }).close;
|
run: () => { if (profile) selected = choice.id; else { search = choice.id; void save(); } } })) }).close;
|
||||||
}
|
}
|
||||||
onMount(() => { void request('state').then(value => {
|
onMount(() => { void request('state').then(value => {
|
||||||
selected = value.profiles[0].id; search = value.settings.search; adblock = value.settings.adblock;
|
selected = value.profiles[0].id; search = value.settings.search; adblock = value.settings.adblock;
|
||||||
@@ -34,35 +34,38 @@
|
|||||||
const result = await act(duplicate ? 'duplicateProfile' : 'createProfile', duplicate ? { profileId: selected, name } : { name });
|
const result = await act(duplicate ? 'duplicateProfile' : 'createProfile', duplicate ? { profileId: selected, name } : { name });
|
||||||
if (result) { selected = result.profiles.at(-1)!.id; name = ''; }
|
if (result) { selected = result.profiles.at(-1)!.id; name = ''; }
|
||||||
}
|
}
|
||||||
|
// Settings apply at once: a switch or a choice on change, a text field when it loses focus.
|
||||||
|
// A change during a save starts one more save after it.
|
||||||
|
let pending = false;
|
||||||
async function save() {
|
async function save() {
|
||||||
|
if (!ready) return;
|
||||||
|
if (busy) { pending = true; return; }
|
||||||
busy = true; message = $t('Saving browser settings…');
|
busy = true; message = $t('Saving browser settings…');
|
||||||
try {
|
try {
|
||||||
await act('settings', { search, adblock, linkDestination: internalLinks ? 'internal' : 'external', personalRules: rules,
|
await act('settings', { search, adblock, linkDestination: internalLinks ? 'internal' : 'external', personalRules: rules,
|
||||||
homepage, filterLists: filterLists.split(/\r?\n/).map(value => value.trim()).filter(Boolean) });
|
homepage, filterLists: filterLists.split(/\r?\n/).map(value => value.trim()).filter(Boolean) });
|
||||||
} finally { busy = false; }
|
} finally { busy = false; }
|
||||||
|
if (pending) { pending = false; void save(); }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<h2>{$t("Browser")}</h2><p>{$t("Choose how you browse within RuneStone.")}</p>
|
<h2>{$t("Browser")}</h2><p>{$t("Choose how you browse within RuneStone.")}</p>
|
||||||
<h3>{$t("General")}</h3>
|
<h3>{$t("General")}</h3>
|
||||||
<form onsubmit={event => { event.preventDefault(); if (ready && !busy) void save(); }}>
|
<fieldset disabled={!ready} onchange={() => void save()}>
|
||||||
<fieldset disabled={!ready || busy}>
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<label class="row"><span>{$t("Open web links in RuneStone")}<small>{$t("Turn this off to use your system browser.")}</small></span><input class="switch" type="checkbox" role="switch" aria-label={$t("Open web links in RuneStone")} bind:checked={internalLinks}></label>
|
<label class="row"><span>{$t("Open web links in RuneStone")}<small>{$t("Turn this off to use your system browser.")}</small></span><input class="rs-switch" type="checkbox" role="switch" aria-label={$t("Open web links in RuneStone")} bind:checked={internalLinks}></label>
|
||||||
<label class="row"><span>{$t("Homepage")}<small>{$t("The page to open in each new browser tab. Leave blank for an empty page.")}</small></span><input class="address" type="url" aria-label={$t("Homepage")} placeholder="https://example.com" maxlength="8192" bind:value={homepage}></label>
|
<label class="row"><span>{$t("Homepage")}<small>{$t("The page to open in each new browser tab. Leave blank for an empty page.")}</small></span><input class="address" type="url" aria-label={$t("Homepage")} placeholder="https://example.com" maxlength="8192" bind:value={homepage}></label>
|
||||||
<div class="row"><span>{$t("Search engine")}</span><button type="button" class="picker" aria-label={$t("Search engine")} aria-haspopup="menu" onclick={event => picker(event)}>{engines.find(engine => engine.id === search)?.name ?? 'DuckDuckGo'}<Icon icon="chevron-down" /></button></div>
|
<div class="row"><span>{$t("Search engine")}</span><button type="button" class="picker" aria-label={$t("Search engine")} aria-haspopup="menu" onclick={event => picker(event)}>{engines.find(engine => engine.id === search)?.name ?? 'DuckDuckGo'}<Icon icon="chevron-down" /></button></div>
|
||||||
<label class="row"><span>{$t("Block ads and trackers")}<small>{$t("Apply the filter lists and personal rules to all browser tabs.")}</small></span><input class="switch" type="checkbox" role="switch" aria-label={$t("Block ads and trackers")} bind:checked={adblock}></label>
|
<label class="row"><span>{$t("Block ads and trackers")}<small>{$t("Apply the filter lists and personal rules to all browser tabs.")}</small></span><input class="rs-switch" type="checkbox" role="switch" aria-label={$t("Block ads and trackers")} bind:checked={adblock}></label>
|
||||||
<label class="row list-row"><span>{$t("Ad blocking lists")}<small>{$t("One HTTPS filter list URL per line, up to eight lists. New lists download when you save.")}</small></span><textarea aria-label={$t("Ad blocking lists")} rows="4" maxlength="66000" placeholder="https://easylist.to/easylist/easylist.txt" bind:value={filterLists}></textarea></label>
|
<label class="row list-row"><span>{$t("Ad blocking lists")}<small>{$t("One HTTPS filter list URL per line, up to eight lists. New lists download when you leave the field.")}</small></span><textarea aria-label={$t("Ad blocking lists")} rows="4" maxlength="66000" placeholder="https://easylist.to/easylist/easylist.txt" bind:value={filterLists}></textarea></label>
|
||||||
</div>
|
</div>
|
||||||
<label class="rules">{$t("Personal filter rules")}<small>{$t("Use one rule per line. Block a domain with ||ads.example.com^, allow it with @@||ads.example.com^, or hide an element with example.com##.advertisement. Save to apply the rules.")}</small><textarea rows="4" maxlength="100000" placeholder={'! Block an advertising domain\n||ads.example.com^\n! Hide an element on one site\nexample.com##.advertisement'} bind:value={rules}></textarea></label>
|
<label class="rules">{$t("Personal filter rules")}<small>{$t("Use one rule per line. Block a domain with ||ads.example.com^, allow it with @@||ads.example.com^, or hide an element with example.com##.advertisement. Save to apply the rules.")}</small><textarea rows="4" maxlength="100000" placeholder={'! Block an advertising domain\n||ads.example.com^\n! Hide an element on one site\nexample.com##.advertisement'} bind:value={rules}></textarea></label>
|
||||||
<button type="submit"><Icon icon="save" />{busy ? $t('Saving…') : $t('Save browser settings')}</button>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
|
||||||
<h3>{$t("Profiles")}</h3><p>{$t("New profiles start blank. Duplicate a profile to copy its stored browsing data and bookmarks.")}</p>
|
<h3>{$t("Profiles")}</h3><p>{$t("New profiles start blank. Duplicate a profile to copy its stored browsing data and bookmarks.")}</p>
|
||||||
<div class="card profiles">
|
<div class="card profiles">
|
||||||
<div class="profile-choice"><span>{$t("Profile")}</span><button type="button" class="picker" aria-label={$t("Profile")} aria-haspopup="menu" disabled={!ready} onclick={event => picker(event, true)}>{$browserState?.profiles.find(profile => profile.id === selected)?.name ?? $t('Profile')}<Icon icon="chevron-down" /></button></div>
|
<div class="profile-choice"><span>{$t("Profile")}</span><button type="button" class="picker" aria-label={$t("Profile")} aria-haspopup="menu" disabled={!ready} onclick={event => picker(event, true)}>{$browserState?.profiles.find(profile => profile.id === selected)?.name ?? $t('Profile')}<Icon icon="chevron-down" /></button></div>
|
||||||
<label>{$t("New profile name")}<input bind:value={name} maxlength="60" placeholder={$t("Profile name")}></label>
|
<label>{$t("New profile name")}<input bind:value={name} maxlength="60" placeholder={$t("Profile name")}></label>
|
||||||
<div class="actions"><button onclick={() => void create(false)}><Icon icon="plus" />{$t("New blank profile")}</button><button onclick={() => void create(true)}><Icon icon="copy" />{$t("Duplicate profile")}</button></div>
|
<div class="actions"><button onclick={() => void create(false)}><Icon icon="plus" />{$t("New blank profile")}</button><button onclick={() => void create(true)}><Icon icon="duplicate" />{$t("Duplicate profile")}</button></div>
|
||||||
<p class="note">{$t("Duplication briefly restarts browser tabs. The copies remain separate. Agent permissions are not copied.")}</p>
|
<p class="note">{$t("Duplication briefly restarts browser tabs. The copies remain separate. Agent permissions are not copied.")}</p>
|
||||||
</div>
|
</div>
|
||||||
<h3>{$t("Web data")}</h3><p>{$t("Clear data for the selected profile. Its browser tabs will close. Bookmarks remain.")}</p>
|
<h3>{$t("Web data")}</h3><p>{$t("Clear data for the selected profile. Its browser tabs will close. Bookmarks remain.")}</p>
|
||||||
@@ -74,16 +77,12 @@
|
|||||||
.settings{color:var(--rs-text);font-family:var(--rs-font-ui)}h2{margin:0;font-size:var(--rs-settings-heading-size);font-weight:500;color:var(--rs-text-strong)}h3{margin:var(--rs-settings-section-gap) 0 var(--rs-settings-gap);font-size:14px;font-weight:500}
|
.settings{color:var(--rs-text);font-family:var(--rs-font-ui)}h2{margin:0;font-size:var(--rs-settings-heading-size);font-weight:500;color:var(--rs-text-strong)}h3{margin:var(--rs-settings-section-gap) 0 var(--rs-settings-gap);font-size:14px;font-weight:500}
|
||||||
p{color:var(--rs-text-dim);font-size:var(--rs-settings-description-size);line-height:1.6}.card{padding:0 var(--rs-settings-row-padding);background:var(--rs-bg-elevated);border:1px solid var(--rs-border);border-radius:var(--rs-control-radius)}
|
p{color:var(--rs-text-dim);font-size:var(--rs-settings-description-size);line-height:1.6}.card{padding:0 var(--rs-settings-row-padding);background:var(--rs-bg-elevated);border:1px solid var(--rs-border);border-radius:var(--rs-control-radius)}
|
||||||
.row{display:flex;justify-content:space-between;align-items:center;gap:var(--rs-settings-gap);padding:var(--rs-settings-row-padding) 0}.row+.row{border-top:1px solid var(--rs-border)}
|
.row{display:flex;justify-content:space-between;align-items:center;gap:var(--rs-settings-gap);padding:var(--rs-settings-row-padding) 0}.row+.row{border-top:1px solid var(--rs-border)}
|
||||||
input,textarea,button{border:1px solid var(--rs-border);border-radius:var(--rs-control-radius);background:var(--rs-bg);color:var(--rs-text);font:inherit;box-sizing:border-box;min-height:var(--rs-settings-control-height);padding:4px 8px}
|
input:not(.rs-switch),textarea,button{border:1px solid var(--rs-border);border-radius:var(--rs-control-radius);background:var(--rs-bg);color:var(--rs-text);font:inherit;box-sizing:border-box;min-height:var(--rs-settings-control-height);padding:4px 8px}
|
||||||
button{display:inline-flex;align-items:center;gap:7px;background:var(--rs-bg-elevated);cursor:pointer}button:hover{background:var(--rs-bg-active)}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--rs-focus);outline-offset:1px}
|
button{display:inline-flex;align-items:center;gap:7px;background:var(--rs-bg-elevated);cursor:pointer}button:hover{background:var(--rs-bg-active)}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--rs-focus);outline-offset:1px}
|
||||||
.picker{justify-content:space-between;min-width:140px;max-width:100%;overflow-wrap:anywhere;text-align:left}
|
.picker{justify-content:space-between;min-width:140px;max-width:100%;overflow-wrap:anywhere;text-align:left}
|
||||||
.rules{display:flex;flex-direction:column;gap:7px;margin:16px 0}.profiles{padding-top:16px;padding-bottom:8px}.profiles label,.profile-choice{display:flex;flex-direction:column;gap:7px;margin-bottom:14px}
|
.rules{display:flex;flex-direction:column;gap:7px;margin:16px 0}.profiles{padding-top:16px;padding-bottom:8px}.profiles label,.profile-choice{display:flex;flex-direction:column;gap:7px;margin-bottom:14px}
|
||||||
.actions{display:flex;flex-wrap:wrap;gap:8px}.note{margin-bottom:0}
|
.actions{display:flex;flex-wrap:wrap;gap:8px}.note{margin-bottom:0}
|
||||||
fieldset{border:0;margin:0;padding:0;min-width:0}small{display:block;color:var(--rs-text-dim);font-size:var(--rs-settings-description-size);line-height:1.5;margin-top:5px}
|
fieldset{border:0;margin:0;padding:0;min-width:0}small{display:block;color:var(--rs-text-dim);font-size:var(--rs-settings-description-size);line-height:1.5;margin-top:5px}
|
||||||
.row>span{flex:1}.address,.list-row textarea{width:260px;max-width:48%;box-sizing:border-box}.list-row{align-items:flex-start}textarea{resize:vertical}␍
|
.row>span{flex:1}.address,.list-row textarea{width:260px;max-width:48%;box-sizing:border-box}.list-row{align-items:flex-start}textarea{resize:vertical}␍
|
||||||
.switch{appearance:none;position:relative;flex:none;width:44px;height:26px;border:0;border-radius:999px;background:var(--rs-text-dim);padding:0;cursor:pointer;transition:background .15s}
|
|
||||||
.switch::before{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:var(--rs-bg);box-shadow:0 1px 3px #0004;transition:transform .15s}
|
|
||||||
.switch:checked{background:var(--rs-accent)}.switch:checked::before{transform:translateX(18px)}:disabled{opacity:.6;cursor:wait}
|
|
||||||
@media(prefers-reduced-motion:reduce){.switch,.switch::before{transition:none}}
|
|
||||||
@media(max-width:600px){.row{flex-wrap:wrap}.address,.list-row textarea{width:100%;max-width:100%}}
|
@media(max-width:600px){.row{flex-wrap:wrap}.address,.list-row textarea{width:100%;max-width:100%}}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { tr } from '../i18n/index.ts';
|
import { tr } from '../i18n/index.ts';
|
||||||
|
import { revealLabel } from '../ui/menuItems.ts';
|
||||||
import { actionIcon, type ActionIcon } from "../ui/actionIcons";
|
import { actionIcon, type ActionIcon } from "../ui/actionIcons";
|
||||||
import { attachTooltip } from "../ui/tooltip";
|
import { attachTooltip } from "../ui/tooltip";
|
||||||
const tooltipCleanups = new WeakMap<HTMLElement, () => void>();
|
const tooltipCleanups = new WeakMap<HTMLElement, () => void>();
|
||||||
@@ -137,7 +138,7 @@ export function imageControls(root: HTMLElement, actions: ImageActions = {}, mea
|
|||||||
...(actions.edit ? [{ label: tr("Edit image source"), icon: "code" as const, run: () => void run(actions.edit!) }] : []),
|
...(actions.edit ? [{ label: tr("Edit image source"), icon: "code" as const, run: () => void run(actions.edit!) }] : []),
|
||||||
...(actions.open ? [{ label: tr("Open in new tab"), icon: "external" as const, run: () => void run(() => actions.open!(image)) }] : []),
|
...(actions.open ? [{ label: tr("Open in new tab"), icon: "external" as const, run: () => void run(() => actions.open!(image)) }] : []),
|
||||||
{ label: tr("Copy path"), icon: "link", run: () => void run(() => navigator.clipboard.writeText(image.dataset.mdSrc || "")) },
|
{ label: tr("Copy path"), icon: "link", run: () => void run(() => navigator.clipboard.writeText(image.dataset.mdSrc || "")) },
|
||||||
...(actions.reveal && !/^https?:/i.test(image.dataset.mdSrc || "") ? [{ label: tr("Show in Explorer"), icon: "external" as const, run: () => void run(() => actions.reveal!(image)) }] : []),
|
...(actions.reveal && !/^https?:/i.test(image.dataset.mdSrc || "") ? [{ label: tr(revealLabel()), icon: "folder" as const, run: () => void run(() => actions.reveal!(image)) }] : []),
|
||||||
];
|
];
|
||||||
openingMenu = true;
|
openingMenu = true;
|
||||||
try { menu = showActionMenu({ x, y, items, label: tr("Image actions") }, undefined, restore); }
|
try { menu = showActionMenu({ x, y, items, label: tr("Image actions") }, undefined, restore); }
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export function tableSelectionControls(root: HTMLElement, wrapper: HTMLElement,
|
|||||||
{ label: tr("Add row below"), icon: "row-after", run: () => structural("row", "after") }, sep,
|
{ label: tr("Add row below"), icon: "row-after", run: () => structural("row", "after") }, sep,
|
||||||
{ label: tr("Move row up"), icon: "up", disabled: row <= 1, run: () => structural("row", "previous") },
|
{ label: tr("Move row up"), icon: "up", disabled: row <= 1, run: () => structural("row", "previous") },
|
||||||
{ label: tr("Move row down"), icon: "down", disabled: row === 0 || row === lastRow, run: () => structural("row", "next") }, sep,
|
{ label: tr("Move row down"), icon: "down", disabled: row === 0 || row === lastRow, run: () => structural("row", "next") }, sep,
|
||||||
{ label: tr("Duplicate row"), icon: "copy", run: () => structural("row", "duplicate") },
|
{ label: tr("Duplicate row"), icon: "duplicate", run: () => structural("row", "duplicate") },
|
||||||
{ label: tr("Delete row"), icon: "trash", run: () => structural("row", "delete") },
|
{ label: tr("Delete row"), icon: "trash", run: () => structural("row", "delete") },
|
||||||
] },
|
] },
|
||||||
{ label: tr("Column"), icon: "column", children: [
|
{ label: tr("Column"), icon: "column", children: [
|
||||||
@@ -145,7 +145,7 @@ export function tableSelectionControls(root: HTMLElement, wrapper: HTMLElement,
|
|||||||
{ label: tr("Move column left"), icon: "move-left", disabled: column === 0, run: () => structural("column", "previous") },
|
{ label: tr("Move column left"), icon: "move-left", disabled: column === 0, run: () => structural("column", "previous") },
|
||||||
{ label: tr("Move column right"), icon: "move-right", disabled: column === lastColumn, run: () => structural("column", "next") }, sep,
|
{ label: tr("Move column right"), icon: "move-right", disabled: column === lastColumn, run: () => structural("column", "next") }, sep,
|
||||||
...alignmentItems, sep,
|
...alignmentItems, sep,
|
||||||
{ label: tr("Duplicate column"), icon: "copy", run: () => structural("column", "duplicate") },
|
{ label: tr("Duplicate column"), icon: "duplicate", run: () => structural("column", "duplicate") },
|
||||||
{ label: tr("Delete column"), icon: "trash", run: () => structural("column", "delete") },
|
{ label: tr("Delete column"), icon: "trash", run: () => structural("column", "delete") },
|
||||||
] }, sep,
|
] }, sep,
|
||||||
{ label: tr("Sort by column (A to Z)"), icon: "sort-asc", disabled: lastRow < 2, run: () => { range ??= cellRange; apply(text => sortTableColumn(text, column)); } },
|
{ label: tr("Sort by column (A to Z)"), icon: "sort-asc", disabled: lastRow < 2, run: () => { range ??= cellRange; apply(text => sortTableColumn(text, column)); } },
|
||||||
|
|||||||
@@ -1109,12 +1109,6 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
"システムのパス",
|
"システムのパス",
|
||||||
"系统路径"
|
"系统路径"
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"Show in system explorer",
|
|
||||||
"Afficher dans l’explorateur système",
|
|
||||||
"システムのエクスプローラーで表示",
|
|
||||||
"在系统文件管理器中显示"
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Blank note",
|
"Blank note",
|
||||||
"Note vide",
|
"Note vide",
|
||||||
@@ -1325,30 +1319,6 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
"ブックマークを削除",
|
"ブックマークを削除",
|
||||||
"删除书签"
|
"删除书签"
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"Copy workspace paths",
|
|
||||||
"Copier les chemins de travail",
|
|
||||||
"ワークスペース内のパスをコピー",
|
|
||||||
"复制工作区路径"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Copy workspace path",
|
|
||||||
"Copier le chemin de travail",
|
|
||||||
"ワークスペース内のパスをコピー",
|
|
||||||
"复制工作区路径"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Copy system paths",
|
|
||||||
"Copier les chemins système",
|
|
||||||
"システムのパスをコピー",
|
|
||||||
"复制系统路径"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Copy system path",
|
|
||||||
"Copier le chemin système",
|
|
||||||
"システムのパスをコピー",
|
|
||||||
"复制系统路径"
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Rename",
|
"Rename",
|
||||||
"Renommer",
|
"Renommer",
|
||||||
@@ -1847,12 +1817,6 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
"広告ブロックリスト",
|
"広告ブロックリスト",
|
||||||
"广告屏蔽列表"
|
"广告屏蔽列表"
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"One HTTPS filter list URL per line, up to eight lists. New lists download when you save.",
|
|
||||||
"Une URL HTTPS par ligne, huit listes maximum. Les nouvelles listes sont téléchargées lors de l’enregistrement.",
|
|
||||||
"1行に1つのHTTPSフィルターリストURLを入力します。最大8件。保存時に新しいリストをダウンロードします。",
|
|
||||||
"每行一个 HTTPS 过滤列表网址,最多八个。保存时下载新列表。"
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Personal filter rules",
|
"Personal filter rules",
|
||||||
"Règles de filtrage personnelles",
|
"Règles de filtrage personnelles",
|
||||||
@@ -1949,18 +1913,6 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
"ブラウザー設定を保存中…",
|
"ブラウザー設定を保存中…",
|
||||||
"正在保存浏览器设置…"
|
"正在保存浏览器设置…"
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"Saving…",
|
|
||||||
"Enregistrement…",
|
|
||||||
"保存中…",
|
|
||||||
"正在保存…"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Save browser settings",
|
|
||||||
"Enregistrer les paramètres du navigateur",
|
|
||||||
"ブラウザー設定を保存",
|
|
||||||
"保存浏览器设置"
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Individual web data",
|
"Individual web data",
|
||||||
"Données web individuelles",
|
"Données web individuelles",
|
||||||
@@ -3466,6 +3418,12 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
["Resize the outline", "Redimensionner le plan", "アウトラインのサイズを変更", "调整大纲大小"],
|
["Resize the outline", "Redimensionner le plan", "アウトラインのサイズを変更", "调整大纲大小"],
|
||||||
["Resize the terminal", "Redimensionner le terminal", "ターミナルのサイズを変更", "调整终端大小"],
|
["Resize the terminal", "Redimensionner le terminal", "ターミナルのサイズを変更", "调整终端大小"],
|
||||||
["Leave the text, then press Tab", "Quitter le texte, puis appuyer sur Tab", "テキストから出て、Tab キーを押す", "离开文本,然后按 Tab"],
|
["Leave the text, then press Tab", "Quitter le texte, puis appuyer sur Tab", "テキストから出て、Tab キーを押す", "离开文本,然后按 Tab"],
|
||||||
|
["One HTTPS filter list URL per line, up to eight lists. New lists download when you leave the field.", "Une URL HTTPS par ligne, huit listes maximum. Les nouvelles listes sont téléchargées quand vous quittez le champ.", "1行に1つのHTTPSフィルターリストURLを入力します。最大8件。欄から移動すると新しいリストをダウンロードします。", "每行一个 HTTPS 过滤列表网址,最多八个。离开此字段时下载新列表。"],
|
||||||
|
["1 result", "1 résultat", "1 件の結果", "1 个结果"],
|
||||||
|
["{count} results in {files} files", "{count} résultats dans {files} fichiers", "{files} 個のファイルに {count} 件の結果", "{files} 个文件中有 {count} 个结果"],
|
||||||
|
["Remove bookmark: {name}", "Retirer le signet : {name}", "ブックマークを削除: {name}", "移除书签:{name}"],
|
||||||
|
["Show in Finder", "Afficher dans le Finder", "Finder で表示", "在访达中显示"],
|
||||||
|
["Show in file manager", "Afficher dans le gestionnaire de fichiers", "ファイルマネージャーで表示", "在文件管理器中显示"],
|
||||||
];
|
];
|
||||||
export const catalogs: Record<Exclude<Locale, 'en'>, Record<string, string>> = {
|
export const catalogs: Record<Exclude<Locale, 'en'>, Record<string, string>> = {
|
||||||
fr: Object.fromEntries(messageRows.map(row => [row[0], row[1]])),
|
fr: Object.fromEntries(messageRows.map(row => [row[0], row[1]])),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { t } from "$lib/i18n";
|
import { t } from "$lib/i18n";
|
||||||
import BrowserSlot from "$lib/plugins/BrowserSlot.svelte";
|
import BrowserSlot from "$lib/plugins/BrowserSlot.svelte";
|
||||||
|
import IconButton from "$lib/ui/IconButton.svelte";
|
||||||
import type { WorkspaceSession } from "$lib/workspace/session.svelte";
|
import type { WorkspaceSession } from "$lib/workspace/session.svelte";
|
||||||
import type { TreeEntry } from "$lib/workspace/types";
|
import type { TreeEntry } from "$lib/workspace/types";
|
||||||
|
|
||||||
@@ -11,6 +12,13 @@
|
|||||||
|
|
||||||
let { session, onOpen }: Props = $props();
|
let { session, onOpen }: Props = $props();
|
||||||
const bookmarks = $derived(session.marks.current.bookmarks);
|
const bookmarks = $derived(session.marks.current.bookmarks);
|
||||||
|
let error = $state("");
|
||||||
|
const parts = (rel: string) => ({ name: rel.split("/").pop() ?? rel, folder: rel.includes("/") ? rel.slice(0, rel.lastIndexOf("/")) : "" });
|
||||||
|
|
||||||
|
async function remove(rel: string) {
|
||||||
|
try { await session.marks.update(marks => ({ ...marks, bookmarks: marks.bookmarks.filter(path => path !== rel) })); error = ""; }
|
||||||
|
catch (reason) { error = String(reason); }
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="pane">
|
<div class="pane">
|
||||||
@@ -21,22 +29,17 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<ul>
|
<ul>
|
||||||
{#each bookmarks as rel (rel)}
|
{#each bookmarks as rel (rel)}
|
||||||
|
{@const item = parts(rel)}
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button type="button" title={rel} onclick={() => onOpen({ name: item.name, rel_path: rel, kind: "file" })}>
|
||||||
type="button"
|
<span class="name">{item.name}</span>{#if item.folder}<span class="folder">{item.folder}</span>{/if}
|
||||||
onclick={() =>
|
|
||||||
onOpen({
|
|
||||||
name: rel.split("/").pop() ?? rel,
|
|
||||||
rel_path: rel,
|
|
||||||
kind: "file",
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{rel}
|
|
||||||
</button>
|
</button>
|
||||||
|
<IconButton icon="close" label={$t("Remove bookmark: {name}", { name: item.name })} onclick={() => void remove(rel)} />
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if error}<p class="error" role="alert">{error}</p>{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -69,18 +72,33 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
li {
|
||||||
width: 100%;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
padding-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
li > button {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 24px;
|
||||||
border-radius: var(--rs-control-radius);
|
border-radius: var(--rs-control-radius);
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--rs-text);
|
color: var(--rs-text);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 6px 10px;
|
padding: 4px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
li > button:hover {
|
||||||
background: var(--rs-bg-active);
|
background: var(--rs-bg-active);
|
||||||
color: var(--rs-text-strong);
|
color: var(--rs-text-strong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.name, .folder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.folder { color: var(--rs-text-dim); font-size: 12px; }
|
||||||
|
.error { margin: 8px 10px; color: var(--rs-error); }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
if (item.kind === "sep") return { separator: true };
|
if (item.kind === "sep") return { separator: true };
|
||||||
if (item.kind === "group") return { label: item.label, icon: item.icon, children: convert(item.items),
|
if (item.kind === "group") return { label: item.label, icon: item.icon, children: convert(item.items),
|
||||||
...(item.run ? { run: () => { close(true); item.run?.(); } } : {}) };
|
...(item.run ? { run: () => { close(true); item.run?.(); } } : {}) };
|
||||||
return { label: item.label, icon: item.icon, disabled: item.disabled, run: () => {
|
return { label: item.label, icon: item.icon, disabled: item.disabled, danger: item.danger, run: () => {
|
||||||
close(true);
|
close(true);
|
||||||
item.run();
|
item.run();
|
||||||
} };
|
} };
|
||||||
|
|||||||
+68
-104
@@ -35,6 +35,7 @@
|
|||||||
import type { MenuItem } from "./menuTypes";
|
import type { MenuItem } from "./menuTypes";
|
||||||
import TreeNode from "./TreeNode.svelte";
|
import TreeNode from "./TreeNode.svelte";
|
||||||
import IconButton from "$lib/ui/IconButton.svelte";
|
import IconButton from "$lib/ui/IconButton.svelte";
|
||||||
|
import { revealLabel } from "$lib/ui/menuItems";
|
||||||
import { dropWorkspaceImage, highlightImageDrop } from "$lib/editor/workspaceImageDrop";
|
import { dropWorkspaceImage, highlightImageDrop } from "$lib/editor/workspaceImageDrop";
|
||||||
import { pluginDocuments, pluginDocumentTypes, inspectPluginDocuments, createPluginDocument } from "$lib/plugins/external";
|
import { pluginDocuments, pluginDocumentTypes, inspectPluginDocuments, createPluginDocument } from "$lib/plugins/external";
|
||||||
|
|
||||||
@@ -785,7 +786,7 @@
|
|||||||
...(templates.length || onManageTemplates ? [{ kind: "group" as const, label: $t("New note"), icon: "file-plus" as const, run: () => { void fromTemplate(); }, items: [
|
...(templates.length || onManageTemplates ? [{ kind: "group" as const, label: $t("New note"), icon: "file-plus" as const, run: () => { void fromTemplate(); }, items: [
|
||||||
{ kind: "action" as const, label: $t("Blank note"), icon: "file-plus" as const, run: () => { void fromTemplate(); } },
|
{ kind: "action" as const, label: $t("Blank note"), icon: "file-plus" as const, run: () => { void fromTemplate(); } },
|
||||||
...templates.map(template => ({ kind: "action" as const, label: template.name, icon: "file-plus" as const, run: () => { void fromTemplate(template); } })),
|
...templates.map(template => ({ kind: "action" as const, label: template.name, icon: "file-plus" as const, run: () => { void fromTemplate(template); } })),
|
||||||
...(onManageTemplates ? [{ kind: "sep" as const }, { kind: "action" as const, label: $t("Manage templates…"), icon: "copy" as const, run: onManageTemplates }] : []),
|
...(onManageTemplates ? [{ kind: "sep" as const }, { kind: "action" as const, label: $t("Manage templates…"), icon: "template" as const, run: onManageTemplates }] : []),
|
||||||
] }] : [{ kind: "action" as const, label: $t("New note"), icon: "file-plus" as const, run: () => { void fromTemplate(); } }]),
|
] }] : [{ kind: "action" as const, label: $t("New note"), icon: "file-plus" as const, run: () => { void fromTemplate(); } }]),
|
||||||
{
|
{
|
||||||
kind: "action",
|
kind: "action",
|
||||||
@@ -815,141 +816,104 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function folderActions(parent: string): MenuItem[] {
|
// The file menu has one order: open, clipboard, organize, show and copy path, history, then Delete in the error color.
|
||||||
|
function terminalItem(parent: string): MenuItem {
|
||||||
|
return { kind: "action", label: $t("Open in terminal"), icon: "terminal", run: () => { void workspaceOpenTerminal(parent).catch(reason => error = String(reason)); } };
|
||||||
|
}
|
||||||
|
|
||||||
|
function pasteItem(parent: string): MenuItem {
|
||||||
|
return { kind: "action", label: $t("Paste"), icon: "paste", disabled: !clipboard || clipboard.root !== workspaceRoot || moving, run: () => { void pasteEntries(parent); } };
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveHistoryItems(): MenuItem[] {
|
||||||
return [
|
return [
|
||||||
{ kind: "action", label: $t("Open in terminal"), icon: "terminal", run: () => { void workspaceOpenTerminal(parent).catch(reason => error = String(reason)); } },
|
|
||||||
{ kind: "action", label: $t("Paste"), icon: "paste", disabled: !clipboard || clipboard.root !== workspaceRoot || moving, run: () => { void pasteEntries(parent); } },
|
|
||||||
{ kind: "sep" },
|
|
||||||
{ kind: "action", label: undoMoves.at(-1)?.action === "rename" ? $t("Undo rename") : $t("Undo file move"), icon: "undo", disabled: !undoMoves.length || moving, run: () => { void replayMoves(); } },
|
{ kind: "action", label: undoMoves.at(-1)?.action === "rename" ? $t("Undo rename") : $t("Undo file move"), icon: "undo", disabled: !undoMoves.length || moving, run: () => { void replayMoves(); } },
|
||||||
{ kind: "action", label: redoMoves.at(-1)?.action === "rename" ? $t("Redo rename") : $t("Redo file move"), icon: "redo", disabled: !redoMoves.length || moving, run: () => { void replayMoves(true); } },
|
{ kind: "action", label: redoMoves.at(-1)?.action === "rename" ? $t("Redo rename") : $t("Redo file move"), icon: "redo", disabled: !redoMoves.length || moving, run: () => { void replayMoves(true); } },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function revealItem(entries: TreeEntry[] | null): MenuItem {
|
||||||
|
return {
|
||||||
|
kind: "action",
|
||||||
|
label: $t(revealLabel()),
|
||||||
|
icon: "folder",
|
||||||
|
run: () => {
|
||||||
|
void (async () => {
|
||||||
|
if (!entries) { await workspaceReveal("").catch((err) => { error = err instanceof Error ? err.message : String(err); }); return; }
|
||||||
|
const result = await runTreeActions(entries, item => workspaceReveal(item.rel_path));
|
||||||
|
error = result.failures.length ? result.failures.join("\n") : null;
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function menuItems(entry: TreeEntry | null): MenuItem[] {
|
function menuItems(entry: TreeEntry | null): MenuItem[] {
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
return [
|
return [
|
||||||
...paneMenuItems(""),
|
...paneMenuItems(""),
|
||||||
{ kind: "sep" },
|
{ kind: "sep" },
|
||||||
...folderActions(""),
|
terminalItem(""),
|
||||||
{ kind: "sep" },
|
{ kind: "sep" },
|
||||||
{
|
pasteItem(""),
|
||||||
kind: "action",
|
{ kind: "sep" },
|
||||||
label: $t("Show in Explorer"),
|
revealItem(null),
|
||||||
icon: "folder",
|
{ kind: "sep" },
|
||||||
run: () => {
|
...moveHistoryItems(),
|
||||||
void workspaceReveal("").catch((err) => {
|
|
||||||
error = err instanceof Error ? err.message : String(err);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
const entries = actionEntries(entry, selection.paths, visiblePaths, findEntry);
|
const entries = actionEntries(entry, selection.paths, visiblePaths, findEntry);
|
||||||
const multiple = entries.length > 1;
|
const multiple = entries.length > 1;
|
||||||
const pinned = entries.every(item => pins.has(item.rel_path));
|
const pinned = entries.every(item => pins.has(item.rel_path));
|
||||||
const bookmarked = entries.every(item => bookmarks.has(item.rel_path));
|
const bookmarked = entries.every(item => bookmarks.has(item.rel_path));
|
||||||
const createItems =
|
const parent = entry.kind === "folder" ? entry.rel_path : parentRel(entry.rel_path);
|
||||||
!multiple && entry.kind === "folder"
|
const copySystemPaths = async () => {
|
||||||
? [...paneMenuItems(entry.rel_path), { kind: "sep" as const }]
|
|
||||||
: [];
|
|
||||||
return [
|
|
||||||
...createItems,
|
|
||||||
...(!multiple && entry.kind === "file" && /\.md$/i.test(entry.name) && onSaveTemplate ? [
|
|
||||||
{ kind: "action" as const, label: $t("Save as template"), icon: "copy" as const, run: () => onSaveTemplate?.(entry) },
|
|
||||||
] : []),
|
|
||||||
...(!multiple && entry.kind === "file" ? [
|
|
||||||
{ kind: "action" as const, label: $t("Open in new tab"), icon: "file-plus" as const, run: () => onOpenFile(entry, true) },
|
|
||||||
{ kind: "action" as const, label: $t("Open in default app"), icon: "external" as const, run: () => { void workspaceOpenDefault(entry.rel_path).catch(reason => error = String(reason)); } },
|
|
||||||
] : []),
|
|
||||||
...folderActions(entry.kind === "folder" ? entry.rel_path : parentRel(entry.rel_path)),
|
|
||||||
{ kind: "sep" },
|
|
||||||
{ kind: "action", label: $t("Cut"), icon: "cut", run: () => { clipboard = { root: workspaceRoot, paths: selectionRoots(entries).map(item => item.rel_path), cut: true }; } },
|
|
||||||
{ kind: "action", label: $t("Copy"), icon: "copy", run: () => { clipboard = { root: workspaceRoot, paths: selectionRoots(entries).map(item => item.rel_path), cut: false }; } },
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: multiple ? $t("Make copies ({count})", { count: entries.length }) : $t("Make a copy"),
|
|
||||||
icon: "copy",
|
|
||||||
run: () => { void copyEntries(entries); },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: bookmarked ? (multiple ? $t("Remove bookmarks") : $t("Remove bookmark")) : $t("Bookmark"),
|
|
||||||
icon: "bookmark",
|
|
||||||
run: () => {
|
|
||||||
void persistMarks(current => ({
|
|
||||||
...current,
|
|
||||||
bookmarks: setSelectedMarks(current.bookmarks, entries, !bookmarked),
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ kind: "sep" },
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: multiple ? $t("Copy workspace paths") : $t("Copy workspace path"),
|
|
||||||
icon: "copy",
|
|
||||||
run: () => {
|
|
||||||
void copyText(entries.map(item => item.rel_path).join("\n"), multiple ? $t("Copied workspace paths") : $t("Copied workspace path"));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: multiple ? $t("Copy system paths") : $t("Copy system path"),
|
|
||||||
icon: "copy",
|
|
||||||
run: () => {
|
|
||||||
void (async () => {
|
|
||||||
try {
|
try {
|
||||||
const paths = await Promise.all(entries.map(item => workspaceAbsPath(item.rel_path)));
|
const paths = await Promise.all(entries.map(item => workspaceAbsPath(item.rel_path)));
|
||||||
await copyText(paths.join("\n"), multiple ? $t("Copied system paths") : $t("Copied system path"));
|
await copyText(paths.join("\n"), multiple ? $t("Copied system paths") : $t("Copied system path"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err instanceof Error ? err.message : String(err);
|
error = err instanceof Error ? err.message : String(err);
|
||||||
}
|
}
|
||||||
})();
|
};
|
||||||
},
|
return [
|
||||||
},
|
...(!multiple && entry.kind === "folder" ? [...paneMenuItems(entry.rel_path), { kind: "sep" as const }] : []),
|
||||||
|
...(!multiple && entry.kind === "file" ? [
|
||||||
|
{ kind: "action" as const, label: $t("Open in new tab"), icon: "tab" as const, run: () => onOpenFile(entry, true) },
|
||||||
|
{ kind: "action" as const, label: $t("Open in default app"), icon: "external" as const, run: () => { void workspaceOpenDefault(entry.rel_path).catch(reason => error = String(reason)); } },
|
||||||
|
] : []),
|
||||||
|
terminalItem(parent),
|
||||||
|
{ kind: "sep" },
|
||||||
|
{ kind: "action", label: $t("Cut"), icon: "cut", run: () => { clipboard = { root: workspaceRoot, paths: selectionRoots(entries).map(item => item.rel_path), cut: true }; } },
|
||||||
|
{ kind: "action", label: $t("Copy"), icon: "copy", run: () => { clipboard = { root: workspaceRoot, paths: selectionRoots(entries).map(item => item.rel_path), cut: false }; } },
|
||||||
|
pasteItem(parent),
|
||||||
|
{ kind: "action", label: multiple ? $t("Make copies ({count})", { count: entries.length }) : $t("Make a copy"), icon: "duplicate", run: () => { void copyEntries(entries); } },
|
||||||
|
{ kind: "sep" },
|
||||||
|
{ kind: "action", label: $t("Rename"), icon: "rename", disabled: multiple, run: () => { startRename(entry); } },
|
||||||
{
|
{
|
||||||
kind: "action",
|
kind: "action",
|
||||||
label: $t("Show in Explorer"),
|
label: bookmarked ? (multiple ? $t("Remove bookmarks") : $t("Remove bookmark")) : $t("Bookmark"),
|
||||||
icon: "folder",
|
icon: "bookmark",
|
||||||
run: () => {
|
run: () => { void persistMarks(current => ({ ...current, bookmarks: setSelectedMarks(current.bookmarks, entries, !bookmarked) })); },
|
||||||
void (async () => {
|
|
||||||
const result = await runTreeActions(entries, item => workspaceReveal(item.rel_path));
|
|
||||||
error = result.failures.length ? result.failures.join("\n") : null;
|
|
||||||
})();
|
|
||||||
},
|
},
|
||||||
},
|
|
||||||
{ kind: "sep" },
|
|
||||||
{
|
{
|
||||||
kind: "action",
|
kind: "action",
|
||||||
label: pinned ? $t("Unpin") : $t("Pin"),
|
label: pinned ? $t("Unpin") : $t("Pin"),
|
||||||
icon: "pin",
|
icon: "pin",
|
||||||
run: () => {
|
run: () => { void persistMarks(current => ({ ...current, pins: setSelectedMarks(current.pins, entries, !pinned) })); },
|
||||||
void persistMarks(current => ({
|
|
||||||
...current,
|
|
||||||
pins: setSelectedMarks(current.pins, entries, !pinned),
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: $t("Rename"),
|
|
||||||
icon: "rename",
|
|
||||||
disabled: multiple,
|
|
||||||
run: () => {
|
|
||||||
startRename(entry);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: multiple ? $t("Delete ({count})", { count: entries.length }) : $t("Delete"),
|
|
||||||
icon: "trash",
|
|
||||||
run: () => { void deleteEntries(entries); },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "action",
|
|
||||||
label: multiple ? $t("Delete permanently ({count})", { count: entries.length }) : $t("Delete permanently"),
|
|
||||||
icon: "trash",
|
|
||||||
run: () => { void deleteEntries(entries, true); },
|
|
||||||
},
|
},
|
||||||
|
...(!multiple && entry.kind === "file" && /\.md$/i.test(entry.name) && onSaveTemplate ? [
|
||||||
|
{ kind: "action" as const, label: $t("Save as template"), icon: "template" as const, run: () => onSaveTemplate?.(entry) },
|
||||||
|
] : []),
|
||||||
|
{ kind: "sep" },
|
||||||
|
revealItem(entries),
|
||||||
|
{ kind: "group", label: $t("Copy path"), icon: "copy", items: [
|
||||||
|
{ kind: "action", label: $t("Workspace path"), icon: "copy", run: () => { void copyText(entries.map(item => item.rel_path).join("\n"), multiple ? $t("Copied workspace paths") : $t("Copied workspace path")); } },
|
||||||
|
{ kind: "action", label: $t("System path"), icon: "copy", run: () => { void copySystemPaths(); } },
|
||||||
|
] },
|
||||||
|
{ kind: "sep" },
|
||||||
|
...moveHistoryItems(),
|
||||||
|
{ kind: "sep" },
|
||||||
|
{ kind: "action", label: multiple ? $t("Delete ({count})", { count: entries.length }) : $t("Delete"), icon: "trash", danger: true, run: () => { void deleteEntries(entries); } },
|
||||||
|
{ kind: "action", label: multiple ? $t("Delete permanently ({count})", { count: entries.length }) : $t("Delete permanently"), icon: "trash", danger: true, run: () => { void deleteEntries(entries, true); } },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -126,6 +126,7 @@
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--rs-text);
|
color: var(--rs-text);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
min-height: 24px;
|
||||||
padding: 3px 8px;
|
padding: 3px 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|||||||
@@ -12,8 +12,31 @@
|
|||||||
let { onOpen, searchRequest }: Props = $props();
|
let { onOpen, searchRequest }: Props = $props();
|
||||||
let query = $state("");
|
let query = $state("");
|
||||||
let hits = $state<SearchHit[]>([]);
|
let hits = $state<SearchHit[]>([]);
|
||||||
|
let searched = $state("");
|
||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
|
|
||||||
|
// Hits in groups by file, in the order of the first hit of each file.
|
||||||
|
const groups = $derived.by(() => {
|
||||||
|
const files = new Map<string, SearchHit[]>();
|
||||||
|
for (const hit of hits) files.set(hit.rel_path, [...files.get(hit.rel_path) ?? [], hit]);
|
||||||
|
return [...files].map(([path, items]) => ({ path, name: path.split("/").pop() ?? path, folder: path.includes("/") ? path.slice(0, path.lastIndexOf("/")) : "", items }));
|
||||||
|
});
|
||||||
|
|
||||||
|
/** The parts of a hit line, with the parts that match the query marked. */
|
||||||
|
function parts(text: string, term: string) {
|
||||||
|
const lower = text.toLowerCase(), needle = term.toLowerCase();
|
||||||
|
if (!needle) return [{ text, match: false }];
|
||||||
|
const result: { text: string; match: boolean }[] = [];
|
||||||
|
let from = 0;
|
||||||
|
for (let index = lower.indexOf(needle); index >= 0; index = lower.indexOf(needle, index + needle.length)) {
|
||||||
|
if (index > from) result.push({ text: text.slice(from, index), match: false });
|
||||||
|
result.push({ text: text.slice(index, index + needle.length), match: true });
|
||||||
|
from = index + needle.length;
|
||||||
|
}
|
||||||
|
if (from < text.length) result.push({ text: text.slice(from), match: false });
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
let generation = 0;
|
let generation = 0;
|
||||||
$effect(() => { if (searchRequest) { query = searchRequest.text; void run(searchRequest.text); } });
|
$effect(() => { if (searchRequest) { query = searchRequest.text; void run(searchRequest.text); } });
|
||||||
|
|
||||||
@@ -28,6 +51,7 @@
|
|||||||
const results = await workspaceSearch(q);
|
const results = await workspaceSearch(q);
|
||||||
if (version !== generation) return;
|
if (version !== generation) return;
|
||||||
hits = results;
|
hits = results;
|
||||||
|
searched = q;
|
||||||
error = null;
|
error = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (version !== generation) return;
|
if (version !== generation) return;
|
||||||
@@ -51,27 +75,26 @@
|
|||||||
{#if error}
|
{#if error}
|
||||||
<p class="error">{error}</p>
|
<p class="error">{error}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if searched}
|
||||||
|
<p class="summary" role="status">{hits.length === 1 ? $t("1 result") : $t("{count} results in {files} files", { count: hits.length, files: groups.length })}</p>
|
||||||
|
{/if}
|
||||||
|
<ul class="results">
|
||||||
|
{#each groups as group (group.path)}
|
||||||
|
<li class="file">
|
||||||
|
<div class="file-name" title={group.path}><span class="name">{group.name}</span>{#if group.folder}<span class="folder">{group.folder}</span>{/if}<span class="count">{group.items.length}</span></div>
|
||||||
<ul>
|
<ul>
|
||||||
{#each hits as hit (hit.rel_path + hit.line + hit.text)}
|
{#each group.items as hit (hit.line + hit.text)}
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button type="button" onclick={() => onOpen({ name: group.name, rel_path: hit.rel_path, kind: "file" }, hit.line)}>
|
||||||
type="button"
|
<span class="line">{hit.line}</span>
|
||||||
onclick={() =>
|
<span class="text">{#each parts(hit.text, searched) as part}{#if part.match}<mark>{part.text}</mark>{:else}{part.text}{/if}{/each}</span>
|
||||||
onOpen(
|
|
||||||
{
|
|
||||||
name: hit.rel_path.split("/").pop() ?? hit.rel_path,
|
|
||||||
rel_path: hit.rel_path,
|
|
||||||
kind: "file",
|
|
||||||
},
|
|
||||||
hit.line,
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<span class="path">{hit.rel_path}:{hit.line}</span>
|
|
||||||
<span class="text">{hit.text}</span>
|
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -110,37 +133,75 @@
|
|||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results {
|
||||||
padding: 0 0 12px;
|
padding: 0 0 12px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
margin: 0 10px 6px;
|
||||||
|
color: var(--rs-text-dim);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file + .file { margin-top: 6px; }
|
||||||
|
|
||||||
|
.file-name {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 6px;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 4px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name { color: var(--rs-text-strong); font-weight: 600; white-space: nowrap; }
|
||||||
|
.folder { min-width: 0; overflow: hidden; color: var(--rs-text-dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.count { margin-left: auto; padding: 0 6px; border-radius: 9px; background: var(--rs-bg-active); color: var(--rs-text); font-size: 11px; }
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 24px;
|
||||||
border-radius: var(--rs-control-radius);
|
border-radius: var(--rs-control-radius);
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 6px 10px;
|
padding: 3px 10px 3px 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
button:hover {
|
||||||
background: var(--rs-bg-active);
|
background: var(--rs-bg-active);
|
||||||
}
|
}
|
||||||
|
|
||||||
.path {
|
.line {
|
||||||
display: block;
|
flex: 0 0 auto;
|
||||||
color: var(--rs-accent);
|
min-width: 2ch;
|
||||||
font-size: 12px;
|
color: var(--rs-text-dim);
|
||||||
|
font-size: 11px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
display: block;
|
min-width: 0;
|
||||||
color: var(--rs-text-dim);
|
color: var(--rs-text);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A match uses the search match fill of the theme, so the text keeps its contrast. */
|
||||||
|
mark {
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--rs-item-selection-bg);
|
||||||
|
box-shadow: inset 0 -2px 0 var(--rs-accent);
|
||||||
|
color: var(--rs-text-strong);
|
||||||
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
margin: 8px 10px;
|
margin: 8px 10px;
|
||||||
color: var(--rs-error);
|
color: var(--rs-error);
|
||||||
|
|||||||
@@ -70,9 +70,12 @@
|
|||||||
const selectedPlugin = $derived(pluginSections.find(item => item.id === selected?.id));
|
const selectedPlugin = $derived(pluginSections.find(item => item.id === selected?.id));
|
||||||
|
|
||||||
$effect(() => { seconds = settings.autosaveSeconds; });
|
$effect(() => { seconds = settings.autosaveSeconds; });
|
||||||
|
let searchInput: HTMLInputElement | undefined = $state();
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||||
dialog.showModal();
|
dialog.showModal();
|
||||||
|
// The first focus goes to the settings search, not to the first window control.
|
||||||
|
searchInput?.focus();
|
||||||
return () => { dialog.close(); previous?.focus(); };
|
return () => { dialog.close(); previous?.focus(); };
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -117,7 +120,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
{#if !help}
|
{#if !help}
|
||||||
<aside>
|
<aside>
|
||||||
<label class="search"><Icon icon="search" /><input aria-label={$t("Search settings")} placeholder={$t("Search settings…")} bind:value={query} /></label>
|
<label class="search"><Icon icon="search" /><input bind:this={searchInput} aria-label={$t("Search settings")} placeholder={$t("Search settings…")} bind:value={query} /></label>
|
||||||
<p class="nav-heading">{$t("Preferences")}</p>
|
<p class="nav-heading">{$t("Preferences")}</p>
|
||||||
<nav aria-label={$t("Settings categories")}>
|
<nav aria-label={$t("Settings categories")}>
|
||||||
{#each matches as item}
|
{#each matches as item}
|
||||||
@@ -142,25 +145,25 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div><label for="show-file-title">{$t("File name title")}</label><p id="file-title-description">{$t("Show the file name above each Markdown note in Write and Read.")}</p></div>
|
<div><label for="show-file-title">{$t("File name title")}</label><p id="file-title-description">{$t("Show the file name above each Markdown note in Write and Read.")}</p></div>
|
||||||
<input id="show-file-title" class="switch" type="checkbox" role="switch" aria-describedby="file-title-description" checked={settings.showFileTitle} onchange={event => apply({ ...settings, showFileTitle: event.currentTarget.checked })} />
|
<input id="show-file-title" class="rs-switch" type="checkbox" role="switch" aria-describedby="file-title-description" checked={settings.showFileTitle} onchange={event => apply({ ...settings, showFileTitle: event.currentTarget.checked })} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>{$t("Tables")}</h3>
|
<h3>{$t("Tables")}</h3>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div><label for="table-formulas">{$t("Table formulas")}</label><p id="table-formulas-description">{$t("Calculate table cells that start with =. When this is off, formulas show as text.")}</p></div>
|
<div><label for="table-formulas">{$t("Table formulas")}</label><p id="table-formulas-description">{$t("Calculate table cells that start with =. When this is off, formulas show as text.")}</p></div>
|
||||||
<input id="table-formulas" class="switch" type="checkbox" role="switch" aria-describedby="table-formulas-description" checked={settings.tableFormulas} onchange={event => apply({ ...settings, tableFormulas: event.currentTarget.checked })} />
|
<input id="table-formulas" class="rs-switch" type="checkbox" role="switch" aria-describedby="table-formulas-description" checked={settings.tableFormulas} onchange={event => apply({ ...settings, tableFormulas: event.currentTarget.checked })} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>{$t("Files")}</h3>
|
<h3>{$t("Files")}</h3>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div><label for="show-internal-folder">{$t("Show .runestone folder")}</label><p id="internal-folder-description">{$t("Show workspace settings and plugin data in the file tree.")}</p></div>
|
<div><label for="show-internal-folder">{$t("Show .runestone folder")}</label><p id="internal-folder-description">{$t("Show workspace settings and plugin data in the file tree.")}</p></div>
|
||||||
<input id="show-internal-folder" class="switch" type="checkbox" role="switch" aria-describedby="internal-folder-description" checked={settings.showInternalFolder} onchange={event => apply({ ...settings, showInternalFolder: event.currentTarget.checked })} />
|
<input id="show-internal-folder" class="rs-switch" type="checkbox" role="switch" aria-describedby="internal-folder-description" checked={settings.showInternalFolder} onchange={event => apply({ ...settings, showInternalFolder: event.currentTarget.checked })} />
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div><label for="autosave-enabled">{$t("Auto-save")}</label><p id="autosave-description">{$t("Save changed notes and scripts, including background tabs.")}</p></div>
|
<div><label for="autosave-enabled">{$t("Auto-save")}</label><p id="autosave-description">{$t("Save changed notes and scripts, including background tabs.")}</p></div>
|
||||||
<input id="autosave-enabled" class="switch" type="checkbox" role="switch" aria-describedby="autosave-description" checked={settings.autosaveEnabled} onchange={event => { apply({ ...settings, autosaveEnabled: event.currentTarget.checked }); event.currentTarget.checked = settings.autosaveEnabled; }} />
|
<input id="autosave-enabled" class="rs-switch" type="checkbox" role="switch" aria-describedby="autosave-description" checked={settings.autosaveEnabled} onchange={event => { apply({ ...settings, autosaveEnabled: event.currentTarget.checked }); event.currentTarget.checked = settings.autosaveEnabled; }} />
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div><label for="autosave-seconds">{$t("Auto-save interval")}</label><p id="interval-description">{$t("Time between saves, even while you type. Choose 1–300 seconds.")}</p></div>
|
<div><label for="autosave-seconds">{$t("Auto-save interval")}</label><p id="interval-description">{$t("Time between saves, even while you type. Choose 1–300 seconds.")}</p></div>
|
||||||
@@ -209,7 +212,7 @@
|
|||||||
aside { width: 220px; flex-shrink: 0; padding: 12px 8px; background: var(--rs-bg-elevated); border-right: 1px solid var(--rs-border); display: flex; flex-direction: column; overflow: auto; }
|
aside { width: 220px; flex-shrink: 0; padding: 12px 8px; background: var(--rs-bg-elevated); border-right: 1px solid var(--rs-border); display: flex; flex-direction: column; overflow: auto; }
|
||||||
.search { display: flex; gap: var(--rs-settings-gap); align-items: center; min-height: var(--rs-settings-control-height); background: var(--rs-bg-active); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); padding: 4px 8px; color: var(--rs-text-dim); }
|
.search { display: flex; gap: var(--rs-settings-gap); align-items: center; min-height: var(--rs-settings-control-height); background: var(--rs-bg-active); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); padding: 4px 8px; color: var(--rs-text-dim); }
|
||||||
.search:focus-within { outline: 2px solid var(--rs-focus); }
|
.search:focus-within { outline: 2px solid var(--rs-focus); }
|
||||||
.search input { width: 100%; min-width: 0; border: 0; padding: 0; outline: none; background: transparent; color: var(--rs-text); }
|
.search input { align-self: stretch; width: 100%; min-width: 0; min-height: 24px; border: 0; padding: 0; outline: none; background: transparent; color: var(--rs-text); }
|
||||||
.nav-heading { margin: 16px 8px 6px; font-size: 11px; color: var(--rs-text-dim); }
|
.nav-heading { margin: 16px 8px 6px; font-size: 11px; color: var(--rs-text-dim); }
|
||||||
nav { display: flex; flex-direction: column; gap: 2px; }
|
nav { display: flex; flex-direction: column; gap: 2px; }
|
||||||
nav button { display: flex; align-items: center; gap: var(--rs-settings-gap); width: 100%; min-height: var(--rs-settings-control-height); padding: 5px 8px; border: 0; border-radius: var(--rs-control-radius); background: transparent; text-align: left; }
|
nav button { display: flex; align-items: center; gap: var(--rs-settings-gap); width: 100%; min-height: var(--rs-settings-control-height); padding: 5px 8px; border: 0; border-radius: var(--rs-control-radius); background: transparent; text-align: left; }
|
||||||
@@ -229,10 +232,6 @@
|
|||||||
.setting-row p { margin: 3px 0 0; font-size: var(--rs-settings-description-size); }
|
.setting-row p { margin: 3px 0 0; font-size: var(--rs-settings-description-size); }
|
||||||
.language-row { flex-wrap: wrap; }
|
.language-row { flex-wrap: wrap; }
|
||||||
.language-picker { display:flex; align-items:center; gap:var(--rs-settings-gap); max-width:100%; }
|
.language-picker { display:flex; align-items:center; gap:var(--rs-settings-gap); max-width:100%; }
|
||||||
.switch { appearance: none; width: 38px; height: 22px; flex: 0 0 38px; margin: 0; border-radius: 20px; background: var(--rs-bg-active); border: 1px solid var(--rs-text-dim); cursor: pointer; }
|
|
||||||
.switch::before { content: ""; display: block; width: 16px; height: 16px; margin: 2px; background: var(--rs-text); border-radius: 50%; transition: transform .12s; }
|
|
||||||
.switch:checked { background: var(--rs-accent); border-color: var(--rs-accent); }
|
|
||||||
.switch:checked::before { transform: translateX(16px); background: var(--rs-bg); }
|
|
||||||
.interval { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; color: var(--rs-text-dim); }
|
.interval { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; color: var(--rs-text-dim); }
|
||||||
.interval input { width: 72px; min-height: var(--rs-settings-control-height); padding: 4px 6px; border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); background: var(--rs-bg); color: var(--rs-text); font-size: 13px; }
|
.interval input { width: 72px; min-height: var(--rs-settings-control-height); padding: 4px 6px; border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); background: var(--rs-bg); color: var(--rs-text); font-size: 13px; }
|
||||||
.interval input:disabled { color: var(--rs-text-dim); }
|
.interval input:disabled { color: var(--rs-text-dim); }
|
||||||
|
|||||||
@@ -497,10 +497,10 @@
|
|||||||
border-radius: var(--rs-control-radius);
|
border-radius: var(--rs-control-radius);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--rs-text-dim);
|
color: var(--rs-text-dim);
|
||||||
width: 22px;
|
width: 24px;
|
||||||
height: 22px;
|
height: 24px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
flex: 0 0 22px;
|
flex: 0 0 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close:hover {
|
.close:hover {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import { renameSelection } from "$lib/workspace/renamePath";
|
import { renameSelection } from "$lib/workspace/renamePath";
|
||||||
import TreeNode from "./TreeNode.svelte";
|
import TreeNode from "./TreeNode.svelte";
|
||||||
import Icon from "$lib/ui/Icon.svelte";
|
import Icon from "$lib/ui/Icon.svelte";
|
||||||
|
import { actionIcons } from "$lib/ui/actionIcons";
|
||||||
import { pluginDocuments } from "$lib/plugins/external";
|
import { pluginDocuments } from "$lib/plugins/external";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -134,7 +135,8 @@
|
|||||||
{#if edges?.bottom != null && edges.bottom > 0}<span class="selection-step bottom"></span>{/if}
|
{#if edges?.bottom != null && edges.bottom > 0}<span class="selection-step bottom"></span>{/if}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
<span class="twist" class:open={isOpen} class:folder={entry.kind === "folder"}></span>
|
<!-- Folders use the shared chevron, as headings and menus do. -->
|
||||||
|
<span class="twist" class:open={isOpen} class:folder={entry.kind === "folder"}>{#if entry.kind === "folder"}<svg viewBox="0 0 24 24" aria-hidden="true">{@html actionIcons.chevron}</svg>{/if}</span>
|
||||||
{#if $pluginDocuments[entry.rel_path]}
|
{#if $pluginDocuments[entry.rel_path]}
|
||||||
<span class="document-icon" title={$pluginDocuments[entry.rel_path].title}><Icon icon={$pluginDocuments[entry.rel_path].icon === "kanban" ? "kanban" : "files"} /></span>
|
<span class="document-icon" title={$pluginDocuments[entry.rel_path].title}><Icon icon={$pluginDocuments[entry.rel_path].icon === "kanban" ? "kanban" : "files"} /></span>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -316,18 +318,21 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.twist.folder::before {
|
.twist svg {
|
||||||
content: "";
|
width: 14px;
|
||||||
width: 0;
|
height: 14px;
|
||||||
height: 0;
|
fill: none;
|
||||||
border-style: solid;
|
stroke: currentColor;
|
||||||
border-width: 5px 0 5px 8px;
|
stroke-width: 2;
|
||||||
border-color: transparent transparent transparent currentColor;
|
stroke-linecap: round;
|
||||||
transform: rotate(0deg);
|
stroke-linejoin: round;
|
||||||
|
transition: transform .12s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.twist.folder.open::before {
|
.twist.open svg { transform: rotate(90deg); }
|
||||||
transform: rotate(90deg);
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.twist svg { transition: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
import { tabsToClose, type TabCloseScope } from "$lib/workspace/tabActions";
|
import { tabsToClose, type TabCloseScope } from "$lib/workspace/tabActions";
|
||||||
import { orderWorkbenchTabs, type WorkbenchTab } from "$lib/workspace/workbenchTabs";
|
import { orderWorkbenchTabs, type WorkbenchTab } from "$lib/workspace/workbenchTabs";
|
||||||
import { actionMenu, type ActionMenuItem } from "$lib/ui/actionMenu";
|
import { actionMenu, type ActionMenuItem } from "$lib/ui/actionMenu";
|
||||||
|
import { revealLabel } from "$lib/ui/menuItems";
|
||||||
import { createNote, noteTemplates, saveNoteTemplate, type NoteTemplate } from "$lib/workspace/templates";
|
import { createNote, noteTemplates, saveNoteTemplate, type NoteTemplate } from "$lib/workspace/templates";
|
||||||
import { requestText } from "$lib/workspace/dialogs.svelte";
|
import { requestText } from "$lib/workspace/dialogs.svelte";
|
||||||
import TextDialog from "./TextDialog.svelte";
|
import TextDialog from "./TextDialog.svelte";
|
||||||
@@ -678,7 +679,7 @@
|
|||||||
const items: ActionMenuItem[] = [];
|
const items: ActionMenuItem[] = [];
|
||||||
if (tab.kind === "text" && isMarkdownPath(tab.relPath)) {
|
if (tab.kind === "text" && isMarkdownPath(tab.relPath)) {
|
||||||
items.push(
|
items.push(
|
||||||
{ label: $t("Save as template"), icon: "copy", run: () => { void saveTemplate({ name: tab.name, rel_path: tab.relPath, kind: "file" }); } },
|
{ label: $t("Save as template"), icon: "template", run: () => { void saveTemplate({ name: tab.name, rel_path: tab.relPath, kind: "file" }); } },
|
||||||
{ label: $t("View"), icon: "book", children: [
|
{ label: $t("View"), icon: "book", children: [
|
||||||
{ label: $t("Write"), icon: "paragraph", radio: true, checked: viewMode === "write", run: () => setDocumentView(documentPanes.active, "write") },
|
{ label: $t("Write"), icon: "paragraph", radio: true, checked: viewMode === "write", run: () => setDocumentView(documentPanes.active, "write") },
|
||||||
{ label: $t("Source"), icon: "code", radio: true, checked: viewMode === "source", run: () => setDocumentView(documentPanes.active, "source") },
|
{ label: $t("Source"), icon: "code", radio: true, checked: viewMode === "source", run: () => setDocumentView(documentPanes.active, "source") },
|
||||||
@@ -691,13 +692,13 @@
|
|||||||
items.push({ separator: true },
|
items.push({ separator: true },
|
||||||
{ label: $t("Rename…"), icon: "rename", run: () => { void renameActive(); } },
|
{ label: $t("Rename…"), icon: "rename", run: () => { void renameActive(); } },
|
||||||
);
|
);
|
||||||
if (tab.kind === "text") items.push({ label: $t("Save a copy…"), icon: "copy", run: () => { void saveCopy(); } });
|
if (tab.kind === "text") items.push({ label: $t("Save a copy…"), icon: "duplicate", run: () => { void saveCopy(); } });
|
||||||
items.push({ separator: true },
|
items.push({ separator: true },
|
||||||
{ label: $t("Copy path"), icon: "copy", children: [
|
{ label: $t("Copy path"), icon: "copy", children: [
|
||||||
{ label: $t("Workspace path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, false); } },
|
{ label: $t("Workspace path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, false); } },
|
||||||
{ label: $t("System path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, true); } },
|
{ label: $t("System path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, true); } },
|
||||||
] },
|
] },
|
||||||
{ label: $t("Show in system explorer"), icon: "folder", run: () => { void workspaceReveal(tab.relPath).catch(err => { error = String(err); }); } },
|
{ label: $t(revealLabel()), icon: "folder", run: () => { void workspaceReveal(tab.relPath).catch(err => { error = String(err); }); } },
|
||||||
);
|
);
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
@@ -1041,7 +1042,7 @@
|
|||||||
if (valid()) status = $t("Bookmarked {name}", { name: file.name });
|
if (valid()) status = $t("Bookmarked {name}", { name: file.name });
|
||||||
}) },
|
}) },
|
||||||
{ label: $t("Open in default app"), icon: "external", run: run(file => workspaceOpenDefault(file.rel_path)) },
|
{ label: $t("Open in default app"), icon: "external", run: run(file => workspaceOpenDefault(file.rel_path)) },
|
||||||
{ label: $t("Show in system explorer"), icon: "folder", run: run(file => workspaceReveal(file.rel_path)) },
|
{ label: $t(revealLabel()), icon: "folder", run: run(file => workspaceReveal(file.rel_path)) },
|
||||||
{ label: $t("Reveal file in navigation"), icon: "folder", run: run(async file => { closePluginSidebar(); leftView = "files"; leftOpen = true; await tick(); await fileTree?.revealPath(file.rel_path); }) },
|
{ label: $t("Reveal file in navigation"), icon: "folder", run: run(async file => { closePluginSidebar(); leftView = "files"; leftOpen = true; await tick(); await fileTree?.revealPath(file.rel_path); }) },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1132,9 +1133,34 @@
|
|||||||
} catch { error = $t("Could not read your layout. Default layout applies for this window."); }
|
} catch { error = $t("Could not read your layout. Default layout applies for this window."); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Side panes give way when the window becomes narrow: the outline below 1100 pixels, and the side pane below 800 pixels.
|
||||||
|
// They come back when the window grows again. A pane that the user opens in a narrow window stays open.
|
||||||
|
// At startup the saved layout applies as it is.
|
||||||
|
let windowWidth = $state(window.innerWidth);
|
||||||
|
let measured = false;
|
||||||
|
const narrow = { left: false, right: false };
|
||||||
|
const wide = { left: true, right: true };
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (!layoutReady || transferredWindow) return;
|
if (!layoutReady || transferredWindow) return;
|
||||||
try { saveWorkbenchLayout(localStorage, { leftOpen, rightOpen, leftWidth, rightWidth, leftView }); }
|
const left = windowWidth < 800, right = windowWidth < 1100;
|
||||||
|
untrack(() => {
|
||||||
|
if (!measured) { measured = true; Object.assign(narrow, { left, right }); Object.assign(wide, { left: leftOpen, right: rightOpen }); return; }
|
||||||
|
if (right !== narrow.right) {
|
||||||
|
if (right) { wide.right = rightOpen; rightOpen = false; } else rightOpen = wide.right;
|
||||||
|
narrow.right = right;
|
||||||
|
}
|
||||||
|
if (left !== narrow.left) {
|
||||||
|
if (left) { wide.left = leftOpen; leftOpen = false; } else leftOpen = wide.left;
|
||||||
|
narrow.left = left;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// The saved layout keeps the choice of a wide window.
|
||||||
|
$effect(() => {
|
||||||
|
if (!layoutReady || transferredWindow) return;
|
||||||
|
const saved = { leftOpen: narrow.left ? wide.left : leftOpen, rightOpen: narrow.right ? wide.right : rightOpen };
|
||||||
|
try { saveWorkbenchLayout(localStorage, { ...saved, leftWidth, rightWidth, leftView }); }
|
||||||
catch { error = $t("Could not save your layout. Layout changes apply for this window only."); }
|
catch { error = $t("Could not save your layout. Layout changes apply for this window only."); }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1209,7 +1235,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window onkeydown={onKeydown} onbeforeunload={(event) => { if (hasDirty) { event.preventDefault(); event.returnValue = ""; } }} />
|
<svelte:window bind:innerWidth={windowWidth} onkeydown={onKeydown} onbeforeunload={(event) => { if (hasDirty) { event.preventDefault(); event.returnValue = ""; } }} />
|
||||||
<TextDialog />
|
<TextDialog />
|
||||||
<WorkspacePicker bind:this={workspacePicker} currentRoot={workspace?.root} anchor={workspaceAnchor} onOpen={openPath} />
|
<WorkspacePicker bind:this={workspacePicker} currentRoot={workspace?.root} anchor={workspaceAnchor} onOpen={openPath} />
|
||||||
{#if preferences}<SettingsDialog {settings} help={preferences === "help"} onSave={updateSettings} onClose={() => preferences = null} />{/if}
|
{#if preferences}<SettingsDialog {settings} help={preferences === "help"} onSave={updateSettings} onClose={() => preferences = null} />{/if}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ export type MenuAction = {
|
|||||||
run: () => void;
|
run: () => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
icon?: ActionIcon;
|
icon?: ActionIcon;
|
||||||
|
/** The action removes data. The menu shows it in the error color. */
|
||||||
|
danger?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MenuSep = { kind: "sep" };
|
export type MenuSep = { kind: "sep" };
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id={`external-${plugin.manifest.id}`} type="checkbox" role="switch" checked={builtInPackages.includes(plugin.manifest.id) || plugin.enabled} disabled={busy || plugin.removal || builtInPackages.includes(plugin.manifest.id)} onchange={event => { const value = event.currentTarget.checked; event.currentTarget.checked = plugin.enabled; void toggle(plugin.manifest.id, value, plugin.hash); }} />
|
<input id={`external-${plugin.manifest.id}`} class="rs-switch" type="checkbox" role="switch" checked={builtInPackages.includes(plugin.manifest.id) || plugin.enabled} disabled={busy || plugin.removal || builtInPackages.includes(plugin.manifest.id)} onchange={event => { const value = event.currentTarget.checked; event.currentTarget.checked = plugin.enabled; void toggle(plugin.manifest.id, value, plugin.hash); }} />
|
||||||
<IconButton icon="folder-open" label={$t("Show files")} disabled={busy || plugin.removal} onclick={() => reveal(plugin.manifest.id)} />
|
<IconButton icon="folder-open" label={$t("Show files")} disabled={busy || plugin.removal} onclick={() => reveal(plugin.manifest.id)} />
|
||||||
{#if plugin.removal}
|
{#if plugin.removal}
|
||||||
<button disabled={busy} onclick={() => run(async () => { await invoke("plugins_retry_remove", { id: plugin.manifest.id }); await refreshPlugins(); message = $t("Plugin file cleanup completed."); })}><Icon icon="refresh" />{$t("Retry cleanup")}</button>
|
<button disabled={busy} onclick={() => run(async () => { await invoke("plugins_retry_remove", { id: plugin.manifest.id }); await refreshPlugins(); message = $t("Plugin file cleanup completed."); })}><Icon icon="refresh" />{$t("Retry cleanup")}</button>
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
{#if notice}<p>{$t(notice)}</p>{/if}
|
{#if notice}<p>{$t(notice)}</p>{/if}
|
||||||
<h3>{$t("Transparency")}</h3>
|
<h3>{$t("Transparency")}</h3>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<label><span>{$t("Transparent surfaces")}</span><input type="checkbox" role="switch" checked={appearance.transparency?.enabled !== false} onchange={event => change({ ...appearance, transparency: { amount: appearance.transparency?.amount ?? 18, enabled: event.currentTarget.checked } })} /></label>
|
<label><span>{$t("Transparent surfaces")}</span><input class="rs-switch" type="checkbox" role="switch" checked={appearance.transparency?.enabled !== false} onchange={event => change({ ...appearance, transparency: { amount: appearance.transparency?.amount ?? 18, enabled: event.currentTarget.checked } })} /></label>
|
||||||
<div class="setting-row"><label for="surface-transparency">{$t("Transparency amount")}</label><div class="overlay-controls"><input id="surface-transparency" type="range" min="0" max="100" step="1" disabled={appearance.transparency?.enabled === false} value={appearance.transparency?.amount ?? 18} oninput={event => change({ ...appearance, transparency: { enabled: true, amount: event.currentTarget.valueAsNumber } })} /><output for="surface-transparency">{appearance.transparency?.amount ?? 18}%</output></div></div>
|
<div class="setting-row"><label for="surface-transparency">{$t("Transparency amount")}</label><div class="overlay-controls"><input id="surface-transparency" type="range" min="0" max="100" step="1" disabled={appearance.transparency?.enabled === false} value={appearance.transparency?.amount ?? 18} oninput={event => change({ ...appearance, transparency: { enabled: true, amount: event.currentTarget.valueAsNumber } })} /><output for="surface-transparency">{appearance.transparency?.amount ?? 18}%</output></div></div>
|
||||||
</div>
|
</div>
|
||||||
<p>{$t("Turn off transparency to use opaque surfaces and reduce compositing work. Text and icons remain opaque.")}</p>
|
<p>{$t("Turn off transparency to use opaque surfaces and reduce compositing work. Text and icons remain opaque.")}</p>
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="primary" disabled={!dirty && draft.id !== null} onclick={() => void save()}><Icon icon="save" />{$t('Save')}</button>
|
<button class="primary" disabled={!dirty && draft.id !== null} onclick={() => void save()}><Icon icon="save" />{$t('Save')}</button>
|
||||||
<button disabled={!dirty} onclick={discard}><Icon icon="undo" />{$t('Discard')}</button>
|
<button disabled={!dirty} onclick={discard}><Icon icon="undo" />{$t('Discard')}</button>
|
||||||
<button onclick={() => void duplicate()}><Icon icon="copy" />{$t('Duplicate')}</button>
|
<button onclick={() => void duplicate()}><Icon icon="duplicate" />{$t('Duplicate')}</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<p class="note">
|
<p class="note">
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<path d="M4 12h16m-6-6 6 6-6 6" />
|
<path d="M4 12h16m-6-6 6 6-6 6" />
|
||||||
{:else if icon === "copy"}
|
{:else if icon === "copy"}
|
||||||
<rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V4H4v12h4" />
|
<rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V4H4v12h4" />
|
||||||
|
{:else if icon === "duplicate"}
|
||||||
|
<rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V4H4v12h4M14 11v6M11 14h6" />
|
||||||
{:else if icon === "stop"}
|
{:else if icon === "stop"}
|
||||||
<rect x="5" y="5" width="14" height="14" rx="2" />
|
<rect x="5" y="5" width="14" height="14" rx="2" />
|
||||||
{:else if icon === "help"}
|
{:else if icon === "help"}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
| "arrow-left"
|
| "arrow-left"
|
||||||
| "arrow-right"
|
| "arrow-right"
|
||||||
| "copy"
|
| "copy"
|
||||||
|
| "duplicate"
|
||||||
| "stop"
|
| "stop"
|
||||||
| "settings"
|
| "settings"
|
||||||
| "sun"
|
| "sun"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function checkMark() {
|
|||||||
return svg;
|
return svg;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ActionMenuItem = { label: string; icon?: ActionIcon; shortcut?: string; run?: () => void; children?: ActionMenuItem[]; disabled?: boolean; checked?: boolean; radio?: boolean; title?: string } | { separator: true };
|
export type ActionMenuItem = { label: string; icon?: ActionIcon; shortcut?: string; run?: () => void; children?: ActionMenuItem[]; disabled?: boolean; checked?: boolean; radio?: boolean; title?: string; danger?: boolean } | { separator: true };
|
||||||
|
|
||||||
export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClose: () => void, label = "Table actions", parent: HTMLElement = document.body) {
|
export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClose: () => void, label = "Table actions", parent: HTMLElement = document.body) {
|
||||||
const root = document.createElement("div"); root.className = "rs-menu table-cell-menu"; root.setAttribute("role", "menu"); root.setAttribute("aria-label", label);
|
const root = document.createElement("div"); root.className = "rs-menu table-cell-menu"; root.setAttribute("role", "menu"); root.setAttribute("aria-label", label);
|
||||||
@@ -46,6 +46,7 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
|
|||||||
const button = document.createElement("button"); button.type = "button"; button.setAttribute("role", "menuitem"); button.disabled = !!item.disabled;
|
const button = document.createElement("button"); button.type = "button"; button.setAttribute("role", "menuitem"); button.disabled = !!item.disabled;
|
||||||
if (item.checked !== undefined) { button.setAttribute("role", item.radio ? "menuitemradio" : "menuitemcheckbox"); button.setAttribute("aria-checked", String(item.checked)); }
|
if (item.checked !== undefined) { button.setAttribute("role", item.radio ? "menuitemradio" : "menuitemcheckbox"); button.setAttribute("aria-checked", String(item.checked)); }
|
||||||
if (item.title) button.title = item.title;
|
if (item.title) button.title = item.title;
|
||||||
|
if (item.danger) button.classList.add("danger");
|
||||||
const label = document.createElement("span"); label.className = "action-label"; label.textContent = item.label;
|
const label = document.createElement("span"); label.className = "action-label"; label.textContent = item.label;
|
||||||
const icon = item.radio ? (item.checked ? checkMark() : document.createElement("span"))
|
const icon = item.radio ? (item.checked ? checkMark() : document.createElement("span"))
|
||||||
: item.checked ? actionIcon("task") : item.icon ? actionIcon(item.icon) : document.createElement("span");
|
: item.checked ? actionIcon("task") : item.icon ? actionIcon(item.icon) : document.createElement("span");
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
/* Disabled rows stay readable: dim text at full opacity. */
|
/* Disabled rows stay readable: dim text at full opacity. */
|
||||||
.rs-menu > button:disabled, .rs-picker .rs-picker-row:disabled { color: var(--rs-text-dim); cursor: default; }
|
.rs-menu > button:disabled, .rs-picker .rs-picker-row:disabled { color: var(--rs-text-dim); cursor: default; }
|
||||||
.rs-menu.rs-menu-text > button > .action-icon { display: none; }
|
.rs-menu.rs-menu-text > button > .action-icon { display: none; }
|
||||||
|
/* An action that removes data, such as Delete, uses the error color. */
|
||||||
|
.rs-menu > button.danger:not(:disabled) { color: var(--rs-error); }
|
||||||
/* Hover gets only the quiet fill. The current radio row shows a check mark, not a fill. */
|
/* Hover gets only the quiet fill. The current radio row shows a check mark, not a fill. */
|
||||||
.rs-menu > button:not(:disabled):is(:hover, :focus-visible, [aria-expanded="true"]),
|
.rs-menu > button:not(:disabled):is(:hover, :focus-visible, [aria-expanded="true"]),
|
||||||
.rs-picker .rs-picker-row:not(:disabled):is(:hover, :focus-visible, :focus-within, [aria-selected="true"], [aria-current="true"]) {
|
.rs-picker .rs-picker-row:not(:disabled):is(:hover, :focus-visible, :focus-within, [aria-selected="true"], [aria-current="true"]) {
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { tr } from "../i18n/index.ts";
|
import { message, tr } from "../i18n/index.ts";
|
||||||
import { keys } from "./shortcuts.ts";
|
import { isMac, keys } from "./shortcuts.ts";
|
||||||
import type { ActionMenuItem } from "./actionMenu.ts";
|
import type { ActionMenuItem } from "./actionMenu.ts";
|
||||||
|
|
||||||
// The common text actions of the editor and reading menus. Each menu supplies only its commands.
|
// The common text actions of the editor and reading menus. Each menu supplies only its commands.
|
||||||
|
|
||||||
|
/** The one label of the action that shows a file in the file manager of the platform. Translate it with `$t` or `tr`. */
|
||||||
|
export function revealLabel(): string {
|
||||||
|
if (isMac()) return message("Show in Finder");
|
||||||
|
return typeof navigator !== "undefined" && /Windows/.test(navigator.userAgent) ? message("Show in Explorer") : message("Show in file manager");
|
||||||
|
}
|
||||||
|
|
||||||
/** Undo and Redo, then a separator. */
|
/** Undo and Redo, then a separator. */
|
||||||
export function historyItems(history: { canUndo: boolean; canRedo: boolean; undo(): void; redo(): void }): ActionMenuItem[] {
|
export function historyItems(history: { canUndo: boolean; canRedo: boolean; undo(): void; redo(): void }): ActionMenuItem[] {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/* The one switch design for boolean settings: <input type="checkbox" role="switch" class="rs-switch">. */
|
||||||
|
.rs-switch {
|
||||||
|
appearance: none;
|
||||||
|
position: relative;
|
||||||
|
flex: 0 0 40px;
|
||||||
|
width: 40px;
|
||||||
|
height: 24px;
|
||||||
|
margin: 0;
|
||||||
|
border: 1px solid var(--rs-text-dim);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--rs-bg-active);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background .12s, border-color .12s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rs-switch::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 3px;
|
||||||
|
left: 3px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--rs-text);
|
||||||
|
transition: transform .12s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rs-switch:checked { background: var(--rs-accent); border-color: var(--rs-accent); }
|
||||||
|
.rs-switch:checked::before { transform: translateX(16px); background: var(--rs-on-accent); }
|
||||||
|
/* A disabled switch keeps full opacity. Its border and knob are dim. */
|
||||||
|
.rs-switch:disabled { cursor: default; border-color: var(--rs-border); }
|
||||||
|
.rs-switch:disabled::before { background: var(--rs-text-dim); }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.rs-switch, .rs-switch::before { transition: none; }
|
||||||
|
}
|
||||||
@@ -110,8 +110,7 @@ await runSmoke('appearance/backgroundFrames', async ({ browser }) => {
|
|||||||
await page.locator('.source-editor .cm-content').waitFor();
|
await page.locator('.source-editor .cm-content').waitFor();
|
||||||
await page.screenshot({ path: `${output}/${theme}-ide.png` });
|
await page.screenshot({ path: `${output}/${theme}-ide.png` });
|
||||||
await page.setViewportSize({ width: 680, height: 720 });
|
await page.setViewportSize({ width: 680, height: 720 });
|
||||||
await page.getByRole('button', { name: 'Files', exact: true }).click();
|
// The side panes give way in a narrow window and come back in a wide one (src/lib/layout/Workbench.svelte).
|
||||||
await page.getByRole('button', { name: 'Hide outline', exact: true }).click();
|
|
||||||
await page.screenshot({ path: `${output}/${theme}-ide-narrow.png` });
|
await page.screenshot({ path: `${output}/${theme}-ide-narrow.png` });
|
||||||
|
|
||||||
await page.keyboard.press('Control+t');
|
await page.keyboard.press('Control+t');
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ await runSmoke('browser/builtin', async ({ page }) => {
|
|||||||
}
|
}
|
||||||
await page.goto(smokeUrl + '/?settingsWindow=true');
|
await page.goto(smokeUrl + '/?settingsWindow=true');
|
||||||
await page.getByRole('button', { name: 'Browser', exact: true }).click();
|
await page.getByRole('button', { name: 'Browser', exact: true }).click();
|
||||||
await page.getByRole('button', { name: 'Save browser settings' }).waitFor({ state: 'visible' });
|
await page.getByRole('button', { name: 'Search engine', exact: true }).waitFor({ state: 'visible' });
|
||||||
assert.match(await page.getByRole('button', { name: 'Profile', exact: true }).innerText(), /Existing user/);
|
assert.match(await page.getByRole('button', { name: 'Profile', exact: true }).innerText(), /Existing user/);
|
||||||
await page.setViewportSize({ width: 360, height: 800 });
|
await page.setViewportSize({ width: 360, height: 800 });
|
||||||
for (const theme of ['dark', 'light']) {
|
for (const theme of ['dark', 'light']) {
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ await runSmoke('browser/settingsMenus', async ({ page }) => {
|
|||||||
}
|
}
|
||||||
await trigger('Search engine').click();
|
await trigger('Search engine').click();
|
||||||
await menu('Search engine').getByRole('menuitemradio', { name: 'Google', exact: true }).click();
|
await menu('Search engine').getByRole('menuitemradio', { name: 'Google', exact: true }).click();
|
||||||
assert.equal(await page.evaluate(() => window.__TEST__.requests.filter(request => request.command === 'settings').length), 0, 'A choice does not submit the form');
|
// A choice applies at once (src/lib/browser/Settings.svelte).
|
||||||
await trigger('Save browser settings').click();
|
|
||||||
await page.waitForFunction(() => window.__TEST__.snapshot.settings.search === 'google');
|
await page.waitForFunction(() => window.__TEST__.snapshot.settings.search === 'google');
|
||||||
await page.evaluate(async () => { const { state } = await import('/src/lib/browser/client.ts'); const snapshot = window.__TEST__.snapshot; snapshot.profiles.push(...Array.from({ length: 60 }, (_, i) => ({ id: 'p' + i, name: 'Profile ' + i }))); state.set(structuredClone(snapshot)); });
|
await page.evaluate(async () => { const { state } = await import('/src/lib/browser/client.ts'); const snapshot = window.__TEST__.snapshot; snapshot.profiles.push(...Array.from({ length: 60 }, (_, i) => ({ id: 'p' + i, name: 'Profile ' + i }))); state.set(structuredClone(snapshot)); });
|
||||||
await page.setViewportSize({ width: 520, height: 700 });
|
await page.setViewportSize({ width: 520, height: 700 });
|
||||||
|
|||||||
@@ -60,10 +60,8 @@ await runSmoke("editor/templatesAndTasks", async ({ page }) => {
|
|||||||
await page.evaluate(async mode => (await import('/src/lib/theme/appearance.ts')).saveAppearance({ theme: 'default', mode }), mode);
|
await page.evaluate(async mode => (await import('/src/lib/theme/appearance.ts')).saveAppearance({ theme: 'default', mode }), mode);
|
||||||
for (const width of [1440, 600]) {
|
for (const width of [1440, 600]) {
|
||||||
await page.setViewportSize({ width, height: width === 600 ? 760 : 1000 });
|
await page.setViewportSize({ width, height: width === 600 ? 760 : 1000 });
|
||||||
if (width === 600) {
|
// The side panes give way in a narrow window and come back in a wide one (src/lib/layout/Workbench.svelte).
|
||||||
await page.getByRole('button', { name: 'Files', exact: true }).click();
|
await page.waitForFunction(width => !!document.querySelector('aside.left') === width >= 800, width);
|
||||||
await page.getByRole('button', { name: 'Hide outline', exact: true }).click();
|
|
||||||
}
|
|
||||||
if (!(await title.isVisible())) await page.getByRole('button', { name: 'Rename note', exact: true }).click();
|
if (!(await title.isVisible())) await page.getByRole('button', { name: 'Rename note', exact: true }).click();
|
||||||
await title.focus();
|
await title.focus();
|
||||||
await expectCount(10);
|
await expectCount(10);
|
||||||
@@ -96,8 +94,6 @@ await runSmoke("editor/templatesAndTasks", async ({ page }) => {
|
|||||||
await page.getByRole('button', { name: 'Rename note', exact: true }).click();
|
await page.getByRole('button', { name: 'Rename note', exact: true }).click();
|
||||||
if (width === 600) {
|
if (width === 600) {
|
||||||
await page.setViewportSize({ width: 1440, height: 1000 });
|
await page.setViewportSize({ width: 1440, height: 1000 });
|
||||||
await page.getByRole('button', { name: 'Files', exact: true }).click();
|
|
||||||
await page.getByRole('button', { name: 'Show outline', exact: true }).click();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,15 +145,12 @@ await runSmoke('find/pluginViews', async ({ page }) => {
|
|||||||
await page.screenshot({ path: `${output}/${name}-${theme}-narrow.png` });
|
await page.screenshot({ path: `${output}/${name}-${theme}-narrow.png` });
|
||||||
const bar = await pane.locator('.rs-find-bar').boundingBox(), bounds = await pane.boundingBox();
|
const bar = await pane.locator('.rs-find-bar').boundingBox(), bounds = await pane.boundingBox();
|
||||||
assert.ok(bar.x >= bounds.x && bar.x + bar.width <= bounds.x + bounds.width + 1);
|
assert.ok(bar.x >= bounds.x && bar.x + bar.width <= bounds.x + bounds.width + 1);
|
||||||
await page.getByRole('button', { name: 'Files', exact: true }).click();
|
// The side panes give way in a narrow window and come back in a wide one (src/lib/layout/Workbench.svelte).
|
||||||
await page.getByRole('button', { name: 'Hide outline', exact: true }).click();
|
|
||||||
await page.screenshot({ path: `${output}/${name}-${theme}-narrow-focused.png` });
|
await page.screenshot({ path: `${output}/${name}-${theme}-narrow-focused.png` });
|
||||||
await find.focus();
|
await find.focus();
|
||||||
await page.keyboard.press('Escape');
|
await page.keyboard.press('Escape');
|
||||||
assert.equal(await returnButton.evaluate(node => node === document.activeElement), true);
|
assert.equal(await returnButton.evaluate(node => node === document.activeElement), true);
|
||||||
await page.setViewportSize({ width: 1440, height: 1000 });
|
await page.setViewportSize({ width: 1440, height: 1000 });
|
||||||
await page.getByRole('button', { name: 'Files', exact: true }).click();
|
|
||||||
await page.getByRole('button', { name: 'Show outline', exact: true }).click();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await page.getByRole('navigation', { name: 'Plugin shortcuts' }).getByRole('button', { name: 'Custom find', exact: true }).click();
|
await page.getByRole('navigation', { name: 'Plugin shortcuts' }).getByRole('button', { name: 'Custom find', exact: true }).click();
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ await runSmoke("find/searchPanel", async ({ page }) => {
|
|||||||
assert.equal(await editor.evaluate(el => document.activeElement === el), true);
|
assert.equal(await editor.evaluate(el => document.activeElement === el), true);
|
||||||
|
|
||||||
await page.setViewportSize({ width: 880, height: 760 });
|
await page.setViewportSize({ width: 880, height: 760 });
|
||||||
|
// The outline gives way below 1100 pixels. The test opens it again to check its search field.
|
||||||
|
await page.getByRole("button", { name: "Show outline", exact: true }).click();
|
||||||
|
await outline.focus();
|
||||||
|
await page.keyboard.press("Control+f");
|
||||||
|
await outlineFind.waitFor();
|
||||||
await find.focus();
|
await find.focus();
|
||||||
await page.screenshot({ path: path.join(output, "find-bars-narrow.png") });
|
await page.screenshot({ path: path.join(output, "find-bars-narrow.png") });
|
||||||
for (const selector of [".rs-editor-search", ".outline-search"]) {
|
for (const selector of [".rs-editor-search", ".outline-search"]) {
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
// Layout, icons, and Settings: side panes that give way, one file menu order with a danger Delete, tree chevrons,
|
||||||
|
// grouped search hits, readable bookmarks, 24-pixel targets, one switch design, and the first focus in Settings.
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||||
|
|
||||||
|
await runSmoke("layout/panesAndSettings", async ({ browser }) => {
|
||||||
|
const output = await outputDir("layout/panesAndSettings");
|
||||||
|
const context = await browser.newContext({ viewport: { width: 1280, height: 760 } });
|
||||||
|
await mockTauri(context, {
|
||||||
|
commands: test => ({
|
||||||
|
...test.workspace({
|
||||||
|
root: "C:\\panes",
|
||||||
|
files: {
|
||||||
|
"alpha.md": "# Alpha\n\nThe river runs past the river mill.\n",
|
||||||
|
"notes/beta.md": "# Beta\n\nA river note.\n\nAnother river line.\n",
|
||||||
|
"notes/gamma.md": "# Gamma\n\nNo match here.\n",
|
||||||
|
".runestone/marks.json": JSON.stringify({ pins: [], bookmarks: ["notes/beta.md", "alpha.md"], order: {} }),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
||||||
|
"plugin:window|is_maximized": () => false,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
const page = await openPage(context);
|
||||||
|
await page.goto(smokeUrl);
|
||||||
|
const row = rel => page.locator(`[data-tree-rel="${rel}"]`);
|
||||||
|
await row("alpha.md").waitFor();
|
||||||
|
await row("alpha.md").click();
|
||||||
|
await page.getByRole("tab", { name: "alpha.md", exact: true, selected: true }).waitFor();
|
||||||
|
|
||||||
|
// Side panes give way in narrow windows and come back when the window grows. The saved layout keeps the wide choice.
|
||||||
|
const panes = () => page.evaluate(() => ({ left: !!document.querySelector("aside.left"), right: !!document.querySelector("aside.right") }));
|
||||||
|
assert.deepEqual(await panes(), { left: true, right: true });
|
||||||
|
await page.setViewportSize({ width: 1000, height: 760 });
|
||||||
|
await page.waitForFunction(() => !document.querySelector("aside.right"));
|
||||||
|
assert.deepEqual(await panes(), { left: true, right: false });
|
||||||
|
await page.setViewportSize({ width: 760, height: 760 });
|
||||||
|
await page.waitForFunction(() => !document.querySelector("aside.left"));
|
||||||
|
const layout = () => page.evaluate(() => JSON.parse(localStorage.getItem("runestone.workbenchLayout") ?? "{}"));
|
||||||
|
assert.equal((await layout()).leftOpen, true);
|
||||||
|
assert.equal((await layout()).rightOpen, true);
|
||||||
|
// A pane that the user opens in a narrow window stays open.
|
||||||
|
await page.getByRole("button", { name: "Show outline", exact: true }).click();
|
||||||
|
await page.locator("aside.right").waitFor();
|
||||||
|
await page.screenshot({ path: `${output}/narrow-760.png` });
|
||||||
|
await page.setViewportSize({ width: 1280, height: 760 });
|
||||||
|
await page.waitForFunction(() => !!document.querySelector("aside.left") && !!document.querySelector("aside.right"));
|
||||||
|
|
||||||
|
// The file menu: open, clipboard, organize, show and copy path, history, then Delete in the error color.
|
||||||
|
await row("alpha.md").click({ button: "right" });
|
||||||
|
const menu = page.getByRole("menu", { name: "File actions", exact: true });
|
||||||
|
await menu.waitFor();
|
||||||
|
const labels = await menu.locator(":scope > button, :scope > hr").evaluateAll(nodes => nodes.map(node => node.tagName === "HR" ? "|" : node.querySelector(".action-label").textContent));
|
||||||
|
assert.deepEqual(labels, ["Open in new tab", "Open in default app", "Open in terminal", "|", "Cut", "Copy", "Paste", "Make a copy", "|",
|
||||||
|
"Rename", "Remove bookmark", "Pin", "Save as template", "|", "Show in Explorer", "Copy path", "|", "Undo file move", "Redo file move", "|", "Delete", "Delete permanently"]);
|
||||||
|
const error = await page.evaluate(() => { const probe = document.createElement("span"); probe.style.color = "var(--rs-error)"; document.body.append(probe); const color = getComputedStyle(probe).color; probe.remove(); return color; });
|
||||||
|
assert.equal(await menu.getByRole("menuitem", { name: "Delete", exact: true }).evaluate(node => getComputedStyle(node).color), error);
|
||||||
|
// Each function has one icon: duplicate, template, and tab differ from copy.
|
||||||
|
const icon = name => menu.getByRole("menuitem", { name, exact: true }).locator("svg").first().evaluate(node => node.innerHTML);
|
||||||
|
const copy = await icon("Copy");
|
||||||
|
for (const name of ["Make a copy", "Save as template", "Open in new tab"]) assert.notEqual(await icon(name), copy, name);
|
||||||
|
await page.screenshot({ path: `${output}/file-menu.png` });
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
|
|
||||||
|
// Folders use the shared chevron. It turns when the folder opens.
|
||||||
|
const chevron = row("notes").locator(".twist svg");
|
||||||
|
assert.equal(await chevron.count(), 1);
|
||||||
|
assert.equal(await chevron.evaluate(node => getComputedStyle(node).transform), "none");
|
||||||
|
await row("notes").click();
|
||||||
|
await page.waitForFunction(() => getComputedStyle(document.querySelector('[data-tree-rel="notes"] .twist svg')).transform !== "none");
|
||||||
|
|
||||||
|
// Search hits come in groups by file, with a count and marked matches.
|
||||||
|
await page.getByRole("button", { name: "Search", exact: true }).click();
|
||||||
|
await page.getByPlaceholder("Search files and notes").fill("river");
|
||||||
|
await page.keyboard.press("Enter");
|
||||||
|
await page.getByRole("status").filter({ hasText: "3 results in 2 files" }).waitFor();
|
||||||
|
const groups = await page.locator(".results > .file").evaluateAll(nodes => nodes.map(node => [node.querySelector(".name").textContent, node.querySelector(".count").textContent]));
|
||||||
|
assert.deepEqual(groups, [["alpha.md", "1"], ["beta.md", "2"]]);
|
||||||
|
assert.equal(await page.locator(".results > .file").first().locator("mark").count(), 2);
|
||||||
|
assert.equal(await page.locator(".results mark").first().textContent(), "river");
|
||||||
|
await page.screenshot({ path: `${output}/search.png` });
|
||||||
|
await page.locator(".results button").filter({ hasText: "Another river line." }).click();
|
||||||
|
await page.getByRole("tab", { name: "beta.md", exact: true, selected: true }).waitFor();
|
||||||
|
|
||||||
|
// Bookmarks show the file name, its folder, and a remove button.
|
||||||
|
await page.getByRole("button", { name: "Bookmarks", exact: true }).click();
|
||||||
|
const bookmark = page.locator(".pane li").filter({ hasText: "beta.md" });
|
||||||
|
assert.equal(await bookmark.locator(".folder").textContent(), "notes");
|
||||||
|
await page.screenshot({ path: `${output}/bookmarks.png` });
|
||||||
|
await bookmark.getByRole("button", { name: "Remove bookmark: beta.md", exact: true }).click();
|
||||||
|
await bookmark.waitFor({ state: "detached" });
|
||||||
|
|
||||||
|
// Targets are at least 24 pixels.
|
||||||
|
const close = await page.getByRole("button", { name: "Close beta.md", exact: true }).boundingBox();
|
||||||
|
assert.ok(close.width >= 24 && close.height >= 24, JSON.stringify(close));
|
||||||
|
const outlineRows = await page.locator("aside.right li button").evaluateAll(nodes => nodes.map(node => node.getBoundingClientRect().height));
|
||||||
|
assert.ok(outlineRows.length && outlineRows.every(height => height >= 24), JSON.stringify(outlineRows));
|
||||||
|
|
||||||
|
// Settings: the first focus is on the search, and every switch has one design.
|
||||||
|
const settings = await openPage(context);
|
||||||
|
await settings.goto(smokeUrl + "/?settingsWindow=true");
|
||||||
|
await settings.getByRole("textbox", { name: "Search settings", exact: true }).waitFor();
|
||||||
|
await settings.waitForFunction(() => document.activeElement?.getAttribute("aria-label") === "Search settings");
|
||||||
|
await settings.getByRole("button", { name: "General", exact: true }).click();
|
||||||
|
const switches = await settings.getByRole("switch").evaluateAll(nodes => nodes.map(node => { const rect = node.getBoundingClientRect(); return `${node.className.split(" ")[0]} ${Math.round(rect.width)}x${Math.round(rect.height)}`; }));
|
||||||
|
assert.ok(switches.length >= 4 && switches.every(item => item === "rs-switch 40x24"), JSON.stringify(switches));
|
||||||
|
await settings.getByRole("button", { name: "Appearance", exact: true }).click();
|
||||||
|
assert.equal(await settings.getByRole("switch", { name: "Transparent surfaces", exact: true }).evaluate(node => node.className.split(" ")[0]), "rs-switch");
|
||||||
|
await settings.screenshot({ path: `${output}/settings-appearance.png` });
|
||||||
|
assert.deepEqual([...page.errors, ...settings.errors], []);
|
||||||
|
console.log("PASS: panes give way, file menu order and icons, danger Delete, tree chevrons, grouped search, bookmarks, 24-pixel targets, one switch design, Settings first focus.");
|
||||||
|
});
|
||||||
@@ -129,7 +129,9 @@ await runSmoke("layout/viewModes", async ({ browser }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Narrow panes show only the icons. The names stay for assistive technology and tooltips.
|
// Narrow panes show only the icons. The names stay for assistive technology and tooltips.
|
||||||
await page.setViewportSize({ width: 700, height: 600 });
|
// The side panes give way first. A 520-pixel window then leaves the pane less than 560 pixels.
|
||||||
|
await page.setViewportSize({ width: 520, height: 600 });
|
||||||
|
await page.locator("aside.left").waitFor({ state: "detached" });
|
||||||
await page.waitForFunction(() => getComputedStyle(document.querySelector(".view-modes .label")).display === "none");
|
await page.waitForFunction(() => getComputedStyle(document.querySelector(".view-modes .label")).display === "none");
|
||||||
assert.equal(await radio("Read").getAttribute("aria-label"), "Read");
|
assert.equal(await radio("Read").getAttribute("aria-label"), "Read");
|
||||||
assert.ok(await page.locator(".chrome-bar").evaluate(node => node.scrollWidth <= node.clientWidth + 1));
|
assert.ok(await page.locator(".chrome-bar").evaluate(node => node.scrollWidth <= node.clientWidth + 1));
|
||||||
|
|||||||
@@ -165,7 +165,8 @@ await runSmoke("layout/workbench", async ({ page }) => {
|
|||||||
await page.getByRole("button", { name: "Copied", exact: true }).waitFor();
|
await page.getByRole("button", { name: "Copied", exact: true }).waitFor();
|
||||||
await page.screenshot({ path: path.join(output, "reader-details.png") });
|
await page.screenshot({ path: path.join(output, "reader-details.png") });
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1000, height: 900 });
|
// At the minimum window width of 880 pixels the outline gives way, and Split stacks in the remaining pane.
|
||||||
|
await page.setViewportSize({ width: 880, height: 900 });
|
||||||
await page.locator(".md-page").evaluate(element => { element.scrollTop = 0; });
|
await page.locator(".md-page").evaluate(element => { element.scrollTop = 0; });
|
||||||
await page.screenshot({ path: path.join(output, "reader-narrow.png") });
|
await page.screenshot({ path: path.join(output, "reader-narrow.png") });
|
||||||
assert.ok(await page.locator(".md-page").evaluate(element => element.scrollWidth <= element.clientWidth + 1));
|
assert.ok(await page.locator(".md-page").evaluate(element => element.scrollWidth <= element.clientWidth + 1));
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ await runSmoke("links/linkMenus", async ({ page }) => {
|
|||||||
await page.keyboard.press('Control+z');
|
await page.keyboard.press('Control+z');
|
||||||
await page.locator('.cm-content').getByText('Selected reading text.', {exact:true}).click();
|
await page.locator('.cm-content').getByText('Selected reading text.', {exact:true}).click();
|
||||||
await writerMenu('Workspace note');
|
await writerMenu('Workspace note');
|
||||||
for (const label of ['Open in new tab', 'Open in new window', 'Copy path', 'Bookmark', 'Show in system explorer', 'Reveal file in navigation', 'Edit link']) assert.equal(await item(label).count(), 1);
|
for (const label of ['Open in new tab', 'Open in new window', 'Copy path', 'Bookmark', 'Show in Explorer', 'Reveal file in navigation', 'Edit link']) assert.equal(await item(label).count(), 1);
|
||||||
for (const label of ['Rename…', 'Move file to…', 'Open in default app']) assert.equal(await item(label).count(), 0);
|
for (const label of ['Rename…', 'Move file to…', 'Open in default app']) assert.equal(await item(label).count(), 0);
|
||||||
await page.screenshot({ path: `${output}/workspace-link-${theme}.png` });
|
await page.screenshot({ path: `${output}/workspace-link-${theme}.png` });
|
||||||
await dismiss();
|
await dismiss();
|
||||||
@@ -76,7 +76,7 @@ await runSmoke("links/linkMenus", async ({ page }) => {
|
|||||||
await writerMenu('Workspace note');
|
await writerMenu('Workspace note');
|
||||||
await item('Copy path').focus(); await page.keyboard.press('ArrowRight'); await item('Workspace path').click();
|
await item('Copy path').focus(); await page.keyboard.press('ArrowRight'); await item('Workspace path').click();
|
||||||
await page.waitForFunction(() => window.__TEST__.clipboard === 'b.md');
|
await page.waitForFunction(() => window.__TEST__.clipboard === 'b.md');
|
||||||
await writerMenu('Workspace note'); await item('Show in system explorer').click(); await page.waitForFunction(() => window.__TEST__.revealed === 'b.md');
|
await writerMenu('Workspace note'); await item('Show in Explorer').click(); await page.waitForFunction(() => window.__TEST__.revealed === 'b.md');
|
||||||
await writerMenu('Workspace note'); await item('Reveal file in navigation').click();
|
await writerMenu('Workspace note'); await item('Reveal file in navigation').click();
|
||||||
await page.waitForFunction(() => document.activeElement?.getAttribute('data-tree-rel') === 'b.md');
|
await page.waitForFunction(() => document.activeElement?.getAttribute('data-tree-rel') === 'b.md');
|
||||||
await chooseView(page, 'Read');
|
await chooseView(page, 'Read');
|
||||||
|
|||||||
@@ -123,7 +123,13 @@ await runSmoke("tables/drag", async ({ page }) => {
|
|||||||
await page.keyboard.press('Control+z');
|
await page.keyboard.press('Control+z');
|
||||||
assert.deepEqual(await rows(), ['Alpha edited', 'Beta', 'Gamma', 'Delta']);
|
assert.deepEqual(await rows(), ['Alpha edited', 'Beta', 'Gamma', 'Delta']);
|
||||||
// Keep column handles aligned when a narrow table viewport scrolls.
|
// Keep column handles aligned when a narrow table viewport scrolls.
|
||||||
|
// At 760 pixels the side panes give way. The test opens both again, so the table pane stays narrow.
|
||||||
await page.setViewportSize({ width: 760, height: 700 });
|
await page.setViewportSize({ width: 760, height: 700 });
|
||||||
|
await page.locator('aside.left').waitFor({ state: 'detached' });
|
||||||
|
await page.keyboard.press('Control+Backslash');
|
||||||
|
await page.locator('aside.left').waitFor();
|
||||||
|
await page.getByRole('button', { name: 'Show outline', exact: true }).click();
|
||||||
|
await page.locator('aside.right').waitFor();
|
||||||
await table.locator('th').first().scrollIntoViewIfNeeded();
|
await table.locator('th').first().scrollIntoViewIfNeeded();
|
||||||
await grip('column', 0);
|
await grip('column', 0);
|
||||||
const viewport = await page.locator('.writer-table .md-table-scroll').boundingBox();
|
const viewport = await page.locator('.writer-table .md-table-scroll').boundingBox();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ await runSmoke("tabs/menus", async ({ page }) => {
|
|||||||
await item("Workspace path").click();
|
await item("Workspace path").click();
|
||||||
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "d.md");
|
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "d.md");
|
||||||
await show("d.md");
|
await show("d.md");
|
||||||
await item("Show in system explorer").click();
|
await item("Show in Explorer").click();
|
||||||
assert.equal(await page.evaluate(() => window.__TEST__.revealed), "d.md");
|
assert.equal(await page.evaluate(() => window.__TEST__.revealed), "d.md");
|
||||||
await show("d.md");
|
await show("d.md");
|
||||||
await item("Rename…").click();
|
await item("Rename…").click();
|
||||||
|
|||||||
@@ -48,9 +48,12 @@ await runSmoke("tree/actions", async ({ page }) => {
|
|||||||
await page.goto(smokeUrl);
|
await page.goto(smokeUrl);
|
||||||
await row("notes").waitFor();
|
await row("notes").waitFor();
|
||||||
}
|
}
|
||||||
|
// A name of the form "Copy path › Workspace path" opens a submenu first.
|
||||||
async function action(path, name) {
|
async function action(path, name) {
|
||||||
await row(path).click({ button: "right" });
|
await row(path).click({ button: "right" });
|
||||||
await page.getByRole("menuitem", { name, exact: true }).click();
|
const [first, second] = name.split(" › ");
|
||||||
|
if (second) await page.getByRole("menuitem", { name: first, exact: true }).hover();
|
||||||
|
await page.getByRole("menuitem", { name: second ?? first, exact: true }).click();
|
||||||
await settle();
|
await settle();
|
||||||
}
|
}
|
||||||
async function selectFiles() {
|
async function selectFiles() {
|
||||||
@@ -76,9 +79,9 @@ await runSmoke("tree/actions", async ({ page }) => {
|
|||||||
assert.deepEqual(await selected(), ["a.md", "b.md"]);
|
assert.deepEqual(await selected(), ["a.md", "b.md"]);
|
||||||
assert.equal(await page.getByRole("menuitem", { name: "Rename", exact: true }).isDisabled(), true);
|
assert.equal(await page.getByRole("menuitem", { name: "Rename", exact: true }).isDisabled(), true);
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
await action("a.md", "Copy workspace paths");
|
await action("a.md", "Copy path › Workspace path");
|
||||||
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "a.md\nb.md");
|
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "a.md\nb.md");
|
||||||
await action("b.md", "Copy system paths");
|
await action("b.md", "Copy path › System path");
|
||||||
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "C:\\tree-actions-test\\a.md\nC:\\tree-actions-test\\b.md");
|
assert.equal(await page.evaluate(() => window.__TEST__.clipboard), "C:\\tree-actions-test\\a.md\nC:\\tree-actions-test\\b.md");
|
||||||
await action("a.md", "Show in Explorer");
|
await action("a.md", "Show in Explorer");
|
||||||
assert.deepEqual((await calls("workspace_reveal")).map(args => args.rel), ["a.md", "b.md"]);
|
assert.deepEqual((await calls("workspace_reveal")).map(args => args.rel), ["a.md", "b.md"]);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Tree rename keeps pins and bookmarks: the file menu offers Copy system path, and Undo rename, Ctrl+Z, and Ctrl+Y restore the marks.
|
// Tree rename keeps pins and bookmarks: the file menu offers Copy path › System path, and Undo rename, Ctrl+Z, and Ctrl+Y restore the marks.
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||||
|
|
||||||
@@ -22,8 +22,9 @@ await runSmoke("tree/renameMarks", async ({ page }) => {
|
|||||||
const item = name => page.getByRole("menuitem", { name, exact: true });
|
const item = name => page.getByRole("menuitem", { name, exact: true });
|
||||||
await page.goto(smokeUrl);
|
await page.goto(smokeUrl);
|
||||||
await row("a.md").click({ button: "right" });
|
await row("a.md").click({ button: "right" });
|
||||||
assert.equal(await item("Copy path").count(), 0);
|
// The file menu copies paths through the Copy path submenu, as the tab menu does.
|
||||||
assert.equal(await item("Copy system path").count(), 1);
|
await item("Copy path").hover();
|
||||||
|
assert.equal(await item("System path").count(), 1);
|
||||||
await item("Rename").click();
|
await item("Rename").click();
|
||||||
await page.locator(".tree input").fill("renamed.md");
|
await page.locator(".tree input").fill("renamed.md");
|
||||||
await page.locator(".tree input").press("Enter");
|
await page.locator(".tree input").press("Enter");
|
||||||
@@ -38,5 +39,5 @@ await runSmoke("tree/renameMarks", async ({ page }) => {
|
|||||||
await row("a.md").focus();
|
await row("a.md").focus();
|
||||||
await page.keyboard.press("Control+y");
|
await page.keyboard.press("Control+y");
|
||||||
await row("renamed.md").waitFor();
|
await row("renamed.md").waitFor();
|
||||||
console.log("PASS: Copy system path, rename, Undo rename, and Ctrl+Z and Ctrl+Y with marks");
|
console.log("PASS: Copy path › System path, rename, Undo rename, and Ctrl+Z and Ctrl+Y with marks");
|
||||||
}, { viewport: { width: 1200, height: 850 } });
|
}, { viewport: { width: 1200, height: 850 } });
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ await runSmoke("tree/renameSelection", async ({ page }) => {
|
|||||||
await row("notes").waitFor();
|
await row("notes").waitFor();
|
||||||
for (const [theme, width] of [["dark", 1440], ["light", 620]]) {
|
for (const [theme, width] of [["dark", 1440], ["light", 620]]) {
|
||||||
await page.setViewportSize({ width, height: 850 });
|
await page.setViewportSize({ width, height: 850 });
|
||||||
|
// The side pane gives way below 800 pixels. The test opens it again.
|
||||||
|
if (width < 800) { await page.locator("aside.left").waitFor({ state: "detached" }); await page.keyboard.press("Control+Backslash"); await row("a.md").waitFor(); }
|
||||||
await page.evaluate(theme => { document.documentElement.dataset.theme = theme; document.documentElement.dataset.palette = "default"; }, theme);
|
await page.evaluate(theme => { document.documentElement.dataset.theme = theme; document.documentElement.dataset.palette = "default"; }, theme);
|
||||||
await row("a.md").click();
|
await row("a.md").click();
|
||||||
await row("a.md").focus();
|
await row("a.md").focus();
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ await runSmoke('tree/renameUndo', async ({ browser }) => {
|
|||||||
await page.keyboard.press('Escape'); await page.keyboard.press('Escape');
|
await page.keyboard.press('Escape'); await page.keyboard.press('Escape');
|
||||||
}
|
}
|
||||||
await page.setViewportSize({ width: 600, height: 600 });
|
await page.setViewportSize({ width: 600, height: 600 });
|
||||||
|
// The side pane gives way below 800 pixels. The test opens it again.
|
||||||
|
await page.locator('aside.left').waitFor({ state: 'detached' });
|
||||||
|
await page.keyboard.press('Control+Backslash');
|
||||||
|
await page.locator('aside.left').waitFor();
|
||||||
await paneMenu(); await item('New note').focus(); await page.keyboard.press('ArrowRight');
|
await paneMenu(); await item('New note').focus(); await page.keyboard.press('ArrowRight');
|
||||||
await shot(page, 'note-menu-dark-narrow.png');
|
await shot(page, 'note-menu-dark-narrow.png');
|
||||||
assert.ok(await item('Manage templates…').evaluate(node => node.getBoundingClientRect().right <= innerWidth));
|
assert.ok(await item('Manage templates…').evaluate(node => node.getBoundingClientRect().right <= innerWidth));
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ await runSmoke(name, async ({ page }) => {
|
|||||||
|
|
||||||
await page.evaluate(() => { for (let i = 0; i < 40; i++) window.__TEST__.files.set(`.runestone/templates/Long template name ${i}.md`, "# Template"); });
|
await page.evaluate(() => { for (let i = 0; i < 40; i++) window.__TEST__.files.set(`.runestone/templates/Long template name ${i}.md`, "# Template"); });
|
||||||
await page.setViewportSize({ width: 600, height: 600 });
|
await page.setViewportSize({ width: 600, height: 600 });
|
||||||
|
// The side pane gives way below 800 pixels. The test opens it again.
|
||||||
|
await page.locator("aside.left").waitFor({ state: "detached" });
|
||||||
|
await page.keyboard.press("Control+Backslash");
|
||||||
|
await page.locator("aside.left").waitFor();
|
||||||
await openManager();
|
await openManager();
|
||||||
assert.ok(await page.locator("dialog .list").evaluate(node => node.scrollHeight > node.clientHeight), "Long template list scrolls");
|
assert.ok(await page.locator("dialog .list").evaluate(node => node.scrollHeight > node.clientHeight), "Long template list scrolls");
|
||||||
await page.screenshot({ path: path.join(output, "templates-narrow-long.png") });
|
await page.screenshot({ path: path.join(output, "templates-narrow-long.png") });
|
||||||
|
|||||||
@@ -46,11 +46,12 @@ await runSmoke("workspace/session", async ({ page }) => {
|
|||||||
|
|
||||||
await page.getByRole("button", { name: "Bookmarks", exact: true }).click();
|
await page.getByRole("button", { name: "Bookmarks", exact: true }).click();
|
||||||
const bookmarks = page.locator(".pane").filter({ hasText: "Bookmarks" });
|
const bookmarks = page.locator(".pane").filter({ hasText: "Bookmarks" });
|
||||||
await bookmarks.getByText("notes/renamed.md").waitFor();
|
// A bookmark shows the file name and its folder, with the full path in its tooltip.
|
||||||
|
await bookmarks.locator('button[title="notes/renamed.md"]').waitFor();
|
||||||
// Another window bookmarks a second note. The watcher reports the marks file.
|
// Another window bookmarks a second note. The watcher reports the marks file.
|
||||||
await page.evaluate(() => window.__TEST__.files.set(".runestone/marks.json", JSON.stringify({ pins: ["notes/renamed.md"], bookmarks: ["notes/renamed.md", "notes/other.md"], order: {} })));
|
await page.evaluate(() => window.__TEST__.files.set(".runestone/marks.json", JSON.stringify({ pins: ["notes/renamed.md"], bookmarks: ["notes/renamed.md", "notes/other.md"], order: {} })));
|
||||||
await emit("modify", [".runestone/marks.json"]);
|
await emit("modify", [".runestone/marks.json"]);
|
||||||
await bookmarks.getByText("notes/other.md").waitFor();
|
await bookmarks.locator('button[title="notes/other.md"]').waitFor();
|
||||||
await page.getByRole("button", { name: "Files", exact: true }).click();
|
await page.getByRole("button", { name: "Files", exact: true }).click();
|
||||||
|
|
||||||
// A note that another program creates appears in the tree and in the backlinks, without a rescan.
|
// A note that another program creates appears in the tree and in the backlinks, without a rescan.
|
||||||
|
|||||||
Reference in New Issue
Block a user