diff --git a/src/pages/NoteEditorPage.vue b/src/pages/NoteEditorPage.vue index 6dfe30d..1e209dd 100644 --- a/src/pages/NoteEditorPage.vue +++ b/src/pages/NoteEditorPage.vue @@ -3,11 +3,6 @@
- -
- -
-
@@ -64,7 +59,6 @@ const isEditing = !!props.noteId const existingNote = isEditing ? store.notes.find(n => n.id === props.noteId) : null // Initialize state with existing note data or empty strings -const title = ref(existingNote?.title || '') const content = ref(existingNote?.content || '') const showAlert = ref(false) @@ -94,29 +88,20 @@ const formattedTime = computed(() => { const wordCount = computed(() => { // 移除HTML标签计算字数 const textContent = content.value.replace(/<[^>]*>/g, '') - return (title.value.length || 0) + (textContent.length || 0) + return textContent.length || 0 }) // 处理保存 const handleSave = async () => { - // Validate input - if (!title.value.trim()) { - // In a full implementation, show an alert or toast - console.log('Validation error: Please enter a note title.') - return - } - try { if (isEditing && existingNote) { // Update existing note await store.updateNote(props.noteId, { - title: title.value, content: content.value, }) } else { // Create new note await store.addNote({ - title: title.value, content: content.value, isStarred: false, }) @@ -133,7 +118,7 @@ const handleSave = async () => { // 处理取消 const handleCancel = () => { // Check if there are unsaved changes - const hasUnsavedChanges = title.value !== (existingNote?.title || '') || content.value !== (existingNote?.content || '') + const hasUnsavedChanges = content.value !== (existingNote?.content || '') if (hasUnsavedChanges) { showAlert.value = true @@ -142,8 +127,6 @@ const handleCancel = () => { } } - - const setShowAlert = value => { showAlert.value = value } @@ -182,23 +165,6 @@ const setShowAlert = value => { height: 24px; } -.title-input-container { - padding: 16px; - border-bottom: 1px solid var(--border); - background-color: var(--background-card); -} - -.title-input { - width: 100%; - font-size: 22px; - font-weight: 600; - color: var(--note-title); - background-color: transparent; - border: none; - outline: none; - padding: 0; -} - .editor-container { flex: 1; overflow-y: auto;