@sveltia/cms 0.26.2 → 0.26.4
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/README.md +21 -3
- package/dist/sveltia-cms.js +162 -154
- package/dist/sveltia-cms.mjs +169 -161
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -163,8 +163,9 @@ We are working hard to create a **significantly better alternative to Netlify CM
|
|
|
163
163
|
- The rich text editor is built with [Lexical](https://github.com/facebook/lexical) instead of [Slate](https://github.com/ianstormtaylor/slate), which solves various problems found in Netlify/Decap CMS, including fatal application crashes[^53][^70][^71][^72][^73].
|
|
164
164
|
- You can set the default editor mode by changing the order of the `modes` option[^58]. If you want to use the plain text editor by default, add `modes: [raw, rich_text]` to the field configuration.
|
|
165
165
|
- Object
|
|
166
|
-
-
|
|
167
|
-
|
|
166
|
+
- Sveltia CMS offers two ways to have conditional fields in a collection[^30]:
|
|
167
|
+
- You can use [variable types](https://decapcms.org/docs/variable-type-widgets/) (the `types` option) with the Object widget just like the List widget.
|
|
168
|
+
- An optional Object field (`required: false`) can be manually added or removed with a checkbox. If unadded or removed, the required subfields won’t trigger validation errors[^16].
|
|
168
169
|
- Relation
|
|
169
170
|
- Field options are displayed with no additional API requests[^14]. The confusing `options_length` option, which defaults to 20, is therefore ignored[^76].
|
|
170
171
|
- The redundant `search_fields` option is not required in Sveltia CMS, as it defaults to `display_fields` (and `value_field`).
|
|
@@ -297,7 +298,11 @@ Alternatively, you can probably use one of the [Netlify/Decap CMS templates](htt
|
|
|
297
298
|
|
|
298
299
|
### Migration
|
|
299
300
|
|
|
300
|
-
Have a look at the [compatibility info](#compatibility) above first. If you’re already using Netlify/Decap CMS with the GitHub or GitLab backend and don’t have any custom widget, custom preview or plugin, migrating to Sveltia CMS is super easy — it works as a drop-in replacement. Edit `/admin/index.html` to replace the CMS `<script>` tag, and push the change to your repository.
|
|
301
|
+
Have a look at the [compatibility info](#compatibility) above first. If you’re already using Netlify/Decap CMS with the GitHub or GitLab backend and don’t have any custom widget, custom preview or plugin, migrating to Sveltia CMS is super easy — it works as a drop-in replacement. Edit `/admin/index.html` to replace the CMS `<script>` tag, and push the change to your repository. Your new `<script>` tag is:
|
|
302
|
+
|
|
303
|
+
```html
|
|
304
|
+
<script src="https://unpkg.com/@sveltia/cms/dist/sveltia-cms.js"></script>
|
|
305
|
+
```
|
|
301
306
|
|
|
302
307
|
From Netlify CMS:
|
|
303
308
|
|
|
@@ -317,6 +322,8 @@ That’s it! You can open `https://[hostname]/admin/` as before to start editing
|
|
|
317
322
|
|
|
318
323
|
That said, we strongly recommend testing your new Sveltia CMS instance first on your local machine. [See below](#working-with-a-local-git-repository) for how.
|
|
319
324
|
|
|
325
|
+
### Installing with npm
|
|
326
|
+
|
|
320
327
|
For advanced users, we have also made the bundle available as an [npm package](https://www.npmjs.com/package/@sveltia/cms). You can install it by running `npm i @sveltia/cms` or `pnpm add @sveltia/cms` on your project. The [manual initialization](https://decapcms.org/docs/manual-initialization/) flow with the `init` method is the same as for Netlify/Decap CMS.
|
|
321
328
|
|
|
322
329
|
### Updates
|
|
@@ -327,6 +334,17 @@ If you’ve chosen to install with npm, updating the package is your responsibil
|
|
|
327
334
|
|
|
328
335
|
## Tips & tricks
|
|
329
336
|
|
|
337
|
+
### Working around configuration loading issue
|
|
338
|
+
|
|
339
|
+
Depending on your server or framework’s configuration, when you access the CMS at `/admin/`, you’ll be redirected to `/admin` with the trailing slash removed. The CMS assumes that your configuration exists in the same directory, which means `/config.yml` is loaded instead of `/admin/config.yml`, resulting in an error saying “The configuration file could not be retrieved.” There are a couple of ways to work around this problem:
|
|
340
|
+
|
|
341
|
+
- Access `/admin/index.html` or `/admin/#/`
|
|
342
|
+
- Rename `/admin/index.html` to `/admin/cms.html`, and access `/admin/cms`
|
|
343
|
+
- [Specify the configuration file path](https://decapcms.org/docs/configuration-options/#configuration-file) with a `<link>` tag in the `/admin/index.html`:
|
|
344
|
+
```html
|
|
345
|
+
<link href="/admin/config.yml" type="text/yaml" rel="cms-config-url" />
|
|
346
|
+
```
|
|
347
|
+
|
|
330
348
|
### Providing a JSON configuration file
|
|
331
349
|
|
|
332
350
|
Sveltia CMS supports a configuration file written in the JSON format in addition to the standard YAML format. This allows developers to programmatically generate the CMS configuration to enable bulk or complex collections. To do this, simply add a `<link>` tag to your HTML, just like a [custom YAML config link](https://decapcms.org/docs/configuration-options/#configuration-file), but with the type `application/json`:
|