Skip to content

Commit f2fbbac

Browse files
fix: Style drop cursor for block elements (#45)
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 4d99c7c commit f2fbbac

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

private/css/cms.tiptap.css

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
flex-flow: column;
1010
height: 100%;
1111
width: 100%;
12-
max-width: 100%; /* for djangocms-admin-style */
12+
max-width: 100%; /* for djangocms-admin-style */
13+
1314
.ProseMirror {
1415
overflow-y: scroll;
1516
padding: 0 0.5rem;
17+
1618
&:focus-visible {
1719
outline: none;
1820
}
@@ -27,11 +29,13 @@
2729
min-height: 3rem;
2830
border-radius: 3px;
2931
}
32+
3033
&.textarea.fixed .tiptap {
3134
padding-top: 0;
3235
resize: vertical;
3336
overflow-y: auto;
3437
}
38+
3539
position: relative;
3640

3741
.tiptap {
@@ -40,23 +44,29 @@
4044
outline: 3px solid AccentColor;
4145
outline-offset: 2px;
4246
}
47+
4348
&.resize-cursor {
4449
/* Table resizable? */
4550
cursor: col-resize;
4651
}
52+
4753
a[href] {
4854
cursor: pointer;
4955
}
56+
5057
.fake-selection {
5158
background-color: Highlight;
5259
}
60+
5361
table {
5462
th, td {
5563
position: relative;
5664
}
65+
5766
.selectedCell {
5867
background: Highlight;
5968
}
69+
6070
.column-resize-handle {
6171
top: 0;
6272
bottom: 0;
@@ -67,20 +77,54 @@
6777
box-shadow: 0 0 2px AccentColor;
6878
}
6979
}
80+
7081
&.ProseMirror-focused {
7182
td, th {
7283
outline: Highlight solid 0.5px;
7384
}
7485
}
86+
7587
& cms-plugin {
7688
pointer-events: auto;
89+
7790
a {
78-
pointer-events: none; /* for text-enabled link plugins */
91+
pointer-events: none; /* for text-enabled link plugins */
7992
}
93+
8094
&.ProseMirror-selectednode > * {
8195
outline: 2px solid #fad507;
8296
outline-offset: 2px;
8397
}
8498
}
8599
}
86100
}
101+
102+
.prosemirror-dropcursor-block {
103+
position: absolute;
104+
background-color: AccentColor !important;
105+
height: 3px !important;
106+
}
107+
108+
.prosemirror-dropcursor-block::before,
109+
.prosemirror-dropcursor-block::after {
110+
content: '';
111+
height: 0 !important;
112+
position: absolute;
113+
border-style: solid;
114+
}
115+
116+
/* Triangle at the left of the dropcursor */
117+
.prosemirror-dropcursor-block::before {
118+
right: 0; /* Position to the left of the dropcursor */
119+
top: -5px; /* Adjust to center vertically */
120+
border-color: transparent AccentColor transparent transparent; /* Triangle pointing left */
121+
border-width: 7px 7px 7px 0; /* Adjust border widths for proper triangle shape */
122+
}
123+
124+
/* Triangle at the bottom of the dropcursor */
125+
.prosemirror-dropcursor-block::after {
126+
left: 0; /* Position to the right of the dropcursor */
127+
top: -5px; /* Adjust to center vertically */
128+
border-color: transparent transparent transparent AccentColor; /* Triangle pointing right */
129+
border-width: 7px 0 7px 7px; /* Adjust border widths for proper triangle shape */
130+
}

0 commit comments

Comments
 (0)