# keystone6-document-gallery-block

> Manage and upload your post images with a gallery block for powerful [Keystone's Document Editor](https://keystonejs.com/docs/guides/document-field-demo)!

Latest version **1.0.1** (published 2021-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install keystone6-document-gallery-block
pnpm add keystone6-document-gallery-block
yarn add keystone6-document-gallery-block
bun add keystone6-document-gallery-block
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-12-12 |
| First published | 2021-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^12.20 \|\| >= 14.13 |
| Dependencies | 13 |
| Unpacked size | 86 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | jutiss |
| Maintainers | jutis |
| Keywords | keystone6, gallery, image-library |

## Links

- npm: https://www.npmjs.com/package/keystone6-document-gallery-block
- Homepage: https://github.com/jutiss/keystone6-document-gallery-block
- Issues: https://github.com/jutiss/keystone6-document-gallery-block/issues
- npm.io page: https://npm.io/package/keystone6-document-gallery-block

## Dependencies (13)

- [react](https://npm.io/package/react.md) ^17.0.2
- [typescript](https://npm.io/package/typescript.md) ^4.4.3
- [@keystone-6/core](https://npm.io/package/@keystone-6/core.md) ^1.0.0
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.16.4
- [@keystone-ui/core](https://npm.io/package/@keystone-ui/core.md) ^4.0.0
- [@keystone-ui/toast](https://npm.io/package/@keystone-ui/toast.md) ^4.0.4
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.16.0
- [@keystone-ui/button](https://npm.io/package/@keystone-ui/button.md) ^6.0.0
- [@keystone-ui/fields](https://npm.io/package/@keystone-ui/fields.md) ^6.0.0
- [@keystone-ui/modals](https://npm.io/package/@keystone-ui/modals.md) ^4.0.2
- [@keystone-ui/loading](https://npm.io/package/@keystone-ui/loading.md) ^5.0.0
- [@babel/preset-typescript](https://npm.io/package/@babel/preset-typescript.md) ^7.16.0
- [@keystone-6/fields-document](https://npm.io/package/@keystone-6/fields-document.md) ^1.0.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-12-12
- 1.0.0 — 2021-12-12

## README

# Keystone 6 Document Gallery Block

Manage and upload your post images with a gallery block for powerful [Keystone's Document Editor](https://keystonejs.com/docs/guides/document-field-demo)!

![Demonstration](https://i.imgur.com/DNrVcXs.gif)
## Installation

Install the yarn package:

```bash
yarn add keystone6-document-gallery-block
```

## Usage

Make sure you [configure image uploading](https://keystonejs.com/docs/apis/config#images) in keystone.ts config, otherwise it will not work:

```bash
images: {
    upload: 'local',
    local: {
        storagePath: 'public/images',
        baseUrl: '/images',
    },
}
```

Add a new list to your schema (you can set your own list key, if needed):

```bash
Image: list({
    fields: {
        name: text(),
        image: image(),
        publishDate: timestamp(),
    }
})
```

Create **component-blocks.tsx** in your root directory and import the gallery block (don't forget to change **listKey**, if it is different):

```bash
import { gallery } from "keystone6-document-gallery-block";

// naming the export componentBlocks is important because the Admin UI
// expects to find the components like on the componentBlocks export
export const componentBlocks = {
    gallery: gallery({
        listKey: "Image",
    }),
};
```

Import the file in schema.ts:

```bash
import { componentBlocks } from './component-blocks';
```

Add the component blocks to the document configuration for the list that you want (e.g. Post):

```bash
Post: list({
    ...
    content: document({
        ui: {
            views: require.resolve('./component-blocks')
        },
        componentBlocks
    })
}),
```

---
_Source: https://npm.io/package/keystone6-document-gallery-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
