mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
theme: support code-block css in builder
This commit is contained in:
@@ -45,14 +45,15 @@ const JSON_SCHEMA_URL =
|
|||||||
"https://raw.githubusercontent.com/streetwriters/notesnook-themes/main/schemas/v1.schema.json";
|
"https://raw.githubusercontent.com/streetwriters/notesnook-themes/main/schemas/v1.schema.json";
|
||||||
const ThemeInfoTemplate: Omit<
|
const ThemeInfoTemplate: Omit<
|
||||||
ThemeDefinition,
|
ThemeDefinition,
|
||||||
"authors" | "compatibilityVersion" | "colorScheme" | "codeBlockCSS" | "scopes"
|
"authors" | "compatibilityVersion" | "colorScheme" | "scopes"
|
||||||
> = {
|
> = {
|
||||||
name: "",
|
name: "",
|
||||||
id: "",
|
id: "",
|
||||||
version: 0,
|
version: 0,
|
||||||
license: "",
|
license: "",
|
||||||
homepage: "",
|
homepage: "",
|
||||||
description: ""
|
description: "",
|
||||||
|
codeBlockCSS: "https://github.com/PrismJS/prism-themes/tree/master/themes"
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ThemeBuilder() {
|
export default function ThemeBuilder() {
|
||||||
@@ -303,7 +304,7 @@ export default function ThemeBuilder() {
|
|||||||
paddingX: "10px"
|
paddingX: "10px"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(ThemeInfoTemplate).map((key) => {
|
{Object.keys(ThemeInfoTemplate).map((key: string) => {
|
||||||
return (
|
return (
|
||||||
<Field
|
<Field
|
||||||
key={`${getThemeKey(currentTheme)}-${key}`}
|
key={`${getThemeKey(currentTheme)}-${key}`}
|
||||||
@@ -356,7 +357,7 @@ export default function ThemeBuilder() {
|
|||||||
key="compatibilityVersion"
|
key="compatibilityVersion"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{authors.map((author, index) => (
|
{authors.map((author, index: number) => (
|
||||||
<Flex
|
<Flex
|
||||||
key={`${getThemeKey(currentTheme)}-${author.name}`}
|
key={`${getThemeKey(currentTheme)}-${author.name}`}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -695,7 +696,10 @@ function getThemeFromFormData(
|
|||||||
function toTitleCase(value: string) {
|
function toTitleCase(value: string) {
|
||||||
return (
|
return (
|
||||||
value.slice(0, 1).toUpperCase() +
|
value.slice(0, 1).toUpperCase() +
|
||||||
value.slice(1).replace(/([A-Z]+)*([A-Z][a-z])/g, "$1 $2")
|
value
|
||||||
|
.slice(1)
|
||||||
|
.replace(/([A-Z]+)/g, " $1")
|
||||||
|
.replace(/([A-Z][a-z])/g, " $1")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user