diff --git a/.editorconfig b/.editorconfig index 581a90859..ba9a45611 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ indent_size = 2 indent_style = space indent_size = 4 -[*.yml] +[*.{md,yml}] indent_style = space indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f4bae0cf..5cb7c4fe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,30 @@ # Changelog -## [v2.0.0-alpha.3](https://github.com/marcantondahmen/automad/commit/7403a58c8ede73b18b960191f408926901a2f7ad) +## [v2.0.0-alpha.4](https://github.com/marcantondahmen/automad/commit/3278dc38395cad81068657e12a7893ebd9e02bd6) -Thu, 29 Feb 2024 21:01:04 +0100 +Sat, 13 Apr 2024 00:08:53 +0200 + +### New Features + +- **engine**: add syntax highlighting for code blocks and markdown variables ([e9d14ae1d](https://github.com/marcantondahmen/automad/commit/e9d14ae1dcb2fce4efdd22b262ecc923364fccaa)) +- **migration**: map legacy standard theme to new standard-v1 composer package ([94b3714fb](https://github.com/marcantondahmen/automad/commit/94b3714fb6a8b56a837cd653a20087ef8b669e48)) +- **ui**: add syntax highlighting theme selection field to page and shared settings ([cf85d6ae8](https://github.com/marcantondahmen/automad/commit/cf85d6ae854bf0f0d2ed400fc388589ff02dc524)) +- add line numbers and copy button for code blocks ([ca6c70014](https://github.com/marcantondahmen/automad/commit/ca6c70014ba037a9efcd8cff9dd55a696a2a6f3a)) +- add syntax highlighting for the automad template language ([94aefa355](https://github.com/marcantondahmen/automad/commit/94aefa355e6f150f0a4078c939a51aa8aa11c973)) + +### Bugfixes + +- **blocks**: fix gallery counter and caption color ([9049b750e](https://github.com/marcantondahmen/automad/commit/9049b750e6d281aa687d60b95a79c611255f46a1)) +- **core**: set cookie path to base url ([118bd1642](https://github.com/marcantondahmen/automad/commit/118bd16423030b00dbf295b4ff8185d75af15cf5)) +- **dashboard**: fix image editor color select and modal styles ([aca720b55](https://github.com/marcantondahmen/automad/commit/aca720b5531cd15defa9f80106a8658251548c8a)) +- **dashboard**: fix missing publish button on small devices ([8678ab32e](https://github.com/marcantondahmen/automad/commit/8678ab32e66fc2e5e551e899da3c8317198e2f88)) +- **dashboard**: fix text selection colors ([1d7e3203e](https://github.com/marcantondahmen/automad/commit/1d7e3203e24a92981d3f0289cb08f539be254abf)) +- **dashboard**: open in-page edit mode in same tab ([56e89b839](https://github.com/marcantondahmen/automad/commit/56e89b839c9f01271ca3fc957d72a01ee010c521)) +- **engine**: fix missing strikethrough support in markdown fields ([f700a1be7](https://github.com/marcantondahmen/automad/commit/f700a1be79c8f048b8ebee137c8b11b5e14593fc)) + +## [v2.0.0-alpha.3](https://github.com/marcantondahmen/automad/commit/7f5ae3584e30a3c4e9c8d3430bf52a7c24e55a5a) + +Thu, 29 Feb 2024 21:03:22 +0100 ### New Features @@ -313,29 +335,3 @@ Sat, 7 Aug 2021 23:06:36 +0200 - **ui**: fix breadcrumbs position in safari ([0ed10e20d](https://github.com/marcantondahmen/automad/commit/0ed10e20d8d32f963be4d76c84d79bcf967b77c0)) - **ui**: fix status badge for outdated packages ([8b53a821f](https://github.com/marcantondahmen/automad/commit/8b53a821fa0d9cdc57af25f0eb122dc0dd312050)) - -## [v1.8.0](https://github.com/marcantondahmen/automad/commit/cbdd0e59738ad28a6a0e2c6d235d5fa886438b2c) - -Sat, 7 Aug 2021 19:45:51 +0200 - -### New Features - -- **blocks**: add option to use an image block as link ([586875ca3](https://github.com/marcantondahmen/automad/commit/586875ca31f9ec5cb273a1d0dc4de24a1c006346)) -- **blocks**: add option to use custom css classes for button blocks ([dd615b97f](https://github.com/marcantondahmen/automad/commit/dd615b97f0dc20b6f440d44d47e7e73e43483bb0)) -- **blocks**: add option to use custom css classes for section blocks ([aea1beec2](https://github.com/marcantondahmen/automad/commit/aea1beec298eacc4317389b8eb913c93a326111c)) -- **console**: add clearcache command ([f72112406](https://github.com/marcantondahmen/automad/commit/f72112406c5a79adb4c7ab26f1a3d87ae1bd87fc)) -- **console**: add purge command ([9f0ca5a83](https://github.com/marcantondahmen/automad/commit/9f0ca5a8324ffd0833161998f9b2b2bb7777f45f)) -- **system**: add check for required PHP version before updating ([c547d52af](https://github.com/marcantondahmen/automad/commit/c547d52afe2b8c5a86d9eebd1cbea1a09986b583)) -- **ui**: add autocompletion for inline link tool ([fb70070ff](https://github.com/marcantondahmen/automad/commit/fb70070ff30ce818463f6421a2f9ae374a8778f9)) -- **ui**: add site wide search and replace ([91e9ad680](https://github.com/marcantondahmen/automad/commit/91e9ad6802e3f9410364a1bed3b9de7fa1ebf023)) -- **ui**: convert search bar in top navigation into a jump bar ([0ab079586](https://github.com/marcantondahmen/automad/commit/0ab07958624b42a8cbe5f22b939483355ea39b5b)) -- **ui**: implement automatic updates of links to moved pages ([0369e52fd](https://github.com/marcantondahmen/automad/commit/0369e52fdc4eb6bacbc87e08e49d73bffc00c97a)) -- **ui**: implement automatic updates of links to renamed files ([3a26c4065](https://github.com/marcantondahmen/automad/commit/3a26c4065095e616db87b2a2df45101e6d2a58fa)) -- **ui**: verify that a given username is valid when adding accounts ([283a41a2f](https://github.com/marcantondahmen/automad/commit/283a41a2f99b59914e81b48935800cd59fbc1b41)) - -### Bugfixes - -- **theme**: fix inline link styles in blocks ([8b89e00f0](https://github.com/marcantondahmen/automad/commit/8b89e00f027372189a5a25ae5b0e7bb9409ac665)) -- **ui**: fix disabled save button after deleting unused variable field ([fe375915e](https://github.com/marcantondahmen/automad/commit/fe375915e5afaa9fb9ec4798df3c466fd0e283a5)) -- **ui**: fix position of block editor toolbar on large devices ([e19b4b983](https://github.com/marcantondahmen/automad/commit/e19b4b98356d22ed475a8f27489c1d65a26e83e2)) -- **ui**: fix switcher tab update on hashchanges ([2a6725d37](https://github.com/marcantondahmen/automad/commit/2a6725d374ffd0b575b8ce98f7a0eb14707d222e)) diff --git a/README.md b/README.md index e66cbd045..2c5a7cd5e 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,28 @@ A flat-file content management system and template engine. -![Tag](https://img.shields.io/github/v/tag/marcantondahmen/automad?include_prereleases&sort=semver&color=222222) -![PHP](https://img.shields.io/packagist/dependency-v/automad/automad/php?version=dev-master&color=222222) -![Language](https://img.shields.io/github/languages/top/marcantondahmen/automad?color=222222) -![Size](https://img.shields.io/github/languages/code-size/marcantondahmen/automad?color=222222) -![License](https://img.shields.io/github/license/marcantondahmen/automad?color=222222) +![Tag](https://img.shields.io/github/v/tag/marcantondahmen/automad?include_prereleases&sort=semver&color=151619&labelColor=1c1d20) +![PHP](https://img.shields.io/packagist/dependency-v/automad/automad/php?version=dev-master&color=151619&labelColor=1c1d20) +![Language](https://img.shields.io/github/languages/top/marcantondahmen/automad?color=151619&labelColor=1c1d20) +![Size](https://img.shields.io/github/languages/code-size/marcantondahmen/automad?color=151619&labelColor=1c1d20) +![License](https://img.shields.io/github/license/marcantondahmen/automad?color=151619&labelColor=1c1d20) [![Twitter](https://img.shields.io/twitter/follow/automadcms?label=Follow)](https://twitter.com/automadcms) -![](https://raw.githubusercontent.com/marcantondahmen/media-files/master/automad-v2/readme-light.png) +[![Screenshot](https://raw.githubusercontent.com/marcantondahmen/media-files/master/automad-v2/readme-light.png)](https://try.automad.org) ## Links -- [Documentation](https://automad.org) -- [Changelog](https://github.com/marcantondahmen/automad/blob/-/CHANGELOG.md) -- [Discussion](https://automad.org/discuss) +- [Documentation](https://automad.org) +- [Live Demo](https://try.automad.org) +- [Changelog](https://github.com/marcantondahmen/automad/blob/-/CHANGELOG.md) +- [Discussion](https://automad.org/discuss) + +## Live Demo + +In case you quickly want to try out Automad without setting up a server first, just check out the [live demo](https://try.automad.org) for free. There is no sign-up required and you can start exploring new features right in away in your personal demo instance. + +> [!IMPORTANT] +> Please note that in order to keep hosting costs under control, all demos are running on **minimal hardware** and expire after one hour. ## Installation @@ -61,6 +69,10 @@ In case you are not able to use Docker or Composer, you can also deploy Automad 2. Make sure the PHP process has the permissions to write to the document root and its subdirectories including all installed files. 3. Visit the `/dashboard` route of your site and create the first user. +## Migrating Content + +In order to migrate an old Automad installation to the new version 2, please follow the [migration giude](https://automad.org/version-2#migration) in the documentation. + ## Documentation Take a look at the [documentation](https://automad.org) to get started with Automad. @@ -77,10 +89,10 @@ Join the community, ask questions or start a discussion on the Automad [discussi In case you are interested in contributing, the following types of contribution are welcome: -- Improving [language packs](https://github.com/automadcms/automad-language-packs) by fixing translation errors or adding new languages -- [Publishing packages](https://automad.org/developer-guide/publishing-packages) like themes or extensions to the Automad package [browser](https://packages.automad.org) -- Giving feedback and helping to grow a [community](https://automad.org/discuss) -- Reporting bugs or requesting features at [GitHub](https://github.com/marcantondahmen/automad/issues) +- Improving [language packs](https://github.com/automadcms/automad-language-packs) by fixing translation errors or adding new languages +- [Publishing packages](https://automad.org/developer-guide/publishing-packages) like themes or extensions to the Automad package [browser](https://packages.automad.org) +- Giving feedback and helping to grow a [community](https://automad.org/discuss) +- Reporting bugs or requesting features at [GitHub](https://github.com/marcantondahmen/automad/issues) However, I do not exclude at this point using parts of Automad's source in future projects under different licenses. In order to avoid having to ask anybody for permission when doing so, I will not accept any contributions to **this** repository. Please understand that pull requests will therefore be ignored. @@ -88,10 +100,10 @@ However, I do not exclude at this point using parts of Automad's source in futur To make the development of themes more efficient, plugins providing syntax highlighting and snippets for Automad's template language are available for the following editors: -- [Neovim (Tree-Sitter)](https://github.com/automadcms/tree-sitter-automad) -- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=MarcAntonDahmen.automad) -- [Atom](https://atom.io/packages/language-automad) -- [Textmate 2](https://github.com/marcantondahmen/automad.tmbundle) +- [Neovim (Tree-Sitter)](https://github.com/automadcms/tree-sitter-automad) +- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=MarcAntonDahmen.automad) +- [Atom](https://atom.io/packages/language-automad) +- [Textmate 2](https://github.com/marcantondahmen/automad.tmbundle) --- diff --git a/automad/lang/english.json b/automad/lang/english.json index 4ecda5306..8b2c6d21d 100644 --- a/automad/lang/english.json +++ b/automad/lang/english.json @@ -50,6 +50,7 @@ "clickToDelete": "Click to delete", "close": "Close", "code": "Source Code", + "codeBlockLineNumbers": "Show line numbers", "color": "Color", "confirmCancelUpload": "Do you want to cancel the upload?", "confirmDeletePage": "Do you want to delete the current page?", @@ -474,6 +475,7 @@ "value": "Value", "vertical": "Vertical", "visit": "Visit", + "visitSyntaxGallery": "Visit the syntax theme gallery", "warmthTool": "Warmth", "watermarkTab": "Watermark", "write": "Write", diff --git a/automad/src/client/admin/components/Alert.ts b/automad/src/client/admin/components/Alert.ts index 4fd47f82d..c43f33f64 100644 --- a/automad/src/client/admin/components/Alert.ts +++ b/automad/src/client/admin/components/Alert.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { App, Attr, CSS, html } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple alert box component. diff --git a/automad/src/client/admin/components/Autocomplete.ts b/automad/src/client/admin/components/Autocomplete.ts index 2dd263c94..4f1c1cefe 100644 --- a/automad/src/client/admin/components/Autocomplete.ts +++ b/automad/src/client/admin/components/Autocomplete.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { AutocompleteItem, AutocompleteItemData, KeyValueMap } from '@/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { AutocompleteItem, AutocompleteItemData, KeyValueMap } from '@/admin/types'; import { App, create, @@ -44,7 +44,7 @@ import { CSS, fire, Attr, -} from '@/core'; +} from '@/admin/core'; /** * An input field with page autocompletion. diff --git a/automad/src/client/admin/components/AutocompleteUrl.ts b/automad/src/client/admin/components/AutocompleteUrl.ts index 5e9a1be96..4e237080d 100644 --- a/automad/src/client/admin/components/AutocompleteUrl.ts +++ b/automad/src/client/admin/components/AutocompleteUrl.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { AutocompleteItemData, KeyValueMap, PageMetaData } from '@/types'; -import { App, create, html, Attr } from '@/core'; +import { AutocompleteItemData, KeyValueMap, PageMetaData } from '@/admin/types'; +import { App, create, html, Attr } from '@/admin/core'; import { AutocompleteComponent } from './Autocomplete'; /** diff --git a/automad/src/client/admin/components/Base.ts b/automad/src/client/admin/components/Base.ts index 86c1defde..decc0e374 100644 --- a/automad/src/client/admin/components/Base.ts +++ b/automad/src/client/admin/components/Base.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { KeyValueMap, Listener } from '@/types'; +import { KeyValueMap, Listener } from '@/admin/types'; /** * The Automad base component. All Automad components are based on this class. diff --git a/automad/src/client/admin/components/Breadcrumbs/BaseBreadcrumbs.ts b/automad/src/client/admin/components/Breadcrumbs/BaseBreadcrumbs.ts index 61d8fc5d2..b5d5ce0fa 100644 --- a/automad/src/client/admin/components/Breadcrumbs/BaseBreadcrumbs.ts +++ b/automad/src/client/admin/components/Breadcrumbs/BaseBreadcrumbs.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { CSS, listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { CSS, listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A breadcrumbs base component. diff --git a/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsPage.ts b/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsPage.ts index e27759d04..a927c4a70 100644 --- a/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsPage.ts +++ b/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsPage.ts @@ -43,8 +43,8 @@ import { Attr, PageController, listen, -} from '@/core'; -import { KeyValueMap } from '@/types'; +} from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseBreadcrumbsComponent } from './BaseBreadcrumbs'; /** diff --git a/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsRoute.ts b/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsRoute.ts index f3c4d3493..bf087f0df 100644 --- a/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsRoute.ts +++ b/automad/src/client/admin/components/Breadcrumbs/BreadcrumbsRoute.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, listen, Route } from '@/core'; +import { App, Attr, CSS, html, listen, Route } from '@/admin/core'; import { BaseBreadcrumbsComponent } from './BaseBreadcrumbs'; /** diff --git a/automad/src/client/admin/components/Checkbox.ts b/automad/src/client/admin/components/Checkbox.ts index b8dd8822a..57b5b4edf 100644 --- a/automad/src/client/admin/components/Checkbox.ts +++ b/automad/src/client/admin/components/Checkbox.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { create, CSS, html, listen, query } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { create, CSS, html, listen, query } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple checkbox component. diff --git a/automad/src/client/admin/components/Copy.ts b/automad/src/client/admin/components/Copy.ts index 60aa32530..cff483668 100644 --- a/automad/src/client/admin/components/Copy.ts +++ b/automad/src/client/admin/components/Copy.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { listen, notifySuccess } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { listen, notifySuccess } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A copy to clipboard button component. diff --git a/automad/src/client/admin/components/CustomIconCheckbox.ts b/automad/src/client/admin/components/CustomIconCheckbox.ts index 3646fdd5b..45a2a2c16 100644 --- a/automad/src/client/admin/components/CustomIconCheckbox.ts +++ b/automad/src/client/admin/components/CustomIconCheckbox.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, create, CSS, html, query } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, create, CSS, html, query } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A custom icon checkbox field. diff --git a/automad/src/client/admin/components/DashboardThemeToggle.ts b/automad/src/client/admin/components/DashboardThemeToggle.ts index cb1e8d292..ccc2df3ab 100644 --- a/automad/src/client/admin/components/DashboardThemeToggle.ts +++ b/automad/src/client/admin/components/DashboardThemeToggle.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { Attr, create, CSS, EventName, html, listen, titleCase } from '@/core'; -import { DashboardTheme, getTheme, setTheme } from '@/core/theme'; -import { BaseComponent } from '@/components/Base'; +import { Attr, create, CSS, EventName, html, listen, titleCase } from '@/admin/core'; +import { DashboardTheme, getTheme, setTheme } from '@/admin/core/theme'; +import { BaseComponent } from '@/admin/components/Base'; /** * A theme toggle component for the dashboard. diff --git a/automad/src/client/admin/components/Dropdown.ts b/automad/src/client/admin/components/Dropdown.ts index c63a1ec88..0ff57efbc 100644 --- a/automad/src/client/admin/components/Dropdown.ts +++ b/automad/src/client/admin/components/Dropdown.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, CSS, listen, queryParents } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, CSS, listen, queryParents } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple dropdown menu component. diff --git a/automad/src/client/admin/components/EditorJS.ts b/automad/src/client/admin/components/EditorJS.ts index 3efdfcd84..b1997af08 100644 --- a/automad/src/client/admin/components/EditorJS.ts +++ b/automad/src/client/admin/components/EditorJS.ts @@ -32,51 +32,51 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { SectionBlock } from '@/editor/blocks/Section'; -import { BoldInline } from '@/editor/inline/Bold'; -import { CodeInline } from '@/editor/inline/Code'; -import { ColorInline } from '@/editor/inline/Color'; -import { FontSizeInline } from '@/editor/inline/FontSize'; -import { ItalicInline } from '@/editor/inline/Italic'; -import { LineHeightInline } from '@/editor/inline/LineHeight'; -import { LinkInline } from '@/editor/inline/Link'; -import { StrikeThroughInline } from '@/editor/inline/StrikeThrough'; -import { UnderlineInline } from '@/editor/inline/Underline'; -import { DragDrop } from '@/editor/plugins/DragDrop'; -import { LayoutTune } from '@/editor/tunes/Layout'; -import { EditorOutputData, KeyValueMap } from '@/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { SectionBlock } from '@/admin/editor/blocks/Section'; +import { BoldInline } from '@/admin/editor/inline/Bold'; +import { CodeInline } from '@/admin/editor/inline/Code'; +import { ColorInline } from '@/admin/editor/inline/Color'; +import { FontSizeInline } from '@/admin/editor/inline/FontSize'; +import { ItalicInline } from '@/admin/editor/inline/Italic'; +import { LineHeightInline } from '@/admin/editor/inline/LineHeight'; +import { LinkInline } from '@/admin/editor/inline/Link'; +import { StrikeThroughInline } from '@/admin/editor/inline/StrikeThrough'; +import { UnderlineInline } from '@/admin/editor/inline/Underline'; +import { DragDrop } from '@/admin/editor/plugins/DragDrop'; +import { LayoutTune } from '@/admin/editor/tunes/Layout'; +import { EditorOutputData, KeyValueMap } from '@/admin/types'; import EditorJS, { EditorConfig, I18nDictionary } from 'automad-editorjs'; -import { App, CSS } from '@/core'; -import { Delimiter } from '@/editor/blocks/Delimiter'; -import { ImageBlock } from '@/editor/blocks/Image'; -import { NestedListBlock } from '@/editor/blocks/NestedList'; -import { QuoteBlock } from '@/editor/blocks/Quote'; -import { TableBlock } from '@/editor/blocks/Table'; +import { App, CSS } from '@/admin/core'; +import { Delimiter } from '@/admin/editor/blocks/Delimiter'; +import { ImageBlock } from '@/admin/editor/blocks/Image'; +import { NestedListBlock } from '@/admin/editor/blocks/NestedList'; +import { QuoteBlock } from '@/admin/editor/blocks/Quote'; +import { TableBlock } from '@/admin/editor/blocks/Table'; import { TextAlignCenterInline, TextAlignLeftInline, TextAlignRightInline, -} from '@/editor/inline/TextAlign'; -import { ClassTune } from '@/editor/tunes/Class'; -import { IdTune } from '@/editor/tunes/Id'; -import { SpacingTune } from '@/editor/tunes/Spacing'; -import { CodeBlock } from '@/editor/blocks/Code'; -import { RawBlock } from '@/editor/blocks/Raw'; -import { GalleryBlock } from '@/editor/blocks/Gallery'; -import { ImageSlideshowBlock } from '@/editor/blocks/ImageSlideshow'; -import { ButtonsBlock } from '@/editor/blocks/Buttons'; +} from '@/admin/editor/inline/TextAlign'; +import { ClassTune } from '@/admin/editor/tunes/Class'; +import { IdTune } from '@/admin/editor/tunes/Id'; +import { SpacingTune } from '@/admin/editor/tunes/Spacing'; +import { CodeBlock } from '@/admin/editor/blocks/Code'; +import { RawBlock } from '@/admin/editor/blocks/Raw'; +import { GalleryBlock } from '@/admin/editor/blocks/Gallery'; +import { ImageSlideshowBlock } from '@/admin/editor/blocks/ImageSlideshow'; +import { ButtonsBlock } from '@/admin/editor/blocks/Buttons'; // @ts-ignore import Embed from '@editorjs/embed'; -import { embedServices } from '@/editor/embedServices'; -import { HeaderBlock } from '@/editor/blocks/Header'; -import { ParagraphBlock } from '@/editor/blocks/Paragraph'; -import { DuplicateTune } from '@/editor/tunes/Duplicate'; -import { MailBlock } from '@/editor/blocks/Mail'; -import { TableOfContentsBlock } from '@/editor/blocks/TableOfContents'; -import { PagelistBlock } from '@/editor/blocks/Pagelist'; -import { FilelistBlock } from '@/editor/blocks/Filelist'; -import { SnippetBlock } from '@/editor/blocks/Snippet'; +import { embedServices } from '@/admin/editor/embedServices'; +import { HeaderBlock } from '@/admin/editor/blocks/Header'; +import { ParagraphBlock } from '@/admin/editor/blocks/Paragraph'; +import { DuplicateTune } from '@/admin/editor/tunes/Duplicate'; +import { MailBlock } from '@/admin/editor/blocks/Mail'; +import { TableOfContentsBlock } from '@/admin/editor/blocks/TableOfContents'; +import { PagelistBlock } from '@/admin/editor/blocks/Pagelist'; +import { FilelistBlock } from '@/admin/editor/blocks/Filelist'; +import { SnippetBlock } from '@/admin/editor/blocks/Snippet'; /** * A wrapper component for EditorJS that is basically a DOM element that represents an EditorJS instance. diff --git a/automad/src/client/admin/components/Fields/BaseField.ts b/automad/src/client/admin/components/Fields/BaseField.ts index a378a5f9e..5c5e5d22a 100644 --- a/automad/src/client/admin/components/Fields/BaseField.ts +++ b/automad/src/client/admin/components/Fields/BaseField.ts @@ -43,7 +43,7 @@ import { query, queryAll, Undo, -} from '@/core'; +} from '@/admin/core'; import { FieldInitData, FieldRenderData, @@ -51,8 +51,8 @@ import { KeyValueMap, UndoCapableField, UndoValue, -} from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * A standard input field with a label. diff --git a/automad/src/client/admin/components/Fields/Color.ts b/automad/src/client/admin/components/Fields/Color.ts index c9e047ed4..35092e846 100644 --- a/automad/src/client/admin/components/Fields/Color.ts +++ b/automad/src/client/admin/components/Fields/Color.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag, fire, listen } from '@/core'; +import { create, CSS, FieldTag, fire, listen } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/Date.ts b/automad/src/client/admin/components/Fields/Date.ts index 11230c49d..148d9d8f7 100644 --- a/automad/src/client/admin/components/Fields/Date.ts +++ b/automad/src/client/admin/components/Fields/Date.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag } from '@/core'; +import { create, CSS, FieldTag } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/Editor.ts b/automad/src/client/admin/components/Fields/Editor.ts index acb2408cf..731ccb150 100644 --- a/automad/src/client/admin/components/Fields/Editor.ts +++ b/automad/src/client/admin/components/Fields/Editor.ts @@ -43,11 +43,11 @@ import { listen, listenToClassChange, query, -} from '@/core'; +} from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; -import { EditorOutputData, UndoValue } from '@/types'; -import { LayoutTune } from '@/editor/tunes/Layout'; -import { EditorJSComponent } from '@/components/EditorJS'; +import { EditorOutputData, UndoValue } from '@/admin/types'; +import { LayoutTune } from '@/admin/editor/tunes/Layout'; +import { EditorJSComponent } from '@/admin/components/EditorJS'; import { API } from 'automad-editorjs'; /** diff --git a/automad/src/client/admin/components/Fields/Email.ts b/automad/src/client/admin/components/Fields/Email.ts index 16141d259..0af69df1c 100644 --- a/automad/src/client/admin/components/Fields/Email.ts +++ b/automad/src/client/admin/components/Fields/Email.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { FieldTag } from '@/core'; +import { FieldTag } from '@/admin/core'; import { InputComponent } from './Input'; /** diff --git a/automad/src/client/admin/components/Fields/FeedFieldSelect.ts b/automad/src/client/admin/components/Fields/FeedFieldSelect.ts index 8080e877d..124f6e894 100644 --- a/automad/src/client/admin/components/Fields/FeedFieldSelect.ts +++ b/automad/src/client/admin/components/Fields/FeedFieldSelect.ts @@ -44,7 +44,7 @@ import { html, listen, query, -} from '@/core'; +} from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; const options: SortableOptions = { diff --git a/automad/src/client/admin/components/Fields/ImageSelect.ts b/automad/src/client/admin/components/Fields/ImageSelect.ts index 2f2ce6b74..cf88188fe 100644 --- a/automad/src/client/admin/components/Fields/ImageSelect.ts +++ b/automad/src/client/admin/components/Fields/ImageSelect.ts @@ -44,7 +44,7 @@ import { html, listen, resizeImageUrl, -} from '@/core'; +} from '@/admin/core'; import { ImgComponent } from '../Img'; import { BaseFieldComponent } from './BaseField'; diff --git a/automad/src/client/admin/components/Fields/Input.ts b/automad/src/client/admin/components/Fields/Input.ts index fd1b8e871..f73f1f311 100644 --- a/automad/src/client/admin/components/Fields/Input.ts +++ b/automad/src/client/admin/components/Fields/Input.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag } from '@/core'; +import { create, CSS, FieldTag } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/MainTheme.ts b/automad/src/client/admin/components/Fields/MainTheme.ts index bc7d9f0b4..e410b8402 100644 --- a/automad/src/client/admin/components/Fields/MainTheme.ts +++ b/automad/src/client/admin/components/Fields/MainTheme.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { App, Attr, create, createSelect, CSS, FieldTag, Route } from '@/core'; +import { App, Attr, create, createSelect, CSS, FieldTag, Route } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; -import { SelectComponentOption, Theme } from '@/types'; +import { SelectComponentOption, Theme } from '@/admin/types'; /** * A theme select field. diff --git a/automad/src/client/admin/components/Fields/Markdown.ts b/automad/src/client/admin/components/Fields/Markdown.ts index d485ea0d2..290df5760 100644 --- a/automad/src/client/admin/components/Fields/Markdown.ts +++ b/automad/src/client/admin/components/Fields/Markdown.ts @@ -47,15 +47,15 @@ import { queryAll, resolveFileUrl, resolvePageUrl, -} from '@/core'; +} from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; import Editor, { LinkMdNode } from '@toast-ui/editor'; import { ToolbarCustomOptions } from '@toast-ui/editor/types/ui'; import { Context, OpenTagToken } from '@toast-ui/editor/types/toastmark'; import { CustomHTMLRenderer } from '@toast-ui/editor/dist/toastui-editor-viewer'; -import Prism from 'prismjs'; +import { Prism } from '@/prism/prism'; // @ts-ignore -import codeSyntaxHighlight from '@toast-ui/editor-plugin-code-syntax-highlight/dist/toastui-editor-plugin-code-syntax-highlight-all.js'; +import codeSyntaxHighlight from '@toast-ui/editor-plugin-code-syntax-highlight'; /** * Create a custom toolbar button. diff --git a/automad/src/client/admin/components/Fields/Number.ts b/automad/src/client/admin/components/Fields/Number.ts index 8ab8f004f..fa75e9d36 100644 --- a/automad/src/client/admin/components/Fields/Number.ts +++ b/automad/src/client/admin/components/Fields/Number.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag } from '@/core'; +import { create, CSS, FieldTag } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/NumberUnit.ts b/automad/src/client/admin/components/Fields/NumberUnit.ts index 94e948d35..3ac6fc104 100644 --- a/automad/src/client/admin/components/Fields/NumberUnit.ts +++ b/automad/src/client/admin/components/Fields/NumberUnit.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, FieldTag } from '@/core'; +import { create, FieldTag } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/PageTags.ts b/automad/src/client/admin/components/Fields/PageTags.ts index 604c56123..42bfa0efd 100644 --- a/automad/src/client/admin/components/Fields/PageTags.ts +++ b/automad/src/client/admin/components/Fields/PageTags.ts @@ -33,8 +33,8 @@ */ import Tagify from '@yaireo/tagify'; -import { App, create, CSS, debounce, FieldTag } from '@/core'; -import { PageDataFormComponent } from '@/components/Forms/PageDataForm'; +import { App, create, CSS, debounce, FieldTag } from '@/admin/core'; +import { PageDataFormComponent } from '@/admin/components/Forms/PageDataForm'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/PageTemplate.ts b/automad/src/client/admin/components/Fields/PageTemplate.ts index 5bbab88dc..c4d17c85d 100644 --- a/automad/src/client/admin/components/Fields/PageTemplate.ts +++ b/automad/src/client/admin/components/Fields/PageTemplate.ts @@ -42,10 +42,10 @@ import { listen, query, titleCase, -} from '@/core'; -import { KeyValueMap, TemplateButtonStatus, TemplateFieldData } from '@/types'; -import { BaseComponent } from '@/components/Base'; -import { SelectComponent } from '@/components/Select'; +} from '@/admin/core'; +import { KeyValueMap, TemplateButtonStatus, TemplateFieldData } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { SelectComponent } from '@/admin/components/Select'; /** * Beautify a template path to be used as name. diff --git a/automad/src/client/admin/components/Fields/Password.ts b/automad/src/client/admin/components/Fields/Password.ts index bd429ce43..a0fb2892a 100644 --- a/automad/src/client/admin/components/Fields/Password.ts +++ b/automad/src/client/admin/components/Fields/Password.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { FieldTag } from '@/core'; +import { FieldTag } from '@/admin/core'; import { InputComponent } from './Input'; /** diff --git a/automad/src/client/admin/components/Fields/SyntaxThemeSelect.ts b/automad/src/client/admin/components/Fields/SyntaxThemeSelect.ts new file mode 100644 index 000000000..fb7682fd3 --- /dev/null +++ b/automad/src/client/admin/components/Fields/SyntaxThemeSelect.ts @@ -0,0 +1,96 @@ +/* + * .... + * .: '':. + * :::: ':.. + * ::. ''.. + * .:'.. ..':.:::' . :. '':. + * :. '' '' '. ::::.. ..: + * ::::. ..':.. .'''::::: . + * :::::::.. '..:::: :. :::: : + * ::'':::::::. ':::.'':.:::: : + * :.. ''::::::....': '':: : + * :::::. '::::: : .. '' . + * .''::::::::... ':::.'' ..'' :.''''. + * :..:::''::::: :::::...:'' :..: + * ::::::. ':::: :::::::: ..:: . + * ::::::::.:::: :::::::: :'':.:: .'' + * ::: '::::::::.' ''::::: :.' '': : + * ::: :::::::::..' :::: ::...' . + * ::: .:::::::::: :::: :::: .:' + * '::' ''::::::: :::: : :: : + * ':::: :::: :'' .: + * :::: :::: ..'' + * :::: ..:::: .:'' + * '''' ''''' + * + * + * AUTOMAD + * + * Copyright (c) 2024 by Marc Anton Dahmen + * https://marcdahmen.de + * + * Licensed under the MIT license. + */ + +import { + FieldTag, + createSelect, + getPageURL, + App, + CSS, + create, + html, + Attr, +} from '@/admin/core'; +import { BaseFieldComponent } from './BaseField'; +import themes from 'automad-prism-themes/dist/themes.json'; + +const defaultTheme = 'verdandi.light-dark'; + +/** + * A syntax theme select field. + * + * @extends BaseFieldComponent + */ +class SyntaxThemeSelectComponent extends BaseFieldComponent { + /** + * Render the input field. + */ + createInput(): void { + const { name, id, value } = this._data; + const isPage = !!getPageURL(); + const _default = isPage ? '' : defaultTheme; + const _value = (value as string) || _default; + + let options = [{ text: '—', value: 'none' }, ...themes]; + + if (isPage) { + options = [ + { text: App.text('useSharedDefault'), value: '' }, + ...options, + ]; + } + + this.classList.add(CSS.flex, CSS.flexColumn, CSS.flexGap); + createSelect(options, _value, this, name, id); + create( + 'div', + [], + {}, + this, + html` + + + + ` + ); + } +} + +customElements.define(FieldTag.syntaxSelect, SyntaxThemeSelectComponent); diff --git a/automad/src/client/admin/components/Fields/Textarea.ts b/automad/src/client/admin/components/Fields/Textarea.ts index 3349b4d58..7834a2dd4 100644 --- a/automad/src/client/admin/components/Fields/Textarea.ts +++ b/automad/src/client/admin/components/Fields/Textarea.ts @@ -39,7 +39,7 @@ import { FieldTag, initTabHandler, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/Title.ts b/automad/src/client/admin/components/Fields/Title.ts index 4455a805f..7c076cc2d 100644 --- a/automad/src/client/admin/components/Fields/Title.ts +++ b/automad/src/client/admin/components/Fields/Title.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag } from '@/core'; +import { create, CSS, FieldTag } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/Toggle.ts b/automad/src/client/admin/components/Fields/Toggle.ts index d937b0f5c..12325bf76 100644 --- a/automad/src/client/admin/components/Fields/Toggle.ts +++ b/automad/src/client/admin/components/Fields/Toggle.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, FieldTag, html } from '@/core'; +import { create, CSS, FieldTag, html } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/ToggleLarge.ts b/automad/src/client/admin/components/Fields/ToggleLarge.ts index 02d3523e6..66532eab1 100644 --- a/automad/src/client/admin/components/Fields/ToggleLarge.ts +++ b/automad/src/client/admin/components/Fields/ToggleLarge.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { CSS, FieldTag } from '@/core'; +import { CSS, FieldTag } from '@/admin/core'; import { ToggleComponent } from './Toggle'; /** diff --git a/automad/src/client/admin/components/Fields/ToggleSelect.ts b/automad/src/client/admin/components/Fields/ToggleSelect.ts index 01322841f..51dc4bd2e 100644 --- a/automad/src/client/admin/components/Fields/ToggleSelect.ts +++ b/automad/src/client/admin/components/Fields/ToggleSelect.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, create, CSS, FieldTag, html, listen, query } from '@/core'; +import { App, create, CSS, FieldTag, html, listen, query } from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/Fields/Url.ts b/automad/src/client/admin/components/Fields/Url.ts index 77266c465..572f22963 100644 --- a/automad/src/client/admin/components/Fields/Url.ts +++ b/automad/src/client/admin/components/Fields/Url.ts @@ -39,7 +39,7 @@ import { Binding, createLinkModal, FieldTag, -} from '@/core'; +} from '@/admin/core'; import { BaseFieldComponent } from './BaseField'; /** diff --git a/automad/src/client/admin/components/File/FileCard.ts b/automad/src/client/admin/components/File/FileCard.ts index d5582eb9c..507bece75 100644 --- a/automad/src/client/admin/components/File/FileCard.ts +++ b/automad/src/client/admin/components/File/FileCard.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, queryAll } from '@/core'; -import { File } from '@/types'; -import { BaseComponent } from '@/components/Base'; +import { App, Attr, CSS, html, queryAll } from '@/admin/core'; +import { File } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; import { FileInfoComponent } from './FileInfo'; /** diff --git a/automad/src/client/admin/components/File/FileCount.ts b/automad/src/client/admin/components/File/FileCount.ts index 64b3bb081..3445beede 100644 --- a/automad/src/client/admin/components/File/FileCount.ts +++ b/automad/src/client/admin/components/File/FileCount.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { create, EventName, listen, queryAll } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { create, EventName, listen, queryAll } from '@/admin/core'; /** * A file count badge component that displays the total number of file card elements. diff --git a/automad/src/client/admin/components/File/FileInfo.ts b/automad/src/client/admin/components/File/FileInfo.ts index ca896161e..bf710be87 100644 --- a/automad/src/client/admin/components/File/FileInfo.ts +++ b/automad/src/client/admin/components/File/FileInfo.ts @@ -43,10 +43,10 @@ import { FileController, html, listen, -} from '@/core'; -import { File } from '@/types'; -import { BaseComponent } from '@/components/Base'; -import { ModalComponent } from '@/components/Modal/Modal'; +} from '@/admin/core'; +import { File } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; /** * A file edit modal toggle component. diff --git a/automad/src/client/admin/components/File/FileRobot.ts b/automad/src/client/admin/components/File/FileRobot.ts index af61a4b30..c9f2eebaf 100644 --- a/automad/src/client/admin/components/File/FileRobot.ts +++ b/automad/src/client/admin/components/File/FileRobot.ts @@ -34,7 +34,7 @@ import FilerobotImageEditor from 'filerobot-image-editor'; import { FilerobotImageEditorConfig } from 'react-filerobot-image-editor'; -import { KeyValueMap } from '@/types'; +import { KeyValueMap } from '@/admin/types'; import { App, Attr, @@ -45,10 +45,10 @@ import { fire, ImageController, listen, -} from '@/core'; -import { ModalComponent } from '@/components/Modal/Modal'; -import { BaseComponent } from '@/components/Base'; -import { FormComponent } from '@/components/Forms/Form'; +} from '@/admin/core'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; +import { BaseComponent } from '@/admin/components/Base'; +import { FormComponent } from '@/admin/components/Forms/Form'; import { fileRobotTheme } from './FileRobotTheme'; /** diff --git a/automad/src/client/admin/components/File/Upload.ts b/automad/src/client/admin/components/File/Upload.ts index 9baea50bd..93d09dd63 100644 --- a/automad/src/client/admin/components/File/Upload.ts +++ b/automad/src/client/admin/components/File/Upload.ts @@ -47,10 +47,10 @@ import { notifySuccess, query, RequestKey, -} from '@/core'; -import { BaseComponent } from '@/components/Base'; -import { FileCollectionListFormComponent } from '@/components/Forms/FileCollection/ListForm'; -import { ModalComponent } from '@/components/Modal/Modal'; +} from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { FileCollectionListFormComponent } from '@/admin/components/Forms/FileCollection/ListForm'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; /** * An upload component. diff --git a/automad/src/client/admin/components/Filter.ts b/automad/src/client/admin/components/Filter.ts index ff127c9e6..b4dc3107e 100644 --- a/automad/src/client/admin/components/Filter.ts +++ b/automad/src/client/admin/components/Filter.ts @@ -42,9 +42,9 @@ import { keyCombo, listen, queryAll, -} from '@/core'; -import { InputElement } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { InputElement } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * A field and card filter input component. diff --git a/automad/src/client/admin/components/Forms/ConfigFileForm.ts b/automad/src/client/admin/components/Forms/ConfigFileForm.ts index 8f504ae64..a91c55f1a 100644 --- a/automad/src/client/admin/components/Forms/ConfigFileForm.ts +++ b/automad/src/client/admin/components/Forms/ConfigFileForm.ts @@ -42,8 +42,8 @@ import { listen, query, Undo, -} from '@/core'; -import { KeyValueMap, UndoValue } from '@/types'; +} from '@/admin/core'; +import { KeyValueMap, UndoValue } from '@/admin/types'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/DeleteUsersForm.ts b/automad/src/client/admin/components/Forms/DeleteUsersForm.ts index 9d2e2e4e1..208c6cd0f 100644 --- a/automad/src/client/admin/components/Forms/DeleteUsersForm.ts +++ b/automad/src/client/admin/components/Forms/DeleteUsersForm.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, CSS, EventName, html, listen } from '@/core'; +import { App, CSS, EventName, html, listen } from '@/admin/core'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/FileCollection/ListForm.ts b/automad/src/client/admin/components/Forms/FileCollection/ListForm.ts index 6013ddc66..6261bfa46 100644 --- a/automad/src/client/admin/components/Forms/FileCollection/ListForm.ts +++ b/automad/src/client/admin/components/Forms/FileCollection/ListForm.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { create, CSS, EventName, fire, listen, queryAll } from '@/core'; -import { File, KeyValueMap } from '@/types'; -import { FormComponent } from '@/components/Forms/Form'; +import { create, CSS, EventName, fire, listen, queryAll } from '@/admin/core'; +import { File, KeyValueMap } from '@/admin/types'; +import { FormComponent } from '@/admin/components/Forms/Form'; /** * The file collection form component. diff --git a/automad/src/client/admin/components/Forms/FileCollection/Submit.ts b/automad/src/client/admin/components/Forms/FileCollection/Submit.ts index ad81801e8..1fa70282c 100644 --- a/automad/src/client/admin/components/Forms/FileCollection/Submit.ts +++ b/automad/src/client/admin/components/Forms/FileCollection/Submit.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { listen, queryAll } from '@/core'; -import { FormComponent } from '@/components/Forms/Form'; -import { SubmitComponent } from '@/components/Forms/Submit'; +import { listen, queryAll } from '@/admin/core'; +import { FormComponent } from '@/admin/components/Forms/Form'; +import { SubmitComponent } from '@/admin/components/Forms/Submit'; /** * A submit button for the FileCollectionListComponent form. diff --git a/automad/src/client/admin/components/Forms/Form.ts b/automad/src/client/admin/components/Forms/Form.ts index 3fe74dc0e..016d67bab 100644 --- a/automad/src/client/admin/components/Forms/Form.ts +++ b/automad/src/client/admin/components/Forms/Form.ts @@ -49,10 +49,10 @@ import { query, queryAll, requestAPI, -} from '@/core'; -import { InputElement, KeyValueMap } from '@/types'; -import { BaseComponent } from '@/components/Base'; -import { ModalComponent } from '@/components/Modal/Modal'; +} from '@/admin/core'; +import { InputElement, KeyValueMap } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; import { SubmitComponent } from './Submit'; import { FormErrorComponent } from './FormError'; diff --git a/automad/src/client/admin/components/Forms/FormError.ts b/automad/src/client/admin/components/Forms/FormError.ts index 17eab5544..15fa6b7bf 100644 --- a/automad/src/client/admin/components/Forms/FormError.ts +++ b/automad/src/client/admin/components/Forms/FormError.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { CSS, html } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { CSS, html } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple error message component that is used to display errors inside of forms. diff --git a/automad/src/client/admin/components/Forms/HistoryModalForm.ts b/automad/src/client/admin/components/Forms/HistoryModalForm.ts index a5c56771c..fa02d2292 100644 --- a/automad/src/client/admin/components/Forms/HistoryModalForm.ts +++ b/automad/src/client/admin/components/Forms/HistoryModalForm.ts @@ -46,10 +46,10 @@ import { Attr, HistoryController, dateFormat, -} from '@/core'; -import { SelectComponentOption } from '@/types'; -import { BaseComponent } from '@/components/Base'; -import { ModalComponent } from '@/components/Modal/Modal'; +} from '@/admin/core'; +import { SelectComponentOption } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; export class HistoryModalFormComponent extends BaseComponent { /** diff --git a/automad/src/client/admin/components/Forms/InPageForm.ts b/automad/src/client/admin/components/Forms/InPageForm.ts index 859887ed2..86ed5c8df 100644 --- a/automad/src/client/admin/components/Forms/InPageForm.ts +++ b/automad/src/client/admin/components/Forms/InPageForm.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { InPageBindings, KeyValueMap } from '@/types'; +import { InPageBindings, KeyValueMap } from '@/admin/types'; import { FormComponent } from './Form'; import { App, @@ -47,9 +47,9 @@ import { listen, query, setDocumentTitle, -} from '@/core'; -import { ModalComponent } from '@/components/Modal/Modal'; -import { EditorJSComponent } from '@/components/EditorJS'; +} from '@/admin/core'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; +import { EditorJSComponent } from '@/admin/components/EditorJS'; /** * The InPage editing form element. diff --git a/automad/src/client/admin/components/Forms/MailConfigForm.ts b/automad/src/client/admin/components/Forms/MailConfigForm.ts index 4edf48219..20368cadc 100644 --- a/automad/src/client/admin/components/Forms/MailConfigForm.ts +++ b/automad/src/client/admin/components/Forms/MailConfigForm.ts @@ -46,8 +46,8 @@ import { MailConfigController, requestAPI, Undo, -} from '@/core'; -import { MailConfig } from '@/types'; +} from '@/admin/core'; +import { MailConfig } from '@/admin/types'; import { FormComponent } from './Form'; export const transportOptions = ['sendmail', 'smtp'] as const; diff --git a/automad/src/client/admin/components/Forms/PageDataForm.ts b/automad/src/client/admin/components/Forms/PageDataForm.ts index e422bd058..d4c65836b 100644 --- a/automad/src/client/admin/components/Forms/PageDataForm.ts +++ b/automad/src/client/admin/components/Forms/PageDataForm.ts @@ -38,7 +38,7 @@ import { KeyValueMap, PageBindings, PageMainSettingsData, -} from '@/types'; +} from '@/admin/types'; import { FormComponent } from './Form'; import { App, @@ -47,6 +47,7 @@ import { create, createField, createFieldSections, + createLabelFromField, CSS, EventName, fieldGroup, @@ -58,9 +59,9 @@ import { listen, prepareFieldGroups, setDocumentTitle, -} from '@/core'; -import { PageTemplateComponent } from '@/components/Fields/PageTemplate'; -import { BaseFieldComponent } from '@/components/Fields/BaseField'; +} from '@/admin/core'; +import { PageTemplateComponent } from '@/admin/components/Fields/PageTemplate'; +import { BaseFieldComponent } from '@/admin/components/Fields/BaseField'; /** * Init all URL and slug related bindings. @@ -215,7 +216,6 @@ export class PageDataFormComponent extends FormComponent { [], { href: `${App.baseURL}${url}`, - target: '_blank', }, titleContainer ).innerHTML = html` @@ -261,6 +261,12 @@ export class PageDataFormComponent extends FormComponent { readmeLink ); + createMainField( + FieldTag.syntaxSelect, + App.reservedFields.SYNTAX_THEME, + createLabelFromField(App.reservedFields.SYNTAX_THEME) + ); + createMainField( FieldTag.toggle, App.reservedFields.HIDDEN, @@ -368,6 +374,10 @@ export class PageDataFormComponent extends FormComponent { private render(response: KeyValueMap): void { const { url, fields, shared, template, readme } = response.data; + if (!fields) { + return; + } + create( 'input', [], diff --git a/automad/src/client/admin/components/Forms/PublishForm.ts b/automad/src/client/admin/components/Forms/PublishForm.ts index e02899a39..7d364ce24 100644 --- a/automad/src/client/admin/components/Forms/PublishForm.ts +++ b/automad/src/client/admin/components/Forms/PublishForm.ts @@ -49,7 +49,7 @@ import { requestAPI, Route, SharedController, -} from '@/core'; +} from '@/admin/core'; import Tooltip from 'codex-tooltip'; import { BaseComponent } from '../Base'; import { SubmitComponent } from './Submit'; diff --git a/automad/src/client/admin/components/Forms/ResetPasswordForm.ts b/automad/src/client/admin/components/Forms/ResetPasswordForm.ts index 05932f058..4a4f5fb05 100644 --- a/automad/src/client/admin/components/Forms/ResetPasswordForm.ts +++ b/automad/src/client/admin/components/Forms/ResetPasswordForm.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, getSearchParam, html, Route } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App, Attr, CSS, getSearchParam, html, Route } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/SearchForm.ts b/automad/src/client/admin/components/Forms/SearchForm.ts index abaa36fb2..5beb55e64 100644 --- a/automad/src/client/admin/components/Forms/SearchForm.ts +++ b/automad/src/client/admin/components/Forms/SearchForm.ts @@ -48,9 +48,9 @@ import { requestAPI, Route, SearchController, -} from '@/core'; -import { FieldResults, FileResults, KeyValueMap } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { FieldResults, FileResults, KeyValueMap } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * Render the inner content for a given field in the results card. diff --git a/automad/src/client/admin/components/Forms/SetupForm.ts b/automad/src/client/admin/components/Forms/SetupForm.ts index 8954a0ec5..312bf4e19 100644 --- a/automad/src/client/admin/components/Forms/SetupForm.ts +++ b/automad/src/client/admin/components/Forms/SetupForm.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS, html, KeyValueMap, Route } from '@/core'; +import { create, CSS, html, KeyValueMap, Route } from '@/admin/core'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/SharedDataForm.ts b/automad/src/client/admin/components/Forms/SharedDataForm.ts index ad623ccfe..70fffbdd9 100644 --- a/automad/src/client/admin/components/Forms/SharedDataForm.ts +++ b/automad/src/client/admin/components/Forms/SharedDataForm.ts @@ -45,13 +45,13 @@ import { fire, listen, prepareFieldGroups, -} from '@/core'; +} from '@/admin/core'; import { FieldSectionCollection, FieldSectionName, KeyValueMap, SharedBindings, -} from '@/types'; +} from '@/admin/types'; import { FormComponent } from './Form'; /** @@ -211,6 +211,12 @@ export class SharedDataFormComponent extends FormComponent { name: `data[${themeKey}]`, }); + createField(FieldTag.syntaxSelect, this.sections.settings, { + key: App.reservedFields.SYNTAX_THEME, + value: fields[App.reservedFields.SYNTAX_THEME], + name: `data[${App.reservedFields.SYNTAX_THEME}]`, + }); + Object.keys(this.sections).forEach((item: FieldSectionName) => { fieldGroup({ section: this.sections[item], diff --git a/automad/src/client/admin/components/Forms/Submit.ts b/automad/src/client/admin/components/Forms/Submit.ts index 3bf5da708..aa4615ced 100644 --- a/automad/src/client/admin/components/Forms/Submit.ts +++ b/automad/src/client/admin/components/Forms/Submit.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, listen, queryAll, queryParents } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, listen, queryAll, queryParents } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/SystemUpdateForm.ts b/automad/src/client/admin/components/Forms/SystemUpdateForm.ts index 77114b4bc..36cd4ac3c 100644 --- a/automad/src/client/admin/components/Forms/SystemUpdateForm.ts +++ b/automad/src/client/admin/components/Forms/SystemUpdateForm.ts @@ -41,9 +41,9 @@ import { html, listen, query, -} from '@/core'; -import { KeyValueMap, SystemUpdateResponse } from '@/types'; -import { ModalComponent } from '@/components/Modal/Modal'; +} from '@/admin/core'; +import { KeyValueMap, SystemUpdateResponse } from '@/admin/types'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; import { FormComponent } from './Form'; /** diff --git a/automad/src/client/admin/components/Forms/TrashForm.ts b/automad/src/client/admin/components/Forms/TrashForm.ts index 0aa4e69e4..5085b2752 100644 --- a/automad/src/client/admin/components/Forms/TrashForm.ts +++ b/automad/src/client/admin/components/Forms/TrashForm.ts @@ -40,9 +40,9 @@ import { html, PageTrashController, requestAPI, -} from '@/core'; -import { DeletedPageMetaData } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { DeletedPageMetaData } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * Create a card for a deleted page. diff --git a/automad/src/client/admin/components/Home/RecentlyEditedPages.ts b/automad/src/client/admin/components/Home/RecentlyEditedPages.ts index ac68250b6..db4739b5b 100644 --- a/automad/src/client/admin/components/Home/RecentlyEditedPages.ts +++ b/automad/src/client/admin/components/Home/RecentlyEditedPages.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; +import { BaseComponent } from '@/admin/components/Base'; import { App, Attr, @@ -45,9 +45,9 @@ import { resolveFileUrl, resolvePageUrl, Route, -} from '@/core'; -import { PageRecentlyEditedCardData } from '@/types'; -import { Section } from 'common'; +} from '@/admin/core'; +import { PageRecentlyEditedCardData } from '@/admin/types'; +import { Section } from '@/common'; /** * A grid of recently edited pages. diff --git a/automad/src/client/admin/components/Home/ServerInfo.ts b/automad/src/client/admin/components/Home/ServerInfo.ts index bbc0ac350..853b4e5e6 100644 --- a/automad/src/client/admin/components/Home/ServerInfo.ts +++ b/automad/src/client/admin/components/Home/ServerInfo.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { AppController, html, requestAPI } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { AppController, html, requestAPI } from '@/admin/core'; /** * A server info component. diff --git a/automad/src/client/admin/components/IconText.ts b/automad/src/client/admin/components/IconText.ts index 319db022f..5996a1309 100644 --- a/automad/src/client/admin/components/IconText.ts +++ b/automad/src/client/admin/components/IconText.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, create, CSS } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, create, CSS } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple icon with text component. diff --git a/automad/src/client/admin/components/ImageCollection.ts b/automad/src/client/admin/components/ImageCollection.ts index 3557253d1..a09c66de8 100644 --- a/automad/src/client/admin/components/ImageCollection.ts +++ b/automad/src/client/admin/components/ImageCollection.ts @@ -41,7 +41,7 @@ import { html, listen, resizeImageUrl, -} from '@/core'; +} from '@/admin/core'; import Sortable from 'sortablejs'; import { BaseComponent } from './Base'; diff --git a/automad/src/client/admin/components/ImagePicker.ts b/automad/src/client/admin/components/ImagePicker.ts index c0c57767b..aef148199 100644 --- a/automad/src/client/admin/components/ImagePicker.ts +++ b/automad/src/client/admin/components/ImagePicker.ts @@ -43,9 +43,9 @@ import { ImageCollectionController, listen, requestAPI, -} from '@/core'; -import { Image } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { Image } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; import { ModalComponent } from './Modal/Modal'; /** diff --git a/automad/src/client/admin/components/Img.ts b/automad/src/client/admin/components/Img.ts index 465379b00..001ba1780 100644 --- a/automad/src/client/admin/components/Img.ts +++ b/automad/src/client/admin/components/Img.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { create, CSS, html, listen } from '@/core'; -import { Listener } from '@/types'; +import { create, CSS, html, listen } from '@/admin/core'; +import { Listener } from '@/admin/types'; import { BaseComponent } from './Base'; /** diff --git a/automad/src/client/admin/components/Indicators/BaseActivationIndicator.ts b/automad/src/client/admin/components/Indicators/BaseActivationIndicator.ts index 2656f38dc..4a4e2cf0c 100644 --- a/automad/src/client/admin/components/Indicators/BaseActivationIndicator.ts +++ b/automad/src/client/admin/components/Indicators/BaseActivationIndicator.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Attr, CSS, html } from '@/core'; +import { Attr, CSS, html } from '@/admin/core'; import { BaseStateIndicatorComponent } from './BaseStateIndicator'; /** diff --git a/automad/src/client/admin/components/Indicators/BaseOutdatedPackagesIndicator.ts b/automad/src/client/admin/components/Indicators/BaseOutdatedPackagesIndicator.ts index 518e541f4..f938d4485 100644 --- a/automad/src/client/admin/components/Indicators/BaseOutdatedPackagesIndicator.ts +++ b/automad/src/client/admin/components/Indicators/BaseOutdatedPackagesIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { EventName, listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { EventName, listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A base update indicator component. diff --git a/automad/src/client/admin/components/Indicators/BaseStateIndicator.ts b/automad/src/client/admin/components/Indicators/BaseStateIndicator.ts index 92d53773f..cb76646c2 100644 --- a/automad/src/client/admin/components/Indicators/BaseStateIndicator.ts +++ b/automad/src/client/admin/components/Indicators/BaseStateIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { EventName, listen } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { EventName, listen } from '@/admin/core'; /** * The abstract base state component. diff --git a/automad/src/client/admin/components/Indicators/BaseUpdateIndicator.ts b/automad/src/client/admin/components/Indicators/BaseUpdateIndicator.ts index 17ba20da8..83d09be0f 100644 --- a/automad/src/client/admin/components/Indicators/BaseUpdateIndicator.ts +++ b/automad/src/client/admin/components/Indicators/BaseUpdateIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { EventName, listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { EventName, listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A base update indicator component. diff --git a/automad/src/client/admin/components/Indicators/Menu/PrivateIndicator.ts b/automad/src/client/admin/components/Indicators/Menu/PrivateIndicator.ts index 336f50169..ffa974f01 100644 --- a/automad/src/client/admin/components/Indicators/Menu/PrivateIndicator.ts +++ b/automad/src/client/admin/components/Indicators/Menu/PrivateIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, create, CSS, EventName, getPageURL, listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { App, create, CSS, EventName, getPageURL, listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A private indicator badge for pages. diff --git a/automad/src/client/admin/components/Indicators/Navbar/DebugIndicator.ts b/automad/src/client/admin/components/Indicators/Navbar/DebugIndicator.ts index d40f2ff60..d5c219f88 100644 --- a/automad/src/client/admin/components/Indicators/Navbar/DebugIndicator.ts +++ b/automad/src/client/admin/components/Indicators/Navbar/DebugIndicator.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, Route } from '@/core'; -import { Section } from 'common'; -import { BaseStateIndicatorComponent } from '@/components/Indicators/BaseStateIndicator'; +import { App, Attr, CSS, html, Route } from '@/admin/core'; +import { Section } from '@/common'; +import { BaseStateIndicatorComponent } from '@/admin/components/Indicators/BaseStateIndicator'; /** * A debug state component. diff --git a/automad/src/client/admin/components/Indicators/Navbar/OutdatedPackagesIndicator.ts b/automad/src/client/admin/components/Indicators/Navbar/OutdatedPackagesIndicator.ts index 8bdf73694..c9d4520fc 100644 --- a/automad/src/client/admin/components/Indicators/Navbar/OutdatedPackagesIndicator.ts +++ b/automad/src/client/admin/components/Indicators/Navbar/OutdatedPackagesIndicator.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, Route } from '@/core'; +import { App, Attr, CSS, html, Route } from '@/admin/core'; import { BaseOutdatedPackagesIndicator } from '../BaseOutdatedPackagesIndicator'; /** @@ -57,7 +57,6 @@ class NavbarOutdatedPackagesIndicatorComponent extends BaseOutdatedPackagesIndic ${Attr.tooltip}="${App.text('packagesUpdatesAvailable')}" > - `; } else { diff --git a/automad/src/client/admin/components/Indicators/Navbar/SystemUpdateIndicator.ts b/automad/src/client/admin/components/Indicators/Navbar/SystemUpdateIndicator.ts index 9100ff5ca..4073d159d 100644 --- a/automad/src/client/admin/components/Indicators/Navbar/SystemUpdateIndicator.ts +++ b/automad/src/client/admin/components/Indicators/Navbar/SystemUpdateIndicator.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, Route } from '@/core'; -import { Section } from 'common'; -import { BaseUpdateIndicatorComponent } from '@/components/Indicators/BaseUpdateIndicator'; +import { App, Attr, CSS, html, Route } from '@/admin/core'; +import { Section } from '@/common'; +import { BaseUpdateIndicatorComponent } from '@/admin/components/Indicators/BaseUpdateIndicator'; /** * A system update state button component. diff --git a/automad/src/client/admin/components/Indicators/Sidebar/OutdatedPackagesIndicator.ts b/automad/src/client/admin/components/Indicators/Sidebar/OutdatedPackagesIndicator.ts index 74e49b3bd..1f2210324 100644 --- a/automad/src/client/admin/components/Indicators/Sidebar/OutdatedPackagesIndicator.ts +++ b/automad/src/client/admin/components/Indicators/Sidebar/OutdatedPackagesIndicator.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, CSS, html } from '@/core'; +import { App, CSS, html } from '@/admin/core'; import { BaseOutdatedPackagesIndicator } from '../BaseOutdatedPackagesIndicator'; /** diff --git a/automad/src/client/admin/components/Indicators/System/CacheIndicator.ts b/automad/src/client/admin/components/Indicators/System/CacheIndicator.ts index c87525935..81ed36f56 100644 --- a/automad/src/client/admin/components/Indicators/System/CacheIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/CacheIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { BaseActivationIndicatorComponent } from '@/components/Indicators/BaseActivationIndicator'; +import { App } from '@/admin/core'; +import { BaseActivationIndicatorComponent } from '@/admin/components/Indicators/BaseActivationIndicator'; /** * A cache state indicator component. diff --git a/automad/src/client/admin/components/Indicators/System/DebugIndicator.ts b/automad/src/client/admin/components/Indicators/System/DebugIndicator.ts index 2bc04f358..044ed87ae 100644 --- a/automad/src/client/admin/components/Indicators/System/DebugIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/DebugIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { BaseActivationIndicatorComponent } from '@/components/Indicators/BaseActivationIndicator'; +import { App } from '@/admin/core'; +import { BaseActivationIndicatorComponent } from '@/admin/components/Indicators/BaseActivationIndicator'; /** * A debug state indicator component. diff --git a/automad/src/client/admin/components/Indicators/System/FeedIndicator.ts b/automad/src/client/admin/components/Indicators/System/FeedIndicator.ts index 19fde7576..91a43af05 100644 --- a/automad/src/client/admin/components/Indicators/System/FeedIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/FeedIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { BaseActivationIndicatorComponent } from '@/components/Indicators/BaseActivationIndicator'; +import { App } from '@/admin/core'; +import { BaseActivationIndicatorComponent } from '@/admin/components/Indicators/BaseActivationIndicator'; /** * A feed state indicator component. diff --git a/automad/src/client/admin/components/Indicators/System/I18nIndicator.ts b/automad/src/client/admin/components/Indicators/System/I18nIndicator.ts index 66862b566..c31be6e3d 100644 --- a/automad/src/client/admin/components/Indicators/System/I18nIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/I18nIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { BaseActivationIndicatorComponent } from '@/components/Indicators/BaseActivationIndicator'; +import { App } from '@/admin/core'; +import { BaseActivationIndicatorComponent } from '@/admin/components/Indicators/BaseActivationIndicator'; /** * A debug state indicator component. diff --git a/automad/src/client/admin/components/Indicators/System/MailIndicator.ts b/automad/src/client/admin/components/Indicators/System/MailIndicator.ts index 72bdb0ed0..f7ba1dc05 100644 --- a/automad/src/client/admin/components/Indicators/System/MailIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/MailIndicator.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS } from '@/core'; +import { App, Attr, CSS } from '@/admin/core'; import { BaseStateIndicatorComponent } from '../BaseStateIndicator'; /** diff --git a/automad/src/client/admin/components/Indicators/System/SystemUpdateIndicator.ts b/automad/src/client/admin/components/Indicators/System/SystemUpdateIndicator.ts index d8db5832b..001ec1442 100644 --- a/automad/src/client/admin/components/Indicators/System/SystemUpdateIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/SystemUpdateIndicator.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html } from '@/core'; -import { BaseUpdateIndicatorComponent } from '@/components/Indicators/BaseUpdateIndicator'; +import { App, Attr, CSS, html } from '@/admin/core'; +import { BaseUpdateIndicatorComponent } from '@/admin/components/Indicators/BaseUpdateIndicator'; /** * A system update state component. diff --git a/automad/src/client/admin/components/Indicators/System/UserCountIndicator.ts b/automad/src/client/admin/components/Indicators/System/UserCountIndicator.ts index 221f2b034..931c4c907 100644 --- a/automad/src/client/admin/components/Indicators/System/UserCountIndicator.ts +++ b/automad/src/client/admin/components/Indicators/System/UserCountIndicator.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; +import { App } from '@/admin/core'; import { BaseStateIndicatorComponent } from '../BaseStateIndicator'; /** diff --git a/automad/src/client/admin/components/KeyComboBadge.ts b/automad/src/client/admin/components/KeyComboBadge.ts index e22f268c4..3630d9a67 100644 --- a/automad/src/client/admin/components/KeyComboBadge.ts +++ b/automad/src/client/admin/components/KeyComboBadge.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, CSS, getMetaKeyLabel } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, CSS, getMetaKeyLabel } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A key combo badge that automatically displays the correct meta key. diff --git a/automad/src/client/admin/components/Link.ts b/automad/src/client/admin/components/Link.ts index f18159742..c53963250 100644 --- a/automad/src/client/admin/components/Link.ts +++ b/automad/src/client/admin/components/Link.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { listen, App, Attr } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { listen, App, Attr } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple link component to change the dashboard view. diff --git a/automad/src/client/admin/components/Logo.ts b/automad/src/client/admin/components/Logo.ts index 1d310cd43..fb6cc7f0c 100644 --- a/automad/src/client/admin/components/Logo.ts +++ b/automad/src/client/admin/components/Logo.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import logo from 'common/svg/logo.svg'; +import { BaseComponent } from '@/admin/components/Base'; +import logo from '@/common/svg/logo.svg'; /** * The Automad logo component. diff --git a/automad/src/client/admin/components/Modal/Modal.ts b/automad/src/client/admin/components/Modal/Modal.ts index b3a58d8c0..ae717a8d3 100644 --- a/automad/src/client/admin/components/Modal/Modal.ts +++ b/automad/src/client/admin/components/Modal/Modal.ts @@ -44,9 +44,9 @@ import { query, setFormData, queryAll, -} from '@/core'; -import { InputElement, KeyValueMap, Listener } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { InputElement, KeyValueMap, Listener } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * A modal component. diff --git a/automad/src/client/admin/components/Modal/ModalBody.ts b/automad/src/client/admin/components/Modal/ModalBody.ts index 3d1ea9895..9ad568690 100644 --- a/automad/src/client/admin/components/Modal/ModalBody.ts +++ b/automad/src/client/admin/components/Modal/ModalBody.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { CSS } from '@/core'; +import { CSS } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/Modal/ModalClose.ts b/automad/src/client/admin/components/Modal/ModalClose.ts index 9d36eff90..ad1259b2e 100644 --- a/automad/src/client/admin/components/Modal/ModalClose.ts +++ b/automad/src/client/admin/components/Modal/ModalClose.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; import { ModalComponent } from './Modal'; /** diff --git a/automad/src/client/admin/components/Modal/ModalDialog.ts b/automad/src/client/admin/components/Modal/ModalDialog.ts index c15f6350c..c54068142 100644 --- a/automad/src/client/admin/components/Modal/ModalDialog.ts +++ b/automad/src/client/admin/components/Modal/ModalDialog.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { CSS } from '@/core'; +import { CSS } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/Modal/ModalField.ts b/automad/src/client/admin/components/Modal/ModalField.ts index cc2a4da05..b6d5ba388 100644 --- a/automad/src/client/admin/components/Modal/ModalField.ts +++ b/automad/src/client/admin/components/Modal/ModalField.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, create, CSS, html, listen, queryAll } from '@/core'; +import { App, Attr, create, CSS, html, listen, queryAll } from '@/admin/core'; import { ModalComponent } from './Modal'; /** diff --git a/automad/src/client/admin/components/Modal/ModalFooter.ts b/automad/src/client/admin/components/Modal/ModalFooter.ts index 15efface3..53026da8e 100644 --- a/automad/src/client/admin/components/Modal/ModalFooter.ts +++ b/automad/src/client/admin/components/Modal/ModalFooter.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { CSS } from '@/core'; +import { CSS } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/Modal/ModalHeader.ts b/automad/src/client/admin/components/Modal/ModalHeader.ts index 6b5aabd86..a1fe62e7f 100644 --- a/automad/src/client/admin/components/Modal/ModalHeader.ts +++ b/automad/src/client/admin/components/Modal/ModalHeader.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create, CSS } from '@/core'; +import { create, CSS } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/Modal/ModalJumpbar.ts b/automad/src/client/admin/components/Modal/ModalJumpbar.ts index a8d04bb40..52e049cf6 100644 --- a/automad/src/client/admin/components/Modal/ModalJumpbar.ts +++ b/automad/src/client/admin/components/Modal/ModalJumpbar.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, create, keyCombo, listen } from '@/core'; +import { App, create, keyCombo, listen } from '@/admin/core'; import { ModalComponent } from './Modal'; /** diff --git a/automad/src/client/admin/components/Modal/ModalJumpbarDialog.ts b/automad/src/client/admin/components/Modal/ModalJumpbarDialog.ts index 1a3494852..0d594d310 100644 --- a/automad/src/client/admin/components/Modal/ModalJumpbarDialog.ts +++ b/automad/src/client/admin/components/Modal/ModalJumpbarDialog.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { JumpbarItemData, KeyValueMap, PageMetaData } from '@/types'; -import { App, Attr, create, CSS, html, Route } from '@/core'; -import { Section } from 'common'; +import { JumpbarItemData, KeyValueMap, PageMetaData } from '@/admin/types'; +import { App, Attr, create, CSS, html, Route } from '@/admin/core'; +import { Section } from '@/common'; import { AutocompleteComponent } from '../Autocomplete'; /** diff --git a/automad/src/client/admin/components/Modal/ModalToggle.ts b/automad/src/client/admin/components/Modal/ModalToggle.ts index 8464eabee..7dc834c97 100644 --- a/automad/src/client/admin/components/Modal/ModalToggle.ts +++ b/automad/src/client/admin/components/Modal/ModalToggle.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { Attr, listen, query } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { Attr, listen, query } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; import { ModalComponent } from './Modal'; /** diff --git a/automad/src/client/admin/components/NavItem.ts b/automad/src/client/admin/components/NavItem.ts index 5d6084f90..202dad392 100644 --- a/automad/src/client/admin/components/NavItem.ts +++ b/automad/src/client/admin/components/NavItem.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { isActivePage, App, html, CSS, Attr } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { isActivePage, App, html, CSS, Attr } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A simple link in the sidebar navigation. diff --git a/automad/src/client/admin/components/NavTree.ts b/automad/src/client/admin/components/NavTree.ts index 72d09fad8..43f25f936 100644 --- a/automad/src/client/admin/components/NavTree.ts +++ b/automad/src/client/admin/components/NavTree.ts @@ -57,10 +57,10 @@ import { queryAll, requestAPI, Route, -} from '@/core'; -import { createSortableTreeNodes, treeStyles } from '@/core/tree'; -import { KeyValueMap, PageMetaData } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { createSortableTreeNodes, treeStyles } from '@/admin/core/tree'; +import { KeyValueMap, PageMetaData } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * Handle responses when moving pages. diff --git a/automad/src/client/admin/components/NumberUnitInput.ts b/automad/src/client/admin/components/NumberUnitInput.ts index e06b26faf..d594649b2 100644 --- a/automad/src/client/admin/components/NumberUnitInput.ts +++ b/automad/src/client/admin/components/NumberUnitInput.ts @@ -39,8 +39,8 @@ import { fire, FormDataProviders, listen, -} from '@/core'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A special input that combines a number input with a unit dropdown. diff --git a/automad/src/client/admin/components/PackageManager/PackageCard.ts b/automad/src/client/admin/components/PackageManager/PackageCard.ts index b5b07fcf0..76e6ee5f6 100644 --- a/automad/src/client/admin/components/PackageManager/PackageCard.ts +++ b/automad/src/client/admin/components/PackageManager/PackageCard.ts @@ -46,9 +46,9 @@ import { notifySuccess, PackageManagerController, requestAPI, -} from '@/core'; -import { Package } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { Package } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; const packageBrowser = 'https://packages.automad.org'; diff --git a/automad/src/client/admin/components/PackageManager/PackageList.ts b/automad/src/client/admin/components/PackageManager/PackageList.ts index 678ee65e4..fa8020ead 100644 --- a/automad/src/client/admin/components/PackageManager/PackageList.ts +++ b/automad/src/client/admin/components/PackageManager/PackageList.ts @@ -39,9 +39,9 @@ import { listen, PackageManagerController, requestAPI, -} from '@/core'; -import { KeyValueMap, Package } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { KeyValueMap, Package } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * Get and sort all required package data in order to generate the package card grid. diff --git a/automad/src/client/admin/components/PackageManager/UpdateAllPackages.ts b/automad/src/client/admin/components/PackageManager/UpdateAllPackages.ts index ec0002b99..a924e190b 100644 --- a/automad/src/client/admin/components/PackageManager/UpdateAllPackages.ts +++ b/automad/src/client/admin/components/PackageManager/UpdateAllPackages.ts @@ -43,8 +43,8 @@ import { notifySuccess, PackageManagerController, requestAPI, -} from '@/core'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * The update all button component. It is only visible in case there are outdated packages. diff --git a/automad/src/client/admin/components/PageSelectTree.ts b/automad/src/client/admin/components/PageSelectTree.ts index f3663801d..571adaf39 100644 --- a/automad/src/client/admin/components/PageSelectTree.ts +++ b/automad/src/client/admin/components/PageSelectTree.ts @@ -45,10 +45,10 @@ import { html, listen, query, -} from '@/core'; -import { createSortableTreeNodes, treeStyles } from '@/core/tree'; -import { PageMetaData } from '@/types'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { createSortableTreeNodes, treeStyles } from '@/admin/core/tree'; +import { PageMetaData } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; import { ModalComponent } from './Modal/Modal'; /** diff --git a/automad/src/client/admin/components/Pages/BaseCenteredLayout.ts b/automad/src/client/admin/components/Pages/BaseCenteredLayout.ts index 5914daa58..744d56533 100644 --- a/automad/src/client/admin/components/Pages/BaseCenteredLayout.ts +++ b/automad/src/client/admin/components/Pages/BaseCenteredLayout.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Partials } from '@/types'; +import { Partials } from '@/admin/types'; import { BaseLayoutComponent } from './BaseLayout'; import { centered } from './Templates/CenteredLayoutTemplate'; diff --git a/automad/src/client/admin/components/Pages/BaseDashboardLayout.ts b/automad/src/client/admin/components/Pages/BaseDashboardLayout.ts index ed88b2193..8c922269e 100644 --- a/automad/src/client/admin/components/Pages/BaseDashboardLayout.ts +++ b/automad/src/client/admin/components/Pages/BaseDashboardLayout.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Partials } from '@/types'; +import { Partials } from '@/admin/types'; import { BaseLayoutComponent } from './BaseLayout'; import { dashboardLayout } from './Templates/DashboardLayoutTemplate'; diff --git a/automad/src/client/admin/components/Pages/BaseLayout.ts b/automad/src/client/admin/components/Pages/BaseLayout.ts index 9d408d958..0162612f8 100644 --- a/automad/src/client/admin/components/Pages/BaseLayout.ts +++ b/automad/src/client/admin/components/Pages/BaseLayout.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { setDocumentTitle } from '@/core'; -import { Partials } from '@/types'; -import { BaseComponent } from '@/components/Base'; +import { setDocumentTitle } from '@/admin/core'; +import { Partials } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; /** * The base view component. diff --git a/automad/src/client/admin/components/Pages/Home.ts b/automad/src/client/admin/components/Pages/Home.ts index 6736600b1..c23a9807c 100644 --- a/automad/src/client/admin/components/Pages/Home.ts +++ b/automad/src/client/admin/components/Pages/Home.ts @@ -40,8 +40,8 @@ import { getTagFromRoute, html, Route, -} from '@/core'; -import { Section } from 'common'; +} from '@/admin/core'; +import { Section } from '@/common'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; const systemInfo = (): string => { @@ -66,11 +66,15 @@ const systemInfo = (): string => { -
+
+ + ${App.text('inPageEdit')} + +
+
${App.text('inPageEdit')} diff --git a/automad/src/client/admin/components/Pages/InPage.ts b/automad/src/client/admin/components/Pages/InPage.ts index 3d7bd04f4..3a9dcc6a8 100644 --- a/automad/src/client/admin/components/Pages/InPage.ts +++ b/automad/src/client/admin/components/Pages/InPage.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { getTagFromRoute, Route } from '@/core'; -import { Partials } from '@/types'; +import { getTagFromRoute, Route } from '@/admin/core'; +import { Partials } from '@/admin/types'; import { BaseLayoutComponent } from './BaseLayout'; import { inPage } from './Templates/InPageLayoutTemplate'; diff --git a/automad/src/client/admin/components/Pages/Login.ts b/automad/src/client/admin/components/Pages/Login.ts index 047b12b45..74f299ce3 100644 --- a/automad/src/client/admin/components/Pages/Login.ts +++ b/automad/src/client/admin/components/Pages/Login.ts @@ -40,7 +40,7 @@ import { html, Route, SessionController, -} from '@/core'; +} from '@/admin/core'; import { BaseCenteredLayoutComponent } from './BaseCenteredLayout'; /** diff --git a/automad/src/client/admin/components/Pages/Packages.ts b/automad/src/client/admin/components/Pages/Packages.ts index 0b62c89ad..fa4c82340 100644 --- a/automad/src/client/admin/components/Pages/Packages.ts +++ b/automad/src/client/admin/components/Pages/Packages.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, getTagFromRoute, html, Route } from '@/core'; +import { App, Attr, CSS, getTagFromRoute, html, Route } from '@/admin/core'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; /** diff --git a/automad/src/client/admin/components/Pages/Page.ts b/automad/src/client/admin/components/Pages/Page.ts index 787ac96d5..eecdb8086 100644 --- a/automad/src/client/admin/components/Pages/Page.ts +++ b/automad/src/client/admin/components/Pages/Page.ts @@ -42,9 +42,9 @@ import { html, PageController, Route, -} from '@/core'; -import { HistoryModalFormComponent } from '@/components/Forms/HistoryModalForm'; -import { Section } from 'common'; +} from '@/admin/core'; +import { HistoryModalFormComponent } from '@/admin/components/Forms/HistoryModalForm'; +import { Section } from '@/common'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; import { renderFileImportModal } from './Partials/FileImportModal'; @@ -162,7 +162,6 @@ const renderDropdown = (): string => { { return html` diff --git a/automad/src/client/admin/components/Pages/Partials/System/Cache.ts b/automad/src/client/admin/components/Pages/Partials/System/Cache.ts index 5b3d562bc..4bbec09d2 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Cache.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Cache.ts @@ -40,7 +40,7 @@ import { CSS, EventName, html, -} from '@/core'; +} from '@/admin/core'; /** * Render the cache section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Debug.ts b/automad/src/client/admin/components/Pages/Partials/System/Debug.ts index b4f31981c..cbf61f2a7 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Debug.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Debug.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, ConfigController, EventName, html } from '@/core'; +import { App, Attr, ConfigController, EventName, html } from '@/admin/core'; /** * Render the debug section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Feed.ts b/automad/src/client/admin/components/Pages/Partials/System/Feed.ts index 89f610995..e328ded5a 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Feed.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Feed.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, ConfigController, CSS, EventName, html } from '@/core'; +import { App, Attr, ConfigController, CSS, EventName, html } from '@/admin/core'; /** * Render the feed section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/I18n.ts b/automad/src/client/admin/components/Pages/Partials/System/I18n.ts index fcb3ded10..cd3e0e5fc 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/I18n.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/I18n.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, ConfigController, EventName, html } from '@/core'; +import { App, Attr, ConfigController, EventName, html } from '@/admin/core'; /** * Render the debug section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Language.ts b/automad/src/client/admin/components/Pages/Partials/System/Language.ts index 1db37b8e2..062be5503 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Language.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Language.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, ConfigController, EventName, html } from '@/core'; +import { App, Attr, ConfigController, EventName, html } from '@/admin/core'; /** * Render the cache section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Mail.ts b/automad/src/client/admin/components/Pages/Partials/System/Mail.ts index 60e94c247..bfde3d2ab 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Mail.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Mail.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, EventName, MailConfigController } from '@/core'; +import { App, Attr, CSS, EventName, MailConfigController } from '@/admin/core'; /** * Render the email section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Update.ts b/automad/src/client/admin/components/Pages/Partials/System/Update.ts index d0d4ac926..00ae73905 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Update.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Update.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Attr, html, SystemController } from '@/core'; +import { Attr, html, SystemController } from '@/admin/core'; /** * Render the update section. diff --git a/automad/src/client/admin/components/Pages/Partials/System/Users.ts b/automad/src/client/admin/components/Pages/Partials/System/Users.ts index 5a5c4df64..6c7f76f40 100644 --- a/automad/src/client/admin/components/Pages/Partials/System/Users.ts +++ b/automad/src/client/admin/components/Pages/Partials/System/Users.ts @@ -42,7 +42,7 @@ import { html, UserCollectionController, UserController, -} from '@/core'; +} from '@/admin/core'; /** * Render the user section. diff --git a/automad/src/client/admin/components/Pages/ResetPassword.ts b/automad/src/client/admin/components/Pages/ResetPassword.ts index 6615f85ce..63ed84c3e 100644 --- a/automad/src/client/admin/components/Pages/ResetPassword.ts +++ b/automad/src/client/admin/components/Pages/ResetPassword.ts @@ -39,7 +39,7 @@ import { html, Route, UserController, -} from '@/core'; +} from '@/admin/core'; import { BaseCenteredLayoutComponent } from './BaseCenteredLayout'; /** diff --git a/automad/src/client/admin/components/Pages/Search.ts b/automad/src/client/admin/components/Pages/Search.ts index 34fbce5c2..bd4110e8f 100644 --- a/automad/src/client/admin/components/Pages/Search.ts +++ b/automad/src/client/admin/components/Pages/Search.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, getTagFromRoute, html, Route } from '@/core'; +import { App, Attr, CSS, getTagFromRoute, html, Route } from '@/admin/core'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; /** diff --git a/automad/src/client/admin/components/Pages/Setup.ts b/automad/src/client/admin/components/Pages/Setup.ts index c6527323e..f2c2d24d8 100644 --- a/automad/src/client/admin/components/Pages/Setup.ts +++ b/automad/src/client/admin/components/Pages/Setup.ts @@ -38,7 +38,7 @@ import { html, Route, UserCollectionController, -} from '@/core'; +} from '@/admin/core'; import { BaseCenteredLayoutComponent } from './BaseCenteredLayout'; /** diff --git a/automad/src/client/admin/components/Pages/Shared.ts b/automad/src/client/admin/components/Pages/Shared.ts index 11c9ca71e..b61e71272 100644 --- a/automad/src/client/admin/components/Pages/Shared.ts +++ b/automad/src/client/admin/components/Pages/Shared.ts @@ -41,8 +41,8 @@ import { html, Route, SharedController, -} from '@/core'; -import { Section } from 'common'; +} from '@/admin/core'; +import { Section } from '@/common'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; import { renderFileImportModal } from './Partials/FileImportModal'; diff --git a/automad/src/client/admin/components/Pages/System.ts b/automad/src/client/admin/components/Pages/System.ts index d55fcde23..f24a9ba67 100644 --- a/automad/src/client/admin/components/Pages/System.ts +++ b/automad/src/client/admin/components/Pages/System.ts @@ -32,13 +32,13 @@ * Licensed under the MIT license. */ -import { App, Attr, create, CSS, getTagFromRoute, html, Route } from '@/core'; +import { App, Attr, create, CSS, getTagFromRoute, html, Route } from '@/admin/core'; import { SwitcherDropdownData, SwitcherDropdownItem, SystemSectionData, -} from '@/types'; -import { Section } from 'common'; +} from '@/admin/types'; +import { Section } from '@/common'; import { renderCacheSection } from './Partials/System/Cache'; import { renderDebugSection } from './Partials/System/Debug'; import { renderFeedSection } from './Partials/System/Feed'; diff --git a/automad/src/client/admin/components/Pages/Templates/CenteredLayoutTemplate.ts b/automad/src/client/admin/components/Pages/Templates/CenteredLayoutTemplate.ts index b3309b992..d650fc706 100644 --- a/automad/src/client/admin/components/Pages/Templates/CenteredLayoutTemplate.ts +++ b/automad/src/client/admin/components/Pages/Templates/CenteredLayoutTemplate.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html } from '@/core'; -import { Partials } from '@/types'; +import { App, Attr, CSS, html } from '@/admin/core'; +import { Partials } from '@/admin/types'; export const centered = ({ main }: Partials): string => { return html` diff --git a/automad/src/client/admin/components/Pages/Templates/DashboardLayoutTemplate.ts b/automad/src/client/admin/components/Pages/Templates/DashboardLayoutTemplate.ts index cfbd3f2c7..35fffb82f 100644 --- a/automad/src/client/admin/components/Pages/Templates/DashboardLayoutTemplate.ts +++ b/automad/src/client/admin/components/Pages/Templates/DashboardLayoutTemplate.ts @@ -44,9 +44,9 @@ import { Route, SessionController, titleCase, -} from '@/core'; -import { Partials } from '@/types'; -import { Section } from 'common'; +} from '@/admin/core'; +import { Partials } from '@/admin/types'; +import { Section } from '@/common'; export const dashboardLayout = ({ main }: Partials) => { return html` @@ -81,35 +81,44 @@ export const dashboardLayout = ({ main }: Partials) => { > -
+ + ${App.text('jumpbarButtonText')} + + + + + + + + - ${App.text('jumpbarButtonText')} - - + -
- - - - - - - + diff --git a/automad/src/client/admin/components/Pages/Templates/InPageLayoutTemplate.ts b/automad/src/client/admin/components/Pages/Templates/InPageLayoutTemplate.ts index 84868e550..b5dcb17e4 100644 --- a/automad/src/client/admin/components/Pages/Templates/InPageLayoutTemplate.ts +++ b/automad/src/client/admin/components/Pages/Templates/InPageLayoutTemplate.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, CSS, html, InPageController } from '@/core'; -import { Partials } from '@/types'; +import { App, Attr, CSS, html, InPageController } from '@/admin/core'; +import { Partials } from '@/admin/types'; export const inPage = ({ main }: Partials): string => { return html` diff --git a/automad/src/client/admin/components/Pages/Trash.ts b/automad/src/client/admin/components/Pages/Trash.ts index 1dc79a877..54122cc4f 100644 --- a/automad/src/client/admin/components/Pages/Trash.ts +++ b/automad/src/client/admin/components/Pages/Trash.ts @@ -40,7 +40,7 @@ import { html, PageTrashController, Route, -} from '@/core'; +} from '@/admin/core'; import { BaseDashboardLayoutComponent } from './BaseDashboardLayout'; /** diff --git a/automad/src/client/admin/components/Root.ts b/automad/src/client/admin/components/Root.ts index 57565e56a..867928a58 100644 --- a/automad/src/client/admin/components/Root.ts +++ b/automad/src/client/admin/components/Root.ts @@ -53,9 +53,9 @@ import { Undo, SessionController, initInputChangeHandler, -} from '@/core'; -import { applyTheme, getTheme } from '@/core/theme'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { applyTheme, getTheme } from '@/admin/core/theme'; +import { BaseComponent } from '@/admin/components/Base'; import { ModalComponent } from './Modal/Modal'; import { SidebarComponent } from './Sidebar/Sidebar'; diff --git a/automad/src/client/admin/components/Select.ts b/automad/src/client/admin/components/Select.ts index 31fb2e531..064af9ce3 100644 --- a/automad/src/client/admin/components/Select.ts +++ b/automad/src/client/admin/components/Select.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { create, CSS, EventName, html, listen, Undo } from '@/core'; -import { BaseComponent } from '@/components/Base'; -import { KeyValueMap, SelectComponentOption, UndoValue } from '@/types'; +import { create, CSS, EventName, html, listen, Undo } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { KeyValueMap, SelectComponentOption, UndoValue } from '@/admin/types'; /** * An advanced select component. The component inner HTML has to contain a single span diff --git a/automad/src/client/admin/components/Sidebar/Sidebar.ts b/automad/src/client/admin/components/Sidebar/Sidebar.ts index 35cc1e3be..2d588b136 100644 --- a/automad/src/client/admin/components/Sidebar/Sidebar.ts +++ b/automad/src/client/admin/components/Sidebar/Sidebar.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { CSS, debounce, listen } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { CSS, debounce, listen } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * The sidebar scroll container. diff --git a/automad/src/client/admin/components/Sidebar/SidebarToggle.ts b/automad/src/client/admin/components/Sidebar/SidebarToggle.ts index c1eb27a11..8cfd83a97 100644 --- a/automad/src/client/admin/components/Sidebar/SidebarToggle.ts +++ b/automad/src/client/admin/components/Sidebar/SidebarToggle.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { listen } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { listen } from '@/admin/core'; import { SidebarComponent } from './Sidebar'; /** diff --git a/automad/src/client/admin/components/Spinner.ts b/automad/src/client/admin/components/Spinner.ts index ed617aa63..f21a89cbe 100644 --- a/automad/src/client/admin/components/Spinner.ts +++ b/automad/src/client/admin/components/Spinner.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { CSS } from '@/core'; -import { BaseComponent } from '@/components/Base'; +import { CSS } from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * A spinner component. diff --git a/automad/src/client/admin/components/Switcher/Switcher.ts b/automad/src/client/admin/components/Switcher/Switcher.ts index 4b6b20ef9..8d522bead 100644 --- a/automad/src/client/admin/components/Switcher/Switcher.ts +++ b/automad/src/client/admin/components/Switcher/Switcher.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; +import { BaseComponent } from '@/admin/components/Base'; import { Attr, EventName, @@ -43,7 +43,7 @@ import { queryAll, setSearchParam, Undo, -} from '@/core'; +} from '@/admin/core'; import { SwitcherLinkComponent } from './SwitcherLink'; import { SwitcherLabelComponent } from './SwitcherLabel'; import { SwitcherSectionComponent } from './SwitcherSection'; diff --git a/automad/src/client/admin/components/Switcher/SwitcherDropdown.ts b/automad/src/client/admin/components/Switcher/SwitcherDropdown.ts index a72afd2aa..46a630785 100644 --- a/automad/src/client/admin/components/Switcher/SwitcherDropdown.ts +++ b/automad/src/client/admin/components/Switcher/SwitcherDropdown.ts @@ -32,11 +32,11 @@ * Licensed under the MIT license. */ -import { Attr, create, CSS, EventName, html, listen } from '@/core'; -import { SwitcherDropdownData, SwitcherDropdownItem } from '@/types'; -import { BaseComponent } from '@/components/Base'; +import { Attr, create, CSS, EventName, html, listen } from '@/admin/core'; +import { SwitcherDropdownData, SwitcherDropdownItem } from '@/admin/types'; +import { BaseComponent } from '@/admin/components/Base'; import { getActiveSection } from './Switcher'; -import { Section } from 'common'; +import { Section } from '@/common'; /** * The system menu switcher wrapper. diff --git a/automad/src/client/admin/components/Switcher/SwitcherLabel.ts b/automad/src/client/admin/components/Switcher/SwitcherLabel.ts index 6681c2916..fe82ae084 100644 --- a/automad/src/client/admin/components/Switcher/SwitcherLabel.ts +++ b/automad/src/client/admin/components/Switcher/SwitcherLabel.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { Attr, CSS, EventName, listen, query } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { Attr, CSS, EventName, listen, query } from '@/admin/core'; import { getActiveSection, SwitcherComponent } from './Switcher'; import { SwitcherLinkComponent } from './SwitcherLink'; diff --git a/automad/src/client/admin/components/Switcher/SwitcherLink.ts b/automad/src/client/admin/components/Switcher/SwitcherLink.ts index 479321736..9c6507b2a 100644 --- a/automad/src/client/admin/components/Switcher/SwitcherLink.ts +++ b/automad/src/client/admin/components/Switcher/SwitcherLink.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { App, Attr, CSS, EventName, listen } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { App, Attr, CSS, EventName, listen } from '@/admin/core'; import { getActiveSection, setActiveSection, diff --git a/automad/src/client/admin/components/Switcher/SwitcherSection.ts b/automad/src/client/admin/components/Switcher/SwitcherSection.ts index c13f976f8..856c8d33f 100644 --- a/automad/src/client/admin/components/Switcher/SwitcherSection.ts +++ b/automad/src/client/admin/components/Switcher/SwitcherSection.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { BaseComponent } from '@/components/Base'; -import { CSS, EventName, listen, query } from '@/core'; +import { BaseComponent } from '@/admin/components/Base'; +import { CSS, EventName, listen, query } from '@/admin/core'; import { getActiveSection, SwitcherComponent } from './Switcher'; /** diff --git a/automad/src/client/admin/components/System/CacheEnable.ts b/automad/src/client/admin/components/System/CacheEnable.ts index d6d2df227..618e96e47 100644 --- a/automad/src/client/admin/components/System/CacheEnable.ts +++ b/automad/src/client/admin/components/System/CacheEnable.ts @@ -40,7 +40,7 @@ import { EventName, FieldTag, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/CacheLifetime.ts b/automad/src/client/admin/components/System/CacheLifetime.ts index 27daf7cba..92d1da813 100644 --- a/automad/src/client/admin/components/System/CacheLifetime.ts +++ b/automad/src/client/admin/components/System/CacheLifetime.ts @@ -40,7 +40,7 @@ import { CSS, EventName, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/CacheMonitor.ts b/automad/src/client/admin/components/System/CacheMonitor.ts index c8ca05b6e..551810d11 100644 --- a/automad/src/client/admin/components/System/CacheMonitor.ts +++ b/automad/src/client/admin/components/System/CacheMonitor.ts @@ -40,7 +40,7 @@ import { CSS, EventName, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/DebugEnable.ts b/automad/src/client/admin/components/System/DebugEnable.ts index ac9b74043..0c3b19a86 100644 --- a/automad/src/client/admin/components/System/DebugEnable.ts +++ b/automad/src/client/admin/components/System/DebugEnable.ts @@ -40,7 +40,7 @@ import { EventName, FieldTag, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/FeedEnable.ts b/automad/src/client/admin/components/System/FeedEnable.ts index 649a99b36..1173ed85a 100644 --- a/automad/src/client/admin/components/System/FeedEnable.ts +++ b/automad/src/client/admin/components/System/FeedEnable.ts @@ -40,7 +40,7 @@ import { EventName, FieldTag, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/FeedFields.ts b/automad/src/client/admin/components/System/FeedFields.ts index dcb5979a3..dcfddbc44 100644 --- a/automad/src/client/admin/components/System/FeedFields.ts +++ b/automad/src/client/admin/components/System/FeedFields.ts @@ -40,7 +40,7 @@ import { EventName, FieldTag, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/I18nEnable.ts b/automad/src/client/admin/components/System/I18nEnable.ts index e271a1cc1..8977c1a22 100644 --- a/automad/src/client/admin/components/System/I18nEnable.ts +++ b/automad/src/client/admin/components/System/I18nEnable.ts @@ -40,7 +40,7 @@ import { EventName, FieldTag, listen, -} from '@/core'; +} from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/LanguageSelect.ts b/automad/src/client/admin/components/System/LanguageSelect.ts index 9d39dcb67..11a2a87e4 100644 --- a/automad/src/client/admin/components/System/LanguageSelect.ts +++ b/automad/src/client/admin/components/System/LanguageSelect.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, createSelect, CSS } from '@/core'; -import { SelectComponentOption } from '@/types'; +import { App, createSelect, CSS } from '@/admin/core'; +import { SelectComponentOption } from '@/admin/types'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/UserEmail.ts b/automad/src/client/admin/components/System/UserEmail.ts index c742d2c5f..cca4ae548 100644 --- a/automad/src/client/admin/components/System/UserEmail.ts +++ b/automad/src/client/admin/components/System/UserEmail.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, createField, FieldTag } from '@/core'; +import { App, Attr, createField, FieldTag } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/System/UserName.ts b/automad/src/client/admin/components/System/UserName.ts index 8a87eeff2..a912801cd 100644 --- a/automad/src/client/admin/components/System/UserName.ts +++ b/automad/src/client/admin/components/System/UserName.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, Attr, createField, FieldTag } from '@/core'; +import { App, Attr, createField, FieldTag } from '@/admin/core'; import { BaseComponent } from '../Base'; /** diff --git a/automad/src/client/admin/components/UndoButtons.ts b/automad/src/client/admin/components/UndoButtons.ts index cd44b3fac..ecb292345 100644 --- a/automad/src/client/admin/components/UndoButtons.ts +++ b/automad/src/client/admin/components/UndoButtons.ts @@ -40,8 +40,8 @@ import { getMetaKeyLabel, listen, Undo, -} from '@/core'; -import { BaseComponent } from '@/components/Base'; +} from '@/admin/core'; +import { BaseComponent } from '@/admin/components/Base'; /** * Undo/redo buttons component. diff --git a/automad/src/client/admin/core/app.ts b/automad/src/client/admin/core/app.ts index cef9fbdeb..54dc48e75 100644 --- a/automad/src/client/admin/core/app.ts +++ b/automad/src/client/admin/core/app.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { RootComponent } from '@/components/Root'; +import { RootComponent } from '@/admin/components/Root'; import { AppController, deleteSearchParam, @@ -55,7 +55,7 @@ import { SystemSettings, ThemeCollection, User, -} from '@/types'; +} from '@/admin/types'; /** * The static class that provides the app state and root element to be used across the application. diff --git a/automad/src/client/admin/core/bindings.ts b/automad/src/client/admin/core/bindings.ts index 93a33f904..eb96e7342 100644 --- a/automad/src/client/admin/core/bindings.ts +++ b/automad/src/client/admin/core/bindings.ts @@ -33,7 +33,7 @@ */ import { Attr, create, EventName, fire, getLogger, listen, queryAll } from '.'; -import { BindingOptions, InputElement, KeyValueMap } from '@/types'; +import { BindingOptions, InputElement, KeyValueMap } from '@/admin/types'; /** * A data binding class that allows to bind an input node to a value modifier function. diff --git a/automad/src/client/admin/core/code.ts b/automad/src/client/admin/core/code.ts index 33e2a4654..e785c9c65 100644 --- a/automad/src/client/admin/core/code.ts +++ b/automad/src/client/admin/core/code.ts @@ -32,73 +32,10 @@ * Licensed under the MIT license. */ -import { CodeLanguage } from '@/types'; +import { CodeLanguage } from '@/admin/types'; import CodeFlask from 'codeflask'; -import { debounce } from '@/core'; - -// https://github.com/PrismJS/prism/issues/1020#issuecomment-602180996 -import Prism, { Languages } from 'prismjs'; -import 'prismjs/components/prism-apacheconf'; -import 'prismjs/components/prism-basic'; -import 'prismjs/components/prism-c'; -import 'prismjs/components/prism-csharp'; -import 'prismjs/components/prism-cpp'; -import 'prismjs/components/prism-go'; -import 'prismjs/components/prism-handlebars'; -import 'prismjs/components/prism-graphql'; -import 'prismjs/components/prism-java'; -import 'prismjs/components/prism-jsx'; -import 'prismjs/components/prism-latex'; -import 'prismjs/components/prism-less'; -import 'prismjs/components/prism-lua'; -import 'prismjs/components/prism-markdown'; -import 'prismjs/components/prism-nginx'; -import 'prismjs/components/prism-php'; -import 'prismjs/components/prism-python'; -import 'prismjs/components/prism-ruby'; -import 'prismjs/components/prism-rust'; -import 'prismjs/components/prism-sass'; -import 'prismjs/components/prism-bash'; -import 'prismjs/components/prism-sql'; -import 'prismjs/components/prism-tsx'; -import 'prismjs/components/prism-typescript'; -import 'prismjs/components/prism-vim'; -import 'prismjs/components/prism-yaml'; - -export const codeLanguages = [ - 'apacheconf', - 'bash', - 'basic', - 'c', - 'clike', - 'csharp', - 'cpp', - 'css', - 'go', - 'graphql', - 'handlebars', - 'html', - 'java', - 'javascript', - 'jsx', - 'latex', - 'less', - 'lua', - 'markdown', - 'nginx', - 'none', - 'php', - 'powershell', - 'python', - 'ruby', - 'rust', - 'sass', - 'sql', - 'tsx', - 'typescript', - 'vim', - 'yaml', -] as const; +import { debounce, getLogger } from '@/admin/core'; +import { Prism, Languages } from '@/prism/prism'; /** * A thin wrapper around CodeFlask. @@ -144,6 +81,8 @@ export class CodeEditor { this.codeFlask.updateCode(code); + getLogger().log('Prism:', language, Prism.languages[language]); + this.codeFlask.onUpdate( debounce(() => { onChange(this.codeFlask.getCode()); diff --git a/automad/src/client/admin/core/events.ts b/automad/src/client/admin/core/events.ts index 4e1a15a66..272f945b9 100644 --- a/automad/src/client/admin/core/events.ts +++ b/automad/src/client/admin/core/events.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Listener } from '@/types'; +import { Listener } from '@/admin/types'; import { CSS, getLogger, query, queryAll } from '.'; /** diff --git a/automad/src/client/admin/core/factory.ts b/automad/src/client/admin/core/factory.ts index 9f9571e48..37a476157 100644 --- a/automad/src/client/admin/core/factory.ts +++ b/automad/src/client/admin/core/factory.ts @@ -32,14 +32,14 @@ * Licensed under the MIT license. */ -import { ModalComponent } from '@/components/Modal/Modal'; +import { ModalComponent } from '@/admin/components/Modal/Modal'; import { EditorOutputData, FieldInitData, FieldSectionCollection, KeyValueMap, SelectComponentOption, -} from '@/types'; +} from '@/admin/types'; import { App, Attr, @@ -56,15 +56,15 @@ import { query, uniqueId, } from '.'; -import { PageDataFormComponent } from '@/components/Forms/PageDataForm'; -import { SwitcherSectionComponent } from '@/components/Switcher/SwitcherSection'; -import { SharedDataFormComponent } from '@/components/Forms/SharedDataForm'; -import { AutocompleteUrlComponent } from '@/components/AutocompleteUrl'; -import { BaseFieldComponent } from '@/components/Fields/BaseField'; -import { SelectComponent } from '@/components/Select'; +import { PageDataFormComponent } from '@/admin/components/Forms/PageDataForm'; +import { SwitcherSectionComponent } from '@/admin/components/Switcher/SwitcherSection'; +import { SharedDataFormComponent } from '@/admin/components/Forms/SharedDataForm'; +import { AutocompleteUrlComponent } from '@/admin/components/AutocompleteUrl'; +import { BaseFieldComponent } from '@/admin/components/Fields/BaseField'; +import { SelectComponent } from '@/admin/components/Select'; import { EditorConfig } from 'automad-editorjs'; -import { EditorJSComponent } from '@/components/EditorJS'; -import { Section } from 'common'; +import { EditorJSComponent } from '@/admin/components/EditorJS'; +import { Section } from '@/common'; /** * Create a new EditorJSComponent element. diff --git a/automad/src/client/admin/core/form.ts b/automad/src/client/admin/core/form.ts index 8d2a180ed..f347e7ff4 100644 --- a/automad/src/client/admin/core/form.ts +++ b/automad/src/client/admin/core/form.ts @@ -47,7 +47,7 @@ import { FieldGroups, InputElement, KeyValueMap, -} from '@/types'; +} from '@/admin/types'; /** * The tag names enum for fields. @@ -71,6 +71,7 @@ export const enum FieldTag { markdown = 'am-markdown', imageSelect = 'am-image-select', url = 'am-url', + syntaxSelect = 'am-syntax-theme-select', textarea = 'am-textarea', title = 'am-title', } diff --git a/automad/src/client/admin/core/html.ts b/automad/src/client/admin/core/html.ts index bf49855b6..145b90d74 100644 --- a/automad/src/client/admin/core/html.ts +++ b/automad/src/client/admin/core/html.ts @@ -33,7 +33,7 @@ */ import DOMPurify from 'dompurify'; -import { KeyValueMap } from '@/types'; +import { KeyValueMap } from '@/admin/types'; /** * A whitelist of custom component attributes. diff --git a/automad/src/client/admin/core/index.ts b/automad/src/client/admin/core/index.ts index e34648f85..740a80eb4 100644 --- a/automad/src/client/admin/core/index.ts +++ b/automad/src/client/admin/core/index.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -export * from 'common'; +export * from '@/common'; export * from './app'; export * from './bindings'; diff --git a/automad/src/client/admin/core/logger.ts b/automad/src/client/admin/core/logger.ts index 88542c61a..a92b91156 100644 --- a/automad/src/client/admin/core/logger.ts +++ b/automad/src/client/admin/core/logger.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { KeyValueMap, Logger } from '@/types'; +import { KeyValueMap, Logger } from '@/admin/types'; import { App } from '.'; /** diff --git a/automad/src/client/admin/core/notify.ts b/automad/src/client/admin/core/notify.ts index b4d553d24..f33209e10 100644 --- a/automad/src/client/admin/core/notify.ts +++ b/automad/src/client/admin/core/notify.ts @@ -34,7 +34,7 @@ import Toastify from 'toastify-js'; import { query, create, CSS } from '.'; -import { NotifyOptions } from '@/types'; +import { NotifyOptions } from '@/admin/types'; const defaults: Toastify.Options = { close: false, diff --git a/automad/src/client/admin/core/request.ts b/automad/src/client/admin/core/request.ts index 89949b186..e1be6e178 100644 --- a/automad/src/client/admin/core/request.ts +++ b/automad/src/client/admin/core/request.ts @@ -44,8 +44,8 @@ import { query, RequestKey, } from '.'; -import { FormComponent } from '@/components/Forms/Form'; -import { KeyValueMap, APIResponse } from '@/types'; +import { FormComponent } from '@/admin/components/Forms/Form'; +import { KeyValueMap, APIResponse } from '@/admin/types'; /** * Get the current CSRF token that is stored in the meta tag. diff --git a/automad/src/client/admin/core/state.ts b/automad/src/client/admin/core/state.ts index b1645be1d..58840b8f1 100644 --- a/automad/src/client/admin/core/state.ts +++ b/automad/src/client/admin/core/state.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { RootComponent } from '@/components/Root'; -import { KeyValueMap } from '@/types'; +import { RootComponent } from '@/admin/components/Root'; +import { KeyValueMap } from '@/admin/types'; import { EventName, fire, getLogger } from '.'; /** diff --git a/automad/src/client/admin/core/tooltips.ts b/automad/src/client/admin/core/tooltips.ts index f010fd75e..3a2432e24 100644 --- a/automad/src/client/admin/core/tooltips.ts +++ b/automad/src/client/admin/core/tooltips.ts @@ -34,7 +34,7 @@ import { Attr, create, listen, query, queryAll } from '.'; import Tooltip from 'codex-tooltip'; -import { KeyValueMap } from '@/types'; +import { KeyValueMap } from '@/admin/types'; const getTooltipOptions = (element: HTMLElement): KeyValueMap => { const optionString = element.getAttribute(Attr.tooltipOptions) || ''; diff --git a/automad/src/client/admin/core/tree.ts b/automad/src/client/admin/core/tree.ts index 4c2605dcf..3c8f4f019 100644 --- a/automad/src/client/admin/core/tree.ts +++ b/automad/src/client/admin/core/tree.ts @@ -37,7 +37,7 @@ import { SortableTreeNodeData, SortableTreeStyles, } from 'sortable-tree'; -import { PageMetaData } from '@/types'; +import { PageMetaData } from '@/admin/types'; import { App } from '.'; /** diff --git a/automad/src/client/admin/core/undo.ts b/automad/src/client/admin/core/undo.ts index 1c5e8ffea..aa522c391 100644 --- a/automad/src/client/admin/core/undo.ts +++ b/automad/src/client/admin/core/undo.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { UndoCapableField, UndoEntry, UndoValue } from '@/types'; +import { UndoCapableField, UndoEntry, UndoValue } from '@/admin/types'; import { debounce, EventName, fire, keyCombo, listen } from '.'; /** diff --git a/automad/src/client/admin/core/utils.ts b/automad/src/client/admin/core/utils.ts index 889ba8965..6bdff0915 100644 --- a/automad/src/client/admin/core/utils.ts +++ b/automad/src/client/admin/core/utils.ts @@ -33,7 +33,7 @@ */ import { App, Attr, CSS, create, html, listen, query } from '.'; -import { Listener } from '@/types'; +import { Listener } from '@/admin/types'; import { customAlphabet } from 'nanoid'; /** diff --git a/automad/src/client/admin/editor/blocks/BaseBlock.ts b/automad/src/client/admin/editor/blocks/BaseBlock.ts index 531aecbe5..177971979 100644 --- a/automad/src/client/admin/editor/blocks/BaseBlock.ts +++ b/automad/src/client/admin/editor/blocks/BaseBlock.ts @@ -39,8 +39,8 @@ import { BlockToolConstructorOptions, BlockToolData, } from 'automad-editorjs'; -import { create } from '@/core'; -import { KeyValueMap, Listener } from '@/types'; +import { create } from '@/admin/core'; +import { KeyValueMap, Listener } from '@/admin/types'; /** * The abstract base block class. diff --git a/automad/src/client/admin/editor/blocks/Buttons.ts b/automad/src/client/admin/editor/blocks/Buttons.ts index 1fc1487b9..c55ae8c44 100644 --- a/automad/src/client/admin/editor/blocks/Buttons.ts +++ b/automad/src/client/admin/editor/blocks/Buttons.ts @@ -48,8 +48,8 @@ import { listen, query, uniqueId, -} from '@/core'; -import { ButtonsBlockButtonStyle, ButtonsBlockData } from '@/types'; +} from '@/admin/core'; +import { ButtonsBlockButtonStyle, ButtonsBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export const buttonsJustifyOptions = ['start', 'center', 'end'] as const; diff --git a/automad/src/client/admin/editor/blocks/Code.ts b/automad/src/client/admin/editor/blocks/Code.ts index a1a1c2202..ab335fa96 100644 --- a/automad/src/client/admin/editor/blocks/Code.ts +++ b/automad/src/client/admin/editor/blocks/Code.ts @@ -32,9 +32,20 @@ * Licensed under the MIT license. */ -import { App, Attr, create, createSelect, CSS, html, query } from '@/core'; -import { CodeEditor, codeLanguages } from '@/core/code'; -import { CodeBlockData } from '@/types'; +import { + App, + Attr, + collectFieldData, + create, + createSelect, + CSS, + html, + query, + uniqueId, +} from '@/admin/core'; +import { CodeEditor } from '@/admin/core/code'; +import { CodeBlockData } from '@/admin/types'; +import { supportedLanguages } from '@/prism/prism'; import { BaseBlock } from './BaseBlock'; export class CodeBlock extends BaseBlock { @@ -83,7 +94,11 @@ export class CodeBlock extends BaseBlock { * @return the prepared data */ protected prepareData(data: CodeBlockData): CodeBlockData { - return { code: data.code ?? '', language: data.language ?? 'none' }; + return { + code: data.code ?? '', + language: data.language ?? 'none', + lineNumbers: data.lineNumbers ?? false, + }; } /** @@ -107,29 +122,69 @@ export class CodeBlock extends BaseBlock { ` ); - const langSelect = createSelect( - codeLanguages.map((lang) => ({ + const container = create( + 'div', + [CSS.flex, CSS.flexColumn, CSS.flexGap], + {}, + this.wrapper + ); + + const settings = create( + 'div', + [CSS.grid, CSS.gridAuto, CSS.flexGap], + {}, + container + ); + + createSelect( + supportedLanguages.map((lang) => ({ value: lang, })), this.data.language, - this.wrapper + settings, + 'language' ); - const container = create( + const toggleId = uniqueId(); + + create( + 'div', + [CSS.toggle, CSS.toggleButton], + {}, + settings, + html` + + + ` + ); + + const code = create( 'div', [CSS.editorBlockCode], {}, - this.wrapper + container ) as HTMLDivElement; - this.api.listeners.on(langSelect, 'change', () => { + this.api.listeners.on(settings, 'change', () => { + const { language, lineNumbers } = collectFieldData(settings); + + this.data.lineNumbers = lineNumbers; this.data.language = - langSelect.value as unknown as (typeof codeLanguages)[number]; + language as unknown as (typeof supportedLanguages)[number]; - this.initEditor(container); + this.initEditor(code); }); - this.initEditor(container); + this.initEditor(code); return this.wrapper; } @@ -167,6 +222,7 @@ export class CodeBlock extends BaseBlock { return { code: this.editor.codeFlask.getCode(), language: this.data.language, + lineNumbers: this.data.lineNumbers, }; } } diff --git a/automad/src/client/admin/editor/blocks/Delimiter.ts b/automad/src/client/admin/editor/blocks/Delimiter.ts index c03b0a903..0143a5384 100644 --- a/automad/src/client/admin/editor/blocks/Delimiter.ts +++ b/automad/src/client/admin/editor/blocks/Delimiter.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App, create, CSS } from '@/core'; +import { App, create, CSS } from '@/admin/core'; import { BaseBlock } from './BaseBlock'; export class Delimiter extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/Filelist.ts b/automad/src/client/admin/editor/blocks/Filelist.ts index 433468d8c..75a9aa919 100644 --- a/automad/src/client/admin/editor/blocks/Filelist.ts +++ b/automad/src/client/admin/editor/blocks/Filelist.ts @@ -47,8 +47,8 @@ import { listen, query, uniqueId, -} from '@/core'; -import { FilelistBlockData, SelectComponentOption } from '@/types'; +} from '@/admin/core'; +import { FilelistBlockData, SelectComponentOption } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; const defaultFile = 'default'; diff --git a/automad/src/client/admin/editor/blocks/Gallery.ts b/automad/src/client/admin/editor/blocks/Gallery.ts index fde4ee71a..50619dfaf 100644 --- a/automad/src/client/admin/editor/blocks/Gallery.ts +++ b/automad/src/client/admin/editor/blocks/Gallery.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { ImageCollectionComponent } from '@/components/ImageCollection'; +import { ImageCollectionComponent } from '@/admin/components/ImageCollection'; import { App, Attr, @@ -47,8 +47,8 @@ import { html, listen, uniqueId, -} from '@/core'; -import { GalleryBlockData } from '@/types'; +} from '@/admin/core'; +import { GalleryBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export class GalleryBlock extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/Header.ts b/automad/src/client/admin/editor/blocks/Header.ts index f0943d078..62798c59d 100644 --- a/automad/src/client/admin/editor/blocks/Header.ts +++ b/automad/src/client/admin/editor/blocks/Header.ts @@ -33,8 +33,8 @@ * https://automad.org/license */ -import { App, create, CSS, html, query } from '@/core'; -import { HeaderBlockData } from '@/types'; +import { App, create, CSS, html, query } from '@/admin/core'; +import { HeaderBlockData } from '@/admin/types'; import { HTMLPasteEvent, TunesMenuConfig, diff --git a/automad/src/client/admin/editor/blocks/Image.ts b/automad/src/client/admin/editor/blocks/Image.ts index a81982bfc..e11999fc6 100644 --- a/automad/src/client/admin/editor/blocks/Image.ts +++ b/automad/src/client/admin/editor/blocks/Image.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { ImgComponent } from '@/components/Img'; +import { ImgComponent } from '@/admin/components/Img'; import { App, Attr, @@ -47,8 +47,8 @@ import { listen, resolveFileUrl, uniqueId, -} from '@/core'; -import { ImageBlockData } from '@/types'; +} from '@/admin/core'; +import { ImageBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export class ImageBlock extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/ImageSlideshow.ts b/automad/src/client/admin/editor/blocks/ImageSlideshow.ts index 5506aafe3..23e18f2b6 100644 --- a/automad/src/client/admin/editor/blocks/ImageSlideshow.ts +++ b/automad/src/client/admin/editor/blocks/ImageSlideshow.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { ImageCollectionComponent } from '@/components/ImageCollection'; +import { ImageCollectionComponent } from '@/admin/components/ImageCollection'; import { App, Attr, @@ -48,8 +48,8 @@ import { html, listen, uniqueId, -} from '@/core'; -import { ImageSlideshowBreakpoints, ImageSlideshowBlockData } from '@/types'; +} from '@/admin/core'; +import { ImageSlideshowBreakpoints, ImageSlideshowBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; /** diff --git a/automad/src/client/admin/editor/blocks/Mail.ts b/automad/src/client/admin/editor/blocks/Mail.ts index d1cf781bb..274e482fd 100644 --- a/automad/src/client/admin/editor/blocks/Mail.ts +++ b/automad/src/client/admin/editor/blocks/Mail.ts @@ -41,8 +41,8 @@ import { FieldTag, html, uniqueId, -} from '@/core'; -import { MailBlockData } from '@/types'; +} from '@/admin/core'; +import { MailBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export class MailBlock extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/NestedList.ts b/automad/src/client/admin/editor/blocks/NestedList.ts index b59421134..f74ff2af0 100644 --- a/automad/src/client/admin/editor/blocks/NestedList.ts +++ b/automad/src/client/admin/editor/blocks/NestedList.ts @@ -34,7 +34,7 @@ // @ts-ignore import NestedList from '@editorjs/nested-list'; -import { App } from '@/core'; +import { App } from '@/admin/core'; export class NestedListBlock extends NestedList { /** diff --git a/automad/src/client/admin/editor/blocks/Pagelist.ts b/automad/src/client/admin/editor/blocks/Pagelist.ts index d92e2bb67..241376e02 100644 --- a/automad/src/client/admin/editor/blocks/Pagelist.ts +++ b/automad/src/client/admin/editor/blocks/Pagelist.ts @@ -49,8 +49,8 @@ import { listen, query, uniqueId, -} from '@/core'; -import { PagelistBlockData, SelectComponentOption } from '@/types'; +} from '@/admin/core'; +import { PagelistBlockData, SelectComponentOption } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export const pagelistTypes = [ diff --git a/automad/src/client/admin/editor/blocks/Paragraph.ts b/automad/src/client/admin/editor/blocks/Paragraph.ts index 6ad0e142e..9361a0d84 100644 --- a/automad/src/client/admin/editor/blocks/Paragraph.ts +++ b/automad/src/client/admin/editor/blocks/Paragraph.ts @@ -33,8 +33,8 @@ * https://automad.org/license */ -import { App, create, CSS, query } from '@/core'; -import { ParagraphBlockData } from '@/types'; +import { App, create, CSS, query } from '@/admin/core'; +import { ParagraphBlockData } from '@/admin/types'; import { HTMLPasteEvent, TunesMenuConfig } from 'automad-editorjs/types/tools'; import { BaseBlock } from './BaseBlock'; diff --git a/automad/src/client/admin/editor/blocks/Quote.ts b/automad/src/client/admin/editor/blocks/Quote.ts index 3512d8996..4775e151f 100644 --- a/automad/src/client/admin/editor/blocks/Quote.ts +++ b/automad/src/client/admin/editor/blocks/Quote.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, create, CSS, html } from '@/core'; -import { QuoteBlockData, QuoteBlockInputs } from '@/types'; +import { App, create, CSS, html } from '@/admin/core'; +import { QuoteBlockData, QuoteBlockInputs } from '@/admin/types'; import { ConversionConfig } from 'automad-editorjs'; import { BaseBlock } from './BaseBlock'; diff --git a/automad/src/client/admin/editor/blocks/Raw.ts b/automad/src/client/admin/editor/blocks/Raw.ts index ef59d1f38..eb2dab6fe 100644 --- a/automad/src/client/admin/editor/blocks/Raw.ts +++ b/automad/src/client/admin/editor/blocks/Raw.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { App, Attr, create, CSS, html, query } from '@/core'; -import { CodeEditor } from '@/core/code'; -import { RawBlockData } from '@/types'; +import { App, Attr, create, CSS, html, query } from '@/admin/core'; +import { CodeEditor } from '@/admin/core/code'; +import { RawBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export class RawBlock extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/Section.ts b/automad/src/client/admin/editor/blocks/Section.ts index 91063e183..defc611aa 100644 --- a/automad/src/client/admin/editor/blocks/Section.ts +++ b/automad/src/client/admin/editor/blocks/Section.ts @@ -49,7 +49,7 @@ import { queryAll, resolveFileUrl, uniqueId, -} from '@/core'; +} from '@/admin/core'; import { EditorOutputData, SectionAlignItemsOption, @@ -57,9 +57,9 @@ import { SectionJustifyContentOption, SectionStyle, SelectComponentOption, -} from '@/types'; +} from '@/admin/types'; import { BaseBlock } from './BaseBlock'; -import { EditorJSComponent } from '@/components/EditorJS'; +import { EditorJSComponent } from '@/admin/components/EditorJS'; import { API } from 'automad-editorjs'; /** diff --git a/automad/src/client/admin/editor/blocks/Snippet.ts b/automad/src/client/admin/editor/blocks/Snippet.ts index d8ea1b326..28185368e 100644 --- a/automad/src/client/admin/editor/blocks/Snippet.ts +++ b/automad/src/client/admin/editor/blocks/Snippet.ts @@ -47,8 +47,8 @@ import { listen, query, uniqueId, -} from '@/core'; -import { SelectComponentOption, SnippetBlockData } from '@/types'; +} from '@/admin/core'; +import { SelectComponentOption, SnippetBlockData } from '@/admin/types'; import { BaseBlock } from './BaseBlock'; export class SnippetBlock extends BaseBlock { diff --git a/automad/src/client/admin/editor/blocks/Table.ts b/automad/src/client/admin/editor/blocks/Table.ts index 3de529720..763316669 100644 --- a/automad/src/client/admin/editor/blocks/Table.ts +++ b/automad/src/client/admin/editor/blocks/Table.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; +import { App } from '@/admin/core'; // @ts-ignore import Table from '@editorjs/table'; diff --git a/automad/src/client/admin/editor/blocks/TableOfContents.ts b/automad/src/client/admin/editor/blocks/TableOfContents.ts index c57558b39..d624f4a5b 100644 --- a/automad/src/client/admin/editor/blocks/TableOfContents.ts +++ b/automad/src/client/admin/editor/blocks/TableOfContents.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, CSS, html } from '@/core'; -import { TableOfContentsBlockData } from '@/types'; +import { App, CSS, html } from '@/admin/core'; +import { TableOfContentsBlockData } from '@/admin/types'; import { TunesMenuConfig } from 'automad-editorjs/types/tools'; import { BaseBlock } from './BaseBlock'; diff --git a/automad/src/client/admin/editor/inline/BaseInline.ts b/automad/src/client/admin/editor/inline/BaseInline.ts index 91e72b9a6..3555c286e 100644 --- a/automad/src/client/admin/editor/inline/BaseInline.ts +++ b/automad/src/client/admin/editor/inline/BaseInline.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create } from '@/core'; +import { create } from '@/admin/core'; import { API, InlineToolConstructorOptions } from 'automad-editorjs'; /** diff --git a/automad/src/client/admin/editor/inline/BaseSelectInline.ts b/automad/src/client/admin/editor/inline/BaseSelectInline.ts index 1921f113b..5d9e337a1 100644 --- a/automad/src/client/admin/editor/inline/BaseSelectInline.ts +++ b/automad/src/client/admin/editor/inline/BaseSelectInline.ts @@ -32,9 +32,9 @@ * Licensed under the MIT license. */ -import { SelectComponent } from '@/components/Select'; -import { create, createSelect, CSS, html, listen } from '@/core'; -import { Listener, SelectComponentOption } from '@/types'; +import { SelectComponent } from '@/admin/components/Select'; +import { create, createSelect, CSS, html, listen } from '@/admin/core'; +import { Listener, SelectComponentOption } from '@/admin/types'; import { BaseInline } from './BaseInline'; export abstract class BaseSelectInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/Bold.ts b/automad/src/client/admin/editor/inline/Bold.ts index 32f404670..5462132c8 100644 --- a/automad/src/client/admin/editor/inline/Bold.ts +++ b/automad/src/client/admin/editor/inline/Bold.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class BoldInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/Code.ts b/automad/src/client/admin/editor/inline/Code.ts index fd3ca29fb..5bdf6fa4a 100644 --- a/automad/src/client/admin/editor/inline/Code.ts +++ b/automad/src/client/admin/editor/inline/Code.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class CodeInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/Color.ts b/automad/src/client/admin/editor/inline/Color.ts index a70a4f2b2..aaed8a6ef 100644 --- a/automad/src/client/admin/editor/inline/Color.ts +++ b/automad/src/client/admin/editor/inline/Color.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { ColorComponent } from '@/components/Fields/Color'; +import { ColorComponent } from '@/admin/components/Fields/Color'; import { App, convertRgbToHex, @@ -43,8 +43,8 @@ import { fire, listen, uniqueId, -} from '@/core'; -import { KeyValueMap, Listener } from '@/types'; +} from '@/admin/core'; +import { KeyValueMap, Listener } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class ColorInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/FontSize.ts b/automad/src/client/admin/editor/inline/FontSize.ts index 3dd10182c..e19a7096c 100644 --- a/automad/src/client/admin/editor/inline/FontSize.ts +++ b/automad/src/client/admin/editor/inline/FontSize.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseSelectInline } from './BaseSelectInline'; export class FontSizeInline extends BaseSelectInline { diff --git a/automad/src/client/admin/editor/inline/Italic.ts b/automad/src/client/admin/editor/inline/Italic.ts index cfd03b685..a65f4b740 100644 --- a/automad/src/client/admin/editor/inline/Italic.ts +++ b/automad/src/client/admin/editor/inline/Italic.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class ItalicInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/LineHeight.ts b/automad/src/client/admin/editor/inline/LineHeight.ts index c6b70ea73..aacfca643 100644 --- a/automad/src/client/admin/editor/inline/LineHeight.ts +++ b/automad/src/client/admin/editor/inline/LineHeight.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseSelectInline } from './BaseSelectInline'; export class LineHeightInline extends BaseSelectInline { diff --git a/automad/src/client/admin/editor/inline/Link.ts b/automad/src/client/admin/editor/inline/Link.ts index e8c968674..57fc4a1db 100644 --- a/automad/src/client/admin/editor/inline/Link.ts +++ b/automad/src/client/admin/editor/inline/Link.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { AutocompleteUrlComponent } from '@/components/AutocompleteUrl'; -import { ToggleComponent } from '@/components/Fields/Toggle'; +import { AutocompleteUrlComponent } from '@/admin/components/AutocompleteUrl'; +import { ToggleComponent } from '@/admin/components/Fields/Toggle'; import { App, create, @@ -44,8 +44,8 @@ import { html, listen, uniqueId, -} from '@/core'; -import { KeyValueMap, Listener } from '@/types'; +} from '@/admin/core'; +import { KeyValueMap, Listener } from '@/admin/types'; import { BaseInline } from './BaseInline'; /** diff --git a/automad/src/client/admin/editor/inline/StrikeThrough.ts b/automad/src/client/admin/editor/inline/StrikeThrough.ts index 30a6e6e6d..6a334f82f 100644 --- a/automad/src/client/admin/editor/inline/StrikeThrough.ts +++ b/automad/src/client/admin/editor/inline/StrikeThrough.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class StrikeThroughInline extends BaseInline { diff --git a/automad/src/client/admin/editor/inline/TextAlign.ts b/automad/src/client/admin/editor/inline/TextAlign.ts index 8e04e9e92..17bde21d1 100644 --- a/automad/src/client/admin/editor/inline/TextAlign.ts +++ b/automad/src/client/admin/editor/inline/TextAlign.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, create, query } from '@/core'; -import { KeyValueMap, TextAlignOption, TextAlignSelection } from '@/types'; +import { App, create, query } from '@/admin/core'; +import { KeyValueMap, TextAlignOption, TextAlignSelection } from '@/admin/types'; import { API, InlineToolConstructorOptions } from 'automad-editorjs'; abstract class BaseTextAlignInline { diff --git a/automad/src/client/admin/editor/inline/Underline.ts b/automad/src/client/admin/editor/inline/Underline.ts index 5c834e31e..1b186ca36 100644 --- a/automad/src/client/admin/editor/inline/Underline.ts +++ b/automad/src/client/admin/editor/inline/Underline.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { KeyValueMap } from '@/types'; +import { App } from '@/admin/core'; +import { KeyValueMap } from '@/admin/types'; import { BaseInline } from './BaseInline'; export class UnderlineInline extends BaseInline { diff --git a/automad/src/client/admin/editor/plugins/DragDrop.ts b/automad/src/client/admin/editor/plugins/DragDrop.ts index 185d763b8..14a62fddd 100644 --- a/automad/src/client/admin/editor/plugins/DragDrop.ts +++ b/automad/src/client/admin/editor/plugins/DragDrop.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { EditorJSComponent } from '@/components/EditorJS'; -import { listen, query } from '@/core'; +import { EditorJSComponent } from '@/admin/components/EditorJS'; +import { listen, query } from '@/admin/core'; import EditorJS, { BlockAPI } from 'automad-editorjs'; import { insertBlock } from '../utils'; diff --git a/automad/src/client/admin/editor/tunes/BaseElementTune.ts b/automad/src/client/admin/editor/tunes/BaseElementTune.ts index 1cec2e437..5dcbf5264 100644 --- a/automad/src/client/admin/editor/tunes/BaseElementTune.ts +++ b/automad/src/client/admin/editor/tunes/BaseElementTune.ts @@ -33,7 +33,7 @@ */ import { API, BlockAPI, BlockTune, ToolConfig } from 'automad-editorjs'; -import { BlockTuneConstructorOptions } from '@/types'; +import { BlockTuneConstructorOptions } from '@/admin/types'; /** * The abstract base tune class that returns an element on render. diff --git a/automad/src/client/admin/editor/tunes/BaseModalTune.ts b/automad/src/client/admin/editor/tunes/BaseModalTune.ts index a12fa920f..5c2091150 100644 --- a/automad/src/client/admin/editor/tunes/BaseModalTune.ts +++ b/automad/src/client/admin/editor/tunes/BaseModalTune.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { createGenericModal, CSS, fire, listen, query } from '@/core'; -import { BlockTuneConstructorOptions } from '@/types'; +import { createGenericModal, CSS, fire, listen, query } from '@/admin/core'; +import { BlockTuneConstructorOptions } from '@/admin/types'; import { API, BlockAPI, ToolConfig } from 'automad-editorjs'; import { TunesMenuConfig } from 'automad-editorjs/types/tools'; diff --git a/automad/src/client/admin/editor/tunes/Class.ts b/automad/src/client/admin/editor/tunes/Class.ts index e645912f5..02cbed765 100644 --- a/automad/src/client/admin/editor/tunes/Class.ts +++ b/automad/src/client/admin/editor/tunes/Class.ts @@ -42,8 +42,8 @@ import { html, query, uniqueId, -} from '@/core'; -import { ClassTuneData } from '@/types'; +} from '@/admin/core'; +import { ClassTuneData } from '@/admin/types'; import { BaseModalTune } from './BaseModalTune'; export class ClassTune extends BaseModalTune { diff --git a/automad/src/client/admin/editor/tunes/Duplicate.ts b/automad/src/client/admin/editor/tunes/Duplicate.ts index 766510981..2d63a3b31 100644 --- a/automad/src/client/admin/editor/tunes/Duplicate.ts +++ b/automad/src/client/admin/editor/tunes/Duplicate.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App } from '@/core'; -import { BlockTuneConstructorOptions } from '@/types'; +import { App } from '@/admin/core'; +import { BlockTuneConstructorOptions } from '@/admin/types'; import { API, BlockAPI, BlockTune } from 'automad-editorjs'; import { TunesMenuConfig } from 'automad-editorjs/types/tools'; import { insertBlock } from '../utils'; diff --git a/automad/src/client/admin/editor/tunes/Id.ts b/automad/src/client/admin/editor/tunes/Id.ts index 3ebd7e400..fece5701b 100644 --- a/automad/src/client/admin/editor/tunes/Id.ts +++ b/automad/src/client/admin/editor/tunes/Id.ts @@ -42,8 +42,8 @@ import { html, query, uniqueId, -} from '@/core'; -import { IdTuneData } from '@/types'; +} from '@/admin/core'; +import { IdTuneData } from '@/admin/types'; import { BaseModalTune } from './BaseModalTune'; export class IdTune extends BaseModalTune { diff --git a/automad/src/client/admin/editor/tunes/Layout.ts b/automad/src/client/admin/editor/tunes/Layout.ts index a90af3b93..cdaceb770 100644 --- a/automad/src/client/admin/editor/tunes/Layout.ts +++ b/automad/src/client/admin/editor/tunes/Layout.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { App, Attr, create, createSelect, CSS, listen, query } from '@/core'; -import { LayoutFraction, LayoutTuneData, SelectComponentOption } from '@/types'; +import { App, Attr, create, createSelect, CSS, listen, query } from '@/admin/core'; +import { LayoutFraction, LayoutTuneData, SelectComponentOption } from '@/admin/types'; import { BaseElementTune } from './BaseElementTune'; /** diff --git a/automad/src/client/admin/editor/tunes/Spacing.ts b/automad/src/client/admin/editor/tunes/Spacing.ts index 8e7e73118..c8c47e1ac 100644 --- a/automad/src/client/admin/editor/tunes/Spacing.ts +++ b/automad/src/client/admin/editor/tunes/Spacing.ts @@ -42,8 +42,8 @@ import { html, query, uniqueId, -} from '@/core'; -import { SpacingTuneData } from '@/types'; +} from '@/admin/core'; +import { SpacingTuneData } from '@/admin/types'; import { BaseModalTune } from './BaseModalTune'; export class SpacingTune extends BaseModalTune { diff --git a/automad/src/client/admin/editor/utils.ts b/automad/src/client/admin/editor/utils.ts index 28487ad89..4eeaa0ace 100644 --- a/automad/src/client/admin/editor/utils.ts +++ b/automad/src/client/admin/editor/utils.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { BaseEditor, KeyValueMap } from '@/types'; +import { BaseEditor, KeyValueMap } from '@/admin/types'; import { BlockAPI } from 'automad-editorjs'; import { nanoid } from 'nanoid'; diff --git a/automad/src/client/admin/index.ts b/automad/src/client/admin/index.ts index f57ada627..d59a78a1f 100644 --- a/automad/src/client/admin/index.ts +++ b/automad/src/client/admin/index.ts @@ -58,6 +58,7 @@ import './components/Fields/NumberUnit'; import './components/Fields/PageTags'; import './components/Fields/PageTemplate'; import './components/Fields/Password'; +import './components/Fields/SyntaxThemeSelect'; import './components/Fields/Textarea'; import './components/Fields/Title'; import './components/Fields/Toggle'; diff --git a/automad/src/client/admin/styles/components/file-robot.less b/automad/src/client/admin/styles/components/file-robot.less index 4beb3defb..5f9ff7516 100644 --- a/automad/src/client/admin/styles/components/file-robot.less +++ b/automad/src/client/admin/styles/components/file-robot.less @@ -105,8 +105,8 @@ &-close-button { position: absolute; - top: 0.6rem; - right: 1rem; + top: 0.2rem; + right: 0.4rem; color: hsl(var(--am-clr-text)); &:hover { @@ -116,7 +116,7 @@ &:after { content: '✗'; font-size: 1.25rem; - padding: 1rem 0.5rem; + padding: 1rem 1rem; } & svg { @@ -273,16 +273,32 @@ } } +.am-ui .FIE_topbar-center-options { + @media (max-width: @am-breakpoint-medium-max) { + display: none; + } +} + +.am-ui .FIE_phone-tools-tabs-wrapper { + padding: 5px; +} + .am-ui .SfxModal-Container[open] { top: 4rem !important; transform: translate(-50%, 0) !important; border-radius: @am-modal-radius; overflow: hidden; box-shadow: @am-shadow; - width: 520px !important; + width: 90vw !important; max-width: 520px !important; padding: 8px 2px; + & .SfxModalContent-root { + & > * { + max-width: 100% !important; + } + } + & .SfxModalTitle-root { flex-direction: row; justify-content: space-between; @@ -353,3 +369,7 @@ width: 20px !important; height: 20px !important; } + +.am-ui table.SfxColorPicker-bar { + table-layout: fixed; +} diff --git a/automad/src/client/admin/styles/components/image-select.less b/automad/src/client/admin/styles/components/image-select.less index 9133639da..f55cfd4bf 100644 --- a/automad/src/client/admin/styles/components/image-select.less +++ b/automad/src/client/admin/styles/components/image-select.less @@ -58,7 +58,7 @@ justify-content: space-evenly; flex-grow: 1; flex-direction: column; - padding: 0 0.55rem; + padding: 0 0.3rem; border-left: @am-border; } } diff --git a/automad/src/client/admin/styles/elements/badge.less b/automad/src/client/admin/styles/elements/badge.less index f8918d107..ecf303c20 100644 --- a/automad/src/client/admin/styles/elements/badge.less +++ b/automad/src/client/admin/styles/elements/badge.less @@ -51,19 +51,6 @@ background-color: hsl(var(--bg)); font-weight: 740; - &:empty { - position: absolute; - display: block; - min-width: 0; - padding: 0; - width: 0.5rem; - height: 0.5rem; - top: 0.2rem; - right: 0.4rem; - border-radius: 100%; - background-color: hsl(var(--am-clr-border-active)); - } - [class*='--danger'] & { --text: var(--am-clr-background-danger); --bg: var(--am-clr-text-danger); diff --git a/automad/src/client/admin/styles/elements/base.less b/automad/src/client/admin/styles/elements/base.less index 559fb559a..5f2f4153f 100644 --- a/automad/src/client/admin/styles/elements/base.less +++ b/automad/src/client/admin/styles/elements/base.less @@ -176,7 +176,7 @@ } & ::selection { - color: hsl(var(--am-clr-text-selected)); - background-color: hsl(var(--am-clr-background-selected)); + color: hsl(var(--am-clr-text-selection)); + background-color: hsl(var(--am-clr-background-selection)); } } diff --git a/automad/src/client/admin/styles/themes/dark.less b/automad/src/client/admin/styles/themes/dark.less index 185c45884..d7f57b591 100644 --- a/automad/src/client/admin/styles/themes/dark.less +++ b/automad/src/client/admin/styles/themes/dark.less @@ -46,6 +46,7 @@ --am-clr-text-danger: 6, 96%, 58%; --am-clr-text-primary: var(--am-clr-text); --am-clr-text-selected: var(--am-clr-text); + --am-clr-text-selection: var(--am-clr-background); --am-clr-text-badge: var(--am-clr-text); --am-clr-background: 220, 9%, 6%; @@ -55,6 +56,7 @@ --am-clr-background-primary: 220, 9%, 14%; --am-clr-background-primary-hover: 220, 9%, 17%; --am-clr-background-selected: var(--am-clr-background-primary); + --am-clr-background-selection: var(--am-clr-text); --am-clr-background-badge: 220, 9%, 23%; --am-clr-background-highlight: 220, 9%, 12%; diff --git a/automad/src/client/admin/styles/themes/light.less b/automad/src/client/admin/styles/themes/light.less index 71bb239a3..1c41f5261 100644 --- a/automad/src/client/admin/styles/themes/light.less +++ b/automad/src/client/admin/styles/themes/light.less @@ -44,6 +44,7 @@ --am-clr-text-danger: 7, 96%, 46%; --am-clr-text-primary: var(--am-clr-background); --am-clr-text-selected: var(--am-clr-text); + --am-clr-text-selection: var(--am-clr-background); --am-clr-text-badge: var(--am-clr-text-primary); --am-clr-background: 240, 0%, 100%; @@ -53,6 +54,7 @@ --am-clr-background-primary: var(--am-clr-text); --am-clr-background-primary-hover: 240, 8%, 22%; --am-clr-background-selected: 240, 7%, 94%; + --am-clr-background-selection: var(--am-clr-text); --am-clr-background-badge: 240, 7%, 33%; --am-clr-background-highlight: 240, 7%, 95%; diff --git a/automad/src/client/admin/styles/themes/low-contrast.less b/automad/src/client/admin/styles/themes/low-contrast.less index cbffdf68e..97b3f4808 100644 --- a/automad/src/client/admin/styles/themes/low-contrast.less +++ b/automad/src/client/admin/styles/themes/low-contrast.less @@ -46,6 +46,7 @@ --am-clr-text-danger: 7, 98%, 60%; --am-clr-text-primary: var(--am-clr-text); --am-clr-text-selected: var(--am-clr-text); + --am-clr-text-selection: var(--am-clr-background); --am-clr-text-badge: var(--am-clr-text-primary); --am-clr-background: 216, 12%, 14%; @@ -55,6 +56,7 @@ --am-clr-background-primary: 216, 12%, 26%; --am-clr-background-primary-hover: 216, 12%, 28%; --am-clr-background-selected: 216, 12%, 20%; + --am-clr-background-selection: var(--am-clr-text); --am-clr-background-badge: 216 12% 21%; --am-clr-background-highlight: 216, 12%, 19%; diff --git a/automad/src/client/admin/styles/utils/display.less b/automad/src/client/admin/styles/utils/display.less index 92e17b075..bcda7176a 100644 --- a/automad/src/client/admin/styles/utils/display.less +++ b/automad/src/client/admin/styles/utils/display.less @@ -34,18 +34,18 @@ .am-u-display { &-none { - display: none; + display: none !important; } &-small { @media (min-width: @am-breakpoint-medium) { - display: none; + display: none !important; } } &-small-none { @media (max-width: @am-breakpoint-medium-max) { - display: none; + display: none !important; } } } diff --git a/automad/src/client/admin/tests/form.test.ts b/automad/src/client/admin/tests/form.test.ts index 176171c02..b33b5374c 100644 --- a/automad/src/client/admin/tests/form.test.ts +++ b/automad/src/client/admin/tests/form.test.ts @@ -1,4 +1,4 @@ -import { collectFieldData, create, FieldTag, query } from '@/core'; +import { collectFieldData, create, FieldTag, query } from '@/admin/core'; test('collectFieldData (nested)', () => { const tag = FieldTag.editor; diff --git a/automad/src/client/admin/tests/request.test.ts b/automad/src/client/admin/tests/request.test.ts index 0eefd4d8c..d1e66b11b 100644 --- a/automad/src/client/admin/tests/request.test.ts +++ b/automad/src/client/admin/tests/request.test.ts @@ -1,4 +1,4 @@ -import { setNodeByPath } from '@/core'; +import { setNodeByPath } from '@/admin/core'; test('setNodebyPath', () => { const tree = {}; diff --git a/automad/src/client/admin/tests/setup.ts b/automad/src/client/admin/tests/setup.ts index d6b2f8579..9a4e20ee5 100644 --- a/automad/src/client/admin/tests/setup.ts +++ b/automad/src/client/admin/tests/setup.ts @@ -1,4 +1,10 @@ -import { FieldTag, FormDataProviders } from '@/core'; +import { FieldTag, FormDataProviders } from '@/admin/core'; + +jest.mock('prismjs', () => { + return { + default: { languages: { extend: () => {} } }, + }; +}); jest.mock('nanoid', () => { return { nanoid: () => 'xxxx' }; diff --git a/automad/src/client/admin/types/editor/blocks.ts b/automad/src/client/admin/types/editor/blocks.ts index a4546a8f1..c02047914 100644 --- a/automad/src/client/admin/types/editor/blocks.ts +++ b/automad/src/client/admin/types/editor/blocks.ts @@ -39,11 +39,11 @@ import { sectionBackgroundBlendModes, sectionBorderStyles, sectionJustifyContentOptions, -} from '@/editor/blocks/Section'; -import { sliderEffects } from '@/editor/blocks/ImageSlideshow'; -import { buttonsJustifyOptions } from '@/editor/blocks/Buttons'; -import { tableOfContentsTypes } from '@/editor/blocks/TableOfContents'; -import { pagelistTypes } from '@/editor/blocks/Pagelist'; +} from '@/admin/editor/blocks/Section'; +import { sliderEffects } from '@/admin/editor/blocks/ImageSlideshow'; +import { buttonsJustifyOptions } from '@/admin/editor/blocks/Buttons'; +import { tableOfContentsTypes } from '@/admin/editor/blocks/TableOfContents'; +import { pagelistTypes } from '@/admin/editor/blocks/Pagelist'; export interface BlockTuneConstructorOptions { api: API; @@ -81,6 +81,7 @@ export interface ButtonsBlockData { export interface CodeBlockData { code: string; language: CodeLanguage; + lineNumbers: boolean; } export interface FilelistBlockData { diff --git a/automad/src/client/admin/types/editor/tunes.ts b/automad/src/client/admin/types/editor/tunes.ts index 4225aacf9..8b0e27357 100644 --- a/automad/src/client/admin/types/editor/tunes.ts +++ b/automad/src/client/admin/types/editor/tunes.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { fractions } from '@/editor/tunes/Layout'; +import { fractions } from '@/admin/editor/tunes/Layout'; export type ClassTuneData = string; diff --git a/automad/src/client/admin/types/field.ts b/automad/src/client/admin/types/field.ts index dde3a5849..dffe2fb16 100644 --- a/automad/src/client/admin/types/field.ts +++ b/automad/src/client/admin/types/field.ts @@ -33,7 +33,7 @@ */ import { KeyValueMap } from '.'; -import { SwitcherSectionComponent } from '@/components/Switcher/SwitcherSection'; +import { SwitcherSectionComponent } from '@/admin/components/Switcher/SwitcherSection'; export type FieldSectionName = 'settings' | 'text' | 'colors'; diff --git a/automad/src/client/admin/types/index.ts b/automad/src/client/admin/types/index.ts index 0a019a81c..a495e52a4 100644 --- a/automad/src/client/admin/types/index.ts +++ b/automad/src/client/admin/types/index.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -export * from '@/../common/types'; +export * from '@/common/types'; export * from './editor/blocks'; export * from './editor/editor'; @@ -47,9 +47,8 @@ export * from './switcher'; export * from './system'; export * from './undo'; -import { KeyValueMap } from 'common'; - -import { codeLanguages } from '@/core/code'; +import { KeyValueMap } from '@/common'; +import { supportedLanguages } from '@/prism/prism'; import { PageMetaData, InputElement } from '.'; declare global { @@ -86,7 +85,7 @@ export interface BindingOptions { onChange?: (value: string) => void; } -export type CodeLanguage = (typeof codeLanguages)[number]; +export type CodeLanguage = (typeof supportedLanguages)[number]; export interface Image { name: string; diff --git a/automad/src/client/admin/types/page.ts b/automad/src/client/admin/types/page.ts index dc38cbd6a..5747fb31f 100644 --- a/automad/src/client/admin/types/page.ts +++ b/automad/src/client/admin/types/page.ts @@ -33,8 +33,8 @@ */ import { KeyValueMap } from '.'; -import { SwitcherSectionComponent } from '@/components/Switcher/SwitcherSection'; -import { Binding } from '@/core'; +import { SwitcherSectionComponent } from '@/admin/components/Switcher/SwitcherSection'; +import { Binding } from '@/admin/core'; export interface PageRecentlyEditedCardData { title: string; diff --git a/automad/src/client/admin/types/shared.ts b/automad/src/client/admin/types/shared.ts index 99ee33a64..65cef37db 100644 --- a/automad/src/client/admin/types/shared.ts +++ b/automad/src/client/admin/types/shared.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Binding } from '@/core'; +import { Binding } from '@/admin/core'; export interface SharedBindings { sharedDataFetchTimeBinding: Binding; diff --git a/automad/src/client/admin/types/switcher.ts b/automad/src/client/admin/types/switcher.ts index 7e15209e0..7a9c14180 100644 --- a/automad/src/client/admin/types/switcher.ts +++ b/automad/src/client/admin/types/switcher.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { Section } from 'common'; +import { Section } from '@/common'; export interface SwitcherDropdownData { overview: SwitcherDropdownOverview; diff --git a/automad/src/client/admin/types/system.ts b/automad/src/client/admin/types/system.ts index b18fb1470..d1682e35d 100644 --- a/automad/src/client/admin/types/system.ts +++ b/automad/src/client/admin/types/system.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { transportOptions } from '@/components/Forms/MailConfigForm'; -import { Section } from 'common'; +import { transportOptions } from '@/admin/components/Forms/MailConfigForm'; +import { Section } from '@/common'; type Enabled = boolean | 0 | 1; diff --git a/automad/src/client/blocks/components/Gallery.ts b/automad/src/client/blocks/components/Gallery.ts index e6baca6be..4032c0e64 100644 --- a/automad/src/client/blocks/components/Gallery.ts +++ b/automad/src/client/blocks/components/Gallery.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { create, debounce } from 'common'; -import { GalleryData, MasonryItem } from '~/types'; +import { create, debounce } from '@/common'; +import { GalleryData, MasonryItem } from '@/blocks/types'; import PhotoSwipe from 'photoswipe'; // @ts-ignore import PhotoSwipeLightbox from 'photoswipe/lightbox'; @@ -43,10 +43,10 @@ import PhotoSwipeDynamicCaption from 'photoswipe-dynamic-caption-plugin'; import ObjectPosition from '@vovayatsyuk/photoswipe-object-position'; import 'photoswipe/style.css'; import 'photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css'; -import arrowPrevSVG from '~/svg/arrowPrev.svg'; -import arrowNextSVG from '~/svg/arrowNext.svg'; -import closeSVG from '~/svg/close.svg'; -import zoomSVG from '~/svg/zoom.svg'; +import arrowPrevSVG from '@/blocks/svg/arrowPrev.svg'; +import arrowNextSVG from '@/blocks/svg/arrowNext.svg'; +import closeSVG from '@/blocks/svg/close.svg'; +import zoomSVG from '@/blocks/svg/zoom.svg'; const renderThumb = (imgSet: GalleryData['imageSets'][number]): string => { return ` diff --git a/automad/src/client/blocks/components/ImageSlideshow.ts b/automad/src/client/blocks/components/ImageSlideshow.ts index ea0c24d59..cbec71d6a 100644 --- a/automad/src/client/blocks/components/ImageSlideshow.ts +++ b/automad/src/client/blocks/components/ImageSlideshow.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { SliderData } from '~/types'; +import { SliderData } from '@/blocks/types'; import Swiper from 'swiper'; import { Autoplay, @@ -49,7 +49,7 @@ import 'swiper/css/autoplay'; import 'swiper/css/effect-cube'; import 'swiper/css/effect-fade'; import 'swiper/css/effect-flip'; -import { create } from 'common'; +import { create } from '@/common'; /** * A slider component based on Swiper.js. diff --git a/automad/src/client/blocks/components/ImgLoader.ts b/automad/src/client/blocks/components/ImgLoader.ts index d8a6c93e9..6b66e00a8 100644 --- a/automad/src/client/blocks/components/ImgLoader.ts +++ b/automad/src/client/blocks/components/ImgLoader.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create } from 'common'; +import { create } from '@/common'; /** * A simple image preloader with a blurred background. diff --git a/automad/src/client/blocks/components/TableOfContents.ts b/automad/src/client/blocks/components/TableOfContents.ts index bf5fa8c23..a3f03caf4 100644 --- a/automad/src/client/blocks/components/TableOfContents.ts +++ b/automad/src/client/blocks/components/TableOfContents.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { queryAll } from 'common'; +import { queryAll } from '@/common'; class TableOfContentsComponent extends HTMLElement { /** diff --git a/automad/src/client/blocks/styles/gallery.less b/automad/src/client/blocks/styles/gallery.less index a1d8462f5..350953597 100644 --- a/automad/src/client/blocks/styles/gallery.less +++ b/automad/src/client/blocks/styles/gallery.less @@ -104,4 +104,10 @@ svg.am-pswp__icon { .am-pswp.pswp { --pswp-bg: var(--am-gallery-background); + + & .pswp__counter, + & .pswp__dynamic-caption { + color: var(--am-gallery-controls-color); + text-shadow: none; + } } diff --git a/automad/src/client/blocks/types.ts b/automad/src/client/blocks/types.ts index 9bd52c2f6..e666a4ded 100644 --- a/automad/src/client/blocks/types.ts +++ b/automad/src/client/blocks/types.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { GalleryBlockData, ImageSlideshowBlockData } from '@/types'; +import { GalleryBlockData, ImageSlideshowBlockData } from '@/admin/types'; export interface GalleryData { imageSets: { diff --git a/automad/src/client/inpage/components/InPageDock.ts b/automad/src/client/inpage/components/InPageDock.ts index c04f1d4c2..5d9e2f408 100644 --- a/automad/src/client/inpage/components/InPageDock.ts +++ b/automad/src/client/inpage/components/InPageDock.ts @@ -32,8 +32,8 @@ * Licensed under the MIT license. */ -import { create, Route, Section } from 'common'; -import logo from 'common/svg/logo.svg'; +import { create, Route, Section } from '@/common'; +import logo from '@/common/svg/logo.svg'; import { restoreDockPosition, restoreScrollPosition, diff --git a/automad/src/client/inpage/components/InPageEdit.ts b/automad/src/client/inpage/components/InPageEdit.ts index b2068833f..d24eebb6d 100644 --- a/automad/src/client/inpage/components/InPageEdit.ts +++ b/automad/src/client/inpage/components/InPageEdit.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { create } from 'common'; +import { create } from '@/common'; import { saveScrollPosition } from '../sessionStore'; import { BaseInPageComponent } from './BaseInPageComponent'; diff --git a/automad/src/client/inpage/components/InPagePublish.ts b/automad/src/client/inpage/components/InPagePublish.ts index 86e67e235..88d723951 100644 --- a/automad/src/client/inpage/components/InPagePublish.ts +++ b/automad/src/client/inpage/components/InPagePublish.ts @@ -32,7 +32,7 @@ * Licensed under the MIT license. */ -import { InPageController } from 'common'; +import { InPageController } from '@/common'; import { inPageRequest } from '../request'; import { saveScrollPosition } from '../sessionStore'; import { BaseInPageComponent } from './BaseInPageComponent'; diff --git a/automad/src/client/inpage/request.ts b/automad/src/client/inpage/request.ts index a1254bdd4..46c8d8bf7 100644 --- a/automad/src/client/inpage/request.ts +++ b/automad/src/client/inpage/request.ts @@ -37,7 +37,7 @@ import { controllerRoute, InPageController, RequestKey, -} from 'common'; +} from '@/common'; /** * Make a request to the API from an InPage component. diff --git a/automad/src/client/inpage/styles/dock.less b/automad/src/client/inpage/styles/dock.less index 99850fdc6..9fd5f3618 100644 --- a/automad/src/client/inpage/styles/dock.less +++ b/automad/src/client/inpage/styles/dock.less @@ -70,12 +70,13 @@ } } - &__item { + & &__item { display: flex; justify-content: center; align-items: center; width: 42px; color: @am-inpage-color; + background-color: transparent; transition: color 0.2s; & .bi { @@ -109,14 +110,20 @@ } &__logo { - width: 24px; + display: flex; + align-items: center; + width: 27px; height: auto; - margin-top: -3px; + margin-top: -2px; padding: 0 2px; color: inherit; + opacity: 0.99; & svg { + max-width: 100%; + height: auto; color: inherit; + transform: scale(0.99); } } } diff --git a/automad/src/client/inpage/styles/publish.less b/automad/src/client/inpage/styles/publish.less index 6eda22f6e..da288c5aa 100644 --- a/automad/src/client/inpage/styles/publish.less +++ b/automad/src/client/inpage/styles/publish.less @@ -40,6 +40,7 @@ am-inpage-publish { padding: 0 12px; margin: 0 0 0 10px; font-size: 14px; + font-weight: 430; border-radius: 5px; border: 2px solid; cursor: pointer; diff --git a/automad/src/client/prism/index.ts b/automad/src/client/prism/index.ts new file mode 100644 index 000000000..a7451993e --- /dev/null +++ b/automad/src/client/prism/index.ts @@ -0,0 +1,42 @@ +/* + * .... + * .: '':. + * :::: ':.. + * ::. ''.. + * .:'.. ..':.:::' . :. '':. + * :. '' '' '. ::::.. ..: + * ::::. ..':.. .'''::::: . + * :::::::.. '..:::: :. :::: : + * ::'':::::::. ':::.'':.:::: : + * :.. ''::::::....': '':: : + * :::::. '::::: : .. '' . + * .''::::::::... ':::.'' ..'' :.''''. + * :..:::''::::: :::::...:'' :..: + * ::::::. ':::: :::::::: ..:: . + * ::::::::.:::: :::::::: :'':.:: .'' + * ::: '::::::::.' ''::::: :.' '': : + * ::: :::::::::..' :::: ::...' . + * ::: .:::::::::: :::: :::: .:' + * '::' ''::::::: :::: : :: : + * ':::: :::: :'' .: + * :::: :::: ..'' + * :::: ..:::: .:'' + * '''' ''''' + * + * + * AUTOMAD + * + * Copyright (c) 2024 by Marc Anton Dahmen + * https://marcdahmen.de + * + * Licensed under the MIT license. + */ + +import { Prism } from './prism'; +import 'prismjs/plugins/line-numbers/prism-line-numbers.css'; +import 'prismjs/plugins/line-numbers/prism-line-numbers'; +import 'prismjs/plugins/toolbar/prism-toolbar'; +import 'prismjs/plugins/toolbar/prism-toolbar.css'; +import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard'; + +Prism.highlightAll(); diff --git a/automad/src/client/prism/prism-automad.ts b/automad/src/client/prism/prism-automad.ts new file mode 100644 index 000000000..06deb6a1b --- /dev/null +++ b/automad/src/client/prism/prism-automad.ts @@ -0,0 +1,122 @@ +/* + * .... + * .: '':. + * :::: ':.. + * ::. ''.. + * .:'.. ..':.:::' . :. '':. + * :. '' '' '. ::::.. ..: + * ::::. ..':.. .'''::::: . + * :::::::.. '..:::: :. :::: : + * ::'':::::::. ':::.'':.:::: : + * :.. ''::::::....': '':: : + * :::::. '::::: : .. '' . + * .''::::::::... ':::.'' ..'' :.''''. + * :..:::''::::: :::::...:'' :..: + * ::::::. ':::: :::::::: ..:: . + * ::::::::.:::: :::::::: :'':.:: .'' + * ::: '::::::::.' ''::::: :.' '': : + * ::: :::::::::..' :::: ::...' . + * ::: .:::::::::: :::: :::: .:' + * '::' ''::::::: :::: : :: : + * ':::: :::: :'' .: + * :::: :::: ..'' + * :::: ..:::: .:'' + * '''' ''''' + * + * + * AUTOMAD + * + * Copyright (c) 2024 by Marc Anton Dahmen + * https://marcdahmen.de + * + * Licensed under the MIT license. + */ + +import Prism from 'prismjs'; + +const stringDefinition = { pattern: /('([^']|\\')*'|"([^"]|\\")*")/ }; + +const variableDefinition = { + pattern: new RegExp('@{.+}', 's'), + greedy: true, + inside: { + punctuation: /[\|\(\)\{\}]+/, + string: stringDefinition, + }, +}; + +/** + * Automad syntax highlighting. + * + * @see {@link docs https://prismjs.com/extending.html} + * @see {@link tokens https://prismjs.com/tokens.html} + * @see {@link api https://prismjs.com/docs/} + */ +export const PrismAutomad: Prism.Grammar = Prism.languages.extend('html', { + comment: { + pattern: new RegExp('<#.+?#>', 's'), + }, + function: { + pattern: new RegExp('<@.+?@>', 's'), + inside: { + keyword: { + pattern: /(for|foreach|if|else|end|snippet|with)/, + }, + boolean: { + pattern: /(true|false)/, + }, + property: { + pattern: /[\w\:]+\:/, + }, + variable: variableDefinition, + string: stringDefinition, + punctuation: { + pattern: /[\:\{\}\(\)]/, + }, + }, + }, + number: { + pattern: /\d(.\d+)?/, + }, + operator: { + pattern: /([\+\-\/\*\!]|not)/, + }, + tag: { + pattern: + /<\/?(?!\d)[^\s@>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/, + greedy: true, + inside: { + tag: { + pattern: /^<\/?[^\s>\/]+/, + inside: { + punctuation: /^<\/?/, + namespace: /^[^\s>\/:]+:/, + }, + }, + 'special-attr': [], + 'attr-value': { + pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/, + inside: { + punctuation: [ + { + pattern: /^=/, + alias: 'attr-equals', + }, + { + pattern: /^(\s*)["']|["']$/, + lookbehind: true, + }, + ], + }, + }, + punctuation: /\/?>/, + 'attr-name': { + pattern: /[^\s>\/]+/, + inside: { + namespace: /^[^\s>\/:]+:/, + }, + }, + }, + }, + variable: variableDefinition, +}); diff --git a/automad/src/client/prism/prism.ts b/automad/src/client/prism/prism.ts new file mode 100644 index 000000000..cecd565e9 --- /dev/null +++ b/automad/src/client/prism/prism.ts @@ -0,0 +1,104 @@ +/* + * .... + * .: '':. + * :::: ':.. + * ::. ''.. + * .:'.. ..':.:::' . :. '':. + * :. '' '' '. ::::.. ..: + * ::::. ..':.. .'''::::: . + * :::::::.. '..:::: :. :::: : + * ::'':::::::. ':::.'':.:::: : + * :.. ''::::::....': '':: : + * :::::. '::::: : .. '' . + * .''::::::::... ':::.'' ..'' :.''''. + * :..:::''::::: :::::...:'' :..: + * ::::::. ':::: :::::::: ..:: . + * ::::::::.:::: :::::::: :'':.:: .'' + * ::: '::::::::.' ''::::: :.' '': : + * ::: :::::::::..' :::: ::...' . + * ::: .:::::::::: :::: :::: .:' + * '::' ''::::::: :::: : :: : + * ':::: :::: :'' .: + * :::: :::: ..'' + * :::: ..:::: .:'' + * '''' ''''' + * + * + * AUTOMAD + * + * Copyright (c) 2024 by Marc Anton Dahmen + * https://marcdahmen.de + * + * Licensed under the MIT license. + */ + +import Prism, { Languages } from 'prismjs'; +import { PrismAutomad } from './prism-automad'; + +import 'prismjs/components/prism-markup-templating'; +import 'prismjs/components/prism-apacheconf'; +import 'prismjs/components/prism-basic'; +import 'prismjs/components/prism-c'; +import 'prismjs/components/prism-csharp'; +import 'prismjs/components/prism-cpp'; +import 'prismjs/components/prism-go'; +import 'prismjs/components/prism-handlebars'; +import 'prismjs/components/prism-graphql'; +import 'prismjs/components/prism-java'; +import 'prismjs/components/prism-jsx'; +import 'prismjs/components/prism-latex'; +import 'prismjs/components/prism-less'; +import 'prismjs/components/prism-lua'; +import 'prismjs/components/prism-markdown'; +import 'prismjs/components/prism-nginx'; +import 'prismjs/components/prism-php'; +import 'prismjs/components/prism-python'; +import 'prismjs/components/prism-ruby'; +import 'prismjs/components/prism-rust'; +import 'prismjs/components/prism-sass'; +import 'prismjs/components/prism-bash'; +import 'prismjs/components/prism-sql'; +import 'prismjs/components/prism-tsx'; +import 'prismjs/components/prism-typescript'; +import 'prismjs/components/prism-vim'; +import 'prismjs/components/prism-yaml'; + +const supportedLanguages = [ + 'apacheconf', + 'automad', + 'bash', + 'basic', + 'c', + 'clike', + 'csharp', + 'cpp', + 'css', + 'go', + 'graphql', + 'handlebars', + 'html', + 'java', + 'javascript', + 'jsx', + 'latex', + 'less', + 'lua', + 'markdown', + 'nginx', + 'none', + 'php', + 'powershell', + 'python', + 'ruby', + 'rust', + 'sass', + 'sql', + 'tsx', + 'typescript', + 'vim', + 'yaml', +] as const; + +Prism.languages['automad'] = PrismAutomad; + +export { Prism, type Languages, supportedLanguages }; diff --git a/automad/src/server/App.php b/automad/src/server/App.php index bdf12944b..fe50ae561 100644 --- a/automad/src/server/App.php +++ b/automad/src/server/App.php @@ -56,7 +56,7 @@ * @license MIT license - https://automad.org/license */ class App { - const VERSION = '2.0.0-alpha.3'; + const VERSION = '2.0.0-alpha.4'; /** * Required PHP version. @@ -139,7 +139,7 @@ private function runVersionCheck(): void { */ private function startSession(): void { session_name('Automad-' . md5(AM_BASE_DIR)); - session_set_cookie_params(0, '/', '', false, true); + session_set_cookie_params(0, AM_BASE_URL ?: '/', '', false, true); session_start(); } } diff --git a/automad/src/server/Blocks/Code.php b/automad/src/server/Blocks/Code.php index f637410bd..b4e25bc1f 100644 --- a/automad/src/server/Blocks/Code.php +++ b/automad/src/server/Blocks/Code.php @@ -52,8 +52,7 @@ */ class Code extends AbstractBlock { /** - * Render a code block. A language class is automatically added that can be used by - * syntax highlighters such as highlight.js and prism. + * Render a code block. * * @param BlockData $block * @param Automad $Automad @@ -61,7 +60,14 @@ class Code extends AbstractBlock { */ public static function render(array $block, Automad $Automad): string { $code = htmlspecialchars($block['data']['code']); + $lang = 'language-' . ($block['data']['language'] ?? ''); + $lines = ($block['data']['lineNumbers'] ?? false) ? ' class="line-numbers"' : ''; + $attr = Attr::render($block['tunes']); - return '
' . $code . '
'; + return <<< HTML +
+
$code
+
+ HTML; } } diff --git a/automad/src/server/Console/Commands/Migrate.php b/automad/src/server/Console/Commands/Migrate.php index 95aad84c6..25c5900fb 100644 --- a/automad/src/server/Console/Commands/Migrate.php +++ b/automad/src/server/Console/Commands/Migrate.php @@ -89,8 +89,11 @@ public static function run(): void { echo "Importing from $source ..." . PHP_EOL; echo 'Converting shared data ...' . PHP_EOL; + $shared = self::dataFile("$source/shared/data.txt"); + $shared['theme'] = str_replace('standard/', 'automad/standard-v1/', $shared['theme']); + $DataStore = new DataStore(); - $DataStore->setState(PublicationState::DRAFT, self::dataFile("$source/shared/data.txt"))->publish(); + $DataStore->setState(PublicationState::DRAFT, $shared)->publish(); self::copyFiles("$source/shared", AM_BASE_DIR . AM_DIR_SHARED); @@ -100,6 +103,10 @@ public static function run(): void { $data = self::dataFile($file); $path = dirname(Str::stripStart($file, "$source/pages")); + if (!empty($data['theme'])) { + $data['theme'] = str_replace('standard/', 'automad/standard-v1/', $data['theme']); + } + echo " $path" . PHP_EOL; $DataStore = new DataStore($path); diff --git a/automad/src/server/Core/Str.php b/automad/src/server/Core/Str.php index 4fa6e0c43..ca708da46 100644 --- a/automad/src/server/Core/Str.php +++ b/automad/src/server/Core/Str.php @@ -180,6 +180,14 @@ public static function markdown(string $str, $multilineOnly = false): string { return $str; } + // Fix syntax highlighting. + /** @var string */ + $str = preg_replace('/```(\w+)/is', '```language-$1', $str); + + // Fix strikethrough. + /** @var string */ + $str = preg_replace('/~~([\w][^~]*[\w])~~/is', '$1', $str); + $str = MarkdownExtra::defaultTransform($str); /** @var string */ diff --git a/automad/src/server/Engine/Processors/PostProcessor.php b/automad/src/server/Engine/Processors/PostProcessor.php index 0c45b7522..e2b035274 100644 --- a/automad/src/server/Engine/Processors/PostProcessor.php +++ b/automad/src/server/Engine/Processors/PostProcessor.php @@ -91,6 +91,7 @@ public function __construct( */ public function process(string $output): string { $MailAddressProcessor = new MailAddressProcessor(); + $SyntaxHighlightingProcessor = new SyntaxHighlightingProcessor($this->Automad); $output = $this->createExtensionAssetTags($output); $output = $this->addMetaTags($output); @@ -98,6 +99,7 @@ public function process(string $output): string { $output = $this->resizeImages($output); $output = Blocks::injectAssets($output); $output = $MailAddressProcessor->obfuscate($output); + $output = $SyntaxHighlightingProcessor->addAssets($output); $output = $this->addCacheBustingTimestamps($output); $output = URLProcessor::resolveUrls($output, 'absoluteUrlToRoot'); $output = $this->InPage->createUI($output); diff --git a/automad/src/server/Engine/Processors/SyntaxHighlightingProcessor.php b/automad/src/server/Engine/Processors/SyntaxHighlightingProcessor.php new file mode 100644 index 000000000..e53473c4c --- /dev/null +++ b/automad/src/server/Engine/Processors/SyntaxHighlightingProcessor.php @@ -0,0 +1,94 @@ +Automad = $Automad; + } + + /** + * Search for pre tags and add Prism assets if needed. + * + * @param string $str + * @return string The processed string + */ + public function addAssets(string $str): string { + if (!preg_match('/\]*\>/', $str) || !preg_match('/class="language-\w+"/', $str)) { + return $str; + } + + $theme = $this->Automad->Context->get()->get(Fields::SYNTAX_THEME); + + if ($theme && $theme != 'none') { + $str = Head::append( + $str, + '' + ); + } + + $str = Head::append($str, Asset::css('dist/prism/main.bundle.css', false)); + $str = Body::append($str, Asset::js('dist/prism/main.bundle.js', false)); + + return $str; + } +} diff --git a/automad/src/server/System/Fields.php b/automad/src/server/System/Fields.php index b45e800b3..abe48b7a2 100644 --- a/automad/src/server/System/Fields.php +++ b/automad/src/server/System/Fields.php @@ -79,6 +79,7 @@ class Fields { const SEARCH_CONTEXT = ':searchContext'; const SITENAME = 'sitename'; const SLUG = 'slug'; + const SYNTAX_THEME = 'syntaxTheme'; const TAG = ':tag'; const TAGS = 'tags'; const TEMPLATE = 'template'; @@ -108,6 +109,7 @@ class Fields { 'TITLE' => Fields::TITLE, 'SITENAME' => Fields::SITENAME, 'SLUG' => Fields::SLUG, + 'SYNTAX_THEME' => Fields::SYNTAX_THEME, 'URL' => Fields::URL ); diff --git a/bin/release.sh b/bin/release.sh index f3f743048..2dc4f238b 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -16,6 +16,13 @@ if [[ $(git branch | grep \* | cut -d ' ' -f2) != "$workBranch" ]]; then exit 0 fi +# Check if working directory is clean. +if [[ $(git status -s) ]]; then + echo "Working directory is not clean!" + git status -s + echo +fi + # Run tests. echo "Running tests ..." npm run test @@ -31,13 +38,6 @@ echo "Updating language packs ..." # Get latest tag. latestTag=$(git describe --tags $(git rev-list --tags --max-count=1)) -# Check if working directory is clean. -if [[ $(git status -s) ]]; then - echo "Working directory is not clean!" - git status -s - echo -fi - # Choose type of release. echo "Current version is: $latestTag" echo diff --git a/jest.config.js b/jest.config.js index a541f2a55..d412b37b4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,8 +7,7 @@ const config = { testMatch: ['**/tests/**/*.test.ts'], setupFilesAfterEnv: ['/tests/setup.ts'], moduleNameMapper: { - '^@/(.*)$': '/$1', - '^common$': '/../common/index.ts', + '^@/(.*)$': '/../$1', }, modulePaths: ['/../../../../node_modules'], transform: { diff --git a/lib/composer.lock b/lib/composer.lock index b39f1fa4a..8694ec68e 100644 --- a/lib/composer.lock +++ b/lib/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/automadcms/automad-language-packs.git", - "reference": "771e17588cfa80f86d812bdf555ad6277953011a" + "reference": "c5b18f9af31b8eba84c55fb084eff81e8e9e1c2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/automadcms/automad-language-packs/zipball/771e17588cfa80f86d812bdf555ad6277953011a", - "reference": "771e17588cfa80f86d812bdf555ad6277953011a", + "url": "https://api.github.com/repos/automadcms/automad-language-packs/zipball/c5b18f9af31b8eba84c55fb084eff81e8e9e1c2e", + "reference": "c5b18f9af31b8eba84c55fb084eff81e8e9e1c2e", "shasum": "" }, "default-branch": true, @@ -55,7 +55,7 @@ "type": "ko_fi" } ], - "time": "2024-02-18T18:45:55+00:00" + "time": "2024-04-12T21:34:55+00:00" }, { "name": "doctrine/lexer", diff --git a/package-lock.json b/package-lock.json index 6804cc1ce..b4d496d98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "automad", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "automad", - "version": "1.10.1", + "version": "2.0.0-alpha.3", "license": "MIT", "devDependencies": { "@editorjs/embed": "^2.6.0", @@ -26,6 +26,7 @@ "@vovayatsyuk/photoswipe-object-position": "^1.0.0", "@yaireo/tagify": "^4.17.6", "automad-editorjs": "^2.29.3", + "automad-prism-themes": "^0.3.1", "bootstrap-icons": "^1.11.1", "browser-sync": "^3.0.2", "browser-sync-v3-webpack-plugin": "^0.1.0", @@ -2364,6 +2365,12 @@ "integrity": "sha512-FjA3gkBVVy7JDQvQeqGs33SKzpB/1iku5VJhrcgL/XtD8z1yIyhI5Qk0g1b4Fhm3NjvEZYaFxQlgn08bwQ3EkA==", "dev": true }, + "node_modules/automad-prism-themes": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/automad-prism-themes/-/automad-prism-themes-0.3.1.tgz", + "integrity": "sha512-advtQ6aUs8IE1LWNIgsZMRrzyaKTspBfOQ4Vh0mRNHZrDHfyYRlX6gBkbRvY0ElDJ+W2YOOINe5kHpx6qnp1kg==", + "dev": true + }, "node_modules/babel-jest": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.3.tgz", @@ -12503,6 +12510,12 @@ "integrity": "sha512-FjA3gkBVVy7JDQvQeqGs33SKzpB/1iku5VJhrcgL/XtD8z1yIyhI5Qk0g1b4Fhm3NjvEZYaFxQlgn08bwQ3EkA==", "dev": true }, + "automad-prism-themes": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/automad-prism-themes/-/automad-prism-themes-0.3.1.tgz", + "integrity": "sha512-advtQ6aUs8IE1LWNIgsZMRrzyaKTspBfOQ4Vh0mRNHZrDHfyYRlX6gBkbRvY0ElDJ+W2YOOINe5kHpx6qnp1kg==", + "dev": true + }, "babel-jest": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.3.tgz", diff --git a/package.json b/package.json index 7958c10d5..042ffa902 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "automad", - "version": "2.0.0-alpha.3", + "version": "2.0.0-alpha.4", "description": "Automad", "author": "Marc Anton Dahmen", "license": "MIT", @@ -36,6 +36,7 @@ "@vovayatsyuk/photoswipe-object-position": "^1.0.0", "@yaireo/tagify": "^4.17.6", "automad-editorjs": "^2.29.3", + "automad-prism-themes": "^0.3.1", "bootstrap-icons": "^1.11.1", "browser-sync": "^3.0.2", "browser-sync-v3-webpack-plugin": "^0.1.0", diff --git a/tsconfig.json b/tsconfig.json index 87eefd878..dc8a25915 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,12 +6,11 @@ "moduleResolution": "node", "noImplicitAny": true, "preserveConstEnums": false, + "resolveJsonModule": true, "target": "es6", "outDir": "dist", "paths": { - "@/*": ["./automad/src/client/admin/*"], - "~/*": ["./automad/src/client/blocks/*"], - "common": ["./automad/src/client/common/index.ts"] + "@/*": ["./automad/src/client/*"] } }, "exclude": ["node_modules", "automad/dist"] diff --git a/webpack.config.js b/webpack.config.js index 5582770a3..29ca8b73a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -73,6 +73,23 @@ const common = (env, argv) => { }, ], }, + resolve: { + extensions: ['.ts', '.js'], + alias: { + '@': path.resolve(__dirname, './automad/src/client'), + // Add this alias to make FileRobot imports work. + // React is only used as dependency of FileRobot but will be installed in two locations: + // 1. node_modules/react + // 2. node_modules/filerobot-image-editor/node_modules/react + // + // It is important to make sure that react is only imported once during bundling and therefore + // the alias has to be added here. + // + // https://github.com/scaleflex/filerobot-image-editor/issues/107#issuecomment-886589896 + // https://github.com/facebook/react/issues/13991#issuecomment-983316545 + react: path.resolve(__dirname, './node_modules/react'), + }, + }, optimization: { minimizer: [ new CssMinimizerPlugin(), @@ -114,24 +131,6 @@ const admin = (env, argv) => { entry: { main: './automad/src/client/admin/index.ts', }, - resolve: { - extensions: ['.ts', '.js'], - alias: { - '@': path.resolve(__dirname, './automad/src/client/admin'), - common: path.resolve(__dirname, './automad/src/client/common'), - // Add this alias to make FileRobot imports work. - // React is only used as dependency of FileRobot but will be installed in two locations: - // 1. node_modules/react - // 2. node_modules/filerobot-image-editor/node_modules/react - // - // It is important to make sure that react is only imported once during bundling and therefore - // the alias has to be added here. - // - // https://github.com/scaleflex/filerobot-image-editor/issues/107#issuecomment-886589896 - // https://github.com/facebook/react/issues/13991#issuecomment-983316545 - react: path.resolve(__dirname, './node_modules/react'), - }, - }, output: { path: path.resolve(__dirname, './automad/dist/admin'), filename: '[name].bundle.js', @@ -181,6 +180,7 @@ const admin = (env, argv) => { './automad/src/client/admin/mockup/**/*.html', './automad/dist/blocks/main.bundle.*', './automad/dist/inpage/main.bundle.*', + './automad/dist/prism/main.bundle.*', ], ignore: ['config/*', 'packages/**/*.php', 'vendor/**/*.php'], notify: false, @@ -197,13 +197,6 @@ const blocks = (env, argv) => entry: { main: './automad/src/client/blocks/index.ts', }, - resolve: { - extensions: ['.ts', '.js'], - alias: { - '~': path.resolve(__dirname, './automad/src/client/blocks'), - common: path.resolve(__dirname, './automad/src/client/common'), - }, - }, output: { path: path.resolve(__dirname, './automad/dist/blocks'), filename: '[name].bundle.js', @@ -215,9 +208,6 @@ const mail = (env, argv) => entry: { main: './automad/src/client/mail/index.ts', }, - resolve: { - extensions: ['.ts', '.js'], - }, output: { path: path.resolve(__dirname, './automad/dist/mail'), filename: '[name].bundle.js', @@ -229,16 +219,21 @@ const inpage = (env, argv) => entry: { main: './automad/src/client/inpage/index.ts', }, - resolve: { - extensions: ['.ts', '.js'], - alias: { - common: path.resolve(__dirname, './automad/src/client/common'), - }, - }, output: { path: path.resolve(__dirname, './automad/dist/inpage'), filename: '[name].bundle.js', }, }); -module.exports = [admin, blocks, mail, inpage]; +const prism = (env, argv) => + merge(common(env, argv), { + entry: { + main: './automad/src/client/prism/index.ts', + }, + output: { + path: path.resolve(__dirname, './automad/dist/prism'), + filename: '[name].bundle.js', + }, + }); + +module.exports = [admin, blocks, mail, inpage, prism];