mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* feat: Show a display menu on hover for mentions that can be cards Mentions that can display as a card show an overflow button on hover, inside the end of the pill or in the top corner of the card. The button opens a menu to switch between the mention and card display, which replaces the selection toolbar for these mentions. * fix: Resolve the mention position on click and hide the button on scroll The menu looks up the mention position when an item is chosen, as edits by collaborators can move it while the menu is open. The button follows the mention when content above it changes and hides when a table is scrolled. * feat: Show the mention display button for a selected mention The button shows for the selected mention as well as the hovered one, so keyboard users can reach it. Touch devices show it for the selected mention only. Only the button takes the pointer, so the fade does not block clicks on short mentions.
247 lines
7.2 KiB
TypeScript
247 lines
7.2 KiB
TypeScript
/**
|
|
* Class names and values used by the editor.
|
|
*/
|
|
export class EditorStyleHelper {
|
|
// Blocks
|
|
|
|
static readonly blockRadius = "6px";
|
|
|
|
/** Corner radius of images and videos */
|
|
static readonly mediaRadius = "2px";
|
|
|
|
/** Corner radius of images and videos when selected */
|
|
static readonly mediaSelectedRadius = "8px";
|
|
|
|
// Images
|
|
|
|
static readonly imageHandle = "image-handle";
|
|
|
|
static readonly imageCaption = "caption";
|
|
|
|
static readonly imagePositionAnchor = "image-position-anchor";
|
|
|
|
/** Node that is displayed while its file uploads */
|
|
static readonly uploadPlaceholder = "upload-placeholder";
|
|
|
|
/** Node that is displayed for the first time while its file uploads */
|
|
static readonly uploadEnter = "upload-enter";
|
|
|
|
/** Status of an upload for assistive technology, not displayed */
|
|
static readonly uploadStatus = "upload-status";
|
|
|
|
/** Node that is hidden while an upload replaces it */
|
|
static readonly uploadReplaced = "upload-replaced";
|
|
|
|
/** Node that has just finished uploading */
|
|
static readonly uploadComplete = "upload-complete";
|
|
|
|
/** Wrapper of an image, around the image element */
|
|
static readonly imageWrapper = "image-wrapper";
|
|
|
|
/** Wrapper of a video, around the video element */
|
|
static readonly videoWrapper = "video-wrapper";
|
|
|
|
/** Wrapper of a PDF preview, around the embedded document */
|
|
static readonly pdfWrapper = "pdf-wrapper";
|
|
|
|
/** Class added to body when resizing images/media */
|
|
static readonly resizeDragging = "resize-dragging";
|
|
|
|
// Headings
|
|
|
|
static readonly headingPositionAnchor = "heading-position-anchor";
|
|
|
|
/** Section number prepended to headings in serialized clipboard HTML */
|
|
static readonly headingPrefix = "heading-prefix";
|
|
|
|
// Comments
|
|
|
|
static readonly comment = "comment-marker";
|
|
|
|
/** Container for the comment indicators shown in the gutter beside a line */
|
|
static readonly commentGutter = "comment-gutter";
|
|
|
|
// Multiplayer
|
|
|
|
/** Remote collaborator's cursor */
|
|
static readonly multiplayerCursor = "ProseMirror-yjs-cursor";
|
|
|
|
/** Remote collaborator's selection */
|
|
static readonly multiplayerSelection = "ProseMirror-yjs-selection";
|
|
|
|
// Code
|
|
|
|
static readonly codeBlock = "code-block";
|
|
|
|
static readonly codeWord = "code-word";
|
|
|
|
/** Toggle button for collapsible code blocks */
|
|
static readonly codeBlockToggle = "code-block-toggle";
|
|
|
|
/** Line number shown in the gutter at the start of each code block line */
|
|
static readonly codeBlockLineNumber = "code-block-line-number";
|
|
|
|
// Mentions
|
|
|
|
/** Attribute on a mention while its hover menu button is shown */
|
|
static readonly mentionMenuTarget = "data-menu-target";
|
|
|
|
// Diffs
|
|
|
|
static readonly diffInsertion = "diff-insertion";
|
|
|
|
static readonly diffDeletion = "diff-deletion";
|
|
|
|
static readonly diffNodeInsertion = "diff-node-insertion";
|
|
|
|
static readonly diffNodeDeletion = "diff-node-deletion";
|
|
|
|
static readonly diffModification = "diff-modification";
|
|
|
|
static readonly diffNodeModification = "diff-node-modification";
|
|
|
|
static readonly diffCurrentChange = "current-diff";
|
|
|
|
// Toggle blocks
|
|
|
|
/** Toggle block wrapper */
|
|
static readonly toggleBlock = "toggle-block";
|
|
|
|
/** Toggle block button */
|
|
static readonly toggleBlockButton = "toggle-block-button";
|
|
|
|
/** Toggle block content area */
|
|
static readonly toggleBlockContent = "toggle-block-content";
|
|
|
|
/** Toggle block head (first child) */
|
|
static readonly toggleBlockHead = "toggle-block-head";
|
|
|
|
/** Toggle block folded state */
|
|
static readonly toggleBlockFolded = "folded";
|
|
|
|
// Notices
|
|
|
|
/** Notice block wrapper */
|
|
static readonly notice = "notice-block";
|
|
|
|
/** Notice block icon */
|
|
static readonly noticeIcon = "icon";
|
|
|
|
/** Notice block content area */
|
|
static readonly noticeContent = "content";
|
|
|
|
// Suggestions
|
|
|
|
/** Trigger character and search term while a suggestion menu is open */
|
|
static readonly suggestionTrigger = "suggestion-trigger";
|
|
|
|
// Checkbox Lists
|
|
|
|
/** Checkbox list wrapper */
|
|
static readonly checklistWrapper = "checklist-wrapper";
|
|
|
|
/** Toggle button for showing/hiding completed items */
|
|
static readonly checklistCompletedToggle = "checklist-completed-toggle";
|
|
|
|
/** State when completed items are hidden */
|
|
static readonly checklistCompletedHidden = "completed-hidden";
|
|
|
|
// Tables
|
|
|
|
/** Table wrapper */
|
|
static readonly table = "table-wrapper";
|
|
|
|
/** Table grip (circle in top left) */
|
|
static readonly tableGrip = "table-grip";
|
|
|
|
/** Table row grip */
|
|
static readonly tableGripRow = "table-grip-row";
|
|
|
|
/** Table column grip */
|
|
static readonly tableGripColumn = "table-grip-column";
|
|
|
|
/** "Plus" to add column on tables */
|
|
static readonly tableAddColumn = "table-add-column";
|
|
|
|
/** "Plus" to add row on tables */
|
|
static readonly tableAddRow = "table-add-row";
|
|
|
|
/** Scrollable area of table */
|
|
static readonly tableScrollable = "table-scrollable";
|
|
|
|
/** Full-width table layout */
|
|
static readonly tableFullWidth = "table-full-width";
|
|
|
|
/** Shadow on the right side of the table */
|
|
static readonly tableShadowRight = "table-shadow-right";
|
|
|
|
/** Shadow on the left side of the table */
|
|
static readonly tableShadowLeft = "table-shadow-left";
|
|
|
|
/** Sticky header state */
|
|
static readonly tableStickyHeader = "table-sticky-header";
|
|
|
|
/** Sticky first column state */
|
|
static readonly tableStickyColumn = "table-sticky-column";
|
|
|
|
/** Drop indicator for table drag and drop */
|
|
static readonly tableDragDropIndicator = "table-drag-drop-indicator";
|
|
|
|
/** Class added to body when dragging table rows/columns */
|
|
static readonly tableDragging = "table-dragging";
|
|
|
|
/** Drag indicator on left side of cell */
|
|
static readonly tableDragIndicatorLeft = "table-drag-indicator-left";
|
|
|
|
/** Drag indicator on right side of cell */
|
|
static readonly tableDragIndicatorRight = "table-drag-indicator-right";
|
|
|
|
/** Drag indicator on top side of cell */
|
|
static readonly tableDragIndicatorTop = "table-drag-indicator-top";
|
|
|
|
/** Drag indicator on bottom side of cell */
|
|
static readonly tableDragIndicatorBottom = "table-drag-indicator-bottom";
|
|
|
|
/** Table row hidden by a filter */
|
|
static readonly tableRowFiltered = "table-row-filtered";
|
|
|
|
/** Button in a header cell that opens the column filter */
|
|
static readonly tableFilterButton = "table-filter-button";
|
|
|
|
/** Bar below a filtered table with the filter summary */
|
|
static readonly tableFilterBar = "table-filter-bar";
|
|
|
|
// Drag and drop
|
|
|
|
/** Line that shows where dragged content will be dropped */
|
|
static readonly dropCursor = "drop-cursor";
|
|
|
|
/** Floating handle shown beside the hovered block to drag it */
|
|
static readonly blockDragHandle = "block-drag-handle";
|
|
|
|
/** Block that the drag handle is currently attached to */
|
|
static readonly dragHandleTarget = "drag-handle-target";
|
|
|
|
/** Block that is being dragged */
|
|
static readonly draggingSource = "dragging-source";
|
|
|
|
// Diagrams
|
|
|
|
/** Container for a rendered Mermaid diagram */
|
|
static readonly mermaidDiagram = "mermaid-diagram-wrapper";
|
|
|
|
// Global
|
|
|
|
/** Minimum padding around editor */
|
|
static readonly padding = 32;
|
|
|
|
/** Table of contents width */
|
|
static readonly tocWidth = 256;
|
|
|
|
/** Width of the document content area */
|
|
static readonly documentWidth = "52em";
|
|
|
|
/** Gutter width for the document (for decorations, etc) */
|
|
static readonly documentGutter = "88px";
|
|
}
|