feat(book/table): support changing note title

This commit is contained in:
Elian Doran 2025-06-25 17:56:47 +03:00
parent 168e224d3e
commit c9b556160f
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View File

@ -25,10 +25,12 @@ export function buildData(info: PromotedAttributeInformation[], notes: FNote[])
export function buildColumnDefinitions(info: PromotedAttributeInformation[]) {
const columnDefs: GridOptions<TableData>["columnDefs"] = [
{
field: "noteId"
field: "noteId",
editable: false
},
{
field: "title"
field: "title",
editable: true
}
];

View File

@ -6,6 +6,7 @@ import { setLabel } from "../../../services/attributes.js";
import applyHeaderCustomization from "./header-customization.js";
import ViewModeStorage from "../view_mode_storage.js";
import { type StateInfo } from "./storage.js";
import server from "../../../services/server.js";
ModuleRegistry.registerModules([ AllCommunityModule ]);
@ -42,8 +43,13 @@ function setupEditing(): GridOptions<TableData> {
return;
}
const { newValue } = event;
if (name === "title") {
// TODO: Deduplicate with note_title.
server.put(`notes/${noteId}/title`, { title: newValue });
}
if (name.startsWith("labels.")) {
const { newValue } = event;
const labelName = name.split(".", 2)[1];
setLabel(noteId, labelName, newValue);
}