feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,67 @@
|
||||
import Setting from '../../models/Setting';
|
||||
|
||||
let fields: string[] = null;
|
||||
let perFieldReverse: { [field: string]: boolean } = null;
|
||||
|
||||
export const notesSortOrderFieldArray = (): string[] => {
|
||||
// The order of the fields is strictly determinate.
|
||||
if (fields === null) {
|
||||
fields = Setting.enumOptionValues('notes.sortOrder.field').sort().reverse();
|
||||
}
|
||||
return fields;
|
||||
};
|
||||
|
||||
export const notesSortOrderNextField = (currentField: string) => {
|
||||
const fields = notesSortOrderFieldArray();
|
||||
const index = fields.indexOf(currentField);
|
||||
if (index < 0) {
|
||||
return currentField;
|
||||
} else {
|
||||
return fields[(index + 1) % fields.length];
|
||||
}
|
||||
};
|
||||
|
||||
export const setNotesSortOrder = (field?: string, reverse?: boolean) => {
|
||||
// field: Sort order's field. undefined means changing a field cyclically.
|
||||
// reverse: whether the sort order is reversed or not. undefined means toggling.
|
||||
let nextField = field;
|
||||
let nextReverse = reverse;
|
||||
const currentField = Setting.value('notes.sortOrder.field');
|
||||
const currentReverse = Setting.value('notes.sortOrder.reverse');
|
||||
const enabled = Setting.value('notes.perFieldReversalEnabled');
|
||||
if (enabled) {
|
||||
if (perFieldReverse === null) {
|
||||
perFieldReverse = { ...Setting.value('notes.perFieldReverse') };
|
||||
}
|
||||
}
|
||||
if (typeof field === 'undefined') {
|
||||
if (typeof reverse === 'undefined') {
|
||||
// If both arguments are undefined, the next field is selected.
|
||||
nextField = notesSortOrderNextField(currentField);
|
||||
} else {
|
||||
nextField = currentField;
|
||||
}
|
||||
}
|
||||
if (typeof reverse === 'undefined') {
|
||||
if (enabled && perFieldReverse.hasOwnProperty(nextField)) {
|
||||
nextReverse = !!perFieldReverse[nextField];
|
||||
} else {
|
||||
nextReverse = currentReverse;
|
||||
}
|
||||
}
|
||||
if (currentField !== nextField) {
|
||||
Setting.setValue('notes.sortOrder.field', nextField);
|
||||
}
|
||||
if (currentReverse !== nextReverse) {
|
||||
Setting.setValue('notes.sortOrder.reverse', nextReverse);
|
||||
}
|
||||
if (enabled) {
|
||||
// nextField is sane here.
|
||||
nextReverse = !!nextReverse;
|
||||
if (perFieldReverse[nextField] !== nextReverse) {
|
||||
perFieldReverse[nextField] = nextReverse;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Partial refactor of old code before rule was applied
|
||||
Setting.setValue('notes.perFieldReverse', { ...perFieldReverse } as any);
|
||||
}
|
||||
}
|
||||
};
|
||||
在新工单中引用
屏蔽一个用户