Skip to content

Commit 29632e1

Browse files
farnabazlarbish
andauthored
feat(editor): binding extension (#201)
Co-authored-by: Baptiste Leproux <[email protected]>
1 parent 0408b00 commit 29632e1

36 files changed

+577
-174
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
},
9292
"resolutions": {
9393
"@nuxt/content": "https://pkg.pr.new/@nuxt/content@9b4b4f2",
94-
"nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@104",
94+
"nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@b65b98e",
9595
"@vueuse/core": "13.9.0"
9696
},
9797
"packageManager": "[email protected]",

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/src/components/content/ContentEditorTipTap.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { InlineElement } from '../../utils/tiptap/extensions/inline-element'
2929
import { SpanStyle } from '../../utils/tiptap/extensions/span-style'
3030
import { compressTree } from '@nuxt/content/runtime'
3131
import TiptapSpanStylePopover from '../tiptap/TiptapSpanStylePopover.vue'
32+
import { Binding } from '../../utils/tiptap/extensions/binding'
3233
3334
const props = defineProps({
3435
draftItem: {
@@ -203,6 +204,7 @@ const emojiItems: EditorEmojiMenuItem[] = gitHubEmojis.filter(
203204
Slot,
204205
CodeBlock,
205206
Emoji,
207+
Binding,
206208
]"
207209
:placeholder="$t('studio.tiptap.editor.placeholder')"
208210
>

src/app/src/components/form/FormPanelInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function computeValue(formItem: FormItem): unknown {
101101
v-model="(model as string | number)"
102102
:placeholder="placeholder"
103103
:type="inputType"
104+
size="xs"
104105
class="w-full"
105106
/>
106107
</UFormField>

src/app/src/components/form/input/FormInputObject.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function updateValue(key: string, value: string | number) {
4747
>
4848
<UInput
4949
v-model="(entry.value as string | number)"
50+
size="xs"
5051
:placeholder="entry.placeholder"
5152
:type="entry.type"
5253
class="w-full"

src/app/src/components/shared/Collapsible.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const open = defineModel('open', { type: Boolean, default: undefined })
2121
>
2222
<div class="flex items-center justify-between gap-2 w-full">
2323
<div class="flex items-center gap-2">
24-
<div class="flex items-center justify-center size-4 rounded bg-gray-100 dark:bg-gray-800 transition-colors duration-200 group-hover/collapsible:bg-gray-200 dark:group-hover/collapsible:bg-gray-700">
24+
<div class="flex items-center justify-center size-3.5 rounded bg-gray-100 dark:bg-gray-800 transition-colors duration-200 group-hover/collapsible:bg-gray-200 dark:group-hover/collapsible:bg-gray-700">
2525
<UIcon
2626
name="i-lucide-chevron-right"
2727
class="size-2.5 text-gray-500 dark:text-gray-400 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"

src/app/src/components/shared/item/ItemActionsToolbar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import { useI18n } from 'vue-i18n'
1111
const { context, gitProvider } = useStudio()
1212
const { preferences, updatePreference } = useStudioState()
1313
const { t } = useI18n()
14-
const fileInputRef = ref<HTMLInputElement>()
1514
1615
// @ts-expect-error vue-tsc error in cli
1716
const toolbarRef = ref<HTMLElement>()
17+
const fileInputRef = ref<HTMLInputElement>()
18+
1819
const pendingAction = ref<StudioAction<StudioItemActionId> | null>(null)
1920
const loadingAction = ref<StudioAction<StudioItemActionId> | null>(null)
2021

src/app/src/components/tiptap/TiptapComponentProps.vue

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const props = defineProps({
1717
type: Function as PropType<(props: Record<string, unknown>) => void>,
1818
required: true,
1919
},
20+
hideTitle: {
21+
type: Boolean,
22+
default: false,
23+
},
2024
})
2125
2226
const { host } = useStudio()
@@ -119,11 +123,14 @@ function normalizePropsTree(tree: FormTree): FormTree {
119123

120124
<template>
121125
<div
122-
class="p-4 min-w-[400px] max-w-[500px] not-prose overflow-y-auto max-h-[400px] relative"
126+
class="p-3 min-w-[400px] max-w-[500px] not-prose overflow-y-auto max-h-[400px] relative"
123127
@click.stop
124128
>
125129
<!-- Header -->
126-
<div class="text-sm font-mono font-semibold text-highlighted mb-4">
130+
<div
131+
v-if="!hideTitle"
132+
class="text-sm font-mono font-semibold text-highlighted mb-2"
133+
>
127134
{{ titleCase(componentName).replace(/^U /, '') }} properties
128135
</div>
129136

@@ -145,8 +152,8 @@ function normalizePropsTree(tree: FormTree): FormTree {
145152
<div class="w-2/3 flex items-center gap-2">
146153
<!-- Nested form overlay for arrays/objects -->
147154
<template v-if="nestedForm?.key === prop.key">
148-
<div class="fixed inset-0 bg-default z-50 flex flex-col p-4 overflow-y-auto rounded-lg">
149-
<div class="flex items-center justify-between mb-4">
155+
<div class="fixed inset-0 bg-default z-50 flex flex-col p-3 overflow-y-auto rounded-lg">
156+
<div class="flex items-center justify-between mb-2">
150157
<span class="text-sm font-mono font-semibold text-highlighted">
151158
{{ prop.title }}
152159
</span>
@@ -202,6 +209,7 @@ function normalizePropsTree(tree: FormTree): FormTree {
202209
<USwitch
203210
:model-value="Boolean(prop.value)"
204211
:disabled="prop.disabled"
212+
size="xs"
205213
@update:model-value="updateProp(key, $event)"
206214
/>
207215
</template>
@@ -213,7 +221,7 @@ function normalizePropsTree(tree: FormTree): FormTree {
213221
:items="prop.options"
214222
:disabled="prop.disabled"
215223
class="w-full"
216-
size="sm"
224+
size="xs"
217225
@update:model-value="updateProp(key, $event)"
218226
/>
219227
</template>
@@ -226,7 +234,7 @@ function normalizePropsTree(tree: FormTree): FormTree {
226234
:placeholder="getPlaceholder(prop)"
227235
:disabled="prop.disabled"
228236
class="w-full"
229-
size="sm"
237+
size="xs"
230238
@update:model-value="updateProp(key, $event)"
231239
/>
232240
</template>
@@ -238,7 +246,7 @@ function normalizePropsTree(tree: FormTree): FormTree {
238246
:placeholder="getPlaceholder(prop)"
239247
:disabled="prop.disabled"
240248
class="w-full"
241-
size="sm"
249+
size="xs"
242250
@update:model-value="updateProp(key, $event)"
243251
/>
244252
</template>

src/app/src/components/tiptap/TiptapLinkPopover.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function handleKeyDown(event: KeyboardEvent) {
126126
<UButton
127127
icon="i-lucide-corner-down-left"
128128
variant="ghost"
129-
size="sm"
129+
size="xs"
130130
:disabled="!url && !active"
131131
:title="$t('studio.tiptap.link.applyLink')"
132132
@click="setLink"
@@ -141,7 +141,7 @@ function handleKeyDown(event: KeyboardEvent) {
141141
icon="i-lucide-external-link"
142142
color="neutral"
143143
variant="ghost"
144-
size="sm"
144+
size="xs"
145145
:disabled="!url && !active"
146146
:title="$t('studio.tiptap.link.openInNewWindow')"
147147
@click="openLink"
@@ -151,7 +151,7 @@ function handleKeyDown(event: KeyboardEvent) {
151151
icon="i-lucide-trash"
152152
color="neutral"
153153
variant="ghost"
154-
size="sm"
154+
size="xs"
155155
:disabled="!url && !active"
156156
:title="$t('studio.tiptap.link.removeLink')"
157157
@click="removeLink"

src/app/src/components/tiptap/TiptapSpanStylePopover.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function handleKeyDown(event: KeyboardEvent) {
120120
<UButton
121121
icon="i-lucide-corner-down-left"
122122
variant="ghost"
123-
size="sm"
123+
size="xs"
124124
@click="applySpanStyle"
125125
/>
126126
</UTooltip>
@@ -130,7 +130,7 @@ function handleKeyDown(event: KeyboardEvent) {
130130
icon="i-lucide-trash"
131131
color="neutral"
132132
variant="ghost"
133-
size="sm"
133+
size="xs"
134134
:disabled="!active"
135135
@click="removeSpanStyle"
136136
/>

0 commit comments

Comments
 (0)