Skip to content

Build your personal knowledge base with Trilium Notes

7.6 KB
Raw Blame
/** Reduce the z-index of modals so that ckeditor popups are properly shown on top of it. */
body.popup-editor-open:not(.popup-editor-stacked) > .modal-backdrop { z-index: 998; }
body.popup-editor-open:not(.popup-editor-stacked) .popup-editor-dialog { z-index: 999; }
body.popup-editor-open:not(.popup-editor-stacked) .ck-clipboard-drop-target-line { z-index: 1000; }

/** When stacked on top of another Bootstrap modal (e.g. opened from a dialog's help button),
    raise the popup and its own backdrop above the underlying modal (Bootstrap defaults are
    backdrop 1050, dialog 1055 — no native stacking increment). */
body.popup-editor-stacked .popup-editor-dialog { z-index: 1100; }
body.popup-editor-stacked .ck-clipboard-drop-target-line { z-index: 1101; }
.modal-backdrop.popup-editor-backdrop { z-index: 1099; }

body.popup-editor-open .ck.ck-dialog-overlay.ck-dialog-behind-popup-editor { z-index: 997; }

body.desktop .modal.popup-editor-dialog .modal-dialog {
    max-width: 75vw;
    border-bottom-left-radius: var(--bs-modal-border-radius);
    border-bottom-right-radius: var(--bs-modal-border-radius);
}

body.desktop .modal.popup-editor-dialog .modal-dialog .modal-content {
    border-radius: var(--bs-modal-border-radius);
    overflow: hidden;
}

body.mobile .modal.popup-editor-dialog .modal-dialog {
    max-height: var(--tn-modal-max-height);
    height: 100%;
}

/* Bootstrap caps every `.modal-dialog` at 500px from 576px up; the quick editor is a sheet, so it
   takes the whole width on phones and leaves the tablet rule (80%) to apply above 992px. */
@media (max-width: 991px) {
    body.mobile .modal.popup-editor-dialog .modal-dialog {
        max-width: none;
    }
}

.modal.popup-editor-dialog .modal-content {
    transition: background-color 250ms ease-in;
}

.modal.popup-editor-dialog .modal-header .modal-title {
    font-size: 1.1em;
}

/* Pinned to the foot of the dialog rather than following the content, which has no room set
   aside for it. Anchored to `.modal-content`, which Bootstrap positions. */
.modal.popup-editor-dialog .note-type-switcher {
    position: absolute;
    inset-block: auto 12px;
    inset-inline: 12px;
}

/* The note-title header (icon + editable title) is shared with the tree popup, the calendar's event
   sheet and the map panes' sheets, which reuse the same TitleRow; keep the selectors together
   so the dialogs stay pixel-identical. This file is loaded wherever the app is: the quick editor
   keeps itself in the DOM and so is never lazily loaded (see layout_commons.tsx). */
.modal.popup-editor-dialog .modal-header .title-row,
.modal.tree-popup-editor-dialog .modal-header .title-row,
.modal.calendar-event-sheet .modal-header .title-row,
.modal.tn-embedded-note-sheet .modal-header .title-row {
    flex-grow: 1;
    display: flex;
    align-items: center;
    margin-block: 0;

    .note-icon-widget {
        display: flex;
        align-items: center;
        margin-inline-start: 0;
    }
}

.modal.popup-editor-dialog .modal-header .note-title-widget,
.modal.tree-popup-editor-dialog .modal-header .note-title-widget,
.modal.calendar-event-sheet .modal-header .note-title-widget,
.modal.tn-embedded-note-sheet .modal-header .note-title-widget {
    display: flex;
    align-items: center;
}

