\n \n {\n messageItems = messageItems.map((item) =>\n item.id == message.id\n ? { ...message, isDefault: true }\n : { ...item, isDefault: false }\n );\n save();\n }\n \"\n @edit=\"\n (message) => {\n messageItems = messageItems.map((item) =>\n item.id == message.id\n ? { ...message, mode: 'edit' }\n : item\n );\n }\n \"\n @saved=\"\n (message) => {\n // do we have any items marked as default\n let hasDefault = messageItems.some(\n (m) => m.isDefault\n );\n if (!hasDefault) {\n message.isDefault = true;\n }\n\n message.isNew = false;\n message.mode = 'view';\n\n messageItems = messageItems.map((item) =>\n item.id == message.id ? { ...message } : item\n );\n\n save();\n }\n \"\n @delete=\"\n (message) => {\n messageItems = messageItems.filter(\n (item) => item.id != message.id\n );\n\n save();\n }\n \"\n @cancelCreate=\"\n () => {\n messageItems = messageItems.filter(\n (item) => !item.isNew\n );\n }\n \"\n @cancel=\"\n () => {\n messageItems = messageItems.map((item) =>\n item.mode == 'edit'\n ? { ...item, mode: 'view' }\n : item\n );\n }\n \"\n :templateData=\"templateData\"\n @selected=\"\n (message) => {\n show = false;\n $emit('selected', message);\n }\n \"\n />\n
\n\n \n \n Create Message Template\n
\n \n