-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add the Visual Editor into Govspeak Preview #525
Conversation
1e2bd9b
to
3fd9252
Compare
There was a problem hiding this 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
markdownButton.addEventListener("click", () => { | ||
event.preventDefault(); | ||
markdownSection.removeAttribute("hidden"); | ||
markdownSection.scrollIntoView({ behavior: "smooth" }); | ||
}); | ||
|
||
copyButton.addEventListener("click", () => { | ||
event.preventDefault(); | ||
textarea.select(); | ||
document.execCommand("copy"); | ||
}); |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
a8db784
to
c403ed8
Compare
c403ed8
to
2d80759
Compare
2d80759
to
79271aa
Compare
Introduce a new route for the visual editor, populate it with the visual editor and add it to the menu.
919c728
to
5460fcc
Compare
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