nuxt-strapi-blocks-renderer 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -4
- package/dist/module.json +1 -1
- package/package.json +7 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Frederik Bußmann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# Nuxt Strapi Blocks Renderer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![Github Actions][github-actions-src]][github-actions-href]
|
|
4
|
+
[![NPM version][npm-version-src]][npm-version-href]
|
|
5
|
+
[![NPM downloads][npm-downloads-src]][npm-downloads-href]
|
|
6
|
+
[![License][license-src]][license-href]
|
|
7
|
+
|
|
8
|
+
A fully customizable Nuxt 3 module for rendering text with the new Blocks rich text editor element from Strapi CMS.
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
7
|
-
1. Install the
|
|
12
|
+
1. Install the Blocks renderer:
|
|
8
13
|
|
|
9
14
|
```bash
|
|
10
15
|
npm install nuxt-strapi-blocks-renderer
|
|
@@ -24,8 +29,8 @@ To render text, use the `StrapiBlocksText` component:
|
|
|
24
29
|
<StrapiBlocksText :nodes="blockNodes" />
|
|
25
30
|
```
|
|
26
31
|
|
|
27
|
-
In this example, the `blockNodes` are taken from the JSON response which Strapi provides when using the
|
|
28
|
-
element:
|
|
32
|
+
In this example, the `blockNodes` are taken from the JSON response which Strapi provides when using the Blocks rich
|
|
33
|
+
text editor element:
|
|
29
34
|
|
|
30
35
|
```vue
|
|
31
36
|
<script setup lang="ts">
|
|
@@ -47,6 +52,8 @@ element:
|
|
|
47
52
|
</template>
|
|
48
53
|
```
|
|
49
54
|
|
|
55
|
+
To use the `useStrapi` composable, install the [Strapi Nuxt module](https://strapi.nuxtjs.org/).
|
|
56
|
+
|
|
50
57
|
### Advanced Usage
|
|
51
58
|
|
|
52
59
|
In situations where your project requires specific styling or behavior for certain HTML tags such as `<a>`, `<p>`,
|
|
@@ -88,6 +95,19 @@ To override the default paragraph tag, we create a file called `StrapiBlocksText
|
|
|
88
95
|
|
|
89
96
|
This component assigns a custom class `my-custom-class-for-p` to the paragraph tag, which can be styled as needed.
|
|
90
97
|
|
|
98
|
+
The prefix for the custom components can be adjusted in your `nuxt.config.{js|ts}`:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
modules: ['nuxt-strapi-blocks-renderer'],
|
|
102
|
+
strapiBlocksRenderer: {
|
|
103
|
+
prefix: 'MyCustomPrefix'
|
|
104
|
+
blocksPrefix: 'MyCustomBlocksPrefix',
|
|
105
|
+
},
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
With this configuration, the `StrapiBlocksText` component becomes `MyCustomPrefixStrapiBlocksText` and the custom
|
|
109
|
+
paragraph node component would be named `MyCustomBlocksPrefixParagraphNode`.
|
|
110
|
+
|
|
91
111
|
#### Other Custom Tags
|
|
92
112
|
|
|
93
113
|
You can apply similar customizations to all other HTML tags used by the renderer.
|
|
@@ -273,3 +293,15 @@ npm run test
|
|
|
273
293
|
# Release new version
|
|
274
294
|
npm run release
|
|
275
295
|
```
|
|
296
|
+
|
|
297
|
+
[github-actions-src]: https://github.com/freb97/nuxt-strapi-blocks-renderer/actions/workflows/ci.yml/badge.svg
|
|
298
|
+
[github-actions-href]: https://github.com/freb97/nuxt-strapi-blocks-renderer/actions
|
|
299
|
+
|
|
300
|
+
[npm-version-src]: https://img.shields.io/npm/v/nuxt-strapi-blocks-renderer/latest.svg?style=flat&colorA=18181B&colorB=31C553
|
|
301
|
+
[npm-version-href]: https://npmjs.com/package/nuxt-strapi-blocks-renderer
|
|
302
|
+
|
|
303
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-strapi-blocks-renderer.svg?style=flat&colorA=18181B&colorB=31C553
|
|
304
|
+
[npm-downloads-href]: https://npmjs.com/package/nuxt-strapi-blocks-renderer
|
|
305
|
+
|
|
306
|
+
[license-src]: https://img.shields.io/github/license/freb97/nuxt-strapi-blocks-renderer.svg?style=flat&colorA=18181B&colorB=31C553
|
|
307
|
+
[license-href]: https://github.com/freb97/nuxt-strapi-blocks-renderer/blob/main/LICENSE
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-strapi-blocks-renderer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Renderer for the strapi blocks text element.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/freb97/nuxt-strapi-blocks-renderer.git"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"exports": {
|
|
8
12
|
".": {
|
|
@@ -19,9 +23,11 @@
|
|
|
19
23
|
"scripts": {
|
|
20
24
|
"prepack": "nuxt-module-build build",
|
|
21
25
|
"dev": "npm run dev:basic",
|
|
26
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
22
27
|
"dev:basic": "nuxi dev playground/basic",
|
|
23
28
|
"dev:custom": "nuxi dev playground/custom",
|
|
24
29
|
"release": "npm run lint && npm run test && npm run prepack && npm publish",
|
|
30
|
+
"release:ci": "npm run prepack && npm publish",
|
|
25
31
|
"lint": "eslint './**/*.{js,ts,vue}' --max-warnings=0",
|
|
26
32
|
"test": "vitest run",
|
|
27
33
|
"test:watch": "vitest watch"
|