Files
Docwell/Packages/editor/src/editor.css
T
tajniak81andClaude Opus 5.5 40d515d15b Add toggles, embeds, link cards, block links, archive, version diff, space export and desktop 1.0
Editor:
- Toggles (Tiptap Details). Open state is per reader, not saved.
- Embeds for YouTube, Vimeo, Loom, Figma, CodePen, Spotify, Google Docs
  and Maps, in sandboxed frames. Other addresses become link cards.
- Link cards with title, description and picture read by docwell-server
  (GET /link-preview). The fetcher refuses private, loopback, link-local
  and CGNAT addresses after DNS resolution, redirects included.
- Block links: a margin button gives a block a short id and copies
  /p/<id>#b-<block>. Opening one jumps to the block and flashes it.
- Markdown, HTML and PDF exports handle the new blocks; HTML import reads
  <details> as a toggle.

Pages and spaces:
- History gets a Changes view: block and word diff against the previous
  version or the page as it is now.
- Archive: archived pages leave the tree and become read-only but stay
  readable; a space's Archive lists them with Unarchive. New migration
  (pages.archived_at) and page.archived / page.unarchived webhook events.
- Full space export (GET /spaces/{id}/export): a zip of Markdown or HTML
  files with subpages in folders, an index, and attachments under _files/.
  Links between exported pages and to attachments become relative paths.

Desktop 1.0:
- Several servers, each with its own sign-in; old settings files carry over.
- Session tokens in the system keychain (go-keyring), moved out of
  localStorage on first start.
- Native menu bar (File, Edit, View, Window, Help) with a Server submenu.
- docwell:// links may point at a block.
- Release workflow builds Windows NSIS, macOS DMG and Linux deb, rpm and
  AppImage installers and attaches them to the release;
  build/set-version.mjs stamps the version into their metadata.

Not yet run: the release workflow, the desktop menus by eye, and macOS or
Linux builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:14:14 +01:00

635 lines
14 KiB
CSS

