Limit CKEditor size to be smaller than the height of the browser window

Has anyone found a more effective way to limit the height of CKEditor 5 when using it with React? By default, it adjusts its height based on the content, which can be problematic in situations where there is a lot of content. This causes the editor to extend beyond the bottom of the screen, requiring users to scroll down to view all the content. Unfortunately, this often results in the toolbar becoming hidden. To address this issue, I have implemented a max-height property in CSS, like so:

.ck-editor__editable {
min-height: 20vw;
max-height: 37vw;
resize: both;
}

While this solution works well for fullscreen windows, it falls short on 4K monitors where the editor appears very small. Additionally, using a FullScreen plugin alongside the max-height attribute restricts the editor's height even in fullscreen mode, rendering the feature useless.

I am seeking alternative methods for sizing the editor to occupy most of the window's height without causing scrolling and enabling FullScreen mode to function properly. Any suggestions or ideas would be greatly appreciated!

Answer №1

I came across some scss code in a different forum that was related to my question about setting the height of CKEditor 5 Classic Editor. After converting it to css, I discovered that it ensured the editor always filled its parent's height without limiting the contents (and scrolling from inside the editor). It would be really helpful if the CKEditor 5 team could include this in their documentation. It took me quite some time to locate this solution.

.ck-editor {
  height: 100% !important;
  display: flex;
  flex-direction: column;
}
.ck-editor .ck-editor__top {
  flex-shrink: 1;
}
.ck-editor .ck-editor__main {
  flex-grow: 1;
  position: relative;
}
.ck-editor .ck-editor__main .ck-editor__editable, .ck-editor .ck-editor__main .ck-source-editing-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ensuring `type=file` input only accepts image files in React

<Input id="image" type="file" accept="image/*" onChange={(event) => getBase64(event.target.files[0]) .then((file) => this.setState({ image: file }) )} /> However, it currently accepts other fil ...

The renderer for PDF files in React is called React

Struggling to register a custom font in react-pdf/renderer? I found a solution by declaring it as a variable. const poppins = 'https://example.com/fonts/Poppins/poppins-regular-webfont.woff' Font.register({family: "Poppins", src: poppi ...

Stop access to geojson files through targeted media queries

Using a vue.js app, I have the ability to choose locations using either a map or an input field. However, for mobile users, I want to exclude the map and only serve the search engine. The issue is that it's not very user-friendly on mobile devices be ...

Challenge with Material UI Palette not refreshing

As a newcomer to React and Material UI, I am eager to customize the appearance of MUI buttons using createMuiTheme. Despite following the documentation and replicating the example code, I am not seeing any changes on the buttons and no errors are appearin ...

Highlighting the Active Navigation Menu for the Current Page Using a Unified Header File

Is there a way to highlight the navigation menu for the current page I am visiting? header.php <div class="header-menu"> <div class="nav"> <ul> <a href="index.php"><li>Home</li> ...

The hover effect is implemented across all image elements

Below is the code snippet in question: #mg1 { margin-left: 3%; } #mg1:hover { margin-top: 4%; } <div id="section1"> <center> <div id="bgp"> <center> <p>THUMBNAILS</p> </center> ...

Unable to get create-react-app to function properly

Recently, I decided to kick off a new project using React and installed create-react-app via npm. However, when attempting to run the command create-react-app pseudogram, an unexpected error occurred: Aborting installation. Unexpected error. Please report ...

When a hyperlink is clicked, an image appears in the div

Can someone help me with a javascript method that can display an image in a div based on which href link is clicked? I've started writing some code, but I think it needs further development. <script type=" "> function changeImg(){ var ima ...

React Component for voting positively or negatively

I am working on creating a React component that contains an input field and two buttons. The input field should initially display the number 25. The component will have one button that decreases the count by 1, and another button that increases the count ...

When employing React in an MVC framework, the specified target container does not correspond to a valid DOM element

I'm currently attempting to incorporate react into my mvc application, but I've encountered a problem that has me stumped on how to resolve. In the file DraftCommentsDisplay.jsx, I have the following code: import React from 'react'; im ...

The Bootstrap tab feature is malfunctioning when a tab is using data-target instead of href

While developing bootstrap tabs for an Angular app, I decided to use the data-target attribute instead of the href attribute to avoid any interference with routes. Here's a snippet of how I structured the tabs: <ul class="nav nav-tabs" id="myTab"& ...

What could be the reason for the lack of rendering in this imported React component using System.import?

I've been experimenting with dynamic code splitting using webpack 2 and react. As part of my testing, I decided to create a component that fetches code asynchronously: import React, { Component } from 'react' export class Async extends Com ...

What is the method to retrieve the IP address of the source accessing the MongoDB database?

I'm looking to enhance the security of my database by allowing access requests only from the app server (which runs on backend using node.js and express.js). However, when I whitelist the IP address of the app server (Azure App Service Linux), the co ...

Creating a Unique Header Navigation Menu on Your WordPress Premium Theme

I recently faced an issue with my premium WordPress theme's navigation menu on the header. Whenever I clicked on it, it wouldn't redirect to the intended page. After some troubleshooting in the Google Chrome element editor, I managed to solve the ...

Automatically Scrolling Div According to its Content

Struggling to figure out how to make a parent div automatically scroll based on its child's content. I have a menu that expands when clicked and needs to scroll if the height of the child exceeds that of the parent. This is the HTML for the menu wra ...

WebDriver does not support compound class names and will throw an error

I have a function that can calculate the total number of elements within divs and return this count. public int getNumberOfOpenBets() { openBetsSlip = driver.findElement(By.id("form_open_bets")); openBets = openBetsSlip.findElements(By.classNa ...

Transferring information in React from a child component to its parent and then to another child

I'm currently developing my app using react.js and facing an issue with passing data between components. I have a Parent component (P) that needs to receive an array of objects from its child component (C1), then pass this data on to another child com ...

Calculating the calc()-expression in Fluid Typography Linear Transition

After exploring the technique demonstrated by Mike Riethmuller, which involves utilizing calc() to create a fluid font-size transition between a minimum and maximum value, I found the outcome obtained from calc() in the browser somewhat perplexing (and not ...

Clearing previous animation and implementing interval in jQuery for optimal performance

On my HTML page, I have implemented a feature with 6 tabs that are initially hidden using CSS display:hidden. When clicking on a tab, the content becomes visible by changing the display property to block. The first tab includes an animated loop created us ...

What is the reason that data from Route Handlers is not being refreshed?

While experimenting with the latest Route Handlers in next next 13.4.4, I encountered a issue. Despite making changes to the NextResponse text, the data does not update. The content displayed on app/page.js remains unchanged. Below is the code snippet: asy ...