diff options
Diffstat (limited to 'Map/Data/MapDocument.swift')
| -rw-r--r-- | Map/Data/MapDocument.swift | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Map/Data/MapDocument.swift b/Map/Data/MapDocument.swift index 2377d5a..4d1f78b 100644 --- a/Map/Data/MapDocument.swift +++ b/Map/Data/MapDocument.swift @@ -30,24 +30,16 @@ struct MapDocument: FileDocument { if let text = text { self.text = text } else { - // Try to get default template, fallback to built-in content - if let templatesData = UserDefaults.standard.data(forKey: "mapTemplates"), + // Check for pending template content first + if let pendingContent = UserDefaults.standard.string(forKey: "pendingTemplateContent") { + self.text = pendingContent + } else if let templatesData = UserDefaults.standard.data(forKey: "mapTemplates"), let templates = try? JSONDecoder().decode([Template].self, from: templatesData), let defaultTemplate = templates.first(where: { $0.isDefault }) { self.text = defaultTemplate.content } else { - self.text = """ - Anchor (60, 5) [x] - Node A (78, 23) - Node B (40, 30) [square] - Node C (65, 70) - - Anchor -> Node A - Anchor -> Node B - Node A -> Node C - Node B -> Node C - """ + self.text = String(localized: "map_template.default.content") } } } |