Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. var plastiq = require('plastiq');
  2. var h = plastiq.html;
  3.  
  4. function render(model) {
  5. return h('article', h('.title', {
  6. onblur: function(e) {
  7. model.title = e.target.innerText.replace(/\n/g, "");
  8. e.target.innerHTML = '<h1>' + model.title + '</h1>';
  9. },
  10. attributes: { contenteditable: true }},
  11. h.rawHtml('h1', model.title)
  12. ), JSON.stringify(model));
  13. }
  14.  
  15.  
  16. var model = { title:"edit me" };
  17.  
  18. plastiq.attach(document.body, render, model);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement