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

Add the Visual Editor into Govspeak Preview #525

Merged

Conversation

dnkrj
Copy link
Contributor

@dnkrj dnkrj commented Sep 18, 2024

https://trello.com/c/RYblkiAD/2819-add-visual-editor-to-the-govspeak-preview-application

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

Screenshots

127 0 0 1_3000_editor(iPad Pro)
127 0 0 1_3000_editor(iPad Pro) (2)

@govuk-ci govuk-ci temporarily deployed to govspeak-pre-2819-add-v-vyammd September 18, 2024 16:05 Inactive
@dnkrj dnkrj force-pushed the 2819-add-visual-editor-to-the-govspeak-preview-application branch 2 times, most recently from 1e2bd9b to 3fd9252 Compare September 24, 2024 17:07
@ChrisBAshton ChrisBAshton changed the title [Spike] Add a page for the visual editor Add the Visual Editor into Govspeak Preview Oct 2, 2024
@ChrisBAshton ChrisBAshton marked this pull request as ready for review October 2, 2024 13:51
Copy link
Member

@yndajas yndajas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - nothing particularly blocking, though it would be good to address the two 'issue' comments if possible


The labels/first lines of each of the comments here are following the Conventional Comments format, which I'm trying out after watching a useful DevOpsDays London talk

config/routes.rb Outdated Show resolved Hide resolved
app/assets/javascripts/visual-editor.js Outdated Show resolved Hide resolved
Comment on lines 27 to 37
markdownButton.addEventListener("click", () => {
event.preventDefault();
markdownSection.removeAttribute("hidden");
markdownSection.scrollIntoView({ behavior: "smooth" });
});

copyButton.addEventListener("click", () => {
event.preventDefault();
textarea.select();
document.execCommand("copy");
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (if-minor): test coverage

Could we add some Jasmine component tests for this custom functionality? Something like these: https://github.com/alphagov/signon/blob/main/spec/javascripts/modules/accessible-autocomplete-spec.js. Or at least some JavaScript-enabled Capybara feature tests to confirm the Markdown button works

I'd maybe also extract these two sections of event listener setup code into descriptively-named functions (example), but that's more personal preference!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a go at both test approaches, but because the module is written in ES6, the tests don't work out of the box. I've put some WIP code in #533 and will pop it on our backlog to add something later (not business critical if the feature fails in the meantime).

@@ -1,2 +1,38 @@
//= require govspeak-visual-editor/dist/govspeak-visual-editor.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: JavaScript style

Is there a reason this is written quite differently to the Whitehall equivalent? Is this a shift in how we write (should be writing) custom JavaScript behaviour in our apps?

Personally I find this style easier to parse!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to defer to @dnkrj on that one!

app/assets/stylesheets/application.scss Outdated Show resolved Hide resolved
app/views/editor/index.html.erb Outdated Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
@ChrisBAshton ChrisBAshton force-pushed the 2819-add-visual-editor-to-the-govspeak-preview-application branch 3 times, most recently from a8db784 to c403ed8 Compare October 3, 2024 09:53
@ChrisBAshton ChrisBAshton force-pushed the 2819-add-visual-editor-to-the-govspeak-preview-application branch from c403ed8 to 2d80759 Compare October 3, 2024 09:55
@ChrisBAshton ChrisBAshton force-pushed the 2819-add-visual-editor-to-the-govspeak-preview-application branch from 2d80759 to 79271aa Compare October 3, 2024 10:00
dnkrj and others added 2 commits October 3, 2024 11:12
Introduce a new route for the visual editor, populate it with the
visual editor and add it to the menu.
@ChrisBAshton ChrisBAshton force-pushed the 2819-add-visual-editor-to-the-govspeak-preview-application branch 2 times, most recently from 919c728 to 5460fcc Compare October 4, 2024 07:05
@ChrisBAshton ChrisBAshton merged commit 45390f7 into main Oct 4, 2024
22 checks passed
@ChrisBAshton ChrisBAshton deleted the 2819-add-visual-editor-to-the-govspeak-preview-application branch October 4, 2024 07:10
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.

4 participants