feat: add text truncation hook and marquee support (#217)
Introduce a hook to detect text truncation for dynamic UI updates Replace static marquee spans with a reusable marquee component in files and labels Enable copying of terminal selection on mouse up and touch end
This commit is contained in:
committed by
GitHub
parent
f34027df10
commit
efe9ad27b7
@@ -1,18 +1,22 @@
|
||||
import React from 'react';
|
||||
import { getSafeStorage } from '@/stores/utils/safeStorage';
|
||||
import { updateDesktopSettings } from '@/lib/persistence';
|
||||
|
||||
const SHOW_HIDDEN_STORAGE_KEY = 'directoryTreeShowHidden';
|
||||
const SHOW_HIDDEN_EVENT = 'directory-show-hidden-change';
|
||||
|
||||
const readStoredShowHidden = (): boolean => {
|
||||
if (typeof window === 'undefined') {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const stored = getSafeStorage().getItem(SHOW_HIDDEN_STORAGE_KEY);
|
||||
if (stored === null) {
|
||||
return true;
|
||||
}
|
||||
return stored === 'true';
|
||||
} catch {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,7 +27,10 @@ export const notifyDirectoryShowHiddenChanged = () => {
|
||||
window.dispatchEvent(new Event(SHOW_HIDDEN_EVENT));
|
||||
};
|
||||
|
||||
export const setDirectoryShowHidden = (value: boolean) => {
|
||||
export const setDirectoryShowHidden = (
|
||||
value: boolean,
|
||||
options: { persist?: boolean } = {}
|
||||
) => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@@ -33,6 +40,10 @@ export const setDirectoryShowHidden = (value: boolean) => {
|
||||
} catch {
|
||||
// ignore storage errors
|
||||
}
|
||||
|
||||
if (options.persist !== false) {
|
||||
void updateDesktopSettings({ directoryShowHidden: value });
|
||||
}
|
||||
};
|
||||
|
||||
export const useDirectoryShowHidden = (): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user