From 47a2f70ef788ae8e61bbbc0ac21e00d68d0029d0 Mon Sep 17 00:00:00 2001 From: Felix Gnass Date: Fri, 17 Jan 2025 13:13:58 +0100 Subject: [PATCH 1/5] feat(nested collections): allow non-index files (#7359) * feat(nested collections): allow non-index files This commit fixes #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 <105373963+eric-gade@users.noreply.github.com> * 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 Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com> Co-authored-by: Anze Demsar --- .../editorial_workflow_spec_test_backend.js | 44 ++++++------ .../Collection/Entries/EntriesCollection.js | 15 ++-- .../__tests__/EntriesCollection.spec.js | 8 +-- .../EntriesCollection.spec.js.snap | 16 ++--- .../components/Collection/NestedCollection.js | 4 +- .../NestedCollection.spec.js.snap | 68 +++++++++++++++++++ 6 files changed, 108 insertions(+), 47 deletions(-) diff --git a/cypress/e2e/editorial_workflow_spec_test_backend.js b/cypress/e2e/editorial_workflow_spec_test_backend.js index 7d5fae36a968..7cd15ea7cffd 100644 --- a/cypress/e2e/editorial_workflow_spec_test_backend.js +++ b/cypress/e2e/editorial_workflow_spec_test_backend.js @@ -207,17 +207,16 @@ describe('Test Backend Editorial Workflow', () => { login(); inSidebar(() => cy.contains('a', 'Pages').click()); - inSidebar(() => cy.contains('a', 'Directory')); + inSidebar(() => cy.contains('a', /^Directory$/)); inGrid(() => cy.contains('a', 'Root Page')); - inGrid(() => cy.contains('a', 'Directory')); - inSidebar(() => cy.contains('a', 'Directory').click()); + inSidebar(() => cy.contains('a', /^Directory$/).click()); - inGrid(() => cy.contains('a', 'Sub Directory')); - inGrid(() => cy.contains('a', 'Another Sub Directory')); + inSidebar(() => cy.contains('a', /^Sub Directory$/)); + inSidebar(() => cy.contains('a', 'Another Sub Directory')); - inSidebar(() => cy.contains('a', 'Sub Directory').click()); - inGrid(() => cy.contains('a', 'Nested Directory')); + inSidebar(() => cy.contains('a', /^Sub Directory$/).click()); + inSidebar(() => cy.contains('a', 'Nested Directory')); cy.url().should( 'eq', 'http://localhost:8080/#/collections/pages/filter/directory/sub-directory', @@ -233,21 +232,17 @@ describe('Test Backend Editorial Workflow', () => { login(); inSidebar(() => cy.contains('a', 'Pages').click()); - inSidebar(() => cy.contains('a', 'Directory').click()); - inGrid(() => cy.contains('a', 'Another Sub Directory').click()); - - cy.url().should( - 'eq', - 'http://localhost:8080/#/collections/pages/entries/directory/another-sub-directory/index', - ); + inSidebar(() => cy.contains('a', /^Directory$/).click()); + inSidebar(() => cy.contains('a', 'Another Sub Directory').click()); + inGrid(() => cy.contains('a', 'Another Sub Directory')); }); it(`can create a new entry with custom path`, () => { login(); inSidebar(() => cy.contains('a', 'Pages').click()); - inSidebar(() => cy.contains('a', 'Directory').click()); - inSidebar(() => cy.contains('a', 'Sub Directory').click()); + inSidebar(() => cy.contains('a', /^Directory$/).click()); + inSidebar(() => cy.contains('a', /^Sub Directory$/).click()); cy.contains('a', 'New Page').click(); cy.get('[id^="path-field"]').should('have.value', 'directory/sub-directory'); @@ -262,9 +257,9 @@ describe('Test Backend Editorial Workflow', () => { publishEntryInEditor(publishTypes.publishNow); exitEditor(); - inGrid(() => cy.contains('a', 'New Path Title')); - inSidebar(() => cy.contains('a', 'Directory').click()); - inSidebar(() => cy.contains('a', 'Directory').click()); + inSidebar(() => cy.contains('a', 'New Path Title')); + inSidebar(() => cy.contains('a', /^Directory$/).click()); + inSidebar(() => cy.contains('a', /^Directory$/).click()); inGrid(() => cy.contains('a', 'New Path Title').should('not.exist')); }); @@ -272,8 +267,8 @@ describe('Test Backend Editorial Workflow', () => { login(); inSidebar(() => cy.contains('a', 'Pages').click()); - inSidebar(() => cy.contains('a', 'Directory').click()); - inSidebar(() => cy.contains('a', 'Sub Directory').click()); + inSidebar(() => cy.contains('a', /^Directory$/).click()); + inSidebar(() => cy.contains('a', /^Sub Directory$/).click()); cy.contains('a', 'New Page').click(); cy.get('[id^="title-field"]').type('New Path Title'); @@ -292,7 +287,8 @@ describe('Test Backend Editorial Workflow', () => { login(); inSidebar(() => cy.contains('a', 'Pages').click()); - inGrid(() => cy.contains('a', 'Directory').click()); + inSidebar(() => cy.contains('a', /^Directory$/).click()); + inGrid(() => cy.contains('a', /^Directory$/).click()); cy.get('[id^="path-field"]').should('have.value', 'directory'); cy.get('[id^="path-field"]').clear(); @@ -310,7 +306,7 @@ describe('Test Backend Editorial Workflow', () => { inSidebar(() => cy.contains('a', 'New Directory').click()); - inGrid(() => cy.contains('a', 'Sub Directory')); - inGrid(() => cy.contains('a', 'Another Sub Directory')); + inSidebar(() => cy.contains('a', /^Sub Directory$/)); + inSidebar(() => cy.contains('a', 'Another Sub Directory')); }); }); diff --git a/packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js b/packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js index 830f7911de8c..55aa3c2bf61d 100644 --- a/packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js +++ b/packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js @@ -119,20 +119,19 @@ export class EntriesCollection extends React.Component { export function filterNestedEntries(path, collectionFolder, entries) { const filtered = entries.filter(e => { - const entryPath = e.get('path').slice(collectionFolder.length + 1); + let entryPath = e.get('path').slice(collectionFolder.length + 1); if (!entryPath.startsWith(path)) { return false; } - // only show immediate children + // for subdirectories, trim off the parent folder corresponding to + // this nested collection entry if (path) { - // non root path - const trimmed = entryPath.slice(path.length + 1); - return trimmed.split('/').length === 2; - } else { - // root path - return entryPath.split('/').length <= 2; + entryPath = entryPath.slice(path.length + 1); } + + // only show immediate children + return !entryPath.includes('/'); }); return filtered; } diff --git a/packages/decap-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js b/packages/decap-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js index 5afbd19b19e2..174bc779370b 100644 --- a/packages/decap-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js +++ b/packages/decap-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js @@ -45,11 +45,11 @@ describe('filterNestedEntries', () => { ]; const entries = fromJS(entriesArray); expect(filterNestedEntries('dir3', 'src/pages', entries).toJS()).toEqual([ - { slug: 'dir3/dir4/index', path: 'src/pages/dir3/dir4/index.md', data: { title: 'File 4' } }, + { slug: 'dir3/index', path: 'src/pages/dir3/index.md', data: { title: 'File 3' } }, ]); }); - it('should return immediate children and root for root path', () => { + it('should return only immediate children for root path', () => { const entriesArray = [ { slug: 'index', path: 'src/pages/index.md', data: { title: 'Root' } }, { slug: 'dir1/index', path: 'src/pages/dir1/index.md', data: { title: 'File 1' } }, @@ -60,8 +60,6 @@ describe('filterNestedEntries', () => { const entries = fromJS(entriesArray); expect(filterNestedEntries('', 'src/pages', entries).toJS()).toEqual([ { slug: 'index', path: 'src/pages/index.md', data: { title: 'Root' } }, - { slug: 'dir1/index', path: 'src/pages/dir1/index.md', data: { title: 'File 1' } }, - { slug: 'dir3/index', path: 'src/pages/dir3/index.md', data: { title: 'File 3' } }, ]); }); }); @@ -126,7 +124,7 @@ describe('EntriesCollection', () => { expect(asFragment()).toMatchSnapshot(); }); - it('should render apply filter term for nested collections', () => { + it('should render with applied filter term for nested collections', () => { const entriesArray = [ { slug: 'index', path: 'src/pages/index.md', data: { title: 'Root' } }, { slug: 'dir1/index', path: 'src/pages/dir1/index.md', data: { title: 'File 1' } }, diff --git a/packages/decap-cms-core/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap b/packages/decap-cms-core/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap index ccc4d5911e89..c833607a1fff 100644 --- a/packages/decap-cms-core/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap +++ b/packages/decap-cms-core/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap @@ -1,36 +1,36 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EntriesCollection should render apply filter term for nested collections 1`] = ` +exports[`EntriesCollection should render connected component 1`] = ` `; -exports[`EntriesCollection should render connected component 1`] = ` +exports[`EntriesCollection should render show only immediate children for nested collection 1`] = ` `; -exports[`EntriesCollection should render show only immediate children for nested collection 1`] = ` +exports[`EntriesCollection should render with applied filter term for nested collections 1`] = ` diff --git a/packages/decap-cms-core/src/components/Collection/NestedCollection.js b/packages/decap-cms-core/src/components/Collection/NestedCollection.js index 0cc9a068c870..d2ff36c5052e 100644 --- a/packages/decap-cms-core/src/components/Collection/NestedCollection.js +++ b/packages/decap-cms-core/src/components/Collection/NestedCollection.js @@ -80,7 +80,7 @@ function TreeNode(props) { const sortedData = sortBy(treeData, getNodeTitle); return sortedData.map(node => { - const leaf = node.children.length <= 1 && !node.children[0]?.isDir && depth > 0; + const leaf = node.children.length === 0 && depth > 0; if (leaf) { return null; } @@ -90,7 +90,7 @@ function TreeNode(props) { } const title = getNodeTitle(node); - const hasChildren = depth === 0 || node.children.some(c => c.children.some(c => c.isDir)); + const hasChildren = depth === 0 || node.children.some(c => c.isDir); return ( diff --git a/packages/decap-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap b/packages/decap-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap index dd3f5fcd55ac..b643246f4411 100644 --- a/packages/decap-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap +++ b/packages/decap-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap @@ -138,6 +138,20 @@ exports[`NestedCollection should render connected component 1`] = ` margin-right: 4px; } +.emotion-6 { + position: relative; + top: 2px; + color: #fff; + width: 0; + height: 0; + border: 5px solid transparent; + border-radius: 2px; + border-left: 6px solid currentColor; + border-right: 0; + color: currentColor; + left: 2px; +} + File 1 +
.emotion-0 { @@ -207,6 +224,20 @@ exports[`NestedCollection should render connected component 1`] = ` margin-right: 4px; } +.emotion-6 { + position: relative; + top: 2px; + color: #fff; + width: 0; + height: 0; + border: 5px solid transparent; + border-radius: 2px; + border-left: 6px solid currentColor; + border-right: 0; + color: currentColor; + left: 2px; +} + File 2 +
@@ -367,6 +401,20 @@ exports[`NestedCollection should render correctly with nested entries 1`] = ` margin-right: 4px; } +.emotion-6 { + position: relative; + top: 2px; + color: #fff; + width: 0; + height: 0; + border: 5px solid transparent; + border-radius: 2px; + border-left: 6px solid currentColor; + border-right: 0; + color: currentColor; + left: 2px; +} + File 1 +
.emotion-0 { @@ -436,6 +487,20 @@ exports[`NestedCollection should render correctly with nested entries 1`] = ` margin-right: 4px; } +.emotion-6 { + position: relative; + top: 2px; + color: #fff; + width: 0; + height: 0; + border: 5px solid transparent; + border-radius: 2px; + border-left: 6px solid currentColor; + border-right: 0; + color: currentColor; + left: 2px; +} + File 2 +
From 8b8e873af9a0749720ec03cadbc4b0d391ad84e1 Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Fri, 17 Jan 2025 12:43:02 +0000 Subject: [PATCH 2/5] fix(markdown): convert inline CSS from Google Docs to Markdown (#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 --- .../MarkdownControl/plugins/html/withHtml.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/decap-cms-widget-markdown/src/MarkdownControl/plugins/html/withHtml.js b/packages/decap-cms-widget-markdown/src/MarkdownControl/plugins/html/withHtml.js index a7f96cbec3e6..9dc9a5d73af7 100644 --- a/packages/decap-cms-widget-markdown/src/MarkdownControl/plugins/html/withHtml.js +++ b/packages/decap-cms-widget-markdown/src/MarkdownControl/plugins/html/withHtml.js @@ -30,6 +30,11 @@ const TEXT_TAGS = { U: () => ({ underline: true }), }; +const INLINE_STYLES = { + 'font-style': value => (value === 'italic' ? { italic: true } : {}), + 'font-weight': value => (value === 'bold' || parseInt(value, 10) >= 600 ? { bold: true } : {}), +}; + function deserialize(el) { if (el.nodeType === 3) { return el.textContent; @@ -65,6 +70,20 @@ function deserialize(el) { return children.map(child => jsx('text', attrs, child)); } + // Convert inline CSS on span elements generated by Google Docs + if (nodeName === 'SPAN') { + const attrs = {}; + for (let i = 0; i < el.style.length; i++) { + const propertyName = el.style[i]; + if (INLINE_STYLES[propertyName]) { + const propertyValue = el.style.getPropertyValue(propertyName); + const propertyStyle = INLINE_STYLES[propertyName](propertyValue); + Object.assign(attrs, propertyStyle); + } + } + return children.map(child => jsx('text', attrs, child)); + } + return children; } From 989c2dd6ed80f69b572b8b73c4e37b5106ae04fb Mon Sep 17 00:00:00 2001 From: Felix Gnass Date: Wed, 29 Jan 2025 12:21:58 +0100 Subject: [PATCH 3/5] feat: visual editing (click-to-edit) (#7374) * refactor: clean up controlRef handling * feat: add click-to-edit * test: update snapshots --------- Co-authored-by: Anze Demsar --- dev-test/config.yml | 6 +- package-lock.json | 6 + packages/decap-cms-core/package.json | 1 + .../Editor/EditorControlPane/EditorControl.js | 3 - .../EditorControlPane/EditorControlPane.js | 29 ++-- .../Editor/EditorControlPane/Widget.js | 23 ++- .../src/components/Editor/EditorInterface.js | 7 +- .../EditorPreviewPane/EditorPreviewContent.js | 62 ++++++-- .../EditorPreviewPane/EditorPreviewPane.js | 15 +- packages/decap-cms-lib-util/src/stega.ts | 134 ++++++++++++++++++ packages/decap-cms-lib-util/src/types.ts | 9 ++ .../decap-cms-widget-list/src/ListControl.js | 107 ++++++++++---- .../__snapshots__/ListControl.spec.js.snap | 11 +- .../src/MarkdownControl/RawEditor.js | 3 +- .../src/MarkdownControl/VisualEditor.js | 3 +- .../src/MarkdownControl/index.js | 4 + .../src/ObjectControl.js | 37 ++++- 17 files changed, 397 insertions(+), 63 deletions(-) create mode 100644 packages/decap-cms-lib-util/src/stega.ts create mode 100644 packages/decap-cms-lib-util/src/types.ts diff --git a/dev-test/config.yml b/dev-test/config.yml index d9bf6182a7cc..592ffbed8b2f 100644 --- a/dev-test/config.yml +++ b/dev-test/config.yml @@ -17,6 +17,8 @@ collections: # A list of collections the CMS should be able to edit slug: '{{year}}-{{month}}-{{day}}-{{slug}}' summary: '{{title}} -- {{year}}/{{month}}/{{day}}' create: true # Allow users to create new documents in this collection + editor: + visualEditing: true view_filters: - label: Posts With Index field: title @@ -60,7 +62,9 @@ collections: # A list of collections the CMS should be able to edit folder: '_restaurants' slug: '{{year}}-{{month}}-{{day}}-{{slug}}' summary: '{{title}} -- {{year}}/{{month}}/{{day}}' - create: true # Allow users to create new documents in this collection + create: true # Allow users to create new documents in this collection + editor: + visualEditing: true fields: # The fields each document in this collection have - { label: 'Title', name: 'title', widget: 'string', tagname: 'h1' } - { label: 'Body', name: 'body', widget: 'markdown', hint: 'Main content goes here.' } diff --git a/package-lock.json b/package-lock.json index 9e1197d65412..5c1729a629cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7718,6 +7718,11 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@vercel/stega": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@vercel/stega/-/stega-0.1.2.tgz", + "integrity": "sha512-P7mafQXjkrsoyTRppnt0N21udKS9wUmLXHRyP9saLXLHw32j/FgUJ3FscSWgvSqRs4cj7wKZtwqJEvWJ2jbGmA==" + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "dev": true, @@ -33419,6 +33424,7 @@ "dependencies": { "@iarna/toml": "2.2.5", "@reduxjs/toolkit": "^1.9.1", + "@vercel/stega": "^0.1.2", "ajv": "8.12.0", "ajv-errors": "^3.0.0", "ajv-keywords": "^5.0.0", diff --git a/packages/decap-cms-core/package.json b/packages/decap-cms-core/package.json index 59654f5a0fe4..87f3566d17cf 100644 --- a/packages/decap-cms-core/package.json +++ b/packages/decap-cms-core/package.json @@ -26,6 +26,7 @@ "dependencies": { "@iarna/toml": "2.2.5", "@reduxjs/toolkit": "^1.9.1", + "@vercel/stega": "^0.1.2", "ajv": "8.12.0", "ajv-errors": "^3.0.0", "ajv-keywords": "^5.0.0", diff --git a/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControl.js b/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControl.js index 58dcd65e4241..a5467c121565 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControl.js +++ b/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControl.js @@ -139,7 +139,6 @@ class EditorControl extends React.Component { removeInsertedMedia: PropTypes.func.isRequired, persistMedia: PropTypes.func.isRequired, onValidate: PropTypes.func, - processControlRef: PropTypes.func, controlRef: PropTypes.func, query: PropTypes.func.isRequired, queryHits: PropTypes.object, @@ -201,7 +200,6 @@ class EditorControl extends React.Component { removeInsertedMedia, persistMedia, onValidate, - processControlRef, controlRef, query, queryHits, @@ -329,7 +327,6 @@ class EditorControl extends React.Component { resolveWidget={resolveWidget} widget={widget} getEditorComponents={getEditorComponents} - ref={processControlRef && partial(processControlRef, field)} controlRef={controlRef} editorControl={ConnectedEditorControl} query={query} diff --git a/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js b/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js index 18b2dfbf83d6..dae2d3d3a241 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js +++ b/packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js @@ -99,15 +99,17 @@ export default class ControlPane extends React.Component { selectedLocale: this.props.locale, }; - componentValidate = {}; + childRefs = {}; - controlRef(field, wrappedControl) { + controlRef = (field, wrappedControl) => { if (!wrappedControl) return; const name = field.get('name'); + this.childRefs[name] = wrappedControl; + }; - this.componentValidate[name] = - wrappedControl.innerWrappedControl?.validate || wrappedControl.validate; - } + getControlRef = field => wrappedControl => { + this.controlRef(field, wrappedControl); + }; handleLocaleChange = val => { this.setState({ selectedLocale: val }); @@ -152,7 +154,11 @@ export default class ControlPane extends React.Component { validate = async () => { this.props.fields.forEach(field => { if (field.get('widget') === 'hidden') return; - this.componentValidate[field.get('name')](); + const control = this.childRefs[field.get('name')]; + const validateFn = control?.innerWrappedControl?.validate ?? control?.validate; + if (validateFn) { + validateFn(); + } }); }; @@ -165,6 +171,14 @@ export default class ControlPane extends React.Component { } }; + focus(path) { + const [fieldName, ...remainingPath] = path.split('.'); + const control = this.childRefs[fieldName]; + if (control?.focus) { + control.focus(remainingPath.join('.')); + } + } + render() { const { collection, entry, fields, fieldsMetaData, fieldsErrors, onChange, onValidate, t } = this.props; @@ -227,8 +241,7 @@ export default class ControlPane extends React.Component { onChange(field, newValue, newMetadata, i18n); }} onValidate={onValidate} - processControlRef={this.controlRef.bind(this)} - controlRef={this.controlRef} + controlRef={this.getControlRef(field)} entry={entry} collection={collection} isDisabled={isDuplicate} diff --git a/packages/decap-cms-core/src/components/Editor/EditorControlPane/Widget.js b/packages/decap-cms-core/src/components/Editor/EditorControlPane/Widget.js index 666053a42ab7..96c530d06232 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorControlPane/Widget.js +++ b/packages/decap-cms-core/src/components/Editor/EditorControlPane/Widget.js @@ -44,6 +44,7 @@ export default class Widget extends Component { fieldsErrors: ImmutablePropTypes.map, onChange: PropTypes.func.isRequired, onValidate: PropTypes.func, + controlRef: PropTypes.func, onOpenMediaLibrary: PropTypes.func.isRequired, onClearMediaControl: PropTypes.func.isRequired, onRemoveMediaControl: PropTypes.func.isRequired, @@ -55,7 +56,6 @@ export default class Widget extends Component { widget: PropTypes.object.isRequired, getEditorComponents: PropTypes.func.isRequired, isFetching: PropTypes.bool, - controlRef: PropTypes.func, query: PropTypes.func.isRequired, clearSearch: PropTypes.func.isRequired, clearFieldErrors: PropTypes.func.isRequired, @@ -112,8 +112,29 @@ export default class Widget extends Component { */ const { shouldComponentUpdate: scu } = this.innerWrappedControl; this.wrappedControlShouldComponentUpdate = scu && scu.bind(this.innerWrappedControl); + + // Call the control ref if provided, passing this Widget instance + if (this.props.controlRef) { + this.props.controlRef(this); + } }; + focus(path) { + // Try widget's custom focus method first + if (this.innerWrappedControl?.focus) { + this.innerWrappedControl.focus(path); + } else { + // Fall back to focusing by ID for simple widgets + const element = document.getElementById(this.props.uniqueFieldId); + element?.focus(); + } + // After focusing, ensure the element is visible + const label = document.querySelector(`label[for="${this.props.uniqueFieldId}"]`); + if (label) { + label.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + } + } + getValidateValue = () => { let value = this.innerWrappedControl?.getValidateValue?.() || this.props.value; // Convert list input widget value to string for validation test diff --git a/packages/decap-cms-core/src/components/Editor/EditorInterface.js b/packages/decap-cms-core/src/components/Editor/EditorInterface.js index 7fb49ae0efac..cad473866aa2 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorInterface.js +++ b/packages/decap-cms-core/src/components/Editor/EditorInterface.js @@ -162,6 +162,10 @@ class EditorInterface extends Component { i18nVisible: localStorage.getItem(I18N_VISIBLE) !== 'false', }; + handleFieldClick = path => { + this.controlPaneRef?.focus(path); + }; + handleSplitPaneDragStart = () => { this.setState({ showEventBlocker: true }); }; @@ -298,6 +302,7 @@ class EditorInterface extends Component { fields={fields} fieldsMetaData={fieldsMetaData} locale={leftPanelLocale} + onFieldClick={this.handleFieldClick} /> @@ -381,7 +386,7 @@ class EditorInterface extends Component { title={t('editor.editorInterface.togglePreview')} /> )} - {scrollSyncVisible && ( + {scrollSyncVisible && !collection.getIn(['editor', 'visualEditing']) && ( { + const { previewProps, onFieldClick } = this.props; + const visualEditing = previewProps?.collection?.getIn(['editor', 'visualEditing'], false); + + if (!visualEditing) { + return; + } + + try { + const text = e.target.textContent; + const decoded = vercelStegaDecode(text); + if (decoded?.decap) { + if (onFieldClick) { + onFieldClick(decoded.decap); + } + } + } catch (err) { + console.log('Visual editing error:', err); + } + }; + + renderPreview() { const { previewComponent, previewProps } = this.props; + return ( +
+ {isElement(previewComponent) + ? React.cloneElement(previewComponent, previewProps) + : React.createElement(previewComponent, previewProps)} +
+ ); + } + + render() { + const { previewProps } = this.props; + const visualEditing = previewProps?.collection?.getIn(['editor', 'visualEditing'], false); + const showScrollSync = !visualEditing; + return ( - {context => ( - - {isElement(previewComponent) - ? React.cloneElement(previewComponent, previewProps) - : React.createElement(previewComponent, previewProps)} - - )} + {context => { + const preview = this.renderPreview(); + if (showScrollSync) { + return ( + + {preview} + + ); + } + return preview; + }} ); } @@ -29,6 +68,7 @@ class PreviewContent extends React.Component { PreviewContent.propTypes = { previewComponent: PropTypes.func.isRequired, previewProps: PropTypes.object, + onFieldClick: PropTypes.func, }; export default PreviewContent; diff --git a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js index b9feb9887238..c35fc642fe39 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -6,6 +6,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import Frame, { FrameContextConsumer } from 'react-frame-component'; import { lengths } from 'decap-cms-ui-default'; import { connect } from 'react-redux'; +import { encodeEntry } from 'decap-cms-lib-util/src/stega'; import { resolveWidget, @@ -92,6 +93,7 @@ export class PreviewPane extends React.Component { if (field.get('meta')) { value = this.props.entry.getIn(['meta', field.get('name')]); } + const nestedFields = field.get('fields'); const singleField = field.get('field'); const metadata = fieldsMetaData && fieldsMetaData.get(field.get('name'), Map()); @@ -226,9 +228,18 @@ export class PreviewPane extends React.Component { this.inferFields(); + const visualEditing = collection.getIn(['editor', 'visualEditing'], false); + + // Only encode entry data if visual editing is enabled + const previewEntry = visualEditing + ? entry.set('data', encodeEntry(entry.get('data'), this.props.fields)) + : entry; + const previewProps = { ...this.props, - widgetFor: this.widgetFor, + entry: previewEntry, + widgetFor: (name, fields, values = previewEntry.get('data'), fieldsMetaData) => + this.widgetFor(name, fields, values, fieldsMetaData), widgetsFor: this.widgetsFor, getCollection: this.getCollection, }; @@ -260,6 +271,7 @@ export class PreviewPane extends React.Component { return ( ); }} @@ -276,6 +288,7 @@ PreviewPane.propTypes = { entry: ImmutablePropTypes.map.isRequired, fieldsMetaData: ImmutablePropTypes.map.isRequired, getAsset: PropTypes.func.isRequired, + onFieldClick: PropTypes.func, }; function mapStateToProps(state) { diff --git a/packages/decap-cms-lib-util/src/stega.ts b/packages/decap-cms-lib-util/src/stega.ts new file mode 100644 index 000000000000..099b86e6db03 --- /dev/null +++ b/packages/decap-cms-lib-util/src/stega.ts @@ -0,0 +1,134 @@ +import { vercelStegaEncode } from '@vercel/stega'; + +import { isImmutableMap, isImmutableList } from './types'; + +import type { Map as ImmutableMap, List } from 'immutable'; +import type { CmsField } from 'decap-cms-core'; + +/** + * Context passed to encode functions, containing the current state of the encoding process + */ +interface EncodeContext { + fields: CmsField[]; // Available CMS fields at current level + path: string; // Path to current value in object tree + visit: (value: unknown, fields: CmsField[], path: string) => unknown; // Visitor for recursive traversal +} + +/** + * Get the fields that should be used for encoding nested values + */ +function getNestedFields(f?: CmsField): CmsField[] { + if (f) { + if ('types' in f) { + return f.types ?? []; + } + if ('fields' in f) { + return f.fields ?? []; + } + if ('field' in f) { + return f.field ? [f.field] : []; + } + return [f]; + } + return []; +} + +/** + * Encode a string value by appending steganographic data + * For markdown fields, encode each paragraph separately + */ +function encodeString(value: string, { fields, path }: EncodeContext): string { + const stega = vercelStegaEncode({ decap: path }); + const isMarkdown = fields[0]?.widget === 'markdown'; + + if (isMarkdown && value.includes('\n\n')) { + const blocks = value.split(/(\n\n+)/); + return blocks.map(block => (block.trim() ? block + stega : block)).join(''); + } + return value + stega; +} + +/** + * Encode a list of values, handling both simple values and nested objects/lists + * For typed lists, use the type field to determine which fields to use + */ +function encodeList(list: List, ctx: EncodeContext): List { + let newList = list; + for (let i = 0; i < newList.size; i++) { + const item = newList.get(i); + if (isImmutableMap(item)) { + const itemType = item.get('type'); + if (typeof itemType === 'string') { + // For typed items, look up fields based on type + const field = ctx.fields.find(f => f.name === itemType); + const newItem = ctx.visit(item, getNestedFields(field), `${ctx.path}.${i}`); + newList = newList.set(i, newItem); + } else { + // For untyped items, use current fields + const newItem = ctx.visit(item, ctx.fields, `${ctx.path}.${i}`); + newList = newList.set(i, newItem); + } + } else { + // For simple values, use first field if available + const field = ctx.fields[0]; + const newItem = ctx.visit(item, field ? [field] : [], `${ctx.path}.${i}`); + if (newItem !== item) { + newList = newList.set(i, newItem); + } + } + } + return newList; +} + +/** + * Encode a map of values, looking up the appropriate field for each key + * and recursively encoding nested values + */ +function encodeMap( + map: ImmutableMap, + ctx: EncodeContext, +): ImmutableMap { + let newMap = map; + for (const [key, val] of newMap.entrySeq().toArray()) { + const field = ctx.fields.find(f => f.name === key); + if (field) { + const fields = getNestedFields(field); + const newVal = ctx.visit(val, fields, ctx.path ? `${ctx.path}.${key}` : key); + if (newVal !== val) { + newMap = newMap.set(key, newVal); + } + } + } + return newMap; +} + +/** + * Main entry point for encoding steganographic data into entry values + * Uses a visitor pattern with caching to handle recursive structures + */ +export function encodeEntry(value: unknown, fields: List>) { + const plainFields = fields.toJS() as CmsField[]; + const cache = new Map(); + + function visit(value: unknown, fields: CmsField[], path = '') { + const cached = cache.get(path); + if (cached === value) return value; + + const ctx: EncodeContext = { fields, path, visit }; + let result; + if (isImmutableList(value)) { + result = encodeList(value, ctx); + } else if (isImmutableMap(value)) { + result = encodeMap(value, ctx); + } else if (typeof value === 'string') { + result = encodeString(value, ctx); + } else { + result = value; + } + + cache.set(path, result); + return result; + } + + return visit(value, plainFields); +} diff --git a/packages/decap-cms-lib-util/src/types.ts b/packages/decap-cms-lib-util/src/types.ts new file mode 100644 index 000000000000..5caf8822565c --- /dev/null +++ b/packages/decap-cms-lib-util/src/types.ts @@ -0,0 +1,9 @@ +import { Map as ImmutableMap, List } from 'immutable'; + +export function isImmutableMap(value: unknown): value is ImmutableMap { + return ImmutableMap.isMap(value); +} + +export function isImmutableList(value: unknown): value is List { + return List.isList(value); +} diff --git a/packages/decap-cms-widget-list/src/ListControl.js b/packages/decap-cms-widget-list/src/ListControl.js index 3db08db07e73..277e5a0d5718 100644 --- a/packages/decap-cms-widget-list/src/ListControl.js +++ b/packages/decap-cms-widget-list/src/ListControl.js @@ -171,7 +171,7 @@ function LabelComponent({ field, isActive, hasErrors, uniqueFieldId, isFieldOpti } export default class ListControl extends React.Component { - validations = []; + childRefs = {}; static propTypes = { metadata: ImmutablePropTypes.map, @@ -365,16 +365,18 @@ export default class ListControl extends React.Component { processControlRef = ref => { if (!ref) return; const { - validate, props: { validationKey: key }, } = ref; - this.validations.push({ key, validate }); + this.childRefs[key] = ref; + this.props.controlRef?.(this); }; validate = () => { - if (this.getValueType()) { - this.validations.forEach(item => { - item.validate(); + // First validate child widgets if this is a complex list + const hasChildWidgets = this.getValueType() && Object.keys(this.childRefs).length > 0; + if (hasChildWidgets) { + Object.values(this.childRefs).forEach(widget => { + widget?.validate?.(); }); } else { this.props.validate(); @@ -431,7 +433,17 @@ export default class ListControl extends React.Component { handleRemove = (index, event) => { event.preventDefault(); const { itemsCollapsed } = this.state; - const { value, metadata, onChange, field, clearFieldErrors } = this.props; + const { + value, + metadata, + onChange, + field, + clearFieldErrors, + onValidateObject, + forID, + fieldsErrors, + } = this.props; + const collectionName = field.get('name'); const isSingleField = this.getValueType() === valueTypes.SINGLE; @@ -441,17 +453,41 @@ export default class ListControl extends React.Component { ? { [collectionName]: metadata.removeIn(metadataRemovePath) } : metadata; + // Get the key of the item being removed + const removedKey = this.state.keys[index]; + + // Update state while preserving keys for remaining items + const newKeys = [...this.state.keys]; + newKeys.splice(index, 1); itemsCollapsed.splice(index, 1); - // clear validations - this.validations = []; this.setState({ itemsCollapsed: [...itemsCollapsed], - keys: Array.from({ length: value.size - 1 }, () => uuid()), + keys: newKeys, }); - onChange(value.remove(index), parsedMetadata); - clearFieldErrors(); + // Clear the ref for the removed item + delete this.childRefs[removedKey]; + + const newValue = value.delete(index); + + // Clear errors for the removed item and its children + if (fieldsErrors) { + Object.entries(fieldsErrors.toJS()).forEach(([fieldId, errors]) => { + if (errors.some(err => err.parentIds?.includes(removedKey))) { + clearFieldErrors(fieldId); + } + }); + } + + // If list is empty, mark it as valid + if (newValue.size === 0) { + clearFieldErrors(forID); + onValidateObject(forID, []); + } + + // Update the value last to ensure all error states are cleared + onChange(newValue, parsedMetadata); }; handleItemCollapseToggle = (index, event) => { @@ -527,7 +563,7 @@ export default class ListControl extends React.Component { } onSortEnd = ({ oldIndex, newIndex }) => { - const { value, clearFieldErrors } = this.props; + const { value } = this.props; const { itemsCollapsed, keys } = this.state; // Update value @@ -541,18 +577,13 @@ export default class ListControl extends React.Component { const updatedItemsCollapsed = [...itemsCollapsed]; updatedItemsCollapsed.splice(newIndex, 0, collapsed); - // Reset item to ensure updated state - const updatedKeys = keys.map((key, keyIndex) => { - if (keyIndex === oldIndex || keyIndex === newIndex) { - return uuid(); - } - return key; - }); - this.setState({ itemsCollapsed: updatedItemsCollapsed, keys: updatedKeys }); + // Move keys to maintain relationships + const movedKey = keys[oldIndex]; + const updatedKeys = [...keys]; + updatedKeys.splice(oldIndex, 1); + updatedKeys.splice(newIndex, 0, movedKey); - //clear error fields and remove old validations - clearFieldErrors(); - this.validations = this.validations.filter(item => updatedKeys.includes(item.key)); + this.setState({ itemsCollapsed: updatedItemsCollapsed, keys: updatedKeys }); }; hasError = index => { @@ -564,6 +595,34 @@ export default class ListControl extends React.Component { } }; + focus(path) { + const [index, ...remainingPath] = path.split('.'); + + if (this.state.listCollapsed || this.state.itemsCollapsed[index]) { + const newItemsCollapsed = [...this.state.itemsCollapsed]; + newItemsCollapsed[index] = false; + this.setState( + { + listCollapsed: false, + itemsCollapsed: newItemsCollapsed, + }, + () => { + const key = this.state.keys[index]; + const control = this.childRefs[key]; + if (control?.focus) { + control.focus(remainingPath.join('.')); + } + }, + ); + } else { + const key = this.state.keys[index]; + const control = this.childRefs[key]; + if (control?.focus) { + control.focus(remainingPath.join('.')); + } + } + } + // eslint-disable-next-line react/display-name renderItem = (item, index) => { const { diff --git a/packages/decap-cms-widget-list/src/__tests__/__snapshots__/ListControl.spec.js.snap b/packages/decap-cms-widget-list/src/__tests__/__snapshots__/ListControl.spec.js.snap index d165efdd4770..b5b38ac07c81 100644 --- a/packages/decap-cms-widget-list/src/__tests__/__snapshots__/ListControl.spec.js.snap +++ b/packages/decap-cms-widget-list/src/__tests__/__snapshots__/ListControl.spec.js.snap @@ -724,13 +724,12 @@ exports[`ListControl should remove from list when remove button is clicked 2`] =
diff --git a/packages/decap-cms-widget-markdown/src/MarkdownControl/RawEditor.js b/packages/decap-cms-widget-markdown/src/MarkdownControl/RawEditor.js index d9478ddb0a66..6a99b9c8481d 100644 --- a/packages/decap-cms-widget-markdown/src/MarkdownControl/RawEditor.js +++ b/packages/decap-cms-widget-markdown/src/MarkdownControl/RawEditor.js @@ -43,8 +43,9 @@ function RawEditor(props) { useEffect(() => { if (props.pendingFocus) { ReactEditor.focus(editor); + props.pendingFocus(); } - }, []); + }, [props.pendingFocus]); function handleToggleMode() { props.onMode('rich_text'); diff --git a/packages/decap-cms-widget-markdown/src/MarkdownControl/VisualEditor.js b/packages/decap-cms-widget-markdown/src/MarkdownControl/VisualEditor.js index d73fbaa7ff60..860939fbb979 100644 --- a/packages/decap-cms-widget-markdown/src/MarkdownControl/VisualEditor.js +++ b/packages/decap-cms-widget-markdown/src/MarkdownControl/VisualEditor.js @@ -135,8 +135,9 @@ function Editor(props) { useEffect(() => { if (props.pendingFocus) { ReactEditor.focus(editor); + props.pendingFocus(); } - }, []); + }, [props.pendingFocus]); function handleMarkClick(format) { ReactEditor.focus(editor); diff --git a/packages/decap-cms-widget-markdown/src/MarkdownControl/index.js b/packages/decap-cms-widget-markdown/src/MarkdownControl/index.js index d89b199872f5..5831f88a3c2e 100644 --- a/packages/decap-cms-widget-markdown/src/MarkdownControl/index.js +++ b/packages/decap-cms-widget-markdown/src/MarkdownControl/index.js @@ -67,6 +67,10 @@ export default class MarkdownControl extends React.Component { getAllowedModes = () => this.props.field.get('modes', List(['rich_text', 'raw'])).toArray(); + focus() { + this.setState({ pendingFocus: true }); + } + render() { const { onChange, diff --git a/packages/decap-cms-widget-object/src/ObjectControl.js b/packages/decap-cms-widget-object/src/ObjectControl.js index 2f974aabdcc9..0d717f3e287c 100644 --- a/packages/decap-cms-widget-object/src/ObjectControl.js +++ b/packages/decap-cms-widget-object/src/ObjectControl.js @@ -22,7 +22,14 @@ const styleStrings = { }; export default class ObjectControl extends React.Component { - componentValidate = {}; + childRefs = {}; + + processControlRef = ref => { + if (!ref) return; + const name = ref.props.field.get('name'); + this.childRefs[name] = ref; + this.props.controlRef?.(ref); + }; static propTypes = { onChangeObject: PropTypes.func.isRequired, @@ -70,7 +77,9 @@ export default class ObjectControl extends React.Component { fields = List.isList(fields) ? fields : List([fields]); fields.forEach(field => { if (field.get('widget') === 'hidden') return; - this.componentValidate[field.get('name')](); + const name = field.get('name'); + const control = this.childRefs[name]; + control?.validate?.(); }); }; @@ -83,7 +92,6 @@ export default class ObjectControl extends React.Component { metadata, fieldsErrors, editorControl: EditorControl, - controlRef, parentIds, isFieldDuplicate, isFieldHidden, @@ -111,8 +119,7 @@ export default class ObjectControl extends React.Component { fieldsMetaData={metadata} fieldsErrors={fieldsErrors} onValidate={onValidateObject} - processControlRef={controlRef && controlRef.bind(this)} - controlRef={controlRef} + controlRef={this.processControlRef} parentIds={[...parentIds, forID]} isDisabled={isDuplicate} isHidden={isHidden} @@ -128,6 +135,26 @@ export default class ObjectControl extends React.Component { this.setState({ collapsed: !this.state.collapsed }); }; + focus(path) { + if (this.state.collapsed) { + this.setState({ collapsed: false }, () => { + if (path) { + const [fieldName, ...remainingPath] = path.split('.'); + const field = this.childRefs[fieldName]; + if (field?.focus) { + field.focus(remainingPath.join('.')); + } + } + }); + } else if (path) { + const [fieldName, ...remainingPath] = path.split('.'); + const field = this.childRefs[fieldName]; + if (field?.focus) { + field.focus(remainingPath.join('.')); + } + } + } + renderFields = (multiFields, singleField) => { if (multiFields) { return multiFields.map((f, idx) => this.controlFor(f, idx)); From 9be2693d1b35bf56c7ef05bdece6c24a21ba7567 Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Wed, 29 Jan 2025 12:53:20 +0000 Subject: [PATCH 4/5] fix(widgetsFor): return widgets for variable type lists (#7296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://github.com/decaporg/decap-cms/issues/2307#issuecomment-638326225 Co-authored-by: Anze Demsar --- .../EditorPreviewPane/EditorPreviewPane.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js index c35fc642fe39..39424176ac95 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -169,9 +169,28 @@ export class PreviewPane extends React.Component { const { fields, entry, fieldsMetaData } = this.props; const field = fields.find(f => f.get('name') === name); const nestedFields = field && field.get('fields'); + const variableTypes = field && field.get('types'); const value = entry.getIn(['data', field.get('name')]); const metadata = fieldsMetaData.get(field.get('name'), Map()); + // Variable Type lists + if (List.isList(value) && variableTypes) { + return value.map(val => { + const valueType = variableTypes.find(t => t.get('name') === val.get('type')); + const typeFields = valueType && valueType.get('fields'); + const widgets = + typeFields && + Map( + typeFields.map((f, i) => [ + f.get('name'), +
{this.getWidget(f, val, metadata.get(f.get('name')), this.props)}
, + ]), + ); + return Map({ data: val, widgets }); + }); + } + + // List widgets if (List.isList(value)) { return value.map(val => { const widgets = From e2165450e5963b2a8d76d4cf331319bf91f05d45 Mon Sep 17 00:00:00 2001 From: Anze Demsar Date: Wed, 29 Jan 2025 14:31:47 +0100 Subject: [PATCH 5/5] chore(release): publish - decap-cms@3.6.0 - decap-cms-app@3.6.0 - decap-cms-core@3.6.0 - decap-cms-lib-util@3.2.0 - decap-cms-widget-list@3.3.0 - decap-cms-widget-markdown@3.3.0 - decap-cms-widget-object@3.3.0 - decap-server@3.2.0 --- package-lock.json | 30 +++++++++---------- packages/decap-cms-app/CHANGELOG.md | 4 +++ packages/decap-cms-app/package.json | 12 ++++---- packages/decap-cms-core/CHANGELOG.md | 11 +++++++ packages/decap-cms-core/package.json | 2 +- packages/decap-cms-lib-util/CHANGELOG.md | 6 ++++ packages/decap-cms-lib-util/package.json | 2 +- packages/decap-cms-widget-list/CHANGELOG.md | 6 ++++ packages/decap-cms-widget-list/package.json | 2 +- .../decap-cms-widget-markdown/CHANGELOG.md | 10 +++++++ .../decap-cms-widget-markdown/package.json | 2 +- packages/decap-cms-widget-object/CHANGELOG.md | 6 ++++ packages/decap-cms-widget-object/package.json | 2 +- packages/decap-cms/CHANGELOG.md | 4 +++ packages/decap-cms/package.json | 4 +-- packages/decap-server/CHANGELOG.md | 4 +++ packages/decap-server/package.json | 4 +-- 17 files changed, 81 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c1729a629cd..f9b0522802f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33162,12 +33162,12 @@ } }, "packages/decap-cms": { - "version": "3.5.0", + "version": "3.6.0", "license": "MIT", "dependencies": { "codemirror": "^5.46.0", "create-react-class": "^15.7.0", - "decap-cms-app": "^3.5.0", + "decap-cms-app": "^3.6.0", "decap-cms-media-library-cloudinary": "^3.0.3", "decap-cms-media-library-uploadcare": "^3.0.2", "file-loader": "^6.2.0", @@ -33177,7 +33177,7 @@ } }, "packages/decap-cms-app": { - "version": "3.5.0", + "version": "3.6.0", "license": "MIT", "dependencies": { "@emotion/react": "^11.11.1", @@ -33193,10 +33193,10 @@ "decap-cms-backend-gitlab": "^3.2.2", "decap-cms-backend-proxy": "^3.1.4", "decap-cms-backend-test": "^3.1.3", - "decap-cms-core": "^3.5.0", + "decap-cms-core": "^3.6.0", "decap-cms-editor-component-image": "^3.1.3", "decap-cms-lib-auth": "^3.0.5", - "decap-cms-lib-util": "^3.1.0", + "decap-cms-lib-util": "^3.2.0", "decap-cms-lib-widgets": "^3.1.0", "decap-cms-locales": "^3.3.0", "decap-cms-ui-default": "^3.1.4", @@ -33206,11 +33206,11 @@ "decap-cms-widget-datetime": "^3.2.3", "decap-cms-widget-file": "^3.1.3", "decap-cms-widget-image": "^3.1.3", - "decap-cms-widget-list": "^3.2.2", + "decap-cms-widget-list": "^3.3.0", "decap-cms-widget-map": "^3.1.4", - "decap-cms-widget-markdown": "^3.2.0", + "decap-cms-widget-markdown": "^3.3.0", "decap-cms-widget-number": "^3.1.3", - "decap-cms-widget-object": "^3.2.0", + "decap-cms-widget-object": "^3.3.0", "decap-cms-widget-relation": "^3.3.2", "decap-cms-widget-select": "^3.2.2", "decap-cms-widget-string": "^3.1.3", @@ -33419,7 +33419,7 @@ } }, "packages/decap-cms-core": { - "version": "3.5.0", + "version": "3.6.0", "license": "MIT", "dependencies": { "@iarna/toml": "2.2.5", @@ -33568,7 +33568,7 @@ } }, "packages/decap-cms-lib-util": { - "version": "3.1.0", + "version": "3.2.0", "license": "MIT", "dependencies": { "js-sha256": "^0.9.0", @@ -33713,7 +33713,7 @@ } }, "packages/decap-cms-widget-list": { - "version": "3.2.2", + "version": "3.3.0", "license": "MIT", "dependencies": { "@dnd-kit/core": "^6.0.8", @@ -33749,7 +33749,7 @@ } }, "packages/decap-cms-widget-markdown": { - "version": "3.2.0", + "version": "3.3.0", "license": "MIT", "dependencies": { "dompurify": "^2.2.6", @@ -33894,7 +33894,7 @@ } }, "packages/decap-cms-widget-object": { - "version": "3.2.0", + "version": "3.3.0", "license": "MIT", "peerDependencies": { "@emotion/react": "^11.11.1", @@ -33966,7 +33966,7 @@ } }, "packages/decap-server": { - "version": "3.1.2", + "version": "3.2.0", "license": "MIT", "dependencies": { "@hapi/joi": "^17.0.2", @@ -33990,7 +33990,7 @@ "@types/morgan": "^1.7.37", "@types/node": "^16.0.0", "@types/vfile-message": "^2.0.0", - "decap-cms-lib-util": "^3.1.0", + "decap-cms-lib-util": "^3.2.0", "jest": "^27.0.0", "nodemon": "^2.0.2", "ts-jest": "^27.0.0", diff --git a/packages/decap-cms-app/CHANGELOG.md b/packages/decap-cms-app/CHANGELOG.md index 181afcbb5112..d66e9e1fcaf9 100644 --- a/packages/decap-cms-app/CHANGELOG.md +++ b/packages/decap-cms-app/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.6.0](https://github.com/decaporg/decap-cms/compare/decap-cms-app@3.5.0...decap-cms-app@3.6.0) (2025-01-29) + +**Note:** Version bump only for package decap-cms-app + # [3.5.0](https://github.com/decaporg/decap-cms/compare/decap-cms-app@3.4.0...decap-cms-app@3.5.0) (2025-01-15) ### Bug Fixes diff --git a/packages/decap-cms-app/package.json b/packages/decap-cms-app/package.json index 52fa65eca3c2..91d4ad502e76 100644 --- a/packages/decap-cms-app/package.json +++ b/packages/decap-cms-app/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-app", "description": "An extensible, open source, Git-based, React CMS for static sites. Reusable congiuration with React as peer.", - "version": "3.5.0", + "version": "3.6.0", "homepage": "https://www.decapcms.org", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-app", "bugs": "https://github.com/decaporg/decap-cms/issues", @@ -40,10 +40,10 @@ "decap-cms-backend-gitlab": "^3.2.2", "decap-cms-backend-proxy": "^3.1.4", "decap-cms-backend-test": "^3.1.3", - "decap-cms-core": "^3.5.0", + "decap-cms-core": "^3.6.0", "decap-cms-editor-component-image": "^3.1.3", "decap-cms-lib-auth": "^3.0.5", - "decap-cms-lib-util": "^3.1.0", + "decap-cms-lib-util": "^3.2.0", "decap-cms-lib-widgets": "^3.1.0", "decap-cms-locales": "^3.3.0", "decap-cms-ui-default": "^3.1.4", @@ -53,11 +53,11 @@ "decap-cms-widget-datetime": "^3.2.3", "decap-cms-widget-file": "^3.1.3", "decap-cms-widget-image": "^3.1.3", - "decap-cms-widget-list": "^3.2.2", + "decap-cms-widget-list": "^3.3.0", "decap-cms-widget-map": "^3.1.4", - "decap-cms-widget-markdown": "^3.2.0", + "decap-cms-widget-markdown": "^3.3.0", "decap-cms-widget-number": "^3.1.3", - "decap-cms-widget-object": "^3.2.0", + "decap-cms-widget-object": "^3.3.0", "decap-cms-widget-relation": "^3.3.2", "decap-cms-widget-select": "^3.2.2", "decap-cms-widget-string": "^3.1.3", diff --git a/packages/decap-cms-core/CHANGELOG.md b/packages/decap-cms-core/CHANGELOG.md index 9a4a6376dace..24ff23f1b1c5 100644 --- a/packages/decap-cms-core/CHANGELOG.md +++ b/packages/decap-cms-core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.6.0](https://github.com/decaporg/decap-cms/compare/decap-cms-core@3.5.0...decap-cms-core@3.6.0) (2025-01-29) + +### Bug Fixes + +- **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) + +### Features + +- **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) +- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb)) + # [3.5.0](https://github.com/decaporg/decap-cms/compare/decap-cms-core@3.4.2...decap-cms-core@3.5.0) (2024-11-12) ### Bug Fixes diff --git a/packages/decap-cms-core/package.json b/packages/decap-cms-core/package.json index 87f3566d17cf..68e8aff56787 100644 --- a/packages/decap-cms-core/package.json +++ b/packages/decap-cms-core/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-core", "description": "Decap CMS core application, see decap-cms package for the main distribution.", - "version": "3.5.0", + "version": "3.6.0", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-core", "bugs": "https://github.com/decaporg/decap-cms/issues", "module": "dist/esm/index.js", diff --git a/packages/decap-cms-lib-util/CHANGELOG.md b/packages/decap-cms-lib-util/CHANGELOG.md index 9bc04cb12103..c29a03a2b3d2 100644 --- a/packages/decap-cms-lib-util/CHANGELOG.md +++ b/packages/decap-cms-lib-util/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.2.0](https://github.com/decaporg/decap-cms/compare/decap-cms-lib-util@3.1.0...decap-cms-lib-util@3.2.0) (2025-01-29) + +### Features + +- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb)) + # [3.1.0](https://github.com/decaporg/decap-cms/compare/decap-cms-lib-util@3.0.4...decap-cms-lib-util@3.1.0) (2024-08-07) ### Bug Fixes diff --git a/packages/decap-cms-lib-util/package.json b/packages/decap-cms-lib-util/package.json index 92ab5ecdffc6..2f9c59073b49 100644 --- a/packages/decap-cms-lib-util/package.json +++ b/packages/decap-cms-lib-util/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-lib-util", "description": "Shared utilities for Decap CMS.", - "version": "3.1.0", + "version": "3.2.0", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-lib-util", "bugs": "https://github.com/decaporg/decap-cms/issues", "module": "dist/esm/index.js", diff --git a/packages/decap-cms-widget-list/CHANGELOG.md b/packages/decap-cms-widget-list/CHANGELOG.md index a334c95bca10..c886c4c6438a 100644 --- a/packages/decap-cms-widget-list/CHANGELOG.md +++ b/packages/decap-cms-widget-list/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.3.0](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-list@3.2.2...decap-cms-widget-list@3.3.0) (2025-01-29) + +### Features + +- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb)) + ## [3.2.2](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-list@3.2.1...decap-cms-widget-list@3.2.2) (2024-08-13) ### Reverts diff --git a/packages/decap-cms-widget-list/package.json b/packages/decap-cms-widget-list/package.json index 5c4860a0bb32..e312aa084726 100644 --- a/packages/decap-cms-widget-list/package.json +++ b/packages/decap-cms-widget-list/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-widget-list", "description": "Widget for editing lists in Decap CMS.", - "version": "3.2.2", + "version": "3.3.0", "homepage": "https://www.decapcms.org/docs/widgets/#list", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-widget-list", "bugs": "https://github.com/decaporg/decap-cms/issues", diff --git a/packages/decap-cms-widget-markdown/CHANGELOG.md b/packages/decap-cms-widget-markdown/CHANGELOG.md index 245d0cf027f3..56921b948e83 100644 --- a/packages/decap-cms-widget-markdown/CHANGELOG.md +++ b/packages/decap-cms-widget-markdown/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.3.0](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-markdown@3.2.0...decap-cms-widget-markdown@3.3.0) (2025-01-29) + +### Bug Fixes + +- **markdown:** convert inline CSS from Google Docs to Markdown ([#7351](https://github.com/decaporg/decap-cms/issues/7351)) ([8b8e873](https://github.com/decaporg/decap-cms/commit/8b8e873af9a0749720ec03cadbc4b0d391ad84e1)) + +### Features + +- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb)) + # [3.2.0](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-markdown@3.1.6...decap-cms-widget-markdown@3.2.0) (2024-11-12) ### Bug Fixes diff --git a/packages/decap-cms-widget-markdown/package.json b/packages/decap-cms-widget-markdown/package.json index b174ffdaeac5..3f382d0e03df 100644 --- a/packages/decap-cms-widget-markdown/package.json +++ b/packages/decap-cms-widget-markdown/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-widget-markdown", "description": "Widget for editing markdown in Decap CMS.", - "version": "3.2.0", + "version": "3.3.0", "homepage": "https://www.decapcms.org/docs/widgets/#markdown", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-widget-markdown", "bugs": "https://github.com/decaporg/decap-cms/issues", diff --git a/packages/decap-cms-widget-object/CHANGELOG.md b/packages/decap-cms-widget-object/CHANGELOG.md index c7bfc1350685..d09dc463e6c8 100644 --- a/packages/decap-cms-widget-object/CHANGELOG.md +++ b/packages/decap-cms-widget-object/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.3.0](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-object@3.2.0...decap-cms-widget-object@3.3.0) (2025-01-29) + +### Features + +- visual editing (click-to-edit) ([#7374](https://github.com/decaporg/decap-cms/issues/7374)) ([989c2dd](https://github.com/decaporg/decap-cms/commit/989c2dd6ed80f69b572b8b73c4e37b5106ae04fb)) + # [3.2.0](https://github.com/decaporg/decap-cms/compare/decap-cms-widget-object@3.1.4...decap-cms-widget-object@3.2.0) (2025-01-15) ### Bug Fixes diff --git a/packages/decap-cms-widget-object/package.json b/packages/decap-cms-widget-object/package.json index 1bfddf240d0a..291ff0e4165f 100644 --- a/packages/decap-cms-widget-object/package.json +++ b/packages/decap-cms-widget-object/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms-widget-object", "description": "Widget for displaying an object of fields for Decap CMS.", - "version": "3.2.0", + "version": "3.3.0", "homepage": "https://www.decapcms.org/docs/widgets/#object", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-widget-object", "bugs": "https://github.com/decaporg/decap-cms/issues", diff --git a/packages/decap-cms/CHANGELOG.md b/packages/decap-cms/CHANGELOG.md index b8a3511b2dc8..34d526226e88 100644 --- a/packages/decap-cms/CHANGELOG.md +++ b/packages/decap-cms/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.6.0](https://github.com/decaporg/decap-cms/compare/decap-cms@3.5.0...decap-cms@3.6.0) (2025-01-29) + +**Note:** Version bump only for package decap-cms + # [3.5.0](https://github.com/decaporg/decap-cms/compare/decap-cms@3.4.0...decap-cms@3.5.0) (2025-01-15) ### Bug Fixes diff --git a/packages/decap-cms/package.json b/packages/decap-cms/package.json index 3b46f8be8dc9..fba911e2cdc6 100644 --- a/packages/decap-cms/package.json +++ b/packages/decap-cms/package.json @@ -1,7 +1,7 @@ { "name": "decap-cms", "description": "An extensible, open source, Git-based, React CMS for static sites.", - "version": "3.5.0", + "version": "3.6.0", "homepage": "https://www.decapcms.org", "repository": "https://github.com/decaporg/decap-cms", "bugs": "https://github.com/decaporg/decap-cms/issues", @@ -22,7 +22,7 @@ "dependencies": { "codemirror": "^5.46.0", "create-react-class": "^15.7.0", - "decap-cms-app": "^3.5.0", + "decap-cms-app": "^3.6.0", "decap-cms-media-library-cloudinary": "^3.0.3", "decap-cms-media-library-uploadcare": "^3.0.2", "file-loader": "^6.2.0", diff --git a/packages/decap-server/CHANGELOG.md b/packages/decap-server/CHANGELOG.md index 3cadf6e587a8..8715efd9cbc2 100644 --- a/packages/decap-server/CHANGELOG.md +++ b/packages/decap-server/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.2.0](https://github.com/decaporg/decap-cms/compare/decap-server@3.1.2...decap-server@3.2.0) (2025-01-29) + +**Note:** Version bump only for package decap-server + ## [3.1.2](https://github.com/decaporg/decap-cms/compare/decap-server@3.1.1...decap-server@3.1.2) (2024-08-13) ### Reverts diff --git a/packages/decap-server/package.json b/packages/decap-server/package.json index e6bb8bb8a828..61b582d03e4b 100644 --- a/packages/decap-server/package.json +++ b/packages/decap-server/package.json @@ -1,7 +1,7 @@ { "name": "decap-server", "description": "Proxy server to be used with Decap CMS proxy backend", - "version": "3.1.2", + "version": "3.2.0", "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-server", "bugs": "https://github.com/decaporg/decap-cms/issues", "license": "MIT", @@ -39,7 +39,7 @@ "@types/morgan": "^1.7.37", "@types/node": "^16.0.0", "@types/vfile-message": "^2.0.0", - "decap-cms-lib-util": "^3.1.0", + "decap-cms-lib-util": "^3.2.0", "jest": "^27.0.0", "nodemon": "^2.0.2", "ts-jest": "^27.0.0",