Skip to content

Build your personal knowledge base with Trilium Notes

6.4 KB
Raw Blame
body.mobile .revisions-dialog {
    .modal-dialog {
        height: 95vh;
    }

    .modal-content {
        flex: 1;
        min-height: 0;
    }

    .modal-footer {
        font-size: 0.9em;
    }

    .revision-title {
        font-size: 1rem;
    }

    .revision-toolbar-actions {
        flex-wrap: wrap;
    }

    .revision-content {
        padding: 0.5em;
    }

    /* The action buttons (delete/download/restore) move out of the toolbar into a bottom footer. */
    .revision-detail-footer {
        flex-shrink: 0;
        display: flex;
        gap: 8px;
        padding: 12px 16px calc(max(var(--safe-area-inset-bottom, env(safe-area-inset-bottom)), 12px));
        border-top: 1px solid var(--main-border-color);
        background-color: var(--modal-background-color);

        > .btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
        }

        /* Restore (the labelled primary action) grows to fill; the icon-only delete/download size
           to their content. */
        > .btn:last-child {
            flex: 1;
        }
    }
}

body.desktop .revisions-dialog {
    .revision-list {
        width: 300px;
    }

    .modal-content-with-sidebar {
        height: 80vh;
    }
}

.revisions-dialog {
    .modal-body {
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    /* Wraps the toolbar + preview so it can fill the body (desktop) and act as the detail pane of
       the mobile master-detail flow. */
    .revision-detail {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        min-height: 0;
    }

    .modal-sidebar {
        background-color: var(--card-background-color);
    }

    .modal-sidebar .dropdown-menu.static {
        background-color: transparent !important;
        border-radius: 0 !important;
    }

    .revision-toolbar {
        flex-shrink: 0;
        border-bottom: 1px solid var(--main-border-color);
        padding: 8px 20px;
    }

    .revision-title {
        font-size: 1.2em;
        margin: 8px 0;
    }

    .revision-toolbar-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .revision-menu-header {
        font-weight: bold;
        font-size: 0.85em;
        text-transform: uppercase;
        opacity: 0.6;
    }

    .revision-content-wrapper {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
    }

    .revision-content {
        flex-grow: 1;
        min-height: 0;
        overflow: auto;
        padding: 20px;
    }

    .no-items {
        padding-block: 0;
        height: calc(100% - 2.5em);
    }

    .revision-list {
        flex: 1 1 0;
        min-height: 0;
        overflow: auto;

        .dropdown-item {
            min-height: 2.5em;

            >div {
                padding-left: 0.25em;
                min-width: 0;
            }
        }

        /* On touch devices the items carry the source/size inline (no hover tooltip), so let the
           description wrap to its full text and give the rows a little more breathing room. */
        &.detailed {
            .dropdown-item {
                padding-block: 6px;
            }

            .revision-item-description {
                white-space: normal;
            }
        }
    }

    .revision-item-description {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85em;
        opacity: 0.7;
    }

    .revision-group-header {
        font-size: 0.75em;
        font-weight: bold;
        text-transform: uppercase;
        opacity: 0.5;
        padding: 6px 12px 2px;
    }

    .revision-item-meta {
        font-size: 0.85em;
        opacity: 0.7;
    }


    .revision-description-icon {
        opacity: 0.5;
        flex-shrink: 0;
    }

    .revision-description-editor {
        display: flex;
        gap: 5px;
        align-items: center;
        margin: 3px 0;

        input {
            flex-grow: 1;
        }
    }

    .revision-description-display {
        display: flex;
        align-items: center;
        margin: 3px 0;
        gap: 5px;
        min-height: 24px;
    }

    .revision-description-text {
        font-size: 0.9em;

        &.empty {
            opacity: 0.5;
            font-style: italic;
        }
    }

    .revision-diff-code {
        font-family: var(--font-family-monospace, monospace);
        font-size: 0.9rem;
        white-space: pre-wrap;
        word-break: break-all;
        max-width: 100%;
        padding: 0;
    }

    /* The `ins`/`del` marks of `diffHtml()` */
    .revision-diff-content {
        ins {
            text-decoration: none;

            &.diffins,
            &.diffmod {
                background-color: color-mix(in srgb, var(--bs-success) 25%, transparent);
            }
        }

        del {
            text-decoration: line-through;

            &.diffdel,
            &.diffmod {
                background-color: color-mix(in srgb, var(--bs-danger) 25%, transparent);
            }
        }

        /* Image diff styles */
        ins img,
        del img {
            border: 3px solid;
            border-radius: 4px;
            position: relative;
        }

        del img {
            border-color: var(--bs-danger);
            opacity: 0.6;
        }

        ins img {
            border-color: var(--bs-success);
        }
    }

    .revision-content.type-file {
        display: flex;
        min-width: 0;
        min-height: 0;
        flex-grow: 1;

        .file-preview-table {
            th,
            td {
                padding: 0.25em 0;
            }
        }

        .revision-file-preview {
            display: flex;
            flex-direction: column;
            min-width: 0;
            min-height: 0;
            flex-grow: 1;
        }

        .revision-file-preview-content {
            flex-grow: 1;
            min-height: 0;
            display: flex;
            flex-direction: column;

            > * {
                height: 100%;
            }
        }
    }

}

/* The master-detail flow itself is the shared one (master_detail.css); what is particular here is that
   the revision fills its pane and scrolls inside itself rather than as a pane. */
body.mobile .revisions-dialog.mobile-master-detail {
    .revision-detail {
        overflow: hidden;
    }
}