feat: improve note editing and creation workflow

- Enhanced the editor to handle new note creation directly, initializing with an empty state.
- Updated save functionality to create a note first if it's new, followed by saving the content.
- Modified breadcrumb navigation to accommodate new notes and improve user experience.
- Removed the old note creation page to streamline the editing process.
- Added error handling and dynamic title updates for better feedback during note creation.
This commit is contained in:
Anish Sarkar 2025-12-16 18:46:18 +05:30
parent e1e813702a
commit e9d3d36dfc
6 changed files with 167 additions and 225 deletions

View file

@ -44,6 +44,13 @@ export function DashboardBreadcrumb() {
useEffect(() => {
if (segments[2] === "editor" && segments[3] && searchSpaceId) {
const documentId = segments[3];
// Skip fetch for "new" notes
if (documentId === "new") {
setDocumentTitle(null);
return;
}
const token = getBearerToken();
if (token) {
@ -110,7 +117,14 @@ export function DashboardBreadcrumb() {
// Handle editor sub-sections (document ID)
if (section === "editor") {
const documentLabel = documentTitle || subSection;
// Handle special cases for editor
let documentLabel: string;
if (subSection === "new") {
documentLabel = "New Note";
} else {
documentLabel = documentTitle || subSection;
}
breadcrumbs.push({
label: t("documents"),
href: `/dashboard/${segments[1]}/documents`,