gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0355975a0355975areports/MC-mobile.md, LOG, STATUS (MC)mre0355975a/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

  • 0355975areports/MC-mobile.md, LOG, STATUS (MC)mre
  • 3f0a7229Month view, date picker, range picker: names follow the page language (English by default, not the browser's), weekday/month names formatted in UTC (a UTC+12 zone showed Tue first), 44 px day cells and buttons, Send row air; gate checks at 390 px for every page, popup and dialog (MC)mre
  • 29eb07eaPhone: 44 px targets on the site (brand, home links, buttons), comments, modal and pagination; the header is the brand alone on a phone; comments demo: labelled 'You are' group with the chosen user pressed (MC)mre
  • d1cc83e2reports/E2-toolbar.mdmre
  • 214c3183MdEditor on a phone: toolbar as two even rows of 44 px targets (no clipped icon, no swipe), 'Markdown source' label 15 px, table head 16 px; gate checks (E2)mre
  • 9215bbaareports/F5-empty.mdmre
  • 134b4e3eMdEditor: an editor the framework puts into the page is built at once (page observer), a surface put in anew under a built editor is redrawn; gates for both (hybriel#211)mre
  • 0dce2899reports/K1-bubble.mdmre
  • 6b0936a0comments: 'edited' foldable also drops the theme's border, margin and radius (display: contents alone left them computed)mre
  • 8d79ff79comments bubble hugs its content: a readonly md-editor surface gets no inline min-height (it beat the stylesheet's min-height 0); 'edited' is a quiet label beside the time, versions unframed; gate checksmre
  • ef253fecreports/F4-icons.mdmre
  • ba96735ficons: README, md-editor README note, gate checks for the single focus ring and toolbar iconsmre
  • 96c97691icons: shared Icon component; md-editor toolbar and files-upload remove use it; no inner focus ring in md-editormre
  • 0d6863d6reports/F3-mdvalue.mdmre
  • d58ed98bMdEditor: an older text of the editor handed back is not an outside change (kept surface, written back); gate for itmre
  • c2d0de59MdEditor: show a value that changes from outside (data-value observer), demo button and gatemre
  • c4272fa3re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • 2e22618etests: cdp-blank/md-bg/md-keys-run Chrome range and base port from env (MDK_CHROME, MDK_PORT), defaults unchangedmre
  • a5d2384bre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • 52902d23docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre