mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Feat: Doubleclick to toggle edit for Markdown (litegraph) (#6560)
## Summary See https://github.com/Comfy-Org/ComfyUI_frontend/pull/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 <github-actions@github.com>
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 141 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 44 KiB |
@@ -509,36 +509,40 @@ body {
|
||||
.comfy-markdown {
|
||||
/* We assign the textarea and the Tiptap editor to the same CSS grid area to stack them on top of one another. */
|
||||
display: grid;
|
||||
}
|
||||
& > textarea,
|
||||
.tiptap {
|
||||
grid-area: 1 / 1 / 2 / 2;
|
||||
}
|
||||
|
||||
.comfy-markdown > textarea {
|
||||
grid-area: 1 / 1 / 2 / 2;
|
||||
}
|
||||
& > textarea {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.comfy-markdown .tiptap {
|
||||
grid-area: 1 / 1 / 2 / 2;
|
||||
background-color: var(--comfy-input-bg);
|
||||
color: var(--input-text);
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
resize: none;
|
||||
border: none;
|
||||
box-sizing: border-box;
|
||||
font-size: var(--comfy-textarea-font-size);
|
||||
height: 100%;
|
||||
padding: 0.5em;
|
||||
}
|
||||
&.editing {
|
||||
& > textarea {
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.comfy-markdown.editing .tiptap {
|
||||
display: none;
|
||||
}
|
||||
.tiptap {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.comfy-markdown .tiptap :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.tiptap {
|
||||
overflow-y: auto;
|
||||
font-size: var(--comfy-textarea-font-size);
|
||||
|
||||
.comfy-markdown .tiptap :last-child {
|
||||
margin-bottom: 0;
|
||||
:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comfy-markdown .tiptap blockquote {
|
||||
|
||||
@@ -2169,7 +2169,7 @@ export class LGraphCanvas
|
||||
}
|
||||
}
|
||||
|
||||
processMouseDown(e: PointerEvent): void {
|
||||
processMouseDown(e: MouseEvent): void {
|
||||
if (
|
||||
this.dragZoomEnabled &&
|
||||
e.ctrlKey &&
|
||||
|
||||
@@ -53,14 +53,7 @@ function addMarkdownWidget(
|
||||
widget.inputEl = inputEl
|
||||
widget.options.minNodeSize = [400, 200]
|
||||
|
||||
inputEl.addEventListener('pointerdown', (event: PointerEvent) => {
|
||||
if (event.button !== 0) {
|
||||
app.canvas.processMouseDown(event)
|
||||
return
|
||||
}
|
||||
if (event.target instanceof HTMLAnchorElement) {
|
||||
return
|
||||
}
|
||||
inputEl.addEventListener('dblclick', () => {
|
||||
inputEl.classList.add('editing')
|
||||
setTimeout(() => {
|
||||
textarea.focus()
|
||||
|
||||
Reference in New Issue
Block a user