Skip to content

Commit d5476ea

Browse files
dfdezfgnassadunkmaneric-gadedemshy
authored
PNW-2564 - merge with master (#23)
* feat(nested collections): allow non-index files (decaporg#7359) * feat(nested collections): allow non-index files This commit fixes decaporg#4972 to allow nested folders with additional content beyond an index file. Side effect: To keep the feature simple, this will now show index files as pages within a folder in NetlifyCMS. This enables creating additional files alongside the given index, but is a change in behavior from the current implementation. Co-authored-by: Eric Gade <[email protected]> * test(e2e): adapt to new way nested collections work We use regexps as otherwise .contains("Sub Directory") would also match "Another Sub Directory" --------- Co-authored-by: Andrew Dunkman <[email protected]> Co-authored-by: Eric Gade <[email protected]> Co-authored-by: Anze Demsar <[email protected]> * fix(markdown): convert inline CSS from Google Docs to Markdown (decaporg#7351) Extends the HTML to Markdown conversion to better support bold and italic formatting from Google Docs, which generates inline styles on a `span` element instead of strong/b/em/i type elements. Co-authored-by: Anze Demsar <[email protected]> * feat: visual editing (click-to-edit) (decaporg#7374) * refactor: clean up controlRef handling * feat: add click-to-edit * test: update snapshots --------- Co-authored-by: Anze Demsar <[email protected]> * fix(widgetsFor): return widgets for variable type lists (decaporg#7296) When using a Variable Type list widget and a custom preview component, the `widgetsFor` helper would only return a `data` list with each of the items in the list, not a `widgets` list, e.g. {"data" => {"markdown" => "# Title"} {"type" => "block_body"} } {"widgets" => undefined} 🚫 The `widgets` list should also be supplied, particularly for nested Markdown widgets, so a fully formatted preview can be rendered: {"data" => {"markdown" => "# Title"} {"type" => "block_body"} } {"widgets" => {"markdown" => Object} ✅ } This extends support in `widgetsFor` to detect variable type list widgets and correctly construct the `widgets` return value. As reported at decaporg#2307 (comment) Co-authored-by: Anze Demsar <[email protected]> * chore(release): publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * fix(ObjectControl): hotfix nested object validation (decaporg#7385) * chore(release): publish - [email protected] - [email protected] - [email protected] * chore: update to upload-artifact@v4 (decaporg#7388) * feat(nested collections) legacy mode (decaporg#7387) * feat(nested-collections): opt-in to legacy nested folder behaviour * style: lint * feat(nested-collection): default subfolders to true * test(nested-collections): keep the tests in the subfolders: false scenario * chore(release): publish - [email protected] - [email protected] - [email protected] * fix(nested-i18n): pass newPath only when customPath differs from current path (decaporg#7418) * fix(decaporg#7371): Duplicate Localized Content When Duplicating Entries with i18n Enabled (decaporg#7372) * chore: add i18n to EntryObject type * fix: draftDuplicateEntry function duplicate i18n data --------- Co-authored-by: Anze Demsar <[email protected]> * chore(release): publish - [email protected] - [email protected] - [email protected] * Update README.md, fix spelling error (decaporg#7472) * PNW-2564 - duplicate workflow (#21) * Merge with feature/PNW-2564_duplicate--wip * feat: duplicate workflow wip * feat: duplicate workflow wip * feat: added local empty draft * feat: added isCustomEntry to edit state with data * feat: added function to retrieve current unpublished entries * feat: added enty and avoid problems if empty is missing * feat: refactor context structure and error name with integration --------- Co-authored-by: Felix Gnass <[email protected]> Co-authored-by: Andrew Dunkman <[email protected]> Co-authored-by: Eric Gade <[email protected]> Co-authored-by: Anze Demsar <[email protected]> Co-authored-by: Dominic Cleal <[email protected]> Co-authored-by: Anze Demsar <[email protected]> Co-authored-by: starkovio <[email protected]> Co-authored-by: kare-rentelligent <[email protected]>
1 parent 256a638 commit d5476ea

File tree

64 files changed

+1265
-346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1265
-346
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
5353
NODE_OPTIONS: --max-old-space-size=4096
5454
TZ: Europe/Amsterdam
55-
- uses: actions/upload-artifact@v3
55+
- uses: actions/upload-artifact@v4
5656
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x' && failure()
5757
with:
5858
name: cypress-results

cypress/e2e/editorial_workflow_spec_test_backend.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,16 @@ describe('Test Backend Editorial Workflow', () => {
207207
login();
208208

209209
inSidebar(() => cy.contains('a', 'Pages').click());
210-
inSidebar(() => cy.contains('a', 'Directory'));
210+
inSidebar(() => cy.contains('a', /^Directory$/));
211211
inGrid(() => cy.contains('a', 'Root Page'));
212-
inGrid(() => cy.contains('a', 'Directory'));
213212

214-
inSidebar(() => cy.contains('a', 'Directory').click());
213+
inSidebar(() => cy.contains('a', /^Directory$/).click());
215214

216-
inGrid(() => cy.contains('a', 'Sub Directory'));
217-
inGrid(() => cy.contains('a', 'Another Sub Directory'));
215+
inSidebar(() => cy.contains('a', /^Sub Directory$/));
216+
inSidebar(() => cy.contains('a', 'Another Sub Directory'));
218217

219-
inSidebar(() => cy.contains('a', 'Sub Directory').click());
220-
inGrid(() => cy.contains('a', 'Nested Directory'));
218+
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
219+
inSidebar(() => cy.contains('a', 'Nested Directory'));
221220
cy.url().should(
222221
'eq',
223222
'http://localhost:8080/#/collections/pages/filter/directory/sub-directory',
@@ -233,21 +232,17 @@ describe('Test Backend Editorial Workflow', () => {
233232
login();
234233

235234
inSidebar(() => cy.contains('a', 'Pages').click());
236-
inSidebar(() => cy.contains('a', 'Directory').click());
237-
inGrid(() => cy.contains('a', 'Another Sub Directory').click());
238-
239-
cy.url().should(
240-
'eq',
241-
'http://localhost:8080/#/collections/pages/entries/directory/another-sub-directory/index',
242-
);
235+
inSidebar(() => cy.contains('a', /^Directory$/).click());
236+
inSidebar(() => cy.contains('a', 'Another Sub Directory').click());
237+
inGrid(() => cy.contains('a', 'Another Sub Directory'));
243238
});
244239

245240
it(`can create a new entry with custom path`, () => {
246241
login();
247242

248243
inSidebar(() => cy.contains('a', 'Pages').click());
249-
inSidebar(() => cy.contains('a', 'Directory').click());
250-
inSidebar(() => cy.contains('a', 'Sub Directory').click());
244+
inSidebar(() => cy.contains('a', /^Directory$/).click());
245+
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
251246
cy.contains('a', 'New Page').click();
252247

253248
cy.get('[id^="path-field"]').should('have.value', 'directory/sub-directory');
@@ -262,18 +257,18 @@ describe('Test Backend Editorial Workflow', () => {
262257
publishEntryInEditor(publishTypes.publishNow);
263258
exitEditor();
264259

265-
inGrid(() => cy.contains('a', 'New Path Title'));
266-
inSidebar(() => cy.contains('a', 'Directory').click());
267-
inSidebar(() => cy.contains('a', 'Directory').click());
260+
inSidebar(() => cy.contains('a', 'New Path Title'));
261+
inSidebar(() => cy.contains('a', /^Directory$/).click());
262+
inSidebar(() => cy.contains('a', /^Directory$/).click());
268263
inGrid(() => cy.contains('a', 'New Path Title').should('not.exist'));
269264
});
270265

271266
it(`can't create an entry with an existing path`, () => {
272267
login();
273268

274269
inSidebar(() => cy.contains('a', 'Pages').click());
275-
inSidebar(() => cy.contains('a', 'Directory').click());
276-
inSidebar(() => cy.contains('a', 'Sub Directory').click());
270+
inSidebar(() => cy.contains('a', /^Directory$/).click());
271+
inSidebar(() => cy.contains('a', /^Sub Directory$/).click());
277272

278273
cy.contains('a', 'New Page').click();
279274
cy.get('[id^="title-field"]').type('New Path Title');
@@ -292,7 +287,8 @@ describe('Test Backend Editorial Workflow', () => {
292287
login();
293288

294289
inSidebar(() => cy.contains('a', 'Pages').click());
295-
inGrid(() => cy.contains('a', 'Directory').click());
290+
inSidebar(() => cy.contains('a', /^Directory$/).click());
291+
inGrid(() => cy.contains('a', /^Directory$/).click());
296292

297293
cy.get('[id^="path-field"]').should('have.value', 'directory');
298294
cy.get('[id^="path-field"]').clear();
@@ -310,7 +306,7 @@ describe('Test Backend Editorial Workflow', () => {
310306

311307
inSidebar(() => cy.contains('a', 'New Directory').click());
312308

313-
inGrid(() => cy.contains('a', 'Sub Directory'));
314-
inGrid(() => cy.contains('a', 'Another Sub Directory'));
309+
inSidebar(() => cy.contains('a', /^Sub Directory$/));
310+
inSidebar(() => cy.contains('a', 'Another Sub Directory'));
315311
});
316312
});

dev-test/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ collections: # A list of collections the CMS should be able to edit
1717
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
1818
summary: '{{title}} -- {{year}}/{{month}}/{{day}}'
1919
create: true # Allow users to create new documents in this collection
20+
editor:
21+
visualEditing: true
2022
view_filters:
2123
- label: Posts With Index
2224
field: title
@@ -61,6 +63,8 @@ collections: # A list of collections the CMS should be able to edit
6163
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
6264
summary: '{{title}} -- {{year}}/{{month}}/{{day}}'
6365
create: true # Allow users to create new documents in this collection
66+
editor:
67+
visualEditing: true
6468
fields: # The fields each document in this collection have
6569
- { label: 'Title', name: 'title', widget: 'string', tagname: 'h1' }
6670
- { label: 'Body', name: 'body', widget: 'markdown', hint: 'Main content goes here.' }
@@ -272,7 +276,7 @@ collections: # A list of collections the CMS should be able to edit
272276
label_singular: 'Page'
273277
folder: _pages
274278
create: true
275-
nested: { depth: 100 }
279+
nested: { depth: 100, subfolders: false }
276280
fields:
277281
- label: Title
278282
name: title

package-lock.json

Lines changed: 21 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/decap-cms-app/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [3.6.3](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.3) (2025-05-15)
7+
8+
**Note:** Version bump only for package decap-cms-app
9+
10+
## [3.6.2](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.2) (2025-02-13)
11+
12+
**Note:** Version bump only for package decap-cms-app
13+
14+
## [3.6.1](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.1) (2025-01-30)
15+
16+
**Note:** Version bump only for package decap-cms-app
17+
18+
# [3.6.0](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.0) (2025-01-29)
19+
20+
**Note:** Version bump only for package decap-cms-app
21+
622
# [3.5.0](https://github.com/decaporg/decap-cms/compare/[email protected]@3.5.0) (2025-01-15)
723

824
### Bug Fixes

packages/decap-cms-app/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "decap-cms-app",
33
"description": "An extensible, open source, Git-based, React CMS for static sites. Reusable congiuration with React as peer.",
4-
"version": "3.5.0",
4+
"version": "3.6.3",
55
"homepage": "https://www.decapcms.org",
66
"repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-app",
77
"bugs": "https://github.com/decaporg/decap-cms/issues",
@@ -40,10 +40,10 @@
4040
"decap-cms-backend-gitlab": "^3.2.2",
4141
"decap-cms-backend-proxy": "^3.1.4",
4242
"decap-cms-backend-test": "^3.1.3",
43-
"decap-cms-core": "^3.5.0",
43+
"decap-cms-core": "^3.6.2",
4444
"decap-cms-editor-component-image": "^3.1.3",
4545
"decap-cms-lib-auth": "^3.0.5",
46-
"decap-cms-lib-util": "^3.1.0",
46+
"decap-cms-lib-util": "^3.2.0",
4747
"decap-cms-lib-widgets": "^3.1.0",
4848
"decap-cms-locales": "^3.3.0",
4949
"decap-cms-ui-default": "^3.1.4",
@@ -53,11 +53,11 @@
5353
"decap-cms-widget-datetime": "^3.2.3",
5454
"decap-cms-widget-file": "^3.1.3",
5555
"decap-cms-widget-image": "^3.1.3",
56-
"decap-cms-widget-list": "^3.2.2",
56+
"decap-cms-widget-list": "^3.3.0",
5757
"decap-cms-widget-map": "^3.1.4",
58-
"decap-cms-widget-markdown": "^3.2.0",
58+
"decap-cms-widget-markdown": "^3.3.0",
5959
"decap-cms-widget-number": "^3.1.3",
60-
"decap-cms-widget-object": "^3.2.0",
60+
"decap-cms-widget-object": "^3.3.1",
6161
"decap-cms-widget-relation": "^3.3.2",
6262
"decap-cms-widget-select": "^3.2.2",
6363
"decap-cms-widget-string": "^3.1.3",

packages/decap-cms-core/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [3.6.2](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.2) (2025-05-15)
7+
8+
### Bug Fixes
9+
10+
- **#7371:** Duplicate Localized Content When Duplicating Entries with i18n Enabled ([#7372](https://github.com/decaporg/decap-cms/issues/7372)) ([c5b1dfe](https://github.com/decaporg/decap-cms/commit/c5b1dfe50ae34230c735d58dd1df475fa17ee578)), closes [#7371](https://github.com/decaporg/decap-cms/issues/7371)
11+
- **nested-i18n:** pass newPath only when customPath differs from current path ([#7418](https://github.com/decaporg/decap-cms/issues/7418)) ([86d41d7](https://github.com/decaporg/decap-cms/commit/86d41d79b20583041570bce30b46835a36bcecf2))
12+
13+
## [3.6.1](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.1) (2025-02-13)
14+
15+
**Note:** Version bump only for package decap-cms-core
16+
17+
# [3.6.0](https://github.com/decaporg/decap-cms/compare/[email protected]@3.6.0) (2025-01-29)
18+
19+
### Bug Fixes
20+
21+
- **widgetsFor:** return widgets for variable type lists ([#7296](https://github.com/decaporg/decap-cms/issues/7296)) ([9be2693](https://github.com/decaporg/decap-cms/commit/9be2693d1b35bf56c7ef05bdece6c24a21ba7567)), closes [/github.com/decaporg/decap-cms/issues/2307#issuecomment-638326225](https://github.com//github.com/decaporg/decap-cms/issues/2307/issues/issuecomment-638326225)
22+
23+
### Features
24+
25+
- **nested collections:** allow non-index files ([#7359](https://github.com/decaporg/decap-cms/issues/7359)) ([47a2f70](https://github.com/decaporg/decap-cms/commit/47a2f70ef788ae8e61bbbc0ac21e00d68d0029d0)), closes [#4972](https://github.com/decaporg/decap-cms/issues/4972)
26+
- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb))
27+
628
# [3.5.0](https://github.com/decaporg/decap-cms/compare/[email protected]@3.5.0) (2024-11-12)
729

830
### Bug Fixes

packages/decap-cms-core/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ declare module 'decap-cms-core' {
311311
publish?: boolean;
312312
nested?: {
313313
depth: number;
314+
subfolders?: boolean;
314315
};
315316
meta?: { path?: { label: string; widget: string; index_file: string } };
316317

@@ -515,12 +516,20 @@ declare module 'decap-cms-core' {
515516
handler: ({
516517
entry,
517518
author,
519+
context,
518520
}: {
519521
entry: Map<string, any>;
520522
author: { login: string; name: string };
523+
context?: HookContext;
521524
}) => any;
522525
}
523526

527+
export interface HookContext {
528+
publishStack?: boolean;
529+
actions?: Record<string, Function>;
530+
[key: string]: any;
531+
}
532+
524533
export type CmsEventListenerOptions = any; // TODO: type properly
525534

526535
export type CmsLocalePhrases = any; // TODO: type properly

packages/decap-cms-core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "decap-cms-core",
33
"description": "Decap CMS core application, see decap-cms package for the main distribution.",
4-
"version": "3.5.0",
4+
"version": "3.6.2",
55
"repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-core",
66
"bugs": "https://github.com/decaporg/decap-cms/issues",
77
"module": "dist/esm/index.js",
@@ -26,6 +26,7 @@
2626
"dependencies": {
2727
"@iarna/toml": "2.2.5",
2828
"@reduxjs/toolkit": "^1.9.1",
29+
"@vercel/stega": "^0.1.2",
2930
"ajv": "8.12.0",
3031
"ajv-errors": "^3.0.0",
3132
"ajv-keywords": "^5.0.0",

0 commit comments

Comments
 (0)