From 6cc2a8292f257d736302377b57ff0f4d5c38fe84 Mon Sep 17 00:00:00 2001 From: Martin Jagodic Date: Wed, 8 Oct 2025 15:33:07 +0200 Subject: [PATCH 1/2] Add preview.visualEditing to docs and to site's config introduced in https://github.com/decaporg/decap-cms/pull/7374 --- content/docs/configuration-options.md | 8 +++++--- static/admin/config.yml | 5 ++--- static/admin/editor-previews/docs.js | 10 ++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/content/docs/configuration-options.md b/content/docs/configuration-options.md index 2b3f2b69..a372a712 100644 --- a/content/docs/configuration-options.md +++ b/content/docs/configuration-options.md @@ -398,18 +398,20 @@ fields: ### `editor` -This setting changes options for the editor view of a collection or a file inside a files collection. It has one option so far: +This setting changes options for the editor view of a collection or a file inside a files collection. It has these options: * `preview`: set to `false` to disable the preview pane for this collection or file; defaults to `true` +* `visualEditing`: set to `true` to allow users to click directly on content in the preview pane to edit fields. This works for preview widgets as well as for custom full-page preview templates. This is an alternative to scroll sync, providing a more direct way to interact with content. When enabled, scroll sync is automatically disabled to prevent interference. 3.6 **Example:** ```yaml editor: - preview: false + preview: true # default is true + visualEditing: true # default is false ``` -**Note**: Setting this as a top level configuration will set the default for all collections +**Note**: Setting `preview` as a top level configuration will set the default for all collections. ### `summary` diff --git a/static/admin/config.yml b/static/admin/config.yml index e79275d3..23a2db56 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -6,11 +6,8 @@ backend: branch: main local_backend: true - site_url: https://www.decapcms.org - publish_mode: editorial_workflow - media_folder: static/img public_folder: /img @@ -20,6 +17,8 @@ docs_collection: &docs_collection summary: '{{weight}} - {{title}}' preview_path: 'docs/{{slug}}' sortable_fields: ['weight', 'title', 'group'] + preview: + visualEditing: true fields: - label: Section name: group diff --git a/static/admin/editor-previews/docs.js b/static/admin/editor-previews/docs.js index 87239d49..7c8114ee 100644 --- a/static/admin/editor-previews/docs.js +++ b/static/admin/editor-previews/docs.js @@ -4,12 +4,10 @@ CMS.registerPreviewStyle('/styles/style.min.css') const DocsPreview = createClass({ render: function () { - const { entry, widgetFor } = this.props - const data = entry.getIn(['data']).toJS() - const { title } = data + const { widgetFor } = this.props return h('div', { className: 'container size-lg' }, h('div', { className: 'page' }, - h('h1', {}, title), + h('h1', {}, widgetFor('title')), h('div', { className: 'markdown' }, h('div', {}, widgetFor('body')) ) @@ -22,10 +20,10 @@ const BlogPreview = createClass({ render: function () { const { entry, widgetFor } = this.props const data = entry.getIn(['data']).toJS() - const { title, author, date } = data + const { author, date } = data return h('div', { className: 'container size-sm' }, h('div', { className: 'page' }, - h('h1', {}, title), + h('h1', {}, widgetFor('title')), h('p', { className: 'meta-info' }, `By ${author} on ${date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}` ), From f8201b01a5b4aa3b7eec1bb16932edeb7d831c03 Mon Sep 17 00:00:00 2001 From: Martin Jagodic Date: Fri, 6 Feb 2026 14:48:57 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com> --- content/docs/configuration-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/configuration-options.md b/content/docs/configuration-options.md index 3174f46f..d49bfdc8 100644 --- a/content/docs/configuration-options.md +++ b/content/docs/configuration-options.md @@ -409,7 +409,7 @@ fields: This setting changes options for the editor view of a collection or a file inside a files collection. It has these options: -* `preview`: set to `false` to disable the preview pane for this collection or file; defaults to `true` +* `preview`: set to `false` to disable the preview pane for this collection or file; defaults to `true`. * `visualEditing`: set to `true` to allow users to click directly on content in the preview pane to edit fields. This works for preview widgets as well as for custom full-page preview templates. This is an alternative to scroll sync, providing a more direct way to interact with content. When enabled, scroll sync is automatically disabled to prevent interference. 3.6 **Example:**