Skip to content

Commit

Permalink
fix: Style drop cursor for block elements (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
  • Loading branch information
fsbraun and sourcery-ai[bot] authored Dec 28, 2024
1 parent 4d99c7c commit f2fbbac
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions private/css/cms.tiptap.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
flex-flow: column;
height: 100%;
width: 100%;
max-width: 100%; /* for djangocms-admin-style */
max-width: 100%; /* for djangocms-admin-style */

.ProseMirror {
overflow-y: scroll;
padding: 0 0.5rem;

&:focus-visible {
outline: none;
}
Expand All @@ -27,11 +29,13 @@
min-height: 3rem;
border-radius: 3px;
}

&.textarea.fixed .tiptap {
padding-top: 0;
resize: vertical;
overflow-y: auto;
}

position: relative;

.tiptap {
Expand All @@ -40,23 +44,29 @@
outline: 3px solid AccentColor;
outline-offset: 2px;
}

&.resize-cursor {
/* Table resizable? */
cursor: col-resize;
}

a[href] {
cursor: pointer;
}

.fake-selection {
background-color: Highlight;
}

table {
th, td {
position: relative;
}

.selectedCell {
background: Highlight;
}

.column-resize-handle {
top: 0;
bottom: 0;
Expand All @@ -67,20 +77,54 @@
box-shadow: 0 0 2px AccentColor;
}
}

&.ProseMirror-focused {
td, th {
outline: Highlight solid 0.5px;
}
}

& cms-plugin {
pointer-events: auto;

a {
pointer-events: none; /* for text-enabled link plugins */
pointer-events: none; /* for text-enabled link plugins */
}

&.ProseMirror-selectednode > * {
outline: 2px solid #fad507;
outline-offset: 2px;
}
}
}
}

.prosemirror-dropcursor-block {
position: absolute;
background-color: AccentColor !important;
height: 3px !important;
}

.prosemirror-dropcursor-block::before,
.prosemirror-dropcursor-block::after {
content: '';
height: 0 !important;
position: absolute;
border-style: solid;
}

/* Triangle at the left of the dropcursor */
.prosemirror-dropcursor-block::before {
right: 0; /* Position to the left of the dropcursor */
top: -5px; /* Adjust to center vertically */
border-color: transparent AccentColor transparent transparent; /* Triangle pointing left */
border-width: 7px 7px 7px 0; /* Adjust border widths for proper triangle shape */
}

/* Triangle at the bottom of the dropcursor */
.prosemirror-dropcursor-block::after {
left: 0; /* Position to the right of the dropcursor */
top: -5px; /* Adjust to center vertically */
border-color: transparent transparent transparent AccentColor; /* Triangle pointing right */
border-width: 7px 0 7px 7px; /* Adjust border widths for proper triangle shape */
}

0 comments on commit f2fbbac

Please sign in to comment.