gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7e428ba67e428ba6Re-vendor Hybriel day72 (day73 withdrawn: minifier breaks write sets)Atlas7e428ba6/components/md-editor/demo.hl

2.8 KB

  1. // demo.hl — `/md-editor`: three editors on one page (the second starts empty and shows its placeholder, the third holds a table), and the Markdown each holds
  2. // shown below. The editor announces a change with a bubbling DOM `input` event on its hidden field: `e.target.value` is the Markdown.
  3. parent '../main.hl'
  4. import MdEditor from './md-editor.hl'
  5. import { storeMdFiles } from '../../lib/uploads.hl'
  6. __title = 'Markdown editor · Hybriel components'
  7. static NL = "
  8. "
  9. String note = '# Hello' + NL + NL + 'Some **bold** and *italic* text with `code` and a [link](https://example.com).' + NL + NL + '- first' + NL + '- second'
  10. String summary = ''
  11. Number outsideN = 0
  12. // a GitHub pipe table (mission 004): alignment, an escaped pipe, bold and code in cells, a long row that scrolls on a phone
  13. String plan = '## Shopping' + NL + NL + '| Item | Qty | Note \| x |' + NL + '|:-----|:---:|---:|' + NL + '| **milk** | `2` | fresh |' + NL + '| bread | 1 | wholegrainsourdoughwithseedsfromthebakeryaroundthecorner |' + NL + NL + 'Tab moves to the next cell, Enter adds a row.'
  14. View {
  15. mdEditorDemo {
  16. h1 { "Markdown editor" }
  17. p { class = "muted" "Edit it visually: headings look like headings, bold is bold, lists are lists. The value below each editor is plain Markdown; paste Markdown in and it shows formatted." }
  18. // a value that arrives from outside after the editor is built (a kept state, a push from another device): the editor shows it
  19. p { button { id = "md-outside" type = "button" "Set the second editor from outside" on click(e) { outsideN = outsideN + 1 summary = '# Outside ' + outsideN + NL + NL + 'set by **the page**' } }
  20. button { id = "md-stale" type = "button" "Hand the second editor its first text back" on click(e) { summary = '' } } }
  21. form { id = "md-form" method = "get" action = "/md-editor" on input(e) { emit demoValue(e) }
  22. MdEditor { name = "note" value = note }
  23. h2 { "Value of “note”" }
  24. pre { id = "md-value" note }
  25. MdEditor { name = "summary" value = summary placeholder = "A second editor, empty: type here…" }
  26. h2 { "Value of “summary”" }
  27. pre { id = "md-value-summary" summary }
  28. MdEditor { name = "plan" value = plan }
  29. h2 { "Value of “plan”" }
  30. pre { id = "md-value-plan" plan }
  31. p { button { type = "submit" "Send (posts both as Markdown)" } }
  32. }
  33. p { a { id = "readme" href = "/md-editor/README.md" "README (how to use it)" } }
  34. }
  35. }
  36. on demoValue(e) {
  37. if (e.target.name == 'note') { note = e.target.value }
  38. if (e.target.name == 'summary') { summary = e.target.value }
  39. if (e.target.name == 'plan') { plan = e.target.value }
  40. }
  41. // WHERE THE FILES GO IS THE APP'S DECISION: the editor sends dropped / pasted / chosen files here (`emit server mdUpload`), this site
  42. // keeps them for one day and answers the address of each file, in order (lib/uploads.hl storeMdFiles).
  43. on server mdUpload(files) { return storeMdFiles(files) }

Branches

Latest commits

  • 7e428ba6Re-vendor Hybriel day72 (day73 withdrawn: minifier breaks write sets)Atlas
  • a06fc778Reset virtual-list window when the host changes resetKeyAtlas
  • 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
  • 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
  • f5f131c5Record AP29 autoplay comparisons and passing gatesmre
  • 51c38187Gate media autoplay on first load and after client mountmre
  • a3f2223dRecord successful B44 deployment and live proofmre
  • 06c1e021Record passing B44 browser rerunmre
  • c9861533Record B44 component proof and browser gate blockermre
  • 1b7413beIgnore detached media events and space demo option outputsmre
  • ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
  • df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
  • 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
  • 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
  • 9b872cedRecord IC28 deployment and live icon verificationmre
  • 46fefaa7Count the icons entry in the offline home-page checkmre
  • c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
  • 5e090ffdRecord IC28 review evidence and gate resultsmre
  • adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre