Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge next into feature/refactor-admin-component-theming #1627

Conversation

jamesricky
Copy link
Contributor

No description provided.

thomasdax98 and others added 30 commits January 2, 2024 10:16
Special characters in names of uploaded files weren't properly decoded.
This led to a wrong result during slugification.
Move the soft-hyphen functionality from `@comet/cms-admin` to
`@comet/admin-rte`. This allows using the soft-hyphen functionality in
plain RTEs, and not only in `RichTextBlock`.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…#1519)

## Previously:

It wasn't possible to copy a document from one category to another (e.g.
from "Main navigation" to "Top menu"). Instead, the document was always
pasted to its original category because we always used the category of
the copied node in `sendPages()`.
 

https://github.com/vivid-planet/comet/assets/13380047/8112d742-f73c-47cb-a664-516ee4e3286b

## Now:

The active category is passed via the `PageTreeContext`. So the node is
always pasted to the active category.


https://github.com/vivid-planet/comet/assets/13380047/b947feb8-c9f5-4b94-816b-3f89641f31ce
…#1542)

For example:

```tsx
<RouterTabs>
    <RouterTab label="One" path="">
        One
    </RouterTab>
    {content.map((value) => (
        <RouterTab key={value} label={value} path={`/${value}`}>
            {value}
        </RouterTab>
    ))}
    <RouterTab label="Four" path="/four">
        Four
    </RouterTab>
</RouterTabs>
```
Remove `MICRO` and `SUBSCRIPTION` from the `LicenseType` enum. Existing
files with those licenses will be changed to `RIGHTS_MANAGED`.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Co-authored-by: Thomas Dax <thomas.dax@vivid-planet.com>
This pull request introduces the integration of external DAM files to
the capabilities of Comet. As an illustration and proof of concept, it
includes the implementation of an image picker feature. The example
image picker uses random Unsplash images.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Co-authored-by: Thomas Dax <thomas.dax@vivid-planet.com>
Co-authored-by: Johannes Obermair <johannes.obermair@vivid-planet.com>
Increase JSON request limit to 1mb

As done in vivid-planet/comet-starter#97.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @comet/admin@5.4.0

### Minor Changes

-   60a1839: Add `Alert` component

    **Example:**

    ```tsx
    import { Alert, OkayButton, SaveButton } from "@comet/admin";

    <Alert
        severity="warning"
        title="Title"
        action={
            <Button variant="text" startIcon={<ArrowRight />}>
                Action Text
            </Button>
        }
    >
        Notification Text
    </Alert>;
    ```

### Patch Changes

- ba80016: Allow passing a mix of elements and arrays to `Tabs` and
`RouterTabs` as children

    For example:

    ```tsx
    <RouterTabs>
        <RouterTab label="One" path="">
            One
        </RouterTab>
        {content.map((value) => (
            <RouterTab key={value} label={value} path={`/${value}`}>
                {value}
            </RouterTab>
        ))}
        {showFourthTab && (
            <RouterTab label="Four" path="/four">
                Four
            </RouterTab>
        )}
    </RouterTabs>
    ```

    -   @comet/admin-icons@5.4.0

## @comet/admin-rte@5.4.0

### Minor Changes

- 981bf48: Allow setting a tooltip to the button of
custom-inline-styles using the `tooltipText` prop
-   51d6c2b: Move soft-hyphen functionality to `@comet/admin-rte`

This allows using the soft-hyphen functionality in plain RTEs, and not
only in `RichTextBlock`

    ```tsx
    const [useRteApi] = makeRteApi();

    export default function MyRte() {
        const { editorState, setEditorState } = useRteApi();
        return (
            <Rte
                value={editorState}
                onChange={setEditorState}
                options={{
                    supports: [
                        // Soft Hyphen
                        "soft-hyphen",
                        // Other options you may wish to support
                        "bold",
                        "italic",
                    ],
                }}
            />
        );
    }
    ```

### Patch Changes

-   @comet/admin-icons@5.4.0

## @comet/cms-admin@5.4.0

### Minor Changes

-   e146d8b: Support the import of files from external DAMs

To connect an external DAM, implement a component with the necessary
logic (asset picker, upload functionality, ...). Pass this component to
the `DamPage` via the `additionalToolbarItems` prop.

    ```tsx
    <DamPage
        // ...
        additionalToolbarItems={<ImportFromExternalDam />}
    />
    ```

You can find an [example](demo/admin/src/dam/ImportFromUnsplash.tsx) in
the demo project.

-   51d6c2b: Move soft-hyphen functionality to `@comet/admin-rte`

This allows using the soft-hyphen functionality in plain RTEs, and not
only in `RichTextBlock`

    ```tsx
    const [useRteApi] = makeRteApi();

    export default function MyRte() {
        const { editorState, setEditorState } = useRteApi();
        return (
            <Rte
                value={editorState}
                onChange={setEditorState}
                options={{
                    supports: [
                        // Soft Hyphen
                        "soft-hyphen",
                        // Other options you may wish to support
                        "bold",
                        "italic",
                    ],
                }}
            />
        );
    }
    ```

- dcaf750: Make all DAM license fields optional if `LicenseType` is
`ROYALTY_FREE` even if `requireLicense` is true in `DamConfig`

### Patch Changes

- 087cb01: Enable copying documents from one `PageTree` category to
another (e.g. from "Main navigation" to "Top menu" in Demo)
-   Updated dependencies [ba80016]
-   Updated dependencies [981bf48]
-   Updated dependencies [60a1839]
-   Updated dependencies [51d6c2b]
    -   @comet/admin@5.4.0
    -   @comet/admin-rte@5.4.0
    -   @comet/admin-date-time@5.4.0
    -   @comet/admin-icons@5.4.0
    -   @comet/admin-theme@5.4.0
    -   @comet/blocks-admin@5.4.0

## @comet/cms-api@5.4.0

### Minor Changes

-   e146d8b: Support the import of files from external DAMs

To connect an external DAM, implement a component with the necessary
logic (asset picker, upload functionality, ...). Pass this component to
the `DamPage` via the `additionalToolbarItems` prop.

    ```tsx
    <DamPage
        // ...
        additionalToolbarItems={<ImportFromExternalDam />}
    />
    ```

You can find an [example](demo/admin/src/dam/ImportFromUnsplash.tsx) in
the demo project.

-   27bf643: Add `PublicUploadsService` to public API

The service can be used to programmatically create public uploads, such
as when creating fixtures.

-   df5c959: Remove license types `MICRO` and `SUBSCRIPTION`

The `LicenseType` enum no longer contains the values `MICRO` and
`SUBSCRIPTION`. The database migration will automatically update all
licenses of type `MICRO` or `SUBSCRIPTION` to `RIGHTS_MANAGED`.

### Patch Changes

- 60f5208: Fix encoding of special characters in names of uploaded
files

    For example:

    Previously:

    -   `€.jpg` -> `a.jpg`
    -   `ä.jpg` -> `ai.jpg`

    Now:

    -   `€.jpg` -> `euro.jpg`
    -   `ä.jpg` -> `ae.jpg`
    -   @comet/blocks-api@5.4.0

## @comet/cms-site@5.4.0

### Minor Changes

-   f906386: Add `hasRichTextBlockContent` helper

    The helper can be used to conditionally render a `RichTextBlock`.

    **Example:**

    ```tsx
    import { hasRichTextBlockContent } from "@comet/cms-site";

function TeaserBlock({ data: { image, text } }:
PropsWithData<TeaserBlockData>) {
        return (
            <>
                <DamImageBlock data={image} />
{hasRichTextBlockContent(text) && <RichTextBlock data={text} />}
            </>
        );
    }
    ```

## @comet/admin-color-picker@5.4.0

### Patch Changes

-   Updated dependencies [ba80016]
-   Updated dependencies [60a1839]
    -   @comet/admin@5.4.0
    -   @comet/admin-icons@5.4.0

## @comet/admin-date-time@5.4.0

### Patch Changes

-   Updated dependencies [ba80016]
-   Updated dependencies [60a1839]
    -   @comet/admin@5.4.0
    -   @comet/admin-icons@5.4.0

## @comet/admin-react-select@5.4.0

### Patch Changes

-   Updated dependencies [ba80016]
-   Updated dependencies [60a1839]
    -   @comet/admin@5.4.0

## @comet/admin-theme@5.4.0

### Patch Changes

-   @comet/admin-icons@5.4.0

## @comet/blocks-admin@5.4.0

### Patch Changes

-   Updated dependencies [ba80016]
-   Updated dependencies [60a1839]
    -   @comet/admin@5.4.0
    -   @comet/admin-icons@5.4.0

## @comet/eslint-config@5.4.0

### Patch Changes

-   @comet/eslint-plugin@5.4.0

## @comet/admin-babel-preset@5.4.0



## @comet/admin-icons@5.4.0



## @comet/blocks-api@5.4.0



## @comet/cli@5.4.0



## @comet/eslint-plugin@5.4.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
The helper is primarily used to create a `FileUploadInput` (previously
`FileUploadInterface`) input for `FilesService#upload` while creating
fixtures. However, the name of the helper is too generic to be part of
the package's public API. We add a new
`FileUploadService#createFileUploadInputFromUrl` method to be used
instead.
The `core-without-import.js` file was originally added to fix a problem
with the `next/core-web-vitals` config that caused duplicate `import`
plugins. This problem doesn't exist anymore in our current setup, so we
may remove the extra file. This also prevents forgetting about adding
new rules to both files.
Previously, generated GraphQL and block types were not removed before
the build. This caused when a GraphQL feature was removed in the API
(for instance, user permissions). To fix it, we now remove the generated
files in the clean script.
…#1549)

The `attachedBlocks` array may be empty when developers forget to set
the `x-include-invisible-content` header. The previously thrown error
wasn't clear enough to be of any help. To fix this, we provide a more
detailed error message during development.
Clip crop values when cropping an image in the DAM or `PixelImageBlock`

Previously, negative values could occur, causing the image proxy to fail
on delivery.

Closes COM-349
…` and `shouldShowFieldWarning` in `FinalFormContext` to match the corresponding methods in `Field` (#1570)

The API in `FinalFormContext` was changed from 

```tsx
// ❌
export interface FinalFormContext {
    shouldScrollToField: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
    shouldShowFieldError: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
    shouldShowFieldWarning: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
}
```

to

```tsx
// ✅
export interface FinalFormContext {
    shouldScrollToField: (fieldMeta: FieldMetaState<any>) => boolean;
    shouldShowFieldError: (fieldMeta: FieldMetaState<any>) => boolean;
    shouldShowFieldWarning: (fieldMeta: FieldMetaState<any>) => boolean;
}
```
…#1560)

## Previously

When copying a page to another scope, all dependencies that we didn't
replace stayed intact. Meaning, for example, links would still point to
pages in other scopes (-> leak to other scope).

## Now

Set unhandled dependencies to `undefined` when copying documents to
another scope

This prevents leaks between scopes. In practice, this mostly concerns
links to documents that don't exist in the target scope.

**Example:**

- Page A links to Page B
- Page A is copied from Scope A to Scope B
- Link to Page B is removed from Page A by replacing the `id` with
`undefined` (since Page B doesn't exist in Scope B)

**Note:** The link is only retained if both pages are copied in the same
operation.

Closes COM-344
The restriction was incorrectly added to the Next.js config, but should
be in the React config (= Admin applications).
The `additionalToolbarItems` were only shown inside the `DamPage`, but
not in the `ChooseFileDialog`. To fix this, we add a
`additionalToolbarItems` option to `DamConfigProvider` that works both
inside the DAM and for the DAM blocks. We also deprecate the
`additionalToolbarItems` prop of `DamPage` in favor of this option.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @comet/cms-api@5.5.0

### Minor Changes

-   bb2c76d: Deprecate `FileUploadInterface` interface

    Use `FileUploadInput` instead.

-   bb2c76d: Deprecate `download` helper

The helper is primarily used to create a `FileUploadInput` (previously
`FileUploadInterface`) input for `FilesService#upload` while creating
fixtures.
However, the name of the helper is too generic to be part of the
package's public API.
Instead, use the newly added
`FileUploadService#createFileUploadInputFromUrl`.

    **Example:**

    ```ts
    @Injectable()
    class ImageFixtureService {
constructor(private readonly filesService: FilesService, private
readonly fileUploadService: FileUploadService) {}

        async generateImage(url: string): Promise<FileInterface> {
const upload = await
this.fileUploadService.createFileUploadInputFromUrl(url);
            return this.filesService.upload(upload, {});
        }
    }
    ```

### Patch Changes

-   @comet/blocks-api@5.5.0

## @comet/admin@5.5.0

### Patch Changes

-   @comet/admin-icons@5.5.0

## @comet/admin-color-picker@5.5.0

### Patch Changes

-   @comet/admin@5.5.0
-   @comet/admin-icons@5.5.0

## @comet/admin-date-time@5.5.0

### Patch Changes

-   @comet/admin@5.5.0
-   @comet/admin-icons@5.5.0

## @comet/admin-react-select@5.5.0

### Patch Changes

-   @comet/admin@5.5.0

## @comet/admin-rte@5.5.0

### Patch Changes

-   @comet/admin-icons@5.5.0

## @comet/admin-theme@5.5.0

### Patch Changes

-   @comet/admin-icons@5.5.0

## @comet/blocks-admin@5.5.0

### Patch Changes

-   @comet/admin@5.5.0
-   @comet/admin-icons@5.5.0

## @comet/cms-admin@5.5.0

### Patch Changes

-   1b37b1f: Show `additionalToolbarItems` in `ChooseFileDialog`

The `additionalToolbarItems` were only shown inside the `DamPage`, but
not in the `ChooseFileDialog`.
To fix this, use the `additionalToolbarItems` option in
`DamConfigProvider`.
The `additionalToolbarItems` prop of `DamPage` has been deprecated in
favor of this option.

    **Previously:**

    ```tsx
    <DamPage
        // ...
        additionalToolbarItems={<ImportFromExternalDam />}
    />
    ```

    **Now:**

    ```tsx
    <DamConfigProvider
        value={{
            // ...
            additionalToolbarItems: <ImportFromExternalDam />,
        }}
    >
        {/*...*/}
    </DamConfigProvider>
    ```

- 85aa962: Set unhandled dependencies to `undefined` when copying
documents to another scope

This prevents leaks between scopes. In practice, this mostly concerns
links to documents that don't exist in the target scope.

    **Example:**

    -   Page A links to Page B
    -   Page A is copied from Scope A to Scope B
