1

Unable to set the height for ngx-quill editor using angular flex layout.

The height of the editor (grey border) is overflowing the parent div (background in red).

stackblitz

How to make sure the editor stays inside the parent div?

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Nithin Kumar Biliya
  • 2,763
  • 3
  • 34
  • 54

4 Answers4

6

SOLUTION: All the solutions online wont work for some reason. Says something about 'unsafely set styles' and they do not even apply.

This solution overrides quill text area in Angular (You can choose any CSS file, I just prefer all my Quill editors to be the same size)

src/styles.scss

.ql-container {
     height: 300px !important;
 }
Martin Goncharov
  • 130
  • 2
  • 10
2

Using the latest quill and ngx-quill, and assuming you're OK using ::ng-deep, this works:

::ng-deep .ql-editor {
    height: 300px;
}
GoForth
  • 573
  • 7
  • 10
  • Or override with global scss since ng-deep is meh. This article can help: https://betterprogramming.pub/best-way-to-overwrite-angular-materials-styles-e38dc8b84962 – usersina Jul 29 '21 at 12:30
  • Yes, I agree. It is quite meh. Honestly though, I'm also quite meh about global scss as well haha! – GoForth Jul 30 '21 at 06:27
1

solution was to override height in ql-container class -

.ql-container {
  height: auto;
}

github link

Nithin Kumar Biliya
  • 2,763
  • 3
  • 34
  • 54
0

The issue is height: 100% coming from the ql-container class which causes the overflow.

Just add the following css to your code it will overwrite quill style

.ql-container {
  min-height: 10rem;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ql-editor {
  height: 100%;
  flex: 1;
  overflow-y: auto;
  width: 100%;
}
Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Prasun Das
  • 41
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 04 '22 at 06:25