.modal.popup-editor-dialog .modal-header .title-row.attachment-title-row {
    gap: 8px;

    .attachment-title {
        overflow: hidden;
        font-size: 1em;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.modal.popup-editor-dialog .modal-body {
    padding: 0;
    height: 75vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal.popup-editor-dialog .popup-editor-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

body.mobile .modal.popup-editor-dialog .popup-editor-scroll {
    --scroll-fade-top: 16px;
    padding-top: var(--scroll-fade-top);
}

.modal.popup-editor-dialog .title-row,
.modal.popup-editor-dialog .modal-title,
.modal.popup-editor-dialog .note-icon-widget,
.modal.tree-popup-editor-dialog .title-row,
.modal.tree-popup-editor-dialog .note-icon-widget,
.modal.calendar-event-sheet .title-row,
.modal.calendar-event-sheet .note-icon-widget,
.modal.tn-embedded-note-sheet .title-row,
.modal.tn-embedded-note-sheet .note-icon-widget {
    height: 32px;
    min-height: unset;
}

:root div.modal.popup-editor-dialog div.note-title-widget,
:root div.modal.tree-popup-editor-dialog div.note-title-widget,
:root div.modal.calendar-event-sheet div.note-title-widget,
:root div.modal.tn-embedded-note-sheet div.note-title-widget {
    --note-title-padding-inline: 8px;
}

.modal.popup-editor-dialog .note-icon-widget button.note-icon,
.modal.popup-editor-dialog .note-title-widget input.note-title,
.modal.tree-popup-editor-dialog .note-icon-widget button.note-icon,
.modal.tree-popup-editor-dialog .note-title-widget input.note-title,
.modal.calendar-event-sheet .note-icon-widget button.note-icon,
.modal.calendar-event-sheet .note-title-widget input.note-title,
.modal.tn-embedded-note-sheet .note-icon-widget button.note-icon,
.modal.tn-embedded-note-sheet .note-title-widget input.note-title {
    font-size: 1em;
}

.modal.popup-editor-dialog .classic-toolbar-outer-container.visible {
    --mobile-toolbar-backdrop: var(--modal-background-color);
    background-color: transparent;
}

.modal.popup-editor-dialog div.promoted-attributes-container {
    margin-block: 0;
}

body.desktop .modal.popup-editor-dialog .classic-toolbar-widget {
    position: sticky;
    margin-inline: 8px;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: var(--modal-background-color);
    z-index: 998;
    align-items: flex-start;
}

body.mobile .modal.popup-editor-dialog .modal-content:has(.classic-toolbar-outer-container.visible) .note-type-switcher {
    inset-block-end: calc(12px + var(--mobile-toolbar-height) + 2 * var(--mobile-toolbar-gap));
}

body.mobile .modal.popup-editor-dialog .modal-body {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
}

@media (max-width: 991px) {
    body.mobile:not(.keyboard-panel-open) .modal.popup-editor-dialog {
        --mobile-toolbar-clearance: calc(var(--mobile-toolbar-height) + 2 * var(--mobile-toolbar-gap) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
    }

    body.mobile:not(.keyboard-panel-open) .modal.popup-editor-dialog .classic-toolbar-island {
        bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
    }

    body.mobile .modal.popup-editor-dialog .modal-content:has(.classic-toolbar-outer-container.visible) .note-type-switcher {
        inset-block-end: calc(12px + var(--mobile-toolbar-height) + 2 * var(--mobile-toolbar-gap) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
    }
}

.modal.popup-editor-dialog .note-detail {
    width: 100%;
}

.modal.popup-editor-dialog .note-detail.full-height {
    flex-grow: 0;
    height: 100%;
}

.modal.popup-editor-dialog .note-detail-editable-text-editor {
    margin: 0 28px;
    overflow: visible; /* Allow selection rectangle to go outside of the editor area */
}

body.mobile .modal.popup-editor-dialog .note-detail-editable-text-editor {
    margin-inline: 8px;
}

.modal.popup-editor-dialog .note-detail-file {
    padding: 0;
}

.modal.popup-editor-dialog .note-detail-readonly-text {
    padding: 1em;
}

.modal.popup-editor-dialog .note-detail-code-editor {
    padding: 0;

    & .cm-editor {
        margin: 0;
        border-radius: 0;
    }
}

.modal.popup-editor-dialog .note-list-widget {
    --content-margin-inline: 12px;

    &:not(.full-height) .note-list-wrapper {
        margin-inline: var(--content-margin-inline);
    }
}