Skip to content

Commit df151dc

Browse files
authored
Rhino grid (#613)
* add grid extension * add delete grid button * add button for add grid row * add grid columns * use grid row and col in parent * change to use grid col and row via tailwind * fix image printing * move css * add grid menu * fix focus * add grid icon * add text align icons * add grid vertical align * add column span * remove row support and only use cells and columns * change captions to text-center * add toggle border * reorder menu * clean up * clean up
1 parent 95d0e25 commit df151dc

File tree

10 files changed

+990
-316
lines changed

10 files changed

+990
-316
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { html, svg } from "lit";
2+
3+
function toSvg(path, size = 24) {
4+
return html`
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
aria-hidden="true"
8+
fill="currentColor"
9+
viewBox="0 0 ${size} ${size}"
10+
width="${size}px"
11+
height="${size}px"
12+
part="toolbar__icon"
13+
>
14+
${path}
15+
</svg>
16+
`
17+
}
18+
19+
export const alignLeft = toSvg(
20+
svg`
21+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M384 128C384 145.7 369.7 160 352 160L128 160C110.3 160 96 145.7 96 128C96 110.3 110.3 96 128 96L352 96C369.7 96 384 110.3 384 128zM384 384C384 401.7 369.7 416 352 416L128 416C110.3 416 96 401.7 96 384C96 366.3 110.3 352 128 352L352 352C369.7 352 384 366.3 384 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"/></svg>
22+
`
23+
);
24+
25+
export const alignCenter = toSvg(
26+
svg`
27+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M448 128C448 110.3 433.7 96 416 96L224 96C206.3 96 192 110.3 192 128C192 145.7 206.3 160 224 160L416 160C433.7 160 448 145.7 448 128zM544 256C544 238.3 529.7 224 512 224L128 224C110.3 224 96 238.3 96 256C96 273.7 110.3 288 128 288L512 288C529.7 288 544 273.7 544 256zM96 512C96 529.7 110.3 544 128 544L512 544C529.7 544 544 529.7 544 512C544 494.3 529.7 480 512 480L128 480C110.3 480 96 494.3 96 512zM448 384C448 366.3 433.7 352 416 352L224 352C206.3 352 192 366.3 192 384C192 401.7 206.3 416 224 416L416 416C433.7 416 448 401.7 448 384z"/></svg>
28+
`
29+
);
30+
31+
export const alignRight= toSvg(
32+
svg`
33+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M544 128C544 145.7 529.7 160 512 160L288 160C270.3 160 256 145.7 256 128C256 110.3 270.3 96 288 96L512 96C529.7 96 544 110.3 544 128zM544 384C544 401.7 529.7 416 512 416L288 416C270.3 416 256 401.7 256 384C256 366.3 270.3 352 288 352L512 352C529.7 352 544 366.3 544 384zM96 256C96 238.3 110.3 224 128 224L512 224C529.7 224 544 238.3 544 256C544 273.7 529.7 288 512 288L128 288C110.3 288 96 273.7 96 256zM544 512C544 529.7 529.7 544 512 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L512 480C529.7 480 544 494.3 544 512z"/></svg>
34+
`
35+
);
36+
37+
export const alignJustify= toSvg(
38+
svg`
39+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M544 128C544 110.3 529.7 96 512 96L128 96C110.3 96 96 110.3 96 128C96 145.7 110.3 160 128 160L512 160C529.7 160 544 145.7 544 128zM544 384C544 366.3 529.7 352 512 352L128 352C110.3 352 96 366.3 96 384C96 401.7 110.3 416 128 416L512 416C529.7 416 544 401.7 544 384zM96 256C96 273.7 110.3 288 128 288L512 288C529.7 288 544 273.7 544 256C544 238.3 529.7 224 512 224L128 224C110.3 224 96 238.3 96 256zM544 512C544 494.3 529.7 480 512 480L128 480C110.3 480 96 494.3 96 512C96 529.7 110.3 544 128 544L512 544C529.7 544 544 529.7 544 512z"/></svg>
40+
`
41+
);
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
custom-rhino-editor table {
2+
border-collapse: collapse;
3+
margin: 0;
4+
overflow: hidden;
5+
table-layout: fixed;
6+
width: 100%;
7+
}
8+
custom-rhino-editor table td, custom-rhino-editor table th {
9+
border: 2px solid #ced4da;
10+
box-sizing: border-box;
11+
min-width: 1em;
12+
padding: 3px 5px;
13+
position: relative;
14+
vertical-align: top;
15+
}
16+
custom-rhino-editor table td > *, custom-rhino-editor table th > * {
17+
margin-bottom: 0;
18+
}
19+
custom-rhino-editor table th {
20+
background-color: #f1f3f5;
21+
font-weight: bold;
22+
text-align: left;
23+
}
24+
custom-rhino-editor table .selectedCell:after {
25+
background: rgba(200, 200, 255, 0.4);
26+
content: "";
27+
left: 0;
28+
right: 0;
29+
top: 0;
30+
bottom: 0;
31+
pointer-events: none;
32+
position: absolute;
33+
z-index: 2;
34+
}
35+
custom-rhino-editor table .column-resize-handle {
36+
background-color: #adf;
37+
bottom: -2px;
38+
position: absolute;
39+
right: -2px;
40+
pointer-events: none;
41+
top: 0;
42+
width: 4px;
43+
}
44+
custom-rhino-editor table p {
45+
margin: 0;
46+
}
47+
custom-rhino-editor a {
48+
text-decoration: underline;
49+
color: #2563eb; /* Tailwind blue-600 */
50+
}
51+
52+
custom-rhino-editor a:hover {
53+
color: #1e40af; /* Tailwind blue-800 */
54+
}
55+
56+
/* Dashed border for grid cells that have hasBorder=false (editor only) */
57+
custom-rhino-editor .grid-cell-editor[hasborder="false"] {
58+
border: 2px dashed #ced4da; }

0 commit comments

Comments
 (0)