()
| 459 | |
| 460 | // 获取自定义模板 |
| 461 | static getCustomTemplates(): Template[] { |
| 462 | if (typeof window === 'undefined') return []; |
| 463 | |
| 464 | try { |
| 465 | const stored = localStorage.getItem(STORAGE_KEY); |
| 466 | return stored ? JSON.parse(stored) : []; |
| 467 | } catch (error) { |
| 468 | console.error('Error reading templates from localStorage:', error); |
| 469 | return []; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | // 保存自定义模板 |
| 474 | static saveCustomTemplate(template: Omit<Template, 'id' | 'category' | 'createdAt' | 'useCount'>): string { |
no outgoing calls
no test coverage detected