笔记图片块:展示真图 + 插图 + blocks 保存(图文混排后半程)laoyang/FamilyBook#23
用户原话(2026-10-28):「鸿蒙端对齐网页端」,笔记端上只支持纯文本。 这半程改鸿蒙端,配合服务端 cd56a9d 补的 /notes/upload: 1) 展示:FbNoteItem 新增 blocks(FbNoteBlock[]),parseNotes 把原始块 带进来;FbNoteSheet 里 image 块真画图(fbImageSrc),不再显示「[图片]」。 2) 插图:正文区下加「+ 插图」,选图 → fbUploadKey 上传拿 key → 加入 待保存列表;每张图带「×」可删。 3) 保存(P0 修复):带图时改走 saveNoteWithBlocks —— 正文 text 块 + 图片 image 块整组提交。原来只传 body,服务端折成单个 text 块整组替换, **编辑带图笔记会把图片块静默删光**。 4) fbUploadKey 是 fbUpload 抽出的第二出口:复用同一 multipart 核心拿 key, 不复制第二份实现(本项目"两份实现漂移"栽过多次)。 编译 BUILD SUCCESSFUL;守卫 _fb_arkts_guard.js 1324/0;服务端冒烟 _i23_note_image_api.py 11/0(含 PATCH 后图片块不被删)+ 反证命中 2/2。
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
import { FbColors, FbMetric, FbTint, fbAlpha } from '../../common/Theme';
|
||||
import { FbAppState, fbAppState } from '../../common/Store';
|
||||
import { FbNoteItem, FbNotificationItem } from '../../model/Types';
|
||||
import { FbNoteItem, FbNoteBlock, FbNotificationItem } from '../../model/Types';
|
||||
import { parseNotes, parseNotifications } from '../../data/FbParse';
|
||||
import { loadModule } from '../../data/FbModuleLoad';
|
||||
import { FbAvatar, FbDot, FbEmptyBox, FbPrimaryButton, FbTag } from '../../components/Widgets';
|
||||
@@ -53,6 +53,8 @@ export struct FbNotesPage {
|
||||
@Local sheetId: number = 0;
|
||||
@Local sheetTitle: string = '';
|
||||
@Local sheetBody: string = '';
|
||||
/** 正文块(工单 #23:图文混排要原始块) */
|
||||
@Local sheetBlocks: FbNoteBlock[] = [];
|
||||
@Local sheetTags: string = '';
|
||||
@Local sheetMine: boolean = true;
|
||||
|
||||
@@ -88,6 +90,7 @@ export struct FbNotesPage {
|
||||
this.sheetId = 0;
|
||||
this.sheetTitle = '';
|
||||
this.sheetBody = '';
|
||||
this.sheetBlocks = [];
|
||||
this.sheetTags = '';
|
||||
this.sheetMine = true;
|
||||
this.sheetOpen = true;
|
||||
@@ -97,6 +100,7 @@ export struct FbNotesPage {
|
||||
this.sheetId = n.id;
|
||||
this.sheetTitle = n.title;
|
||||
this.sheetBody = n.body;
|
||||
this.sheetBlocks = n.blocks;
|
||||
this.sheetTags = n.tags.join(' ');
|
||||
this.sheetMine = n.mine;
|
||||
this.sheetOpen = true;
|
||||
@@ -194,6 +198,7 @@ export struct FbNotesPage {
|
||||
editingId: this.sheetId,
|
||||
editingTitle: this.sheetTitle,
|
||||
editingBody: this.sheetBody,
|
||||
editingBlocks: this.sheetBlocks,
|
||||
editingTags: this.sheetTags,
|
||||
mine: this.sheetMine,
|
||||
onClose: (): void => {
|
||||
|
||||
Reference in New Issue
Block a user