Skip to content

Commit 4cfa5b4

Browse files
DrJKLgithub-actions
andauthored
Feat: Doubleclick to toggle edit for Markdown (litegraph) (#6560)
## Summary See #6537, but for litegraph widget. Doesn't allow dragging the node through the rendered markdown yet, that would be more complicated (DOMWidget complication) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6560-Feat-Doubleclick-to-toggle-edit-for-Markdown-litegraph-2a06d73d36508189bf6eedd7cdeba6db) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <[email protected]>
1 parent a10c01d commit 4cfa5b4

File tree

5 files changed

+31
-34
lines changed

5 files changed

+31
-34
lines changed
1002 Bytes
Loading
1.04 KB
Loading

packages/design-system/src/css/style.css

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -509,36 +509,40 @@ body {
509509
.comfy-markdown {
510510
/* We assign the textarea and the Tiptap editor to the same CSS grid area to stack them on top of one another. */
511511
display: grid;
512-
}
512+
& > textarea,
513+
.tiptap {
514+
grid-area: 1 / 1 / 2 / 2;
515+
}
513516

514-
.comfy-markdown > textarea {
515-
grid-area: 1 / 1 / 2 / 2;
516-
}
517+
& > textarea {
518+
opacity: 0;
519+
pointer-events: none;
520+
}
517521

518-
.comfy-markdown .tiptap {
519-
grid-area: 1 / 1 / 2 / 2;
520-
background-color: var(--comfy-input-bg);
521-
color: var(--input-text);
522-
overflow: hidden;
523-
overflow-y: auto;
524-
resize: none;
525-
border: none;
526-
box-sizing: border-box;
527-
font-size: var(--comfy-textarea-font-size);
528-
height: 100%;
529-
padding: 0.5em;
530-
}
522+
&.editing {
523+
& > textarea {
524+
opacity: 1;
525+
pointer-events: all;
526+
}
531527

532-
.comfy-markdown.editing .tiptap {
533-
display: none;
534-
}
528+
.tiptap {
529+
opacity: 0;
530+
pointer-events: none;
531+
}
532+
}
535533

536-
.comfy-markdown .tiptap :first-child {
537-
margin-top: 0;
538-
}
534+
.tiptap {
535+
overflow-y: auto;
536+
font-size: var(--comfy-textarea-font-size);
539537

540-
.comfy-markdown .tiptap :last-child {
541-
margin-bottom: 0;
538+
:first-child {
539+
margin-top: 0;
540+
}
541+
542+
:last-child {
543+
margin-bottom: 0;
544+
}
545+
}
542546
}
543547

544548
.comfy-markdown .tiptap blockquote {

src/lib/litegraph/src/LGraphCanvas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ export class LGraphCanvas
21692169
}
21702170
}
21712171

2172-
processMouseDown(e: PointerEvent): void {
2172+
processMouseDown(e: MouseEvent): void {
21732173
if (
21742174
this.dragZoomEnabled &&
21752175
e.ctrlKey &&

src/renderer/extensions/vueNodes/widgets/composables/useMarkdownWidget.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,7 @@ function addMarkdownWidget(
5353
widget.inputEl = inputEl
5454
widget.options.minNodeSize = [400, 200]
5555

56-
inputEl.addEventListener('pointerdown', (event: PointerEvent) => {
57-
if (event.button !== 0) {
58-
app.canvas.processMouseDown(event)
59-
return
60-
}
61-
if (event.target instanceof HTMLAnchorElement) {
62-
return
63-
}
56+
inputEl.addEventListener('dblclick', () => {
6457
inputEl.classList.add('editing')
6558
setTimeout(() => {
6659
textarea.focus()

0 commit comments

Comments
 (0)