ion-app.app-root core-rich-text-editor {
    height: 40vh;
    overflow: hidden;
    min-height: 200px; /* Just in case vh is not supported */
    min-height: 40vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    @include darkmode() {
        background-color: $black;
    }

    .core-rte-editor, .core-textarea {
        padding: 2px;
        margin: 2px;
        width: 100%;
        resize: none;
        background-color: $white;
        @include darkmode() {
            background-color: $black;
            color: $white;
        }
    }

    .core-rte-editor {
        flex-grow: 1;
        flex-shrink: 1;
        -webkit-user-select: auto !important;
        word-wrap: break-word;
        overflow-x: hidden;
        overflow-y: auto;
        cursor: text;
        img {
            @include padding(null, null, null, 2px);
            max-width: 95%;
        }
        &:empty:before {
            content: attr(data-placeholder-text);
            display: block;
            color: $gray-light;
            font-weight: bold;

            @include darkmode() {
                color: $gray;
            }
        }

        // Make empty elements selectable (to move the cursor).
        *:empty:after {
            content: '\200B';
        }
    }

    .core-textarea {
        flex-grow: 1;
        flex-shrink: 1;
        position: relative;

        textarea {
            margin: 0 !important;
            padding: 0;
            height: 100% !important;
            width: 100% !important;
            resize: none;
            overflow-x: hidden;
            overflow-y: auto;
            position: absolute;
            @include position(0, 0, 0, 0);
        }
    }

    div.core-rte-toolbar {
        display: flex;
        width: 100%;
        z-index: 1;
        flex-grow: 0;
        flex-shrink: 0;
        background-color: $white;

        @include darkmode() {
            background-color: $black;
        }
        @include padding(5px, null);
        border-top: 1px solid $gray;

        ion-slides {
            width: 240px;
            flex-grow: 1;
            flex-shrink: 1;
        }

        button {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 36px;
            height: 36px;
            padding-right: 6px;
            padding-left: 6px;
            margin: 0 auto;
            font-size: 18px;
            background-color: $white;
            border-radius: 4px;
            @include core-transition(background-color, 200ms);
            color: $text-color;
            cursor: pointer;

            @include darkmode() {
                background-color: $black;
                color: $core-dark-text-color;
            }

            &.toolbar-button-enable {
                width: 100%;
            }

            &:active, &[aria-pressed="true"] {
                background-color: $gray;
                @include darkmode() {
                    background-color: $gray-dark;
                }
            }

            &.toolbar-arrow {
                width: 28px;
                flex-grow: 0;
                flex-shrink: 0;
                opacity: 1;
                @include core-transition(opacity, 200ms);

                &:active {
                    background-color: $white;
                    @include darkmode() {
                        background-color: $black;
                    }
                }

                &.toolbar-arrow-hidden {
                    opacity: 0;
                }
            }
        }

        &.toolbar-hidden {
            visibility: none;
            height: 0;
            border: none;
        }
    }

}

body.keyboard-is-open ion-app.app-root core-rich-text-editor {
    min-height: 200px;
}