Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Style drop cursor for block elements #45

Merged
merged 18 commits into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */
}
Loading