Skip to content

Commit 8044281

Browse files
authored
Merge pull request #19 from AtomGraph/feature/nested-drag-drop
Extend drag-and-drop to nested blocks via the content model
2 parents d979317 + 0c443f8 commit 8044281

18 files changed

Lines changed: 725 additions & 71 deletions

CLAUDE.md

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ RDFa extraction and the document canonicalization are all XSLT.
77

88
- **Structured-block editing** of any number of `.rdfa-editor-content` regions (p, h1–h3, lists, blockquote,
99
pre, figure): Enter splits, Backspace merges, toolbar for block types / inline
10-
formatting / links / figures, drag-handle and Alt+Arrow reordering, HTML paste through
11-
a sanitizing canonicalization pipeline, unified snapshot undo/redo with caret
12-
restoration.
10+
formatting / links / figures, drag-handle and Alt+Arrow reordering — nested blocks
11+
carry their own handles and drop wherever the XHTML content model admits them (out of
12+
a list item or quote, into a table cell) — HTML paste through a sanitizing
13+
canonicalization pipeline, unified snapshot undo/redo with caret restoration.
1314
- **RDFa annotation**: right-click a selection to assert a statement (S/P/O framing,
1415
vocabulary dropdowns fed by plain ontology RDF/XML files); right-click an annotation
1516
to edit or remove it.

index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ <h2>Try it yourself</h2>
244244
<li>Type a sentence, then press <strong>Enter</strong> to start a new block.</li>
245245
<li>Select a few words, then <strong>right-click</strong> to tag them with meaning.</li>
246246
<li>Use the toolbar to add a heading, list, image or table.</li>
247-
<li>Hover a block and drag the <strong></strong> handle to reorder it.</li>
247+
<li>Hover a block and drag the <strong></strong> handle to reorder it —
248+
even into a table cell.</li>
249+
<li>Hover the quote above: the paragraph <em>inside</em> it has its own
250+
handle, so you can drag it out of the quote.</li>
248251
</ol>
249252

250253
<h2>Learn more</h2>
@@ -314,7 +317,11 @@ <h4>Adding meaning (RDFa)</h4>
314317

315318
<h4>Reordering</h4>
316319
<p>Hover over a block and drag the <strong></strong> handle that appears in
317-
the left margin to move it.</p>
320+
the left margin to move it. Blocks nested inside a list item, a quote or
321+
a table cell have handles of their own, at their own indent — a drop
322+
lands wherever the document structure allows it: next to another block,
323+
<strong>into a table cell</strong>, or — dropped in the page's left
324+
gutter — out at the top level.</p>
318325

319326
<h4>Seeing the result</h4>
320327
<p><strong>Source</strong> (in the toolbar) shows the clean, canonical

rdfa-editor.css

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@
7474
position: relative;
7575
}
7676

77+
/* nested draggable blocks position their own handle (chrome is their first
78+
child); handles stack per nesting level, each at its block's own indent */
79+
.rdfa-editor-content *:has(> [data-role="chrome"]) {
80+
position: relative;
81+
}
82+
7783
/* invisible gutter strip: keeps the block hovered while the pointer
7884
travels to the drag handle, which sits outside the block box */
7985
.rdfa-editor-content > *::before {
@@ -85,6 +91,27 @@
8591
width: 2.25em;
8692
}
8793

94+
/* nested blocks get a narrower gutter, inside the parent's indentation */
95+
.rdfa-editor-content > * *:has(> [data-role="chrome"])::before {
96+
content: '';
97+
position: absolute;
98+
left: -1.5em;
99+
top: 0;
100+
bottom: 0;
101+
width: 1.5em;
102+
}
103+
104+
/* a blockquote has no intrinsic child indentation, so its handle and its first
105+
block's handle would coincide; the editing view indents quote content to give
106+
each nesting level its own gutter column (lists and cells indent natively).
107+
The quote bar (Markdown/Bootstrap convention) makes the container visible -
108+
a normalized blockquote > p would otherwise read as a plain paragraph */
109+
.rdfa-editor-content blockquote {
110+
padding-left: 2em;
111+
border-left: 4px solid #e0e0e0;
112+
color: #616161;
113+
}
114+
88115
/* the editing-DOM run wrapper (mixed flow content, e.g. <li>text<ul>...) renders
89116
like the bare inline run it stands for; unwrapped again at canonicalization */
90117
.rdfa-editor-content p.rdfa-editor-run {
@@ -156,23 +183,28 @@
156183
border: none;
157184
}
158185

159-
.rdfa-editor-content > *:hover > [data-role="chrome"] {
186+
.rdfa-editor-content *:hover > [data-role="chrome"] {
160187
visibility: visible;
161188
}
162189

163-
/* Drag-and-drop feedback (v6 conventions) */
164-
.rdfa-editor-content > .dragging {
190+
/* Drag-and-drop feedback (v6 conventions) - any nesting depth */
191+
.rdfa-editor-content .dragging {
165192
opacity: 0.4;
166193
}
167194

168-
.rdfa-editor-content > .drop-before {
195+
.rdfa-editor-content .drop-before {
169196
box-shadow: 0 -3px 0 0 #2196f3;
170197
}
171198

172-
.rdfa-editor-content > .drop-after {
199+
.rdfa-editor-content .drop-after {
173200
box-shadow: 0 3px 0 0 #2196f3;
174201
}
175202

203+
/* dropping INTO a cell highlights the cell itself, not an edge */
204+
.rdfa-editor-content .drop-into {
205+
box-shadow: inset 0 0 0 2px #2196f3;
206+
}
207+
176208
/* Editor toolbar (injected into the navbar) */
177209
#edit-toolbar {
178210
order: -1;

0 commit comments

Comments
 (0)