| 44 | * 转换为旧格式(保持兼容性) |
| 45 | */ |
| 46 | export function convertToLegacyHighlight( |
| 47 | id: string, |
| 48 | highlight: OptimizedHighlight, |
| 49 | filePath: string |
| 50 | ): HiNote { |
| 51 | return { |
| 52 | id, |
| 53 | text: highlight.text, |
| 54 | position: highlight.position, |
| 55 | createdAt: highlight.created, |
| 56 | updatedAt: highlight.updated, |
| 57 | filePath, |
| 58 | backgroundColor: highlight.backgroundColor, |
| 59 | blockId: highlight.blockId, |
| 60 | isCloze: highlight.isCloze || false, |
| 61 | isVirtual: highlight.isVirtual || false, |
| 62 | paragraphOffset: highlight.paragraphOffset, |
| 63 | contextBefore: highlight.contextBefore, |
| 64 | contextAfter: highlight.contextAfter, |
| 65 | textFingerprint: highlight.textFingerprint, |
| 66 | comments: highlight.comments?.map(comment => ({ |
| 67 | id: comment.id, |
| 68 | content: comment.content, |
| 69 | createdAt: comment.created, |
| 70 | updatedAt: comment.updated |
| 71 | })) || [] |
| 72 | }; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * 转换为优化格式 |