mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
Merge remote-tracking branch 'origin/main' into react/type_widgets
This commit is contained in:
@@ -49,4 +49,9 @@ export interface HiddenSubtreeItem {
|
||||
* the user moves it around.
|
||||
*/
|
||||
enforceBranches?: boolean;
|
||||
/**
|
||||
* If set to true, then the attributes of this note will be checked. Any owned attribute that does not match the
|
||||
* definitions will be removed.
|
||||
*/
|
||||
enforceAttributes?: boolean;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ export interface Locale {
|
||||
rtl?: boolean;
|
||||
/** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
|
||||
contentOnly?: boolean;
|
||||
/** `true` if the language should only be visible while in development mode, and not in production. */
|
||||
devOnly?: boolean;
|
||||
/** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
|
||||
electronLocale?: "en" | "de" | "es" | "fr" | "zh_CN" | "zh_TW" | "ro" | "af" | "am" | "ar" | "bg" | "bn" | "ca" | "cs" | "da" | "el" | "en_GB" | "es_419" | "et" | "fa" | "fi" | "fil" | "gu" | "he" | "hi" | "hr" | "hu" | "id" | "it" | "ja" | "kn" | "ko" | "lt" | "lv" | "ml" | "mr" | "ms" | "nb" | "nl" | "pl" | "pt_BR" | "pt_PT" | "ru" | "sk" | "sl" | "sr" | "sv" | "sw" | "ta" | "te" | "th" | "tr" | "uk" | "ur" | "vi";
|
||||
}
|
||||
|
||||
const UNSORTED_LOCALES: Locale[] = [
|
||||
const UNSORTED_LOCALES = [
|
||||
{ id: "cn", name: "简体中文", electronLocale: "zh_CN" },
|
||||
{ id: "de", name: "Deutsch", electronLocale: "de" },
|
||||
{ id: "en", name: "English", electronLocale: "en" },
|
||||
@@ -17,11 +19,25 @@ const UNSORTED_LOCALES: Locale[] = [
|
||||
{ id: "fr", name: "Français", electronLocale: "fr" },
|
||||
{ id: "ja", name: "日本語", electronLocale: "ja" },
|
||||
{ id: "pt_br", name: "Português (Brasil)", electronLocale: "pt_BR" },
|
||||
{ id: "pt", name: "Português (Portugal)", electronLocale: "pt_PT" },
|
||||
{ id: "ro", name: "Română", electronLocale: "ro" },
|
||||
{ id: "ru", name: "Русский", electronLocale: "ru" },
|
||||
{ id: "tw", name: "繁體中文", electronLocale: "zh_TW" },
|
||||
{ id: "uk", name: "Українська", electronLocale: "uk" },
|
||||
|
||||
/**
|
||||
* Development-only languages.
|
||||
*
|
||||
* These are only displayed while in dev mode, to test some language particularities (such as RTL) more easily.
|
||||
*/
|
||||
{
|
||||
id: "en_rtl",
|
||||
name: "English (right-to-left) [dev]",
|
||||
electronLocale: "en",
|
||||
rtl: true,
|
||||
devOnly: true
|
||||
},
|
||||
|
||||
/*
|
||||
* Right to left languages
|
||||
*
|
||||
@@ -31,7 +47,8 @@ const UNSORTED_LOCALES: Locale[] = [
|
||||
id: "ar",
|
||||
name: "اَلْعَرَبِيَّةُ",
|
||||
rtl: true,
|
||||
contentOnly: true
|
||||
devOnly: true,
|
||||
electronLocale: "ar"
|
||||
},
|
||||
{ // Hebrew
|
||||
id: "he",
|
||||
@@ -56,4 +73,7 @@ const UNSORTED_LOCALES: Locale[] = [
|
||||
export const LOCALES: Locale[] = Array.from(UNSORTED_LOCALES)
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
/** A type containing a string union of all the supported locales, including those that are content-only. */
|
||||
export type LOCALE_IDS = typeof UNSORTED_LOCALES[number]["id"];
|
||||
/** A type containing a string union of all the supported locales that are not content-only (i.e. can be used as the UI language). */
|
||||
export type DISPLAYABLE_LOCALE_IDS = Exclude<typeof UNSORTED_LOCALES[number], { contentOnly: true }>["id"];
|
||||
|
||||
@@ -1,98 +1,22 @@
|
||||
// Default list of allowed HTML tags
|
||||
export const SANITIZER_DEFAULT_ALLOWED_TAGS = [
|
||||
"h1",
|
||||
"h2",
|
||||
"h3",
|
||||
"h4",
|
||||
"h5",
|
||||
"h6",
|
||||
"blockquote",
|
||||
"p",
|
||||
"a",
|
||||
"ul",
|
||||
"ol",
|
||||
"li",
|
||||
"b",
|
||||
"i",
|
||||
"strong",
|
||||
"em",
|
||||
"strike",
|
||||
"s",
|
||||
"del",
|
||||
"abbr",
|
||||
"code",
|
||||
"hr",
|
||||
"br",
|
||||
"div",
|
||||
"table",
|
||||
"thead",
|
||||
"caption",
|
||||
"tbody",
|
||||
"tfoot",
|
||||
"tr",
|
||||
"th",
|
||||
"td",
|
||||
"pre",
|
||||
"section",
|
||||
"img",
|
||||
"figure",
|
||||
"figcaption",
|
||||
"span",
|
||||
"label",
|
||||
"input",
|
||||
"details",
|
||||
"summary",
|
||||
"address",
|
||||
"aside",
|
||||
"footer",
|
||||
"header",
|
||||
"hgroup",
|
||||
"main",
|
||||
"nav",
|
||||
"dl",
|
||||
"dt",
|
||||
"menu",
|
||||
"bdi",
|
||||
"bdo",
|
||||
"dfn",
|
||||
"kbd",
|
||||
"mark",
|
||||
"q",
|
||||
"time",
|
||||
"var",
|
||||
"wbr",
|
||||
"area",
|
||||
"map",
|
||||
"track",
|
||||
"video",
|
||||
"audio",
|
||||
"picture",
|
||||
"del",
|
||||
"ins",
|
||||
"en-media", // for ENEX import
|
||||
"h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "p", "a", "ul", "ol", "li", "b", "i", "strong", "em",
|
||||
"strike", "s", "del", "abbr", "code", "hr", "br", "div", "table", "thead", "caption", "tbody", "tfoot",
|
||||
"tr", "th", "td", "pre", "section", "img", "figure", "figcaption", "span", "label", "input", "details",
|
||||
"summary", "address", "aside", "footer", "header", "hgroup", "main", "nav", "dl", "dt", "menu", "bdi",
|
||||
"bdo", "dfn", "kbd", "mark", "q", "time", "var", "wbr", "area", "map", "track", "video", "audio", "picture",
|
||||
"del", "ins",
|
||||
// for ENEX import
|
||||
"en-media",
|
||||
// Additional tags (https://github.com/TriliumNext/Trilium/issues/567)
|
||||
"acronym",
|
||||
"article",
|
||||
"big",
|
||||
"button",
|
||||
"cite",
|
||||
"col",
|
||||
"colgroup",
|
||||
"data",
|
||||
"dd",
|
||||
"fieldset",
|
||||
"form",
|
||||
"legend",
|
||||
"meter",
|
||||
"noscript",
|
||||
"option",
|
||||
"progress",
|
||||
"rp",
|
||||
"samp",
|
||||
"small",
|
||||
"sub",
|
||||
"sup",
|
||||
"template",
|
||||
"textarea",
|
||||
"tt"
|
||||
"acronym", "article", "big", "button", "cite", "col", "colgroup", "data", "dd", "fieldset", "form", "legend",
|
||||
"meter", "noscript", "option", "progress", "rp", "samp", "small", "sub", "sup", "template", "textarea", "tt"
|
||||
] as const;
|
||||
|
||||
export const ALLOWED_PROTOCOLS = [
|
||||
'http', 'https', 'ftp', 'ftps', 'mailto', 'data', 'evernote', 'file', 'facetime', 'gemini', 'git',
|
||||
'gopher', 'imap', 'irc', 'irc6', 'jabber', 'jar', 'lastfm', 'ldap', 'ldaps', 'magnet', 'message',
|
||||
'mumble', 'nfs', 'onenote', 'pop', 'rmi', 's3', 'sftp', 'skype', 'sms', 'spotify', 'steam', 'svn', 'udp',
|
||||
'view-source', 'vlc', 'vnc', 'ws', 'wss', 'xmpp', 'jdbc', 'slack', 'tel', 'smb', 'zotero', 'geo',
|
||||
'mid', 'obsidian'
|
||||
];
|
||||
|
||||
@@ -54,3 +54,11 @@ export function trimIndentation(strings: TemplateStringsArray, ...values: any[])
|
||||
}
|
||||
return output.join("\n");
|
||||
}
|
||||
|
||||
export function flushPromises() {
|
||||
return new Promise(setImmediate);
|
||||
}
|
||||
|
||||
export function sleepFor(duration: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, duration));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user