/* SPDX-License-Identifier: AGPL-3.0-or-later */
@import "katex/dist/katex.min.css";
/* Document styles for the Docwell editor, from the design system's Document
type scale. Uses tokens from @docwell/ui/theme.css. */
.dw-prose {
outline: none;
font-family: var(--font-sans);
font-size: var(--text-doc-body);
line-height: var(--text-doc-body--line-height);
color: var(--color-ink);
min-height: 12rem;
}
/* Paragraph blocks sit space-2 apart; a heading gets space-5 above it. */
.dw-prose > * + * {
margin-top: 8px;
}
.dw-prose > :is(h1, h2, h3) {
margin-top: 20px;
}
.dw-prose h1 {
font-family: var(--font-serif);
font-size: var(--text-doc-h1);
line-height: var(--text-doc-h1--line-height);
font-weight: 600;
}
.dw-prose h2 {
font-family: var(--font-serif);
font-size: var(--text-doc-h2);
line-height: var(--text-doc-h2--line-height);
font-weight: 600;
}
.dw-prose h3 {
font-size: var(--text-doc-h3);
line-height: var(--text-doc-h3--line-height);
font-weight: 600;
}
.dw-prose ul {
list-style: disc;
padding-left: 1.5rem;
}
.dw-prose ol {
list-style: decimal;
padding-left: 1.5rem;
}
.dw-prose a {
color: var(--color-accent);
text-decoration: underline;
text-underline-offset: 2px;
}
.dw-prose blockquote {
border-left: 3px solid var(--color-line);
padding-left: 1rem;
color: var(--color-ink-muted);
}
.dw-prose code {
font-family: var(--font-mono);
font-size: 0.9em;
background: var(--color-code-bg);
padding: 0.1em 0.3em;
border-radius: var(--radius-xs);
}
.dw-prose pre {
font-family: var(--font-mono);
font-size: var(--text-code);
line-height: var(--text-code--line-height);
background: var(--color-code-bg);
padding: 12px 16px;
border-radius: var(--radius-md);
overflow-x: auto;
}
.dw-prose pre code {
background: none;
padding: 0;
font-size: inherit;
}
.dw-prose hr {
border: none;
border-top: 1px solid var(--color-line);
margin: 24px 0;
}
.dw-prose ::selection {
background: var(--color-selection);
}
.dw-prose p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
color: var(--color-ink-faint);
float: left;
height: 0;
pointer-events: none;
}
.dw-prose img {
display: block;
max-width: 100%;
height: auto;
border-radius: var(--radius-md);
}
.dw-prose img.ProseMirror-selectednode,
.dw-prose .dw-file.ProseMirror-selectednode,
.dw-prose .ProseMirror-selectednode:is(.dw-mermaid, .dw-diagram, .dw-toc, .tiptap-mathematics-render) {
outline: 2px solid var(--color-focus-ring);
outline-offset: 2px;
}
/* A non-image attachment: a one-line download card. */
.dw-prose .dw-file {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
font-family: var(--font-sans);
font-size: var(--text-ui-md);
}
.dw-prose .dw-file__name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dw-prose .dw-file__size {
color: var(--color-ink-muted);
font-size: var(--text-ui-sm);
}
/* Other editors' carets (CollaborationCaret's default render). */
.dw-prose .collaboration-carets__caret {
position: relative;
margin-left: -1px;
margin-right: -1px;
border-left: 1px solid;
border-right: 1px solid;
word-break: normal;
pointer-events: none;
}
.dw-prose .collaboration-carets__label {
position: absolute;
top: -1.4em;
left: -1px;
padding: 0.1rem 0.3rem;
border-radius: var(--radius-xs) var(--radius-xs) var(--radius-xs) 0;
font-family: var(--font-sans);
font-size: 12px;
font-weight: 600;
line-height: normal;
color: #fff;
white-space: nowrap;
user-select: none;
}
/* "@" mentions. */
.dw-prose .dw-mention {
border-radius: var(--radius-xs);
background: var(--color-accent-soft);
padding: 0 0.15em;
font-weight: 500;
white-space: nowrap;
}
/* Commented text; the active comment's text stands out more. */
.dw-prose .dw-comment {
background: color-mix(in srgb, var(--color-warning-soft) 70%, transparent);
border-bottom: 2px solid color-mix(in srgb, var(--color-warning) 55%, transparent);
cursor: pointer;
}
.dw-prose .dw-comment.is-active {
background: var(--color-warning-soft);
border-bottom-color: var(--color-warning);
}
/* The "/" and "@" popups (suggestion.ts): the design system's slash menu,
drawn without a framework so every host can show it. */
.dw-suggest {
position: fixed;
z-index: 60;
left: 0;
top: 0;
width: 20rem;
max-width: calc(100vw - 16px);
max-height: 22rem;
overflow-y: auto;
padding: 4px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
box-shadow: var(--dw-shadow-menu);
font-family: var(--font-sans);
}
.dw-suggest__query {
padding: 8px 8px 4px;
font-family: var(--font-mono);
font-size: var(--text-ui-xs);
color: var(--color-ink-muted);
}
.dw-suggest__empty {
padding: 6px 8px;
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
.dw-suggest__item {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 8px;
border-radius: var(--radius-sm);
cursor: pointer;
}
.dw-suggest__item.is-active {
background: var(--color-surface-hover);
}
.dw-suggest__icon {
display: grid;
place-items: center;
flex-shrink: 0;
width: 36px;
height: 36px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink-muted);
}
.dw-suggest__text {
display: flex;
flex-direction: column;
min-width: 0;
}
.dw-suggest__label {
font-size: var(--text-ui-md);
font-weight: 500;
color: var(--color-ink);
}
.dw-suggest__desc {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: var(--text-ui-xs);
color: var(--color-ink-muted);
}
/* ---- Math (KaTeX) ---- */
.dw-prose .tiptap-mathematics-render {
cursor: default;
}
.dw-prose.ProseMirror[contenteditable="true"] .tiptap-mathematics-render {
cursor: pointer;
border-radius: var(--radius-xs);
}
.dw-prose.ProseMirror[contenteditable="true"] .tiptap-mathematics-render:hover {
background: var(--color-surface-hover);
}
.dw-prose [data-type="block-math"] {
display: block;
text-align: center;
padding: 8px 0;
overflow-x: auto;
}
/* ---- Mermaid ---- */
.dw-prose .dw-mermaid {
padding: 12px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
overflow-x: auto;
text-align: center;
}
.dw-prose.ProseMirror[contenteditable="true"] .dw-mermaid {
cursor: pointer;
}
.dw-prose .dw-mermaid svg {
max-width: 100%;
height: auto;
margin: 0 auto;
}
.dw-prose .dw-mermaid__source {
margin: 0;
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
text-align: left;
white-space: pre-wrap;
}
.dw-prose .dw-mermaid__body--error {
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
color: var(--color-danger);
text-align: left;
white-space: pre-wrap;
}
/* ---- Draw.io and Excalidraw drawings ---- */
.dw-prose .dw-diagram {
position: relative;
margin: 0;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: #fff;
overflow: hidden;
}
.dw-prose .dw-diagram__img {
display: block;
max-width: 100%;
margin: 0 auto;
border-radius: 0;
}
.dw-prose .dw-diagram__empty {
margin: 0;
padding: 32px 16px;
text-align: center;
font-family: var(--font-sans);
font-size: var(--text-ui-md);
color: var(--color-ink-muted);
background: var(--color-surface-raised);
cursor: pointer;
}
.dw-prose .dw-diagram__edit {
position: absolute;
top: 8px;
right: 8px;
padding: 2px 10px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface-raised);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-sm);
cursor: pointer;
opacity: 0;
transition: opacity 0.15s;
}
.dw-prose .dw-diagram:hover .dw-diagram__edit,
.dw-prose .dw-diagram__edit:focus-visible {
opacity: 1;
}
@media (hover: none) {
.dw-prose .dw-diagram__edit {
opacity: 1;
}
}
/* The full-screen layer for the Draw.io or Excalidraw editor. */
.dw-diagram-editor {
position: fixed;
inset: 0;
z-index: 100;
display: flex;
flex-direction: column;
background: var(--color-surface);
}
.dw-diagram-editor__frame {
flex: 1;
width: 100%;
border: 0;
}
.dw-diagram-editor__bar {
display: flex;
justify-content: flex-end;
gap: 8px;
padding: 8px 12px;
border-bottom: 1px solid var(--color-line);
}
.dw-diagram-editor__canvas {
flex: 1;
min-height: 0;
}
.dw-diagram-editor__status {
padding: 8px 12px;
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
/* ---- Table of contents ---- */
.dw-prose .dw-toc {
padding: 12px 16px;
border-left: 3px solid var(--color-line);
font-family: var(--font-sans);
font-size: var(--text-ui-md);
}
.dw-prose .dw-toc__title {
margin: 0 0 4px;
font-size: var(--text-ui-xs);
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--color-ink-muted);
}
.dw-prose .dw-toc__list {
list-style: none;
padding: 0;
margin: 0;
}
.dw-prose .dw-toc__list a {
color: var(--color-ink-muted);
text-decoration: none;
}
.dw-prose .dw-toc__list a:hover {
color: var(--color-ink);
text-decoration: underline;
}
.dw-prose .dw-toc__empty {
color: var(--color-ink-faint);
}
/* ---- Toggles ---- */
.dw-prose .dw-toggle {
display: flex;
gap: 4px;
align-items: flex-start;
}
.dw-prose .dw-toggle > button {
flex: none;
display: grid;
place-items: center;
width: 24px;
height: calc(var(--text-doc-body--line-height) * 1em);
border: none;
border-radius: var(--radius-xs);
background: none;
color: var(--color-ink-muted);
cursor: pointer;
}
.dw-prose .dw-toggle > button:hover {
background: var(--color-surface-hover);
color: var(--color-ink);
}
.dw-prose .dw-toggle > button::before {
content: "";
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 7px solid currentColor;
transition: transform 0.12s ease;
}
.dw-prose .dw-toggle.is-open > button::before {
transform: rotate(90deg);
}
.dw-prose .dw-toggle > div {
flex: 1;
min-width: 0;
}
.dw-prose .dw-toggle summary {
display: block;
list-style: none;
font-weight: 600;
}
.dw-prose .dw-toggle summary::-webkit-details-marker {
display: none;
}
.dw-prose .dw-toggle [data-type="detailsContent"] > * + * {
margin-top: 8px;
}
.dw-prose .dw-toggle [data-type="detailsContent"] {
margin-top: 4px;
}
.dw-prose .dw-toggle [data-type="detailsContent"][hidden] {
display: none;
}
/* ---- Embeds and link cards ---- */
.dw-prose .dw-embed {
margin: 0;
}
.dw-prose .dw-embed__frame {
display: block;
width: 100%;
aspect-ratio: 16 / 9;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-sunken);
}
.dw-prose .dw-embed[data-ratio="audio"] .dw-embed__frame {
aspect-ratio: auto;
height: 152px;
}
.dw-prose .dw-embed[data-ratio="tall"] .dw-embed__frame {
aspect-ratio: 4 / 5;
max-height: 80vh;
}
.dw-prose .dw-embed__caption {
margin-top: 4px;
font-family: var(--font-sans);
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
.dw-prose .dw-embed__caption a {
color: inherit;
}
.dw-prose .dw-linkcard {
display: flex;
align-items: stretch;
gap: 12px;
overflow: hidden;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
color: var(--color-ink);
text-decoration: none;
font-family: var(--font-sans);
}
.dw-prose .dw-linkcard:hover {
background: var(--color-surface-hover);
}
.dw-prose .dw-linkcard__text {
display: flex;
flex: 1;
min-width: 0;
flex-direction: column;
gap: 2px;
padding: 10px 14px;
}
.dw-prose .dw-linkcard__title {
font-size: var(--text-ui-md);
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dw-prose .dw-linkcard__desc {
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.dw-prose .dw-linkcard__site {
font-size: var(--text-ui-xs);
color: var(--color-ink-faint);
}
.dw-prose .dw-linkcard__image {
flex: none;
width: 30%;
max-width: 200px;
max-height: 120px;
object-fit: cover;
}
.dw-prose .ProseMirror-selectednode:is(.dw-embed, .dw-linkcard) {
outline: 2px solid var(--color-focus-ring);
outline-offset: 2px;
border-radius: var(--radius-md);
}
/* ---- Block links ---- */
.dw-block-host {
position: relative;
}
.dw-block-handle {
position: absolute;
left: -30px;
display: grid;
place-items: center;
width: 22px;
height: 22px;
border: none;
border-radius: var(--radius-xs);
background: none;
color: var(--color-ink-faint);
cursor: pointer;
}
.dw-block-handle:hover {
background: var(--color-surface-hover);
color: var(--color-ink);
}
/* Phones have no margin to spare and no hover. */
@media (max-width: 640px), (hover: none) {
.dw-block-handle {
display: none;
}
}
/* ---- The floating source editor (math, Mermaid) ---- */
.dw-source {
position: absolute;
z-index: 60;
width: min(32rem, calc(100vw - 16px));
padding: 8px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
box-shadow: var(--dw-shadow-menu);
}
.dw-source__field {
display: block;
width: 100%;
padding: 6px 8px;
border: 1px solid var(--color-line-strong);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-md);
resize: vertical;
}
.dw-source__field--mono {
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
}
.dw-source__field:focus {
outline: 2px solid var(--color-focus-ring);
outline-offset: 1px;
}
.dw-source__actions {
display: flex;
gap: 6px;
margin-top: 8px;
}
.dw-source__btn {
padding: 3px 10px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-sm);
cursor: pointer;
}
.dw-source__btn:hover {
background: var(--color-surface-hover);
}
.dw-source__btn--primary {
border-color: var(--color-primary);
background: var(--color-primary);
color: var(--color-on-primary);
}
.dw-source__btn--primary:hover {
background: var(--color-primary-hover);
}
.dw-source__btn--danger {
color: var(--color-danger);
}