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

using esc for exiting fullscreen #2518

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/shell/components/FieldTypeTinyMCE/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
"socialmediaembed",
"imageresizer",
],

// NOTE: premium plugins are being loaded from a self hosted location
// specific to our application. Making this component not usable outside of our context.
external_plugins: externalPlugins ?? {},
Expand Down Expand Up @@ -313,6 +312,15 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
setIsSkinLoaded(true);
});

editor.on("keydown", (evt: any) => {
if (evt.key === "Escape") {
if (editor.plugins.fullscreen.isFullscreen()) {
editor.execCommand("mceFullScreen");
evt.preventDefault();
}
}
});

// Limits the content width to 640px when in fullscreen
editor.on("FullscreenStateChanged", (evt: any) => {
if (evt.state) {
Expand Down
Loading