mirror of
https://github.com/zadam/trilium.git
synced 2025-12-07 07:54:26 +01:00
Compare commits
23 Commits
3aa5b3f31e
...
ae5d6f828b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae5d6f828b | ||
|
|
3cc64b5764 | ||
|
|
19cf07564f | ||
|
|
5847ce5c14 | ||
|
|
a7ad45635e | ||
|
|
781215394e | ||
|
|
0aafdca999 | ||
|
|
18d3cb6f0c | ||
|
|
263a96e8b7 | ||
|
|
27d5009486 | ||
|
|
d51a0d415b | ||
|
|
a79c8b4add | ||
|
|
b359b48ec3 | ||
|
|
a0e1cc4154 | ||
|
|
625c0ed7dc | ||
|
|
1ac241ad1b | ||
|
|
2c447a4293 | ||
|
|
6c1886c5ca | ||
|
|
9c86145ff8 | ||
|
|
6dcc3a7e81 | ||
|
|
921b56a89e | ||
|
|
9d0b532aeb | ||
|
|
cc468d964f |
@ -8,6 +8,7 @@ import Color, { ColorInstance } from "color";
|
|||||||
import Debouncer from "../../utils/debouncer";
|
import Debouncer from "../../utils/debouncer";
|
||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import froca from "../../services/froca";
|
import froca from "../../services/froca";
|
||||||
|
import { isMobile } from "../../services/utils";
|
||||||
|
|
||||||
const COLOR_PALETTE = [
|
const COLOR_PALETTE = [
|
||||||
"#e64d4d", "#e6994d", "#e5e64d", "#99e64d", "#4de64d", "#4de699",
|
"#e64d4d", "#e6994d", "#e5e64d", "#99e64d", "#4de64d", "#4de699",
|
||||||
@ -128,7 +129,6 @@ function CustomColorCell(props: ColorCellProps) {
|
|||||||
const colorInput = useRef<HTMLInputElement>(null);
|
const colorInput = useRef<HTMLInputElement>(null);
|
||||||
const colorInputDebouncer = useRef<Debouncer<string | null> | null>(null);
|
const colorInputDebouncer = useRef<Debouncer<string | null> | null>(null);
|
||||||
const callbackRef = useRef(props.onSelect);
|
const callbackRef = useRef(props.onSelect);
|
||||||
const isSafari = useRef(/^((?!chrome|android).)*safari/i.test(navigator.userAgent));
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
colorInputDebouncer.current = new Debouncer(250, (color) => {
|
colorInputDebouncer.current = new Debouncer(250, (color) => {
|
||||||
@ -160,11 +160,11 @@ function CustomColorCell(props: ColorCellProps) {
|
|||||||
}, [pickedColor]);
|
}, [pickedColor]);
|
||||||
|
|
||||||
return <div style={`--foreground: ${getForegroundColor(props.color)};`}
|
return <div style={`--foreground: ${getForegroundColor(props.color)};`}
|
||||||
onClick={(e) => {
|
onClick={isMobile() ? (e) => {
|
||||||
// The color picker dropdown will close on Safari if the parent context menu is
|
// The color picker dropdown will close on some browser if the parent context menu is
|
||||||
// dismissed, so stop the click propagation to prevent dismissing the menu.
|
// dismissed, so stop the click propagation to prevent dismissing the menu.
|
||||||
isSafari.current && e.stopPropagation();
|
e.stopPropagation();
|
||||||
}}>
|
} : undefined}>
|
||||||
<ColorCell {...props}
|
<ColorCell {...props}
|
||||||
color={pickedColor}
|
color={pickedColor}
|
||||||
className={clsx("custom-color-cell", {
|
className={clsx("custom-color-cell", {
|
||||||
|
|||||||
@ -1316,7 +1316,7 @@ body.mobile #context-menu-container.mobile-bottom-menu {
|
|||||||
inset-inline-end: 0 !important;
|
inset-inline-end: 0 !important;
|
||||||
bottom: 0 !important;
|
bottom: 0 !important;
|
||||||
top: unset !important;
|
top: unset !important;
|
||||||
max-height: 70vh;
|
max-height: 90vh;
|
||||||
overflow: auto !important;
|
overflow: auto !important;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
|||||||
@ -119,17 +119,6 @@ body.backdrop-effects-disabled {
|
|||||||
font-size: 0.9rem !important;
|
font-size: 0.9rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mobile .dropdown-menu {
|
|
||||||
backdrop-filter: var(--dropdown-backdrop-filter);
|
|
||||||
border-radius: var(--dropdown-border-radius);
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.mobile .dropdown-menu .dropdown-menu {
|
|
||||||
backdrop-filter: unset !important;
|
|
||||||
border-radius: unset !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.desktop .dropdown-menu::before,
|
body.desktop .dropdown-menu::before,
|
||||||
:root .ck.ck-dropdown__panel::before,
|
:root .ck.ck-dropdown__panel::before,
|
||||||
:root .excalidraw .popover::before,
|
:root .excalidraw .popover::before,
|
||||||
@ -157,17 +146,12 @@ body.desktop .dropdown-submenu .dropdown-menu::before {
|
|||||||
content: unset;
|
content: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mobile .dropdown-submenu .dropdown-menu {
|
|
||||||
background: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.desktop .dropdown-submenu .dropdown-menu {
|
body.desktop .dropdown-submenu .dropdown-menu {
|
||||||
backdrop-filter: var(--dropdown-backdrop-filter);
|
backdrop-filter: var(--dropdown-backdrop-filter);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-item,
|
.dropdown-item,
|
||||||
body.mobile .dropdown-submenu .dropdown-toggle,
|
|
||||||
.excalidraw .context-menu .context-menu-item {
|
.excalidraw .context-menu .context-menu-item {
|
||||||
--menu-item-start-padding: 8px;
|
--menu-item-start-padding: 8px;
|
||||||
--menu-item-end-padding: 22px;
|
--menu-item-end-padding: 22px;
|
||||||
@ -201,10 +185,6 @@ body.mobile .dropdown-item:not(:last-of-type) {
|
|||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mobile .dropdown-submenu:hover {
|
|
||||||
background: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
html body .dropdown-item.disabled,
|
html body .dropdown-item.disabled,
|
||||||
html body .dropdown-item[disabled] {
|
html body .dropdown-item[disabled] {
|
||||||
color: var(--menu-text-color) !important;
|
color: var(--menu-text-color) !important;
|
||||||
@ -322,13 +302,25 @@ body.desktop .dropdown-menu.static .dropdown-item.active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* #region Mobile tweaks for dropdown menus */
|
/* #region Mobile tweaks for dropdown menus */
|
||||||
|
body.mobile #context-menu-cover {
|
||||||
|
transition: background-color 150ms ease-in;
|
||||||
|
|
||||||
|
&.show {
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body.mobile .dropdown-menu {
|
body.mobile .dropdown-menu {
|
||||||
--dropdown-menu-padding-vertical: 0.7em;
|
--dropdown-menu-padding-vertical: 0.7em;
|
||||||
--dropdown-menu-padding-horizontal: 1em;
|
--dropdown-menu-padding-horizontal: 1em;
|
||||||
|
--hover-item-background-color: var(--card-background-color);
|
||||||
font-size: 1em !important;
|
font-size: 1em !important;
|
||||||
|
backdrop-filter: var(--dropdown-backdrop-filter);
|
||||||
|
border-radius: var(--dropdown-border-radius) var(--dropdown-border-radius) 0 0;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.dropdown-toggle::after {
|
.dropdown-toggle::after {
|
||||||
top: var(--dropdown-menu-padding-vertical);
|
top: 0.5em;
|
||||||
right: var(--dropdown-menu-padding-horizontal);
|
right: var(--dropdown-menu-padding-horizontal);
|
||||||
transform: translateX(50%) rotate(90deg);
|
transform: translateX(50%) rotate(90deg);
|
||||||
}
|
}
|
||||||
@ -366,6 +358,37 @@ body.mobile .dropdown-menu {
|
|||||||
.dropdown-divider {
|
.dropdown-divider {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-submenu {
|
||||||
|
padding: 0 !important;
|
||||||
|
backdrop-filter: unset !important;
|
||||||
|
|
||||||
|
.dropdown-toggle {
|
||||||
|
padding: var(--dropdown-menu-padding-vertical) var(--dropdown-menu-padding-horizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
--menu-background-color: rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 0;
|
||||||
|
max-height: 0;
|
||||||
|
transition: max-height 100ms ease-in;
|
||||||
|
display: block !important;
|
||||||
|
|
||||||
|
&.show {
|
||||||
|
max-height: 1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-item {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.submenu-open {
|
||||||
|
.dropdown-toggle {
|
||||||
|
padding-bottom: var(--dropdown-menu-padding-vertical);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* #endregion */
|
/* #endregion */
|
||||||
|
|
||||||
|
|||||||
@ -385,6 +385,7 @@
|
|||||||
"workspace_template": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
|
"workspace_template": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
|
||||||
"search_home": "new search notes will be created as children of this note",
|
"search_home": "new search notes will be created as children of this note",
|
||||||
"workspace_search_home": "new search notes will be created as children of this note when hoisted to some ancestor of this workspace note",
|
"workspace_search_home": "new search notes will be created as children of this note when hoisted to some ancestor of this workspace note",
|
||||||
|
"auto_execute_search": "Automatically executes the search defined in a saved search note and switches to the Collection Properties tab if any notes match the query",
|
||||||
"inbox": "default inbox location for new notes - when you create a note using \"new note\" button in the sidebar, notes will be created as child notes in the note marked as with <code>#inbox</code> label.",
|
"inbox": "default inbox location for new notes - when you create a note using \"new note\" button in the sidebar, notes will be created as child notes in the note marked as with <code>#inbox</code> label.",
|
||||||
"workspace_inbox": "default inbox location for new notes when hoisted to some ancestor of this workspace note",
|
"workspace_inbox": "default inbox location for new notes when hoisted to some ancestor of this workspace note",
|
||||||
"sql_console_home": "default location of SQL console notes",
|
"sql_console_home": "default location of SQL console notes",
|
||||||
|
|||||||
@ -236,6 +236,7 @@ const ATTR_HELP: Record<string, Record<string, string>> = {
|
|||||||
workspaceTemplate: t("attribute_detail.workspace_template"),
|
workspaceTemplate: t("attribute_detail.workspace_template"),
|
||||||
searchHome: t("attribute_detail.search_home"),
|
searchHome: t("attribute_detail.search_home"),
|
||||||
workspaceSearchHome: t("attribute_detail.workspace_search_home"),
|
workspaceSearchHome: t("attribute_detail.workspace_search_home"),
|
||||||
|
autoExecuteSearch: t("attribute_detail.auto_execute_search"),
|
||||||
inbox: t("attribute_detail.inbox"),
|
inbox: t("attribute_detail.inbox"),
|
||||||
workspaceInbox: t("attribute_detail.workspace_inbox"),
|
workspaceInbox: t("attribute_detail.workspace_inbox"),
|
||||||
sqlConsoleHome: t("attribute_detail.sql_console_home"),
|
sqlConsoleHome: t("attribute_detail.sql_console_home"),
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
|
|||||||
import { getErrorMessage } from "../../services/utils";
|
import { getErrorMessage } from "../../services/utils";
|
||||||
import "./SearchDefinitionTab.css";
|
import "./SearchDefinitionTab.css";
|
||||||
|
|
||||||
export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext) {
|
export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }: TabContext) {
|
||||||
const parentComponent = useContext(ParentComponent);
|
const parentComponent = useContext(ParentComponent);
|
||||||
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
|
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
|
||||||
const [ error, setError ] = useState<{ message: string }>();
|
const [ error, setError ] = useState<{ message: string }>();
|
||||||
@ -73,6 +73,27 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function autoExecute() {
|
||||||
|
if (!note || note.type !== "search" || !note.hasLabel("autoExecuteSearch")) {
|
||||||
|
executionState.save("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastExecutedNoteId = executionState.load();
|
||||||
|
if (lastExecutedNoteId !== note.noteId) {
|
||||||
|
executionState.save(note.noteId);
|
||||||
|
|
||||||
|
await refreshResults();
|
||||||
|
|
||||||
|
if (noteContext?.viewScope?.viewMode === "default" && note.children.length > 0) {
|
||||||
|
parentComponent?.triggerCommand("toggleRibbonTabBookProperties", {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
autoExecute();
|
||||||
|
}, [note]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="search-definition-widget">
|
<div className="search-definition-widget">
|
||||||
<div className="search-settings">
|
<div className="search-settings">
|
||||||
@ -160,6 +181,14 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const executionState = function() {
|
||||||
|
let lastAutoExecutedSearchNoteId = "";
|
||||||
|
return {
|
||||||
|
load: () => lastAutoExecutedSearchNoteId,
|
||||||
|
save: (noteId: string) => lastAutoExecutedSearchNoteId = noteId,
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
function BulkActionsList({ note }: { note: FNote }) {
|
function BulkActionsList({ note }: { note: FNote }) {
|
||||||
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();
|
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,8 @@ async function register(app: express.Application) {
|
|||||||
appType: "custom",
|
appType: "custom",
|
||||||
cacheDir: path.join(srcRoot, "../../.cache/vite"),
|
cacheDir: path.join(srcRoot, "../../.cache/vite"),
|
||||||
base: `/${assetUrlFragment}/`,
|
base: `/${assetUrlFragment}/`,
|
||||||
root: clientDir
|
root: clientDir,
|
||||||
|
css: { devSourcemap: true }
|
||||||
});
|
});
|
||||||
app.use(`/${assetUrlFragment}/`, (req, res, next) => {
|
app.use(`/${assetUrlFragment}/`, (req, res, next) => {
|
||||||
req.url = `/${assetUrlFragment}` + req.url;
|
req.url = `/${assetUrlFragment}` + req.url;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -23,6 +23,7 @@ type Labels = {
|
|||||||
ancestorDepth: string;
|
ancestorDepth: string;
|
||||||
orderBy: string;
|
orderBy: string;
|
||||||
orderDirection: string;
|
orderDirection: string;
|
||||||
|
autoExecuteSearch: boolean;
|
||||||
|
|
||||||
// Collection-specific
|
// Collection-specific
|
||||||
viewType: string;
|
viewType: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user