feat: add image width height adaption and rotation
This commit is contained in:
1 parent
20eb94d7c0
commit
f79be768f9
4 files changed
+289
-74
No files matched your search
+64
-9
@@ -147,20 +147,26 @@
|
||||
margin-bottom: 0.212cm;
|
||||
}
|
||||
|
||||
/* Inline, as-character images (image.ts). The span is the node view wrapper; it
|
||||
carries selection chrome and positions the corner resize handles. */
|
||||
/* Inline, as-character images (image.ts). The wrapper reserves the rotated bounding
|
||||
box; the rotor holds the <img>, resize handles and rotate grip, rotating together. */
|
||||
.paper .tiptap .image-node {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
/* sit on the text baseline like a tall character, no descender gap */
|
||||
vertical-align: bottom;
|
||||
line-height: 0;
|
||||
}
|
||||
.paper .tiptap .image-node img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
.paper .tiptap .image-rotor {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.paper .tiptap .image-node.image-selected img {
|
||||
.paper .tiptap .image-rotor img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.paper .tiptap .image-node.image-selected .image-rotor img {
|
||||
outline: 2px solid var(--accent, #3b82f6);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
@@ -174,13 +180,62 @@
|
||||
border-radius: 50%;
|
||||
z-index: 30;
|
||||
}
|
||||
.paper .tiptap .image-node.image-selected .image-resize-handle {
|
||||
.paper .tiptap .image-node.image-selected .image-resize-handle,
|
||||
.paper .tiptap .image-node.image-selected .image-rotate-handle {
|
||||
display: block;
|
||||
}
|
||||
.paper .tiptap .image-resize-nw { top: -5px; left: -5px; cursor: nwse-resize; }
|
||||
.paper .tiptap .image-resize-n { top: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
|
||||
.paper .tiptap .image-resize-ne { top: -5px; right: -5px; cursor: nesw-resize; }
|
||||
.paper .tiptap .image-resize-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
|
||||
.paper .tiptap .image-resize-e { top: 50%; right: -5px; margin-top: -5px; cursor: ew-resize; }
|
||||
.paper .tiptap .image-resize-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
|
||||
.paper .tiptap .image-resize-s { bottom: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
|
||||
.paper .tiptap .image-resize-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
|
||||
.paper .tiptap .image-resize-w { top: 50%; left: -5px; margin-top: -5px; cursor: ew-resize; }
|
||||
/* Rotate grip floats above top-centre with a short connector line; the icon is a
|
||||
circular rotation arrow (like Word). */
|
||||
.paper .tiptap .image-rotate-handle {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: -28px;
|
||||
left: 50%;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: -8px;
|
||||
background: #fff center / 11px 11px no-repeat
|
||||
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-2.6-6.4'/%3E%3Cpath d='M21 4v5h-5'/%3E%3C/svg%3E");
|
||||
border: 1px solid var(--accent, #3b82f6);
|
||||
border-radius: 50%;
|
||||
cursor: grab;
|
||||
z-index: 31;
|
||||
}
|
||||
.paper .tiptap .image-rotate-handle::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
height: 13px;
|
||||
margin-left: -0.5px;
|
||||
background: var(--accent, #3b82f6);
|
||||
}
|
||||
/* Live size readout while resizing. */
|
||||
.paper .tiptap .image-size-badge {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 2px 7px;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
border-radius: 4px;
|
||||
pointer-events: none;
|
||||
z-index: 32;
|
||||
}
|
||||
|
||||
/* Tab stops every 1.25cm, matching ODF's default tab interval. */
|
||||
.paper .tiptap {
|
||||
|
||||
Reference in new issue
Block a user