- Link to Page B is removed from Page A by replacing the `id` with
`undefined` (since Page B doesn't exist in Scope B)

**Note:** The link is only retained if both pages are copied in the same
operation.

- c4639be: Clip crop values when cropping an image in the DAM or
`PixelImageBlock`

Previously, negative values could occur, causing the image proxy to fail
on delivery.

    -   @comet/admin@5.5.0
    -   @comet/admin-date-time@5.5.0
    -   @comet/admin-icons@5.5.0
    -   @comet/admin-rte@5.5.0
    -   @comet/admin-theme@5.5.0
    -   @comet/blocks-admin@5.5.0

## @comet/eslint-config@5.5.0

### Patch Changes

- 80a6d8d: Move import restriction for MUI's `Alert` to correct ESLint
config
    -   @comet/eslint-plugin@5.5.0

## @comet/admin-babel-preset@5.5.0



## @comet/admin-icons@5.5.0



## @comet/blocks-api@5.5.0



## @comet/cli@5.5.0



## @comet/eslint-plugin@5.5.0



## @comet/cms-site@5.5.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Flips2001 and others added 22 commits January 17, 2024 12:44
… factories (#1581)

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…Block` (#1544)

Allows adding migrations to a `RichTextBlock` in application code.

---------

Co-authored-by: Stefanie Kaltenhauser <stefanie.kaltenhauser@vivid-planet.com>
Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Prevents importing the file from outside the source folder.
…." (#1534)

Before:

<img width="1920" alt="Bildschirmfoto 2023-12-28 um 14 46 39"
src="https://github.com/vivid-planet/comet/assets/13380047/62ca9910-affb-46bd-b432-32a6fb921374">


Now:

<img width="1920" alt="Bildschirmfoto 2024-01-18 um 10 00 00"
src="https://github.com/vivid-planet/comet/assets/13380047/8f33ac38-8a50-416c-9f1f-08f3977e566a">

---

Closes COM-168
The sites config was previously assumed to be `Record<string,
SiteConfg`. However, as the sites config is solely used in application
code, it could be of any shape. Therefore, the `SitesConfigProvider` and
`useSitesConfig` are made generic.

---------

Co-authored-by: Niko Sams <niko.sams@gmail.com>
I'm not sure why we didn't return this in the first place, but I think
it was just because it wasn't needed at the moment. But for some use
cases it can be convenient to have the items returned directly.
…te/list block combinations (#1569)

fix issue from #1507

---------

Co-authored-by: Johannes Obermair <johannes.obermair@vivid-planet.com>
This is in line with our best practices.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @comet/admin-theme@5.6.0

### Minor Changes

- fb6c806: Change `DataGrid`'s `noRowsLabel` from "No rows" to "No
results found."

### Patch Changes

-   @comet/admin-icons@5.6.0

## @comet/cms-admin@5.6.0

### Minor Changes

- fe26a6e: Show an error message when trying to edit a non-existing
document and when trying to edit an archived document
- 3ee4ce0: Return newly uploaded items from
`useDamFileUpload#uploadFiles`

### Patch Changes

-   Updated dependencies [fb6c806]
-   Updated dependencies [76f85ab]
    -   @comet/admin-theme@5.6.0
    -   @comet/blocks-admin@5.6.0
    -   @comet/admin@5.6.0
    -   @comet/admin-date-time@5.6.0
    -   @comet/admin-icons@5.6.0
    -   @comet/admin-rte@5.6.0

## @comet/blocks-api@5.6.0

### Minor Changes

- fd10b80: Add support for a custom block name and migrations to
`createRichTextBlock`

## @comet/admin@5.6.0

### Patch Changes

-   @comet/admin-icons@5.6.0

## @comet/admin-color-picker@5.6.0

### Patch Changes

-   @comet/admin@5.6.0
-   @comet/admin-icons@5.6.0

## @comet/admin-date-time@5.6.0

### Patch Changes

-   @comet/admin@5.6.0
-   @comet/admin-icons@5.6.0

## @comet/admin-react-select@5.6.0

### Patch Changes

-   @comet/admin@5.6.0

## @comet/admin-rte@5.6.0

### Patch Changes

-   @comet/admin-icons@5.6.0

## @comet/blocks-admin@5.6.0

### Patch Changes

- 76f85ab: Fix linking from block preview to block admin for
non-trivial composite/list block combinations
    -   @comet/admin@5.6.0
    -   @comet/admin-icons@5.6.0

## @comet/cms-api@5.6.0

### Patch Changes

-   Updated dependencies [fd10b80]
    -   @comet/blocks-api@5.6.0

## @comet/eslint-config@5.6.0

### Patch Changes

-   @comet/eslint-plugin@5.6.0

## @comet/admin-babel-preset@5.6.0



## @comet/admin-icons@5.6.0



## @comet/cli@5.6.0



## @comet/eslint-plugin@5.6.0



## @comet/cms-site@5.6.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Alongside `error` and `warning` messages for `Field` there is now a a
`helperText` prop.
Errors and warnings override the helper message.

---------

Co-authored-by: Thomas Dax <thomas.dax@vivid-planet.com>
The contentScopes now have to be checked for every permission
individually.
@jamesricky jamesricky self-assigned this Jan 27, 2024
@jamesricky jamesricky changed the base branch from main to feature/refactor-admin-component-theming January 27, 2024 17:08
@johnnyomair johnnyomair merged commit b640c97 into feature/refactor-admin-component-theming Jan 29, 2024
11 checks passed
@johnnyomair johnnyomair deleted the merge-next-into-feature-refactor-admin-component-theming branch January 29, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.