* 在指定位置后插入新页面 * @param afterIndex 在此索引后插入 * @param type 页面类型 * @param content 页面内容
(afterIndex: number, type: 'cover' | 'content' | 'summary', content: string = '')
| 250 | * @param content 页面内容 |
| 251 | */ |
| 252 | insertPage(afterIndex: number, type: 'cover' | 'content' | 'summary', content: string = '') { |
| 253 | const newPage: Page = { |
| 254 | index: afterIndex + 1, |
| 255 | type, |
| 256 | content |
| 257 | } |
| 258 | this.outline.pages.splice(afterIndex + 1, 0, newPage) |
| 259 | // 重新索引所有页面 |
| 260 | this.outline.pages.forEach((page, idx) => { |
| 261 | page.index = idx |
| 262 | }) |
| 263 | // 同步更新 raw 文本 |
| 264 | this.syncRawFromPages() |
| 265 | }, |
| 266 | |
| 267 | /** |
| 268 | * 移动页面位置(用于拖拽排序) |
nothing calls this directly
no outgoing calls
no test coverage detected