Skip to content

Commit 6e0c343

Browse files
committed
Merge branch 'main' into feat/git-blob
2 parents 5095536 + 8e93bea commit 6e0c343

File tree

18 files changed

+1095
-354
lines changed

18 files changed

+1095
-354
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,28 @@
4141
"@nuxt/eslint-config": "latest",
4242
"@nuxt/kit": "^4.1.2",
4343
"@nuxt/module-builder": "latest",
44-
"@nuxt/ui": "4.0.0-alpha.2",
44+
"@nuxt/ui": "4.0.0",
4545
"@octokit/types": "^15.0.0",
4646
"@tailwindcss/typography": "latest",
4747
"@vitejs/plugin-vue": "^6.0.1",
4848
"eslint": "^9.36.0",
49-
"modern-monaco": "^0.2.1",
49+
"modern-monaco": "^0.2.2",
5050
"nuxt-studio": "workspace:*",
51-
"vite": "^7.1.6",
51+
"vite": "^7.1.7",
5252
"vite-plugin-dts": "^4.5.4",
5353
"vite-plugin-libcss": "^1.1.2",
5454
"vitest": "^3.2.4",
55-
"vue": "^3.5.21",
55+
"vue": "^3.5.22",
5656
"vue-router": "^4.5.1",
57-
"vue-tsc": "^3.0.7",
58-
"zod": "^4.1.9"
57+
"vue-tsc": "^3.1.0",
58+
"zod": "^4.1.11"
5959
},
6060
"resolutions": {
6161
"@nuxt/content": "https://pkg.pr.new/@nuxt/content@22409fe",
6262
"@nuxtjs/mdc": "https://pkg.pr.new/@nuxtjs/mdc@61af819",
6363
"remark-mdc": "npm:[email protected]"
6464
},
65-
"packageManager": "[email protected].0",
65+
"packageManager": "[email protected].1",
6666
"dependencies": {
6767
"@nuxtjs/mdc": "https://pkg.pr.new/@nuxtjs/mdc@61af819",
6868
"@nuxtlabs/monarch-mdc": "^0.8.1",
File renamed without changes.
File renamed without changes.

playground/docus/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build": "nuxt build --extends docus"
77
},
88
"dependencies": {
9-
"docus": "https://pkg.pr.new/docus@db0ec99",
9+
"docus": "^5.1.0",
1010
"better-sqlite3": "^12.2.0",
1111
"nuxt": "latest",
1212
"@nuxt/content": "latest",

pnpm-lock.yaml

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

src/app/src/App.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function detectActiveDocuments() {
2323
})
2424
}
2525
26-
async function onContentSelect(id: string) {
26+
async function editContentFile(id: string) {
2727
await documentTree.selectItemById(id)
2828
ui.openPanel(StudioFeature.Content)
2929
}
@@ -59,19 +59,20 @@ host.on.mounted(() => {
5959
>
6060
<UButton
6161
icon="i-lucide-panel-left-open"
62-
size="lg"
63-
color="primary"
64-
class="shadow-lg"
62+
size="sm"
63+
color="neutral"
64+
class="shadow"
6565
@click="ui.panels.content = true"
6666
/>
6767
<UButton
6868
v-if="activeDocuments.length === 1"
69-
icon="i-lucide-file-text"
70-
size="lg"
69+
icon="i-lucide-pen"
70+
size="sm"
71+
color="neutral"
7172
variant="outline"
72-
label="Edit This Page"
73-
class="shadow-lg bg-white hover:bg-gray-100"
74-
@click="onContentSelect(activeDocuments[0].id)"
73+
label="Edit this page"
74+
class="shadow"
75+
@click="editContentFile(activeDocuments[0].id)"
7576
/>
7677
</div>
7778
</UApp>

src/app/src/components/panel/base/PanelBaseFooter.vue

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,43 +34,47 @@ const userMenuItems = computed(() => [
3434
</script>
3535

3636
<template>
37-
<UFooter class="h-var(--ui-footer-height) sticky bottom-0 bg-white">
37+
<UFooter
38+
class="h-var(--ui-footer-height) sticky bottom-0 bg-white"
39+
:ui="{ container: 'px-2 sm:px-2 lg:px-2', right: 'gap-0' }"
40+
>
3841
<template #left>
3942
<UDropdownMenu
4043
:portal="false"
4144
:items="userMenuItems"
42-
:ui="{ slots: { content: 'w-full' } }"
43-
placeholder="Select a content"
45+
:ui="{ content: 'w-full' }"
46+
size="xs"
4447
>
4548
<UButton
4649
color="neutral"
4750
variant="ghost"
48-
size="xs"
49-
>
50-
<UAvatar
51-
:src="user?.avatar"
52-
size="xs"
53-
/>
54-
<span>{{ user?.name }}</span>
55-
</UButton>
51+
size="sm"
52+
:avatar="{ src: user?.avatar, alt: user?.name, size: '2xs' }"
53+
class="px-2 font-medium"
54+
:label="user?.name"
55+
/>
5656
</UDropdownMenu>
5757
</template>
5858

5959
<template #right>
60-
<UTooltip :text="uiConfig.syncEditorAndRoute ? 'Disable synchronization between editor and host' : 'Enable synchronization between editor and host'">
60+
<UTooltip
61+
:text="uiConfig.syncEditorAndRoute ? 'Unlink editor and preview' : 'Link editor and preview'"
62+
:delay-duration="0"
63+
>
6164
<UButton
6265
icon="i-lucide-arrow-left-right"
63-
variant="link"
64-
:color="uiConfig.syncEditorAndRoute ? 'success' : 'neutral'"
65-
size="md"
66+
variant="ghost"
67+
:color="uiConfig.syncEditorAndRoute ? 'info' : 'neutral'"
68+
:class="!uiConfig.syncEditorAndRoute && 'opacity-50'"
69+
size="sm"
6670
@click="uiConfig.syncEditorAndRoute = !uiConfig.syncEditorAndRoute"
6771
/>
6872
</UTooltip>
6973
<UButton
7074
icon="i-lucide-panel-left-close"
71-
variant="link"
75+
variant="ghost"
7276
color="neutral"
73-
size="md"
77+
size="sm"
7478
@click="ui.closePanels()"
7579
/>
7680
</template>

src/app/src/components/panel/content/editor/PanelContentEditorCode.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script setup lang="ts">
22
import { onMounted, ref, shallowRef, watch } from 'vue'
33
import type { DatabasePageItem, DraftItem } from '../../../../types'
4+
import { DraftStatus } from '../../../../types/draft'
45
import type { PropType } from 'vue'
5-
import { setupMonaco, type Editor } from '../../../../utils/monaco'
6+
import { setupMonaco, setupSuggestion, type Editor } from '../../../../utils/monaco/index'
67
import { generateContentFromDocument, generateDocumentFromContent, pickReservedKeysFromDocument } from '../../../../utils/content'
8+
import { useStudio } from '../../../../composables/useStudio'
79
810
const props = defineProps({
911
draftItem: {
@@ -18,15 +20,18 @@ const props = defineProps({
1820
})
1921
2022
const document = defineModel<DatabasePageItem>()
23+
const { mediaTree, host } = useStudio()
2124
2225
const editor = shallowRef<Editor.IStandaloneCodeEditor | null>(null)
2326
const editorRef = ref()
2427
const content = ref<string>('')
2528
const currentDocumentId = ref<string | null>(null)
29+
const localStatus = ref<DraftStatus>(props.draftItem.status)
2630
2731
// Trigger on action events
28-
watch(() => props.draftItem.status, () => {
29-
if (editor.value) {
32+
watch(() => props.draftItem.status, (newStatus) => {
33+
if (editor.value && newStatus !== localStatus.value) {
34+
localStatus.value = newStatus
3035
setContent(props.draftItem.modified as DatabasePageItem)
3136
}
3237
})
@@ -40,6 +45,7 @@ watch(() => document.value?.id, async () => {
4045
4146
onMounted(async () => {
4247
const monaco = await setupMonaco()
48+
setupSuggestion(monaco.monaco, host.meta.components(), mediaTree.root.value)
4349
4450
// create a Monaco editor instance
4551
editor.value = monaco.createEditor(editorRef.value, {
@@ -70,6 +76,10 @@ onMounted(async () => {
7076
content.value = newContent
7177
7278
generateDocumentFromContent(document.value!.id, content.value).then((doc) => {
79+
// Update local status
80+
localStatus.value = DraftStatus.Updated
81+
82+
// Update document
7383
document.value = {
7484
...pickReservedKeysFromDocument(props.draftItem.original as DatabasePageItem || document.value!),
7585
...doc,
@@ -86,7 +96,11 @@ function setContent(document: DatabasePageItem) {
8696
content.value = md || ''
8797
8898
if (editor.value && editor.value.getModel()?.getValue() !== md) {
99+
// Keep the cursor position
100+
const position = editor.value.getPosition()
89101
editor.value.getModel()?.setValue(md || '')
102+
// Restore the cursor position
103+
position && editor.value.setPosition(position)
90104
}
91105
92106
currentDocumentId.value = document.id

src/app/src/composables/useHooks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ import { createSharedComposable } from '@vueuse/core'
22
import { createHooks } from 'hookable'
33

44
export const useHooks = createSharedComposable(() => {
5-
return createHooks()
5+
return createHooks<{
6+
'studio:draft:document:updated': () => void
7+
'studio:draft:media:updated': () => void
8+
}>()
69
})

src/app/src/composables/useMonacoDiff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// import { computed, watch, unref } from 'vue'
22
// import type { Ref } from 'vue'
33
// import type { editor as Editor } from 'modern-monaco/editor-core'
4-
// import { setupMonaco, setupTheme, baseEditorOptions } from '../utils/monaco'
4+
// import { setupMonaco, setupTheme, baseEditorOptions } from '../utils/monaco/index'
55

66
// export function useMonacoDiff(target: Ref, options: { original: string, modified: string, language: string, renderSideBySide?: boolean }) {
77
// let monaco: Awaited<ReturnType<typeof setupMonaco>>

0 commit comments

Comments
 (0)