Skip to content

Commit fddebd4

Browse files
authored
Feat: Nicer click behavior for the Markdown Widget (#6537)
## Summary Double click instead of single to edit. No longer changes background color dramatically on hover. <!-- Add screenshots or video recording to help explain your changes --> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6537-Feat-Nicer-click-behavior-for-the-Markdown-Widget-29f6d73d365081a49119fcc2cc86fc11) by [Unito](https://www.unito.io)
1 parent 704de20 commit fddebd4

File tree

3 files changed

+6
-41
lines changed

3 files changed

+6
-41
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ e3bb29ceb8174b8bbca9e48ec7d42cd540f40efa
2525

2626
# [refactor] Improve updates/notifications domain organization (#5590)
2727
27ab355f9c73415dc39f4d3f512b02308f847801
28+
29+
# Migrate Tailwind styles to design-system package
30+
9f19d8fb4bd22518879343b49c05634dca777df0

src/renderer/extensions/vueNodes/widgets/components/WidgetMarkdown.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -369,32 +369,6 @@ Another line with more content.`
369369
})
370370
})
371371

372-
describe('Styling and Layout', () => {
373-
it('applies widget-markdown class to container', () => {
374-
const widget = createMockWidget('# Test')
375-
const wrapper = mountComponent(widget, '# Test')
376-
377-
const container = wrapper.find('.widget-markdown')
378-
expect(container.exists()).toBe(true)
379-
expect(container.classes()).toContain('relative')
380-
expect(container.classes()).toContain('w-full')
381-
expect(container.classes()).toContain('cursor-text')
382-
})
383-
384-
it('applies overflow handling to display mode', () => {
385-
const widget = createMockWidget(
386-
'# Long Content\n' + 'Content '.repeat(100)
387-
)
388-
const wrapper = mountComponent(
389-
widget,
390-
'# Long Content\n' + 'Content '.repeat(100)
391-
)
392-
393-
const displayDiv = wrapper.find('.comfy-markdown-content')
394-
expect(displayDiv.classes()).toContain('overflow-y-auto')
395-
})
396-
})
397-
398372
describe('Focus Management', () => {
399373
it('creates textarea reference when entering edit mode', async () => {
400374
const widget = createMockWidget('# Test')

src/renderer/extensions/vueNodes/widgets/components/WidgetMarkdown.vue

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div
3-
class="widget-expands widget-markdown relative w-full cursor-text"
4-
@click="startEditing"
3+
class="widget-expands widget-markdown relative w-full"
4+
@dblclick="startEditing"
55
>
66
<!-- Display mode: Rendered markdown -->
77
<div
8-
class="comfy-markdown-content lod-toggle h-full min-h-[60px] w-full overflow-y-auto rounded-lg px-4 py-2 text-sm hover:bg-[var(--p-content-hover-background)]"
8+
class="comfy-markdown-content lod-toggle size-full min-h-[60px] overflow-y-auto rounded-lg px-4 py-2 text-sm"
99
:class="isEditing === false ? 'visible' : 'invisible'"
1010
v-html="renderedHtml"
1111
/>
@@ -83,15 +83,3 @@ const handleBlur = () => {
8383
isEditing.value = false
8484
}
8585
</script>
86-
87-
<style scoped>
88-
.widget-markdown {
89-
background-color: var(--p-muted-color);
90-
border: 1px solid var(--p-border-color);
91-
border-radius: var(--p-border-radius);
92-
}
93-
94-
.comfy-markdown-content:hover {
95-
background-color: var(--p-content-hover-background);
96-
}
97-
</style>

0 commit comments

Comments
 (0)