Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Preview customization #51

Open
braebo opened this issue Sep 3, 2023 · 4 comments
Open

[feature request] Preview customization #51

braebo opened this issue Sep 3, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@braebo
Copy link

braebo commented Sep 3, 2023

Being able to customize the previews is an amazing feature in Decap. I use it to import my global css so that the content in the preview looks just like the page the content is on!

Any plans to support this feature? Or perhaps I missed it?

@braebo braebo changed the title [feature request]: Preview customization [feature request] Preview customization Sep 3, 2023
@kyoshino
Copy link
Member

kyoshino commented Sep 4, 2023

Hi, thank you for checking Sveltia CMS! Custom Previews are not supported yet, as mentioned in the README. I’ll figure out how to do it hopefully this month.

@kyoshino kyoshino added the enhancement New feature or request label Sep 4, 2023
@braebo
Copy link
Author

braebo commented Sep 4, 2023

Ah, missed that sorry. Looking forward to it! Amazing work on Sveltia btw, crazy how much faster it is when swapping out decap! UI is beautiful too 🙏🏽

@dindinet
Copy link

dindinet commented Sep 10, 2023

@kyoshino @fractalhq I have used NetlifyCMS on a couple of hugo projects. I created PreviewTemplates for the collection types and found the process a bit of a torture. I am not a React developer. I have dreamed more than once of a svelte port of the CMS. You are a hero for doing this.

To allow clients to build their own page layouts from a menu of sections we implemented the 'Advanced_Page' collection type.
The client can add a new page and choose the components for the page in the order they require. I never managed to implement a satisfactory PreviewTemplate for this Advanced page type.I have attached the section for the advanced page type from our config.yml (it is inside the zip file.)

So my request is a Preview template made up of sub templates displayed in the order passed in as a collection.

advanced_page.zip

To help explain whjat I mean. The hugo template for the advanced page loops through the page sections and selects the appropriate partial template

{{ range $section := .Params.sections }}
{{ $include_dict := dict "section" $section "Site" $.Site }}
{{ $component := print $section.type ".html" }}
{{ partial $component $include_dict }}
{{ end }}

I am a beginner with svelte but I get the feeling this should be possible.

@waynevanson
Copy link

I'm so keen for this.

My initial thought would an onChange event, and a way to subscribe to partial updates of content.

If I was editing in a directory collection .[5].reviewer, it would send a payload with:

{
  segments: [5, 'reviewer'],
  value: {
    from: 3,
    to: 5
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants