From c85921a5484f8c8084b7fc6e096deb6171b66d2e Mon Sep 17 00:00:00 2001 From: Joe <33972521+hnb-ku@users.noreply.github.com> Date: Thu, 11 Aug 2022 14:38:56 +0800 Subject: [PATCH] FEATURE: Adds full screen composer submit button and prompt (#17839) Context: https://meta.discourse.org/t/still-display-the-reply-create-topic-button-when-using-full-screen-composition/123597/6?u=johani Right now, we don't show the submit buttons when you enter the full-screen composer. The reasons for that are described in the context link above. This PR adds the improvements highlighted here: https://meta.discourse.org/t/still-display-the-reply-create-topic-button-when-using-full-screen-composition/123597/12?u=johani Here's a list of the changes this PR introduces: 1. When you enter full-screen mode, we will now add a prompt that matches the browser fullscreen F11 function. It looks like so The prompt fades away after a couple of seconds. 2. This PR adds the submit buttons to the full-screen composer mode. The submit buttons should work like normal if the post has no errors. If the post has errors (title too short, body too short, required categories/tags), then the button will make the composer exit the full-screen mode so that users will see the errors and fix them. The error logic is based on what we currently have; this PR doesn't add any new validation. Here's a video of what that looks like: https://meta.discourse.org/t/-/127948/14?u=johani --- .../components/composer-fullscreen-prompt.hbs | 3 ++ .../components/composer-fullscreen-prompt.js | 24 ++++++++++ .../discourse/app/controllers/composer.js | 47 ++++++++++++++----- .../discourse/app/models/composer.js | 1 + .../discourse/app/templates/composer.hbs | 30 ++++++------ .../tests/acceptance/composer-test.js | 34 ++++++++++++++ app/assets/stylesheets/desktop/compose.scss | 21 +++++++++ config/locales/client.en.yml | 3 +- 8 files changed, 135 insertions(+), 28 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/templates/components/composer-fullscreen-prompt.hbs create mode 100644 app/assets/javascripts/discourse/app/components/composer-fullscreen-prompt.js diff --git a/app/assets/javascripts/admin/addon/templates/components/composer-fullscreen-prompt.hbs b/app/assets/javascripts/admin/addon/templates/components/composer-fullscreen-prompt.hbs new file mode 100644 index 00000000000..c9fc1d04e6f --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/components/composer-fullscreen-prompt.hbs @@ -0,0 +1,3 @@ +