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

Replace the body textarea with a Monaco editor #9532

Draft
wants to merge 16 commits into
base: editionable-landing-pages
Choose a base branch
from

Conversation

richardTowers
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

KludgeKML and others added 15 commits October 17, 2024 10:21
- LandingPage is a new document type rendered by Frontend
  which constructs its page using blocks specified in
  the details of the content item (not to be confused with
  the reusable content blocks project).
- Here we add it as an editionable object, add a
  PublishingAPI presenter to allow it to be published,
  and update Whitehall's list of allowed rendering apps
  to include Frontend (this is the first, but the consolidation
  work means it won't be the last document type that will
  need this).
- _form partial is required for editions
- add resource route
- Add additional_significant_fields partial
- This handles editing the base_path the first time the
  document is created
- allow the slug parameter in EditionsController
- skip updating document slugs for landing pages. We
  want to be able to specify the base_path explicitly
  for these editions, so having them set automatically
  from the title is not desired.

Co-authored-by: Richard Towers <[email protected]>
- Add redirect to new_document_controller to
  allow it to bounce landing pages to their controller.
- base_path must exist and not already be taken
- body must be valid YAML (and more, root element must be blocks: - we can expand this to stricter testing, but maybe that should be by schema?)
@richardTowers richardTowers force-pushed the editionable-landing-pages-monaco branch from 7b7e861 to 50b2515 Compare October 17, 2024 13:41
This should provide a much better editing experience for YAML files. It
gives us syntax highlighting, code folding, line numbers, and a whole
bunch of other features.

It does not yet provide schema validation, or schema-powered
autocomplete, but that's a possible improvement for later.

We're using ecmascript modules to load the third party javascript here,
rather than installing it with npm. This is just because bundling the
code and making the rails asset pipeline aware of it is a yak shave.
Hopefully the YAML editor won't be a long term component, so this will
be a temporary oddity.
@richardTowers richardTowers force-pushed the editionable-landing-pages-monaco branch from 50b2515 to fbd21c1 Compare October 17, 2024 13:47
@KludgeKML KludgeKML force-pushed the editionable-landing-pages branch 5 times, most recently from 94bdaed to d4c80fa Compare October 17, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants