From 3e455d6cbce4af40b914ef2a4cff56b231588635 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 11 Oct 2018 18:21:28 -0700 Subject: [PATCH] Use value attr for textarea Because setting content as child text node seems to confuse Mithril. I suspect that's because it uses 'value' property to get/set textarea content. --- client/long-text-component.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/client/long-text-component.js b/client/long-text-component.js index 08f4cff..d884d91 100644 --- a/client/long-text-component.js +++ b/client/long-text-component.js @@ -15,21 +15,16 @@ const component = { title: text, onclick: () => { overlay.open(() => { - return m( - "textarea.long-text", - { - cols: 80, - rows: 24, - readonly: "", - oncreate: vnode2 => { - setTimeout(() => { - vnode2.dom.focus(); - vnode2.dom.select(); - }, 50); - } - }, - text - ); + return m("textarea.long-text", { + value: text, + cols: 80, + rows: 24, + readonly: "", + oncreate: vnode2 => { + vnode2.dom.focus(); + vnode2.dom.select(); + } + }); }); } },