Skip to content

Commit

Permalink
merge branch v2 (release 2.0.0-alpha.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Oct 27, 2024
2 parents 774d205 + 56b4b81 commit 80de5b2
Show file tree
Hide file tree
Showing 122 changed files with 522 additions and 132 deletions.
29 changes: 15 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
*-legacy.*
.history
.php-cs-fixer.cache
.phpunit.result.cache
/automad/legacy
/automad/src/client/blocks/legacy
/cache/*
/config/*
/lib/vendor
/packages
/pages/.trash
/pages/index
/pages/test
/sitemap.xml
/vendor
dist
node_modules
cache/*
config/*
vendor
packages
pages/.trash
pages/test
automad/legacy
automad/src/client/blocks/legacy
/sitemap.xml
.phpunit.result.cache
.php-cs-fixer.cache
.history
*-legacy.*
robots.txt
pages/index
87 changes: 85 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
# Changelog

## [v2.0.0-alpha.7](https://github.com/marcantondahmen/automad/commit/5ecf43618492a8260e3f5e06dbbe513537a912cc)
## [v2.0.0-alpha.8](https://github.com/marcantondahmen/automad/commit/3ef9f936a5651dab3a6e9285b1506b2321b8ff36)

Sun, 13 Oct 2024 20:51:29 +0200
Sun, 27 Oct 2024 19:22:31 +0100

### New Features

- add customization editor placeholders with shared values ([8aa92e3c6](https://github.com/marcantondahmen/automad/commit/8aa92e3c631f1f43fe7d3eecd18f9db1bea55962))
- hide block editor on small devices and show alert instead ([2b3f644ee](https://github.com/marcantondahmen/automad/commit/2b3f644ee2a3067b87d9170ac07b25c9cd62164f))
- improve customization field labels and add customization section info ([a08ce16df](https://github.com/marcantondahmen/automad/commit/a08ce16dff3a30225d0c01f080aa3789459a89f0))
- improve urls of remote images ([ab6514de1](https://github.com/marcantondahmen/automad/commit/ab6514de1dfd6d434aec7149aaf3e116b319bfde))
- merge data of localized home page with shared data when language router is enabled ([81165de58](https://github.com/marcantondahmen/automad/commit/81165de58b76a46ff2a4d903ef2fa15f710bc503))
- replace custom js and css file fields with custom html fields ([38be7bab4](https://github.com/marcantondahmen/automad/commit/38be7bab48f0825abbc36903dc90564eedfc968d))

### Bugfixes

- **i18n**: fix home page url when language router is enabled ([02391e2f1](https://github.com/marcantondahmen/automad/commit/02391e2f1df24b808e64778a0fdcd7edb1f57f8d))
- **ui**: fix disappearing block when dragging onto itself ([d3a3d4a9b](https://github.com/marcantondahmen/automad/commit/d3a3d4a9b3b25ce70ab2c69337d85c87b379abc4))
- **ui**: fix hidden dropdown items on small devices ([0800a93dc](https://github.com/marcantondahmen/automad/commit/0800a93dcb23c8cca07f753200c4d1d163711e80))
- **ui**: fix text overflow in jump bar ([03109a60c](https://github.com/marcantondahmen/automad/commit/03109a60c4ca18a2c00c4032cabe935861d279e1))
- **ui**: fix text overflow of autocomplete dropdowns ([45cd0b25d](https://github.com/marcantondahmen/automad/commit/45cd0b25d2383170d8e2cc3d85b58401b5b18b67))
- enable text wrap in code editors in order to fix invisble text ([fa107781c](https://github.com/marcantondahmen/automad/commit/fa107781caf211191979da38149844ae9246df5f))
- fix deleting image caption not triggering change event ([1960fb0be](https://github.com/marcantondahmen/automad/commit/1960fb0be7a30632cb15e247d93a18ae5b23a6a3))

## [v2.0.0-alpha.7](https://github.com/marcantondahmen/automad/commit/774d20584dd470555a61b3b2afd03261bf96e8f5)

Sun, 13 Oct 2024 20:56:43 +0200

### New Features

Expand Down Expand Up @@ -352,3 +375,63 @@ Thu, 12 Aug 2021 22:24:51 +0200

- **ui**: fix typo in text modules ([ba8702a87](https://github.com/marcantondahmen/automad/commit/ba8702a87d26afd0172294d541c1573925f77f56))
- **ui**: fix updating links that are wrapped in quotes ([4417468d6](https://github.com/marcantondahmen/automad/commit/4417468d659c1e71e9b76698e377a19a1e209b5a))

## [v1.8.3](https://github.com/marcantondahmen/automad/commit/aa72e82f0192571f5ae1a8b032720fd9b3fb8645)

Mon, 9 Aug 2021 23:21:36 +0200

### New Features

- **core**: use a shortened md5 hash as directory slug in case a sanitized title is too short ([d6d5e57cd](https://github.com/marcantondahmen/automad/commit/d6d5e57cd663bcf0eed7c8697b7b454fac1064fb))

### Bugfixes

- **ui**: fix updating links to images that belong to the page they are used on ([723a6be37](https://github.com/marcantondahmen/automad/commit/723a6be37fb283fdcd42a5a365e6089509a25139))

## [v1.8.2](https://github.com/marcantondahmen/automad/commit/e070a89209c2e90eadb9be4b77580beef6aa75d1)

Sun, 8 Aug 2021 22:25:34 +0200

### New Features

- **samples**: add pagelist example page ([2a033f4da](https://github.com/marcantondahmen/automad/commit/2a033f4dada04e3d2fd7d24f2d2d6b1bfd04986e))
- **samples**: add tags and filters to example pages ([d18f2482b](https://github.com/marcantondahmen/automad/commit/d18f2482b2f258d7b42a6609a439769773ffb7f8))

### Bugfixes

- **themes**: fix thumbnail visibility ([45ed2eee5](https://github.com/marcantondahmen/automad/commit/45ed2eee5f1cf0b81148678820b6a796bf4791e2))

## [v1.8.1](https://github.com/marcantondahmen/automad/commit/8be976c0215c549d3ac27016b8c9fee02c052cca)

Sat, 7 Aug 2021 23:06:36 +0200

### Bugfixes

- **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))
9 changes: 6 additions & 3 deletions automad/lang/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@
"currentPasswordError": "The current password is wrong!",
"custom": "Custom",
"customCSS": "Custom CSS",
"customCSSFile": "Custom CSS File",
"customJS": "Custom JavaScript",
"customJSFile": "Custom JavaScript File",
"customHTMLHead": "Custom HTML to injected into the head element",
"customHTMLBodyEnd": "Custom HTML to be injected right before the closing body tag",
"customJSHead": "Custom JavaScript to be injected into the head element",
"customJSBodyEnd": "Custom JavaScript to be injected right before the closing body tag",
"customization": "This section allows for adding custom CSS and JavaScript to your site. The HTML fields can be used to add external resources such as fonts or JavaScript libraries. In case the active theme supports color overrides, colors can be define here as well.",
"dashboardTitle": "Dashboard",
"date": "Date",
"debugDisabled": "Debugging is disabled",
Expand All @@ -93,6 +95,7 @@
"editImage": "Edit Image",
"editStyle": "Edit Style",
"editorPlaceholder": "Click here to add content",
"editorSmallDisplayAlert": "The display is too small for using the block editor. Please change to a larger device for editing.",
"ellipse": "Ellipse",
"ellipseTool": "Ellipse",
"email": "Email address",
Expand Down
12 changes: 11 additions & 1 deletion automad/src/client/admin/components/EditorJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ 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 '@/admin/core';
import { App, Attr, create, 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';
Expand Down Expand Up @@ -118,6 +118,16 @@ export class EditorJSComponent extends BaseComponent {
this.style.position = 'relative';
this.classList.add(CSS.contents);

create(
'am-alert',
[CSS.displaySmall],
{
[Attr.icon]: 'window',
[Attr.text]: 'editorSmallDisplayAlert',
},
this
);

this.editor = new EditorJS(
Object.assign(
{
Expand Down
11 changes: 8 additions & 3 deletions automad/src/client/admin/components/Fields/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Licensed under the MIT license.
*/

import { create, CSS, FieldTag, FormDataProviders } from '@/admin/core';
import { create, CSS, FieldTag, FormDataProviders, html } from '@/admin/core';
import { CodeEditor } from '@/admin/core/code';
import { UndoValue } from '@/admin/types';
import { BaseFieldComponent } from './BaseField';
Expand Down Expand Up @@ -61,6 +61,10 @@ export class CodeComponent extends BaseFieldComponent {
private getLanguageFromName = (name: string) => {
const sanitized = name.replace(/\W+/g, '');

if (sanitized.match(/html/i)) {
return 'html';
}

if (sanitized.match(/js/i)) {
return 'javascript';
}
Expand All @@ -72,7 +76,7 @@ export class CodeComponent extends BaseFieldComponent {
* Render the field.
*/
protected createInput(): void {
const { name, id, value } = this._data;
const { name, id, value, placeholder } = this._data;

this.setAttribute('name', name);
this.value = value as string;
Expand All @@ -81,7 +85,8 @@ export class CodeComponent extends BaseFieldComponent {
create('div', [CSS.codeflask], { id }, this),
value as string,
this.getLanguageFromName(name),
(code) => (this.value = code)
(code) => (this.value = code),
placeholder as string
);
}

Expand Down
2 changes: 1 addition & 1 deletion automad/src/client/admin/components/Forms/PageDataForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class PageDataFormComponent extends FormComponent {
readme,
});

createCustomizationFields(fields, this.sections);
createCustomizationFields(fields, this.sections, shared);

Object.keys(this.sections).forEach((item: FieldSectionName) => {
fieldGroup({
Expand Down
7 changes: 6 additions & 1 deletion automad/src/client/admin/components/Modal/ModalField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ export class ModalFieldComponent extends ModalComponent {
`
);

create('div', [CSS.modalFieldToggle], {}, this).innerHTML = '↗';
create(
'div',
[CSS.modalFieldToggle, CSS.displaySmallNone],
{},
this
).innerHTML = '↗';

listen(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,11 @@ class ModalJumpbarDialogComponent extends AutocompleteComponent {
*/
private itemHtml(icon: string, title: string, subtitle: string): string {
return html`
<i class="bi bi-${icon}"></i>
<span>$${title}</span>
<span class="${CSS.textMuted}">$${subtitle || ''}</span>
<span class="${CSS.iconText}">
<i class="bi bi-${icon}"></i>
<span>$${title}</span>
<span class="${CSS.textMuted}">$${subtitle || ''}</span>
</span>
`;
}

Expand Down
14 changes: 12 additions & 2 deletions automad/src/client/admin/core/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import { CodeLanguage } from '@/admin/types';
import CodeFlask from 'codeflask';
import { debounce, getLogger } from '@/admin/core';
import { create, CSS, debounce, getLogger, html } from '@/admin/core';
import { Prism, Languages } from '@/prism/prism';

/**
Expand All @@ -55,12 +55,14 @@ export class CodeEditor {
* @param code
* @param language
* @param onChange
* @param placeholder
*/
constructor(
element: HTMLElement,
code: string,
language: CodeLanguage,
onChange: (code: string) => void = () => {}
onChange: (code: string) => void = () => {},
placeholder: string = ''
) {
element.innerHTML = '';

Expand All @@ -74,6 +76,14 @@ export class CodeEditor {
language,
});

create(
'pre',
[CSS.codeflaskPlaceholder, 'codeflask__pre'],
{},
element,
html`$${placeholder}`
);

this.codeFlask.addLanguage(
language,
Prism.languages[language] as Languages
Expand Down
1 change: 1 addition & 0 deletions automad/src/client/admin/core/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const enum CSS {
checkbox = 'am-f-checkbox',

codeflask = 'am-f-codeflask',
codeflaskPlaceholder = 'am-f-codeflask__placeholder',

contents = 'am-e-contents',

Expand Down
43 changes: 12 additions & 31 deletions automad/src/client/admin/core/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,70 +126,51 @@ export class FormDataProviders {
*/
export const createCustomizationFields = (
fields: KeyValueMap,
sections: FieldSectionCollection
sections: FieldSectionCollection,
shared: KeyValueMap = {}
) => {
const buildFieldProps = (
field: string,
label: string | null = null,
placeholder: string | null = null
) => {
const buildFieldProps = (field: string, label: string) => {
const key = App.reservedFields[field];

return {
key,
label,
placeholder,
value: fields[key],
name: `data[${key}]`,
placeholder: shared[key] ?? '',
};
};

createField(
FieldTag.input,
sections.customize,
buildFieldProps(
'CUSTOM_CSS_FILE',
App.text('customCSSFile'),
'/shared/custom.css'
)
);
create('p', [], {}, sections.customize, App.text('customization'));

createField(
FieldTag.input,
FieldTag.code,
sections.customize,
buildFieldProps(
'CUSTOM_JS_HEADER_FILE',
`${App.text('customJSFile')} (Header)`,
'/shared/header.js'
)
buildFieldProps('CUSTOM_HTML_HEAD', App.text('customHTMLHead'))
);

createField(
FieldTag.input,
FieldTag.code,
sections.customize,
buildFieldProps(
'CUSTOM_JS_FOOTER_FILE',
`${App.text('customJSFile')} (Footer)`,
'/shared/footer.js'
)
buildFieldProps('CUSTOM_HTML_BODY_END', App.text('customHTMLBodyEnd'))
);

createField(
FieldTag.code,
sections.customize,
buildFieldProps('CUSTOM_CSS', App.text('customCSS'))
buildFieldProps('CUSTOM_JS_HEAD', App.text('customJSHead'))
);

createField(
FieldTag.code,
sections.customize,
buildFieldProps('CUSTOM_JS_HEADER', `${App.text('customJS')} (Header)`)
buildFieldProps('CUSTOM_JS_BODY_END', App.text('customJSBodyEnd'))
);

createField(
FieldTag.code,
sections.customize,
buildFieldProps('CUSTOM_JS_FOOTER', `${App.text('customJS')} (Footer)`)
buildFieldProps('CUSTOM_CSS', App.text('customCSS'))
);
};

Expand Down
Loading

0 comments on commit 80de5b2

Please sign in to comment.