I can answer part of your question by explaining our plan for how the WikiDom will look when there's templates. A template call in WikiDom is just a template name with some parameters. The parameters are like documents, in that they are a series of blocks, just like a document is. The server could (and ideally will) render the templates into HTML, and pass that along with the parameter information. This will allow previews in the editor to be true to the final output, but also let the editor get at the parameters, change them, send them to the server for re-rendering, and then update the HTML representation.
Though, as we learned the hard way, one should not assume that rendering a template separately yields the same result as substituting its source text into the caller and then rendering the whole thing at once. For example, we wanted to allow templates on support.mozilla.com to contain just single bullet points...
* Hello there
...for inclusion into lists in the caller. MW supports this. The naive approach of rendering the template on its own leaves you with an extra list (and possibly invalid markup—I forget). Our new parser (https://github.com/erikrose/mediawiki-parser) subs the parametrized template into the caller and then renders once.
I'm looking forward to seeing what you do with the WYSIWYG editor; it's quite ambitious!
Cheers, Erik Rose