tess_edit 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8335fb097106c74abdf46d0df1489766f3868bd0bb08169b103a49b3542afd1b
4
- data.tar.gz: a5aded7ba78002b81214a8f55ef4916a90c1e55a6d8a1dbe2d6747e67df96ba3
3
+ metadata.gz: 4606ec9405953c28850c78e56ba84dbd98746d3b5304908915cb122130b0ad54
4
+ data.tar.gz: 6b97b338496fa61698751df3f4fadb6307e583a1ada2be8ccd9e903fad99f17b
5
5
  SHA512:
6
- metadata.gz: 7cb9c17a7e0e24780821b00b66ee30ee42167e9dd660e5c89fd68625c55fe6eb88307996d84f824c2851aa9603a0802a6f751ce5d39b0eb37fdc9c3321c25abc
7
- data.tar.gz: 479ad383c95aff99940edc2e8fec3fa803aef1a682db1afc72ba8004b1511fd31dbbb8c7c90acfdf6d6ca376718bf0dbbf6c8c95960c2371abd046da238318fb
6
+ metadata.gz: 6cf843dc450464c7273b05f24f38f9299a91525785a1dea7291ae1aa3d00228f4bddf8559c0721ad1516146c79006fb1b4a69c691ff7682e3ab633e78441937c
7
+ data.tar.gz: faf9a015532294fa7d5dbf2cfcead3085a7e93acf634d37c7ee5adbc063e6628b08ce7785d364688f2ba74e4064b190fa71b0c22aed80f257a396e94dd19a3eb
data/README.md CHANGED
@@ -31,7 +31,8 @@ Liquid is completed as you type, in text and in settings:
31
31
  - Clicking a tile in the Blocks panel adds the block in or after the selection, or else at the end of the last block it fits in.
32
32
  - Undo/redo, duplicate, delete, keyboard shortcuts (⌘Z, ⇧⌘Z, ⌘D, Delete, Enter to edit text, Tab to the next table cell, Esc).
33
33
  - A preview of the output, and the canvas at the widths a kit gives, such as an email's desktop and mobile.
34
- - Panels on both sides, or combined as tabs in one sidebar on the left or right to give the canvas more room.
34
+ - Panels on both sides, or combined as tabs in one sidebar on the left or right to give the canvas more room; each tab can be dragged to the other side.
35
+ - Zoom on the canvas: buttons, ⌘+ / ⌘− / ⌘0, ⇧1 to fit, and pinch or ⌘ and the wheel.
35
36
  - Dark mode that follows the host app's.
36
37
  - Code dialog to view, copy or download the JSON and the kit's outputs, and to load JSON.
37
38
  - Kits: any kind of document, registered by your app or a gem, with its own blocks and output and TessEdit's blocks brought in.
@@ -102,7 +103,7 @@ Give the controller an element with a height, the kit it makes and, optionally,
102
103
 
103
104
  The editor loads the document from the `jsonInput` (or from `data-tess-edit-document-value`). With neither, it starts with the kit's sample, if it has one; set `data-tess-edit-sample-value="false"` to start with an empty document.
104
105
 
105
- `data-tess-edit-panels-value` sets the default panel layout: `split` (Blocks and Layers on the left, Inspect on the right, the default), `left` or `right` (Blocks, Layers and Inspect as tabs in one sidebar on that side). People can switch with the buttons in the top bar; their choice is remembered in the browser. When the editor is narrower than 1000px, it puts all panels on the left so the canvas keeps its room, and goes back to the chosen layout when it is wide enough again.
106
+ `data-tess-edit-panels-value` sets the default panel layout: `split` (Blocks and Layers on the left, Inspect on the right, the default), `left` or `right` (Blocks, Layers and Inspect as tabs in one sidebar on that side). People can switch with the buttons in the top bar, or drag a tab (Blocks, Layers, Inspect, a kit's own panel) to the other pane, or to a side without one to make a pane there; where each tab is is remembered in the browser, per kit. When the editor is narrower than 1000px, it puts all panels on the left so the canvas keeps its room, and goes back to the chosen layout when it is wide enough again.
106
107
 
107
108
  The editor has a border with rounded corners. A page that frames it itself, such as a card it fills, turns it off with `data-tess-edit-frame-value="false"`.
108
109
 
@@ -458,7 +459,7 @@ TessEdit's own blocks are part of no kit until a kit takes them in: `extendBlock
458
459
 
459
460
  The demo's Note kit (`test/dummy/app/javascript/kits/note.js`) is a small kit of a host app's own. [Nuntius](https://github.com/entdec/nuntius)' email kit (`app/javascript/nuntius/email`) is a complete one: it takes in TessEdit's blocks with their MJML, adds the email's own (Email, Wrapper, Hero, Social, Navbar), orders the Blocks panel's tiles with `palette`, loads documents from before its root's rename with `aliases`, and has its MJML compiled to HTML on the server (see [Compiling](#compiling)).
460
461
 
461
- A kit can bring panels of its own, each a tab after Layers (and Inspect, when that is a tab), such as a test run of what is being designed:
462
+ A kit can bring panels of its own, each a tab after Inspect, which can be dragged to either pane like the others, such as a test run of what is being designed:
462
463
 
463
464
  ```js
464
465
  registerKit({
@@ -468,7 +469,7 @@ registerKit({
468
469
  })
469
470
  ```
470
471
 
471
- `render` fills the panel's element once, when the editor is built; `editor` is the editor, with its `doc`, `select(id)`, `renderCanvas()` and its `element`, which sends `tess-edit:change`. The canvas is drawn again when the open panel changes, so it can show what the panel is about; a panel that changes what it shows calls `editor.renderCanvas()`. The demo's Note kit has an Outline panel.
472
+ `render` fills the panel's element once, when the editor is built; `editor` is the editor, with its `doc`, `select(id)`, `renderCanvas()` and its `element`, which sends `tess-edit:change`. The canvas is drawn again when the open panel changes, so it can show what the panel is about; a panel that changes what it shows calls `editor.renderCanvas()`. A panel dragged to the other pane moves its element, so Stimulus controllers in it disconnect and connect again: the same controller, so state kept in `initialize` survives it. The demo's Note kit has an Outline panel.
472
473
 
473
474
  Loading a document into the editor of another kit fails with a message saying which editor it is for.
474
475
 
@@ -87,6 +87,13 @@ const TOOL = "w-8 h-8 flex items-center justify-center rounded-md text-gray-600
87
87
  const TAB = "shrink-0 whitespace-nowrap px-3 h-12 text-[13px] font-medium border-b-2 -mb-px"
88
88
  const PANELS = ["left", "split", "right"]
89
89
  const PANELS_KEY = "tess_edit:panels"
90
+ // Where each tab is, per kit (its own panels are tabs too)
91
+ const TABS_KEY = "tess_edit:tabs"
92
+ const SIDES = ["left", "right"]
93
+ // The canvas's zoom: the steps the buttons and keys go through, and its range
94
+ const ZOOMS = [0.25, 0.33, 0.5, 0.67, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
95
+ const MIN_ZOOM = ZOOMS[0]
96
+ const MAX_ZOOM = ZOOMS[ZOOMS.length - 1]
90
97
  const TRANSLATION_LOCALE_KEY = "tess_edit:translation_locale"
91
98
  // Two sidebars (256px + 320px) leave too little canvas below this editor width.
92
99
  const NARROW_WIDTH = 1000
@@ -100,6 +107,13 @@ function placed(node, at) {
100
107
  return node
101
108
  }
102
109
 
110
+ // Puts the children in an element unless they're there already: moving them
111
+ // would reconnect the controllers in them
112
+ function setChildren(element, children) {
113
+ const current = [...element.children]
114
+ if (current.length !== children.length || children.some((child, index) => current[index] !== child)) element.replaceChildren(...children)
115
+ }
116
+
103
117
  export default class extends Controller {
104
118
  static values = { kit: String, document: String, sample: { type: Boolean, default: true }, frame: { type: Boolean, default: true }, panels: { type: String, default: "split" }, compileUrl: { type: String, default: COMPILE_URL }, mediaUrl: String, variablesUrl: String, filtersUrl: String, tagsUrl: String, translationsUrl: String, values: String, lock: String, blocks: String, options: String }
105
119
  static targets = ["jsonInput", "slot", "translations"]
@@ -126,8 +140,9 @@ export default class extends Controller {
126
140
  this.drag = null
127
141
  this.mode = "edit"
128
142
  this.device = this.kit.devices?.[0]?.key || null
129
- this.leftTab = "blocks"
130
- this.panels = [this.storedPanels(), this.panelsValue].find((value) => PANELS.includes(value)) || "split"
143
+ // The tab open in each pane, by the side it shows on ("sheet" on a compact editor)
144
+ this.openTabs = {}
145
+ this.zoom = 1
131
146
  this.narrow = false
132
147
  this.compact = false
133
148
  this.sheetOpen = false
@@ -437,16 +452,29 @@ export default class extends Controller {
437
452
  build() {
438
453
  this.blocksElement = h("div", { class: "flex-1 overflow-y-auto pb-4" })
439
454
  this.treeElement = h("div", { class: "flex-1 overflow-y-auto" })
440
- this.leftTabs = h("div", { class: "flex border-b border-gray-200 dark:border-gray-700 px-2 shrink-0 overflow-x-auto" })
441
- // The kit's own panels (registerKit's panels), a tab each after Layers
455
+ // The kit's own panels (registerKit's panels), a tab each after Inspect
442
456
  this.kitPanels = (this.hasBlocks ? this.kit.panels || [] : []).map((panel) => ({ ...panel, element: h("div", { class: "hidden flex-1 overflow-y-auto min-h-0", dataset: { tessEditPanel: panel.key } }) }))
443
457
  this.inspectorElement = h("div", { class: "flex flex-1 flex-col min-h-0", dataset: { tessEditPanel: "inspect" } })
444
- this.sidePanel = h("aside")
458
+ // Each tab is a panel, in the pane on either side of the canvas it was put in
459
+ this.tabs = this.hasBlocks
460
+ ? [
461
+ { key: "blocks", label: "Blocks", element: this.blocksElement },
462
+ { key: "layers", label: "Layers", element: this.treeElement },
463
+ { key: "inspect", label: "Inspect", element: this.inspectorElement },
464
+ ...this.kitPanels.map((panel) => ({ key: panel.key, label: panel.label, element: panel.element }))
465
+ ]
466
+ : []
467
+ this.arrangement = this.storedArrangement() || this.preset([this.storedPanels(), this.panelsValue].find((value) => PANELS.includes(value)) || "split")
468
+ this.panes = Object.fromEntries(SIDES.map((side) => [side, { side, element: h("aside", { dataset: { tessEditPane: side } }), strip: this.tabStrip(side) }]))
445
469
  this.inspectPanel = h("aside")
446
470
  this.sheetClose = h("button", { type: "button", title: t("Hide panels"), class: `${TOOL} ml-auto self-center`, html: icon("close"), onclick: () => this.setSheetOpen(false) })
447
471
  this.textToolbar = h("div", { class: "hidden absolute left-1/2 top-3 z-20 -translate-x-1/2 flex items-center gap-0.5 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 px-1.5 py-1 shadow-md" })
448
- this.frame = h("iframe", { class: "block h-full w-full border-0 bg-white transition-[width] duration-200", title: t("%{name} canvas", { name: t(this.kit.name) }) })
449
- this.frameWrap = h("div", { class: "relative h-full mx-auto" }, this.frame)
472
+ // Zoomed by scaling the iframe (applyZoom): what's in it lays out as in a
473
+ // browser zoomed as much
474
+ this.frame = h("iframe", { class: "block h-full w-full border-0 bg-white origin-top-left", title: t("%{name} canvas", { name: t(this.kit.name) }) })
475
+ this.frameWrap = h("div", { class: "relative h-full mx-auto overflow-hidden transition-[width] duration-200" }, this.frame)
476
+ // Where a tab dragged off its pane makes a pane of its own on a side that has none
477
+ this.dropZones = Object.fromEntries(SIDES.map((side) => [side, this.dropZone(side)]))
450
478
  this.topBar = h("div", { class: "flex items-center gap-1 h-12 px-3 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shrink-0" })
451
479
  this.body = h("div", { class: "flex flex-1 min-h-0" })
452
480
 
@@ -457,7 +485,7 @@ export default class extends Controller {
457
485
  this.body
458
486
  )
459
487
  this.errorBar = h("div", { class: "hidden absolute inset-x-3 bottom-3 z-20 rounded-md border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/40 px-3 py-2 text-xs text-red-700 dark:text-red-300 shadow-sm", role: "alert" })
460
- this.main = h("main", { class: "relative flex-1 min-w-0 min-h-0 bg-gray-100 dark:bg-gray-900", ondragover: (event) => this.drag && event.preventDefault() }, this.textToolbar, this.frameWrap, this.errorBar)
488
+ this.main = h("main", { class: "relative flex-1 min-w-0 min-h-0 bg-gray-100 dark:bg-gray-900", ondragover: (event) => this.drag && event.preventDefault() }, this.textToolbar, this.frameWrap, this.errorBar, this.dropZones.left, this.dropZones.right)
461
489
  this.arrangePanels()
462
490
  this.element.append(this.root)
463
491
 
@@ -487,9 +515,10 @@ export default class extends Controller {
487
515
  window.addEventListener("resize", this.closeMenuOnResize)
488
516
  }
489
517
 
490
- // Split: Blocks and Layers on the left, Inspect on the right. Left or right:
491
- // one sidebar on that side with Blocks, Layers and Inspect as tabs. Sheet:
492
- // those tabs in the lower half, below the canvas, while it is open.
518
+ // The panes either side of the canvas, each with the tabs put in it (see
519
+ // moveTab); one without tabs isn't shown. Narrow, the panes are one on the
520
+ // left (or the right, when that's the only one); compact, they're one sheet
521
+ // below the canvas, while it is open.
493
522
  arrangePanels() {
494
523
  const panelClass = (border, width) => `${width} shrink-0 flex flex-col ${border} border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 min-h-0`
495
524
  const sheetClass = `${panelClass("border-t", "h-1/2")}${this.sheetOpen ? "" : " hidden"}`
@@ -500,31 +529,178 @@ export default class extends Controller {
500
529
  if (!this.hasBlocks) {
501
530
  this.inspectPanel.className = this.compact ? sheetClass : panelClass("border-l", "w-80")
502
531
  const children = this.compact ? [this.sheetHeader(t("Inspect")), this.inspectorElement] : [this.inspectorElement]
503
- const current = [...this.inspectPanel.children]
504
- if (current.length !== children.length || children.some((child, index) => current[index] !== child)) this.inspectPanel.replaceChildren(...children)
532
+ setChildren(this.inspectPanel, children)
505
533
  if (this.main.nextSibling !== this.inspectPanel) this.main.after(this.inspectPanel)
506
534
  return
507
535
  }
508
- this.sidePanel.replaceChildren(this.leftTabs, this.blocksElement, this.treeElement, ...this.kitPanels.map((panel) => panel.element))
509
- if (this.layout === "sheet") {
510
- this.sidePanel.className = sheetClass
511
- this.sidePanel.append(this.inspectorElement)
512
- this.inspectPanel.remove()
513
- this.main.after(this.sidePanel)
514
- } else if (this.layout === "split") {
515
- this.sidePanel.className = panelClass("border-r", "w-64")
516
- this.inspectPanel.className = panelClass("border-l", "w-80")
517
- this.inspectPanel.replaceChildren(this.inspectorElement)
518
- this.main.before(this.sidePanel)
519
- this.main.after(this.inspectPanel)
520
- } else {
521
- this.sidePanel.className = panelClass(this.layout === "left" ? "border-r" : "border-l", "w-80")
522
- this.sidePanel.append(this.inspectorElement)
523
- this.inspectPanel.remove()
524
- this.layout === "left" ? this.main.before(this.sidePanel) : this.main.after(this.sidePanel)
536
+ const shown = this.shownPanes
537
+ const both = shown.length === 2
538
+ for (const side of SIDES) {
539
+ const pane = this.panes[side]
540
+ const showing = shown.find((each) => each.element === pane.element)
541
+ if (!showing) {
542
+ pane.element.remove()
543
+ continue
544
+ }
545
+ const width = !both ? "w-80" : showing.keys.includes("inspect") ? "w-80" : "w-64"
546
+ pane.element.className = showing.side === "sheet" ? sheetClass : panelClass(side === "left" ? "border-r" : "border-l", width)
547
+ setChildren(pane.element, [pane.strip, ...showing.keys.map((key) => this.tab(key).element)])
548
+ if (side === "left" && showing.side !== "sheet") {
549
+ if (this.main.previousSibling !== pane.element) this.main.before(pane.element)
550
+ } else if (this.main.nextSibling !== pane.element) this.main.after(pane.element)
525
551
  }
526
552
  }
527
553
 
554
+ // The panes shown, by the side they show on, with their tabs in order
555
+ get shownPanes() {
556
+ const { left, right } = this.arrangement
557
+ if (this.compact) return [{ side: "sheet", element: this.panes.left.element, strip: this.panes.left.strip, keys: [...left, ...right] }]
558
+ if (this.narrow && left.length && right.length) return [{ side: "left", element: this.panes.left.element, strip: this.panes.left.strip, keys: [...left, ...right] }]
559
+ return SIDES.filter((side) => this.arrangement[side].length).map((side) => ({ ...this.panes[side], keys: this.arrangement[side] }))
560
+ }
561
+
562
+ tab(key) {
563
+ return this.tabs.find((tab) => tab.key === key)
564
+ }
565
+
566
+ // The tabs in the panes a preset puts them in: all on one side, or split
567
+ // with Inspect on the right
568
+ preset(panels) {
569
+ const keys = this.tabs.map((tab) => tab.key)
570
+ if (panels === "left") return { left: keys, right: [] }
571
+ if (panels === "right") return { left: [], right: keys }
572
+ return { left: keys.filter((key) => key !== "inspect"), right: keys.filter((key) => key === "inspect") }
573
+ }
574
+
575
+ // Where the tabs were put last, with tabs it doesn't know of yet (a kit's
576
+ // new panel) where the split preset puts them
577
+ storedArrangement() {
578
+ if (!this.hasBlocks) return null
579
+ let stored
580
+ try {
581
+ stored = JSON.parse(this.stored(`${TABS_KEY}:${this.kit.key}`) || "null")
582
+ } catch {
583
+ return null
584
+ }
585
+ if (!stored || !SIDES.every((side) => Array.isArray(stored[side]))) return null
586
+ const keys = this.tabs.map((tab) => tab.key)
587
+ const arrangement = Object.fromEntries(SIDES.map((side) => [side, [...new Set(stored[side])].filter((key) => keys.includes(key))]))
588
+ arrangement.right = arrangement.right.filter((key) => !arrangement.left.includes(key))
589
+ const split = this.preset("split")
590
+ for (const key of keys) {
591
+ if (arrangement.left.includes(key) || arrangement.right.includes(key)) continue
592
+ arrangement[split.left.includes(key) ? "left" : "right"].push(key)
593
+ }
594
+ return arrangement
595
+ }
596
+
597
+ // The preset the arrangement is: a side with no tabs, or split
598
+ get panels() {
599
+ if (!this.arrangement.right.length) return "left"
600
+ if (!this.arrangement.left.length) return "right"
601
+ return "split"
602
+ }
603
+
604
+ // A pane's tabs, which a tab can be dragged to from the other pane, and
605
+ // within to put it elsewhere in the row
606
+ tabStrip(side) {
607
+ const strip = h("div", { role: "tablist", class: "flex border-b border-gray-200 dark:border-gray-700 px-2 shrink-0 overflow-x-auto" })
608
+ strip.addEventListener("dragover", (event) => {
609
+ if (!this.tabDrag) return
610
+ event.preventDefault()
611
+ event.dataTransfer.dropEffect = "move"
612
+ this.showTabDrop(strip, this.tabDropIndex(strip, event.clientX))
613
+ })
614
+ strip.addEventListener("dragleave", (event) => !strip.contains(event.relatedTarget) && this.showTabDrop(null))
615
+ strip.addEventListener("drop", (event) => {
616
+ if (!this.tabDrag) return
617
+ event.preventDefault()
618
+ this.moveTab(this.tabDrag, this.paneSide(strip), this.tabDropIndex(strip, event.clientX))
619
+ })
620
+ return strip
621
+ }
622
+
623
+ // The side of the pane a strip is in (the left pane is also the combined one)
624
+ paneSide(strip) {
625
+ return SIDES.find((side) => this.panes[side].strip === strip)
626
+ }
627
+
628
+ // Where in a strip's row of tabs a tab let go at x goes
629
+ tabDropIndex(strip, x) {
630
+ const buttons = [...strip.querySelectorAll("[data-tess-edit-tab]")].filter((button) => button.dataset.tessEditTab !== this.tabDrag)
631
+ const index = buttons.findIndex((button) => {
632
+ const rect = button.getBoundingClientRect()
633
+ return x < rect.left + rect.width / 2
634
+ })
635
+ return index === -1 ? buttons.length : index
636
+ }
637
+
638
+ showTabDrop(strip, index) {
639
+ this.tabIndicator ||= h("span", { class: "pointer-events-none self-stretch my-2 w-0.5 shrink-0 rounded bg-blue-600 dark:bg-blue-400" })
640
+ if (!strip) return this.tabIndicator.remove()
641
+ const buttons = [...strip.querySelectorAll("[data-tess-edit-tab]")].filter((button) => button.dataset.tessEditTab !== this.tabDrag)
642
+ if (buttons[index]) buttons[index].before(this.tabIndicator)
643
+ else if (buttons.length) buttons.at(-1).after(this.tabIndicator)
644
+ else strip.append(this.tabIndicator)
645
+ }
646
+
647
+ // A side without a pane, while a tab is dragged: let go there, it's that
648
+ // side's pane
649
+ dropZone(side) {
650
+ const zone = h("div", { class: `hidden absolute inset-y-3 ${side === "left" ? "left-3" : "right-3"} z-30 w-28 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-400 bg-blue-50/90 dark:bg-blue-950/80 p-2 text-center text-xs font-medium text-blue-700 dark:text-blue-300`, dataset: { tessEditDropZone: side } }, t(side === "left" ? "Put it in a panel on the left" : "Put it in a panel on the right"))
651
+ zone.addEventListener("dragover", (event) => {
652
+ if (!this.tabDrag) return
653
+ event.preventDefault()
654
+ event.dataTransfer.dropEffect = "move"
655
+ zone.classList.add("bg-blue-100")
656
+ })
657
+ zone.addEventListener("dragleave", () => zone.classList.remove("bg-blue-100"))
658
+ zone.addEventListener("drop", (event) => {
659
+ if (!this.tabDrag) return
660
+ event.preventDefault()
661
+ this.moveTab(this.tabDrag, side, 0)
662
+ })
663
+ return zone
664
+ }
665
+
666
+ startTabDrag(event, key) {
667
+ this.tabDrag = key
668
+ event.dataTransfer.effectAllowed = "move"
669
+ event.dataTransfer.setData("text/plain", key)
670
+ // A side with no pane takes one; not while the panes are combined
671
+ for (const side of SIDES) this.dropZones[side].classList.toggle("hidden", !!this.arrangement[side].length)
672
+ }
673
+
674
+ endTabDrag() {
675
+ this.tabDrag = null
676
+ this.showTabDrop(null)
677
+ for (const zone of Object.values(this.dropZones)) {
678
+ zone.classList.add("hidden")
679
+ zone.classList.remove("bg-blue-100")
680
+ }
681
+ }
682
+
683
+ // Puts a tab in a pane, at a place in its row, open there; remembered for
684
+ // the kit. The pane it left opens its first tab, or goes when it has none.
685
+ moveTab(key, side, index) {
686
+ const panel = this.panel
687
+ const arrangement = Object.fromEntries(SIDES.map((each) => [each, this.arrangement[each].filter((other) => other !== key)]))
688
+ arrangement[side].splice(Math.min(index, arrangement[side].length), 0, key)
689
+ this.endTabDrag()
690
+ this.setArrangement(arrangement)
691
+ this.openTabs[side] = key
692
+ this.renderLeftTabs()
693
+ if (panel !== this.panel) this.renderCanvas()
694
+ }
695
+
696
+ setArrangement(arrangement) {
697
+ this.arrangement = arrangement
698
+ try {
699
+ localStorage.setItem(`${TABS_KEY}:${this.kit.key}`, JSON.stringify(arrangement))
700
+ } catch {}
701
+ this.applyPanels()
702
+ }
703
+
528
704
  // The sheet's title bar for a kit without blocks, which has no tabs
529
705
  sheetHeader(title) {
530
706
  this.sheetTitle ||= h("div", { class: "flex items-center h-12 px-3 border-b border-gray-200 dark:border-gray-700 shrink-0 text-[13px] font-medium" })
@@ -536,25 +712,25 @@ export default class extends Controller {
536
712
  setSheetOpen(open) {
537
713
  if (!this.compact || open === this.sheetOpen) return
538
714
  this.sheetOpen = open
539
- ;(this.hasBlocks ? this.sidePanel : this.inspectPanel).classList.toggle("hidden", !open)
715
+ ;(this.hasBlocks ? this.panes.left.element : this.inspectPanel).classList.toggle("hidden", !open)
540
716
  this.renderTopBar()
541
717
  this.canvas.refresh()
542
718
  }
543
719
 
720
+ // Puts the tabs as a preset does: all on the left or the right, or split
544
721
  setPanels(panels) {
545
722
  if (!PANELS.includes(panels)) return
546
- this.panels = panels
547
- try {
548
- localStorage.setItem(PANELS_KEY, panels)
549
- } catch {}
550
- this.applyPanels()
723
+ const panel = this.panel
724
+ this.setArrangement(this.preset(panels))
725
+ if (panel !== this.panel) this.renderCanvas()
551
726
  }
552
727
 
553
728
  applyPanels() {
554
- if (!this.combined && this.leftTab === "inspect") this.leftTab = "blocks"
729
+ const panel = this.panel
555
730
  this.arrangePanels()
556
731
  this.renderTopBar()
557
732
  this.renderLeftTabs()
733
+ if (this.canvas && panel !== this.panel) this.renderCanvas()
558
734
  }
559
735
 
560
736
  // Combines the panels while the editor is narrower than NARROW_WIDTH, and
@@ -569,17 +745,18 @@ export default class extends Controller {
569
745
  if (compact !== this.compact) this.sheetOpen = false
570
746
  this.compact = compact
571
747
  this.applyPanels()
572
- this.canvas.refresh()
748
+ this.applyZoom()
573
749
  })
574
750
  this.resizeObserver.observe(this.root)
575
751
  }
576
752
 
577
- // The layout in use: the chosen one, unless the editor is too narrow to
578
- // split, or the kit has no blocks
753
+ // The layout in use: a pane on each side ("split"), one on the left or the
754
+ // right, or the sheet; a kit without blocks has Inspect on the right
579
755
  get layout() {
580
756
  if (!this.hasBlocks) return "split"
581
757
  if (this.compact) return "sheet"
582
- return this.narrow && this.panels === "split" ? "left" : this.panels
758
+ const shown = this.shownPanes
759
+ return shown.length === 2 ? "split" : shown[0]?.side || "left"
583
760
  }
584
761
 
585
762
  get hasBlocks() {
@@ -598,10 +775,6 @@ export default class extends Controller {
598
775
  }
599
776
  }
600
777
 
601
- get combined() {
602
- return this.layout !== "split"
603
- }
604
-
605
778
  renderAll() {
606
779
  this.liquidChecker?.schedule()
607
780
  this.renderTopBar()
@@ -636,12 +809,13 @@ export default class extends Controller {
636
809
  this.compact ? null : h("span", { class: "font-semibold text-gray-900 dark:text-gray-100 mr-3" }, t(this.kit.name)),
637
810
  toggle(this.mode, [["edit", "edit", t("Edit")], ["preview", "eye", this.kit.previewTitle ? t(this.kit.previewTitle) : t("Preview")]], (mode) => this.setMode(mode)),
638
811
  this.kit.devices?.length ? toggle(this.device, this.kit.devices.map((device) => [device.key, device.icon, t(device.title)]), (device) => this.setDevice(device)) : null,
812
+ this.zoomControls(),
639
813
  this.translations.enabled ? this.translationLocaleMenu() : null,
640
814
  h("div", { class: "flex-1" }),
641
815
  // A compact editor shows its panels or not; one without blocks has none to arrange
642
816
  this.compact && h("button", { type: "button", title: t(this.sheetOpen ? "Hide panels" : "Show panels"), "aria-pressed": String(this.sheetOpen), class: `${TOOL} ${this.sheetOpen ? "bg-gray-100 dark:bg-gray-700" : ""}`, html: icon("panels-bottom"), onclick: () => this.setSheetOpen(!this.sheetOpen) }),
643
817
  this.hasBlocks && !this.compact && toggle(
644
- this.layout,
818
+ this.narrow ? this.layout : this.panels,
645
819
  [
646
820
  ["left", "panels-left", t("All panels on the left")],
647
821
  ["split", "panels-split", t(this.narrow ? "Too narrow to split the panels" : "Blocks on the left, Inspect on the right"), this.narrow],
@@ -681,34 +855,136 @@ export default class extends Controller {
681
855
  )
682
856
  }
683
857
 
858
+ // Each pane's tabs, and its open one shown. A tab is dragged to the other
859
+ // pane, or to a side without one, while the panes are side by side.
684
860
  renderLeftTabs() {
685
- const tab = (key, name) =>
686
- h("button", { type: "button", class: `${TAB} ${this.leftTab === key ? "border-blue-600 dark:border-blue-400 text-blue-700 dark:text-blue-300" : "border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`, onclick: () => this.setLeftTab(key) }, name)
687
- // replaceChildren would turn a null into the text "null", so only pass real tabs.
688
- const tabs = [tab("blocks", t("Blocks")), tab("layers", t("Layers"))]
689
- if (this.combined) tabs.push(tab("inspect", t("Inspect")))
690
- for (const panel of this.kitPanels) tabs.push(tab(panel.key, t(panel.label)))
691
- if (this.compact && this.hasBlocks) tabs.push(this.sheetClose)
692
- this.leftTabs.replaceChildren(...tabs)
693
- this.blocksElement.classList.toggle("hidden", this.leftTab !== "blocks")
694
- this.treeElement.classList.toggle("hidden", this.leftTab !== "layers")
695
- this.inspectorElement.classList.toggle("hidden", this.combined && this.leftTab !== "inspect")
696
- for (const panel of this.kitPanels) panel.element.classList.toggle("hidden", this.leftTab !== panel.key)
861
+ if (!this.hasBlocks) return
862
+ const movable = !this.compact && !(this.narrow && this.arrangement.left.length && this.arrangement.right.length)
863
+ for (const pane of this.shownPanes) {
864
+ const open = this.openTab(pane)
865
+ const tabs = pane.keys.map((key) =>
866
+ h(
867
+ "button",
868
+ {
869
+ type: "button",
870
+ role: "tab",
871
+ "aria-selected": String(open === key),
872
+ draggable: movable ? "true" : null,
873
+ title: movable ? t("Drag to move it to another panel") : null,
874
+ dataset: { tessEditTab: key },
875
+ class: `${TAB} ${open === key ? "border-blue-600 dark:border-blue-400 text-blue-700 dark:text-blue-300" : "border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,
876
+ onclick: () => this.setLeftTab(key),
877
+ ondragstart: (event) => this.startTabDrag(event, key),
878
+ ondragend: () => this.endTabDrag()
879
+ },
880
+ t(this.tab(key).label)
881
+ )
882
+ )
883
+ if (this.compact) tabs.push(this.sheetClose)
884
+ pane.strip.replaceChildren(...tabs)
885
+ for (const key of pane.keys) this.tab(key).element.classList.toggle("hidden", key !== open)
886
+ }
887
+ }
888
+
889
+ // The tab open in a pane: the one opened there last, else its first
890
+ openTab(pane) {
891
+ const open = this.openTabs[pane.side]
892
+ if (pane.keys.includes(open)) return open
893
+ if (pane.side !== "left" && pane.keys.includes(this.openTabs.left)) return this.openTabs.left
894
+ return pane.keys[0]
895
+ }
896
+
897
+ // Whether a tab is showing in its pane
898
+ isOpen(key) {
899
+ return this.shownPanes.some((pane) => this.openTab(pane) === key)
697
900
  }
698
901
 
699
902
  // The kit's panel that is open, if one is
700
903
  get panel() {
701
- return this.kitPanels.some((panel) => panel.key === this.leftTab) ? this.leftTab : null
904
+ if (!this.kitPanels.length) return null
905
+ return this.kitPanels.find((panel) => this.isOpen(panel.key))?.key || null
702
906
  }
703
907
 
704
- setLeftTab(tab) {
908
+ // Opens a tab in the pane it is in
909
+ setLeftTab(key) {
910
+ const pane = this.shownPanes.find((each) => each.keys.includes(key))
911
+ if (!pane) return
705
912
  const panel = this.panel
706
- this.leftTab = tab
913
+ this.openTabs[pane.side] = key
707
914
  this.renderLeftTabs()
708
915
  // The canvas is told which of the kit's panels is open, so it draws again when that changes
709
916
  if (panel !== this.panel) this.renderCanvas()
710
917
  }
711
918
 
919
+ // --- zoom -------------------------------------------------------------------------
920
+
921
+ // Out, the zoom (which fits the canvas, or back to 100%), and in
922
+ zoomControls() {
923
+ const percent = `${Math.round(this.zoom * 100)}%`
924
+ return h(
925
+ "div",
926
+ { class: "ml-1 flex items-center rounded-lg bg-gray-100 dark:bg-gray-900 p-0.5" },
927
+ h("button", { type: "button", title: t("Zoom out (⌘−)"), class: "w-7 h-7 flex items-center justify-center rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40", disabled: this.zoom <= MIN_ZOOM, html: icon("minus"), onclick: () => this.zoomBy(-1) }),
928
+ h("button", { type: "button", title: t(this.zoom === 1 ? "Fit the canvas (⇧1)" : "Back to 100% (⌘0)"), "aria-label": t("Zoom"), dataset: { tessEditZoom: "" }, class: "h-7 min-w-12 px-1 rounded-md text-xs tabular-nums text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100", onclick: () => (this.zoom === 1 ? this.zoomToFit() : this.setZoom(1)) }, percent),
929
+ h("button", { type: "button", title: t("Zoom in (⌘+)"), class: "w-7 h-7 flex items-center justify-center rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40", disabled: this.zoom >= MAX_ZOOM, html: icon("plus"), onclick: () => this.zoomBy(1) })
930
+ )
931
+ }
932
+
933
+ // To the next step in or out
934
+ zoomBy(direction) {
935
+ const next = direction > 0 ? ZOOMS.find((zoom) => zoom > this.zoom + 0.001) : [...ZOOMS].reverse().find((zoom) => zoom < this.zoom - 0.001)
936
+ this.setZoom(next ?? this.zoom)
937
+ }
938
+
939
+ // Zooms the canvas, keeping the point `at` (in the canvas's viewport) where
940
+ // it is; without it, the top left of what shows
941
+ setZoom(zoom, { at = null } = {}) {
942
+ zoom = Math.round(Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, zoom)) * 100) / 100
943
+ if (zoom === this.zoom) return
944
+ const win = this.frame.contentWindow
945
+ const before = this.zoom
946
+ const point = at || { x: 0, y: 0 }
947
+ const scroll = win ? { x: win.scrollX + point.x, y: win.scrollY + point.y } : null
948
+ this.zoom = zoom
949
+ this.applyZoom()
950
+ if (scroll) win.scrollTo(scroll.x - (point.x * before) / zoom, scroll.y - (point.y * before) / zoom)
951
+ this.renderTopBar()
952
+ }
953
+
954
+ // The whole canvas in view, at most at 100%
955
+ zoomToFit() {
956
+ const doc = this.frame.contentDocument
957
+ if (!doc?.body) return
958
+ const range = doc.createRange()
959
+ range.selectNodeContents(doc.body)
960
+ const content = range.getBoundingClientRect()
961
+ const win = this.frame.contentWindow
962
+ const width = Math.max(content.width, 1) + 32
963
+ const height = Math.max(content.bottom + win.scrollY, 1) + 16
964
+ const box = this.frameWrap.parentElement.getBoundingClientRect()
965
+ const device = this.deviceWidth
966
+ const fit = Math.min(1, (device || box.width) / width, box.height / height)
967
+ this.setZoom(Math.floor(fit * 20) / 20)
968
+ win.scrollTo(0, 0)
969
+ }
970
+
971
+ // The iframe at the size that, scaled, fills its place: what's in it lays
972
+ // out in a viewport as much larger (or smaller) as it is zoomed out (or in)
973
+ applyZoom() {
974
+ const zoom = this.zoom
975
+ const scaled = zoom !== 1
976
+ Object.assign(this.frame.style, { width: scaled ? `${100 / zoom}%` : "", height: scaled ? `${100 / zoom}%` : "", transform: scaled ? `scale(${zoom})` : "" })
977
+ const width = this.deviceWidth
978
+ this.frameWrap.style.width = width ? `${width * zoom}px` : ""
979
+ this.canvas?.refresh()
980
+ }
981
+
982
+ // The device's width in pixels, when it has one (mobile, 375px)
983
+ get deviceWidth() {
984
+ const width = this.kit.devices?.find((option) => option.key === this.device)?.width
985
+ return width ? parseFloat(width) : null
986
+ }
987
+
712
988
  setMode(mode) {
713
989
  this.stopEditing()
714
990
  this.mode = mode
@@ -720,8 +996,8 @@ export default class extends Controller {
720
996
  this.device = device
721
997
  // A device without a width (desktop) fills the canvas area; one with a
722
998
  // width (mobile, 375px) shows a full-height frame in the middle of it.
723
- const width = this.kit.devices?.find((option) => option.key === device)?.width
724
- this.frameWrap.style.width = width || ""
999
+ const width = this.deviceWidth
1000
+ this.applyZoom()
725
1001
  this.frameWrap.classList.toggle("shadow-sm", !!width)
726
1002
  this.main.classList.toggle("px-4", !!width)
727
1003
  this.renderTopBar()
@@ -819,10 +1095,10 @@ export default class extends Controller {
819
1095
 
820
1096
  // --- selection and editing ---------------------------------------------------
821
1097
 
822
- // `reveal` (a click on the canvas) shows the Inspect tab when the panels are
823
- // combined, and opens their sheet on a compact editor.
1098
+ // `reveal` (a click on the canvas) opens the Inspect tab in its pane, and
1099
+ // the sheet on a compact editor.
824
1100
  select(id, { reveal = false } = {}) {
825
- if (reveal && this.combined && this.leftTab !== "inspect") this.setLeftTab("inspect")
1101
+ if (reveal && this.hasBlocks && !this.isOpen("inspect")) this.setLeftTab("inspect")
826
1102
  if (reveal) this.setSheetOpen(true)
827
1103
  if (this.editingId && this.editingId !== id) this.stopEditing()
828
1104
  if (!find(this.doc, id)) id = this.doc.id
@@ -977,7 +1253,7 @@ export default class extends Controller {
977
1253
  const node = createFromPalette(key)
978
1254
  this.commit((doc) => insert(doc, parentId, index, node))
979
1255
  this.select(node.id)
980
- this.leftTab === "layers" && this.tree.render()
1256
+ this.isOpen("layers") && this.tree.render()
981
1257
  }
982
1258
 
983
1259
  // Clicking a tile: add inside the selection when it fits, otherwise after the
@@ -1155,8 +1431,17 @@ export default class extends Controller {
1155
1431
  }
1156
1432
  return
1157
1433
  }
1434
+ // Zoom, also while typing in a field: ⌘+ and ⌘− in steps, ⌘0 back to 100%
1435
+ if (mod && !event.altKey && ["=", "+", "-", "0"].includes(event.key)) {
1436
+ event.preventDefault()
1437
+ event.key === "0" ? this.setZoom(1) : this.zoomBy(event.key === "-" ? -1 : 1)
1438
+ return
1439
+ }
1158
1440
  if (typing) return
1159
- if (mod && event.key.toLowerCase() === "z") {
1441
+ if (event.shiftKey && !mod && !event.altKey && event.code === "Digit1") {
1442
+ event.preventDefault()
1443
+ this.zoomToFit()
1444
+ } else if (mod && event.key.toLowerCase() === "z") {
1160
1445
  event.preventDefault()
1161
1446
  event.shiftKey ? this.redo() : this.undo()
1162
1447
  } else if (mod && event.key.toLowerCase() === "y") {
@@ -62,6 +62,17 @@ a{cursor:default}
62
62
  .tess-liquid-error{text-decoration:underline wavy rgba(220,38,38,.9);text-decoration-skip-ink:none;text-underline-offset:3px}
63
63
  `
64
64
 
65
+ // A rect in an iframe's viewport in the page's, the iframe maybe scaled
66
+ export function frameToPage(frame, rect) {
67
+ const box = frame?.getBoundingClientRect() || { left: 0, top: 0, width: 1 }
68
+ const scale = frame?.offsetWidth ? box.width / frame.offsetWidth : 1
69
+ const left = box.left + rect.left * scale
70
+ const top = box.top + rect.top * scale
71
+ const width = (rect.right - rect.left) * scale
72
+ const height = (rect.bottom - rect.top) * scale
73
+ return { left, top, right: left + width, bottom: top + height, width, height }
74
+ }
75
+
65
76
  // A file dragged in from outside the browser (block drags set editor.drag)
66
77
  function isFileDrag(event, editor) {
67
78
  return !editor.drag && Array.from(event.dataTransfer?.types || []).includes("Files")
@@ -107,6 +118,8 @@ export class Canvas {
107
118
  // overlay's coordinates are the document's
108
119
  doc.documentElement.append(this.overlay)
109
120
  this.win.scrollTo(0, scrollY)
121
+ // ⌘ or Ctrl and the wheel, or a pinch on a trackpad, zooms where the pointer is
122
+ doc.addEventListener("wheel", (event) => this.onWheel(event), { passive: false })
110
123
  if (mode === "edit") {
111
124
  this.listen()
112
125
  this.annotate()
@@ -496,14 +509,21 @@ export class Canvas {
496
509
  this.refresh()
497
510
  }
498
511
 
499
- // Converts a rect in iframe viewport coordinates to the parent page's viewport.
512
+ // Converts a rect in iframe viewport coordinates to the parent page's
513
+ // viewport, the iframe scaled as the canvas is zoomed
500
514
  toParentRect(rect) {
501
- const frame = this.frame.getBoundingClientRect()
502
- return { left: rect.left + frame.left, top: rect.top + frame.top, right: rect.right + frame.left, bottom: rect.bottom + frame.top, width: rect.width, height: rect.height }
515
+ return frameToPage(this.frame, rect)
503
516
  }
504
517
 
505
518
  // --- events ---------------------------------------------------------------
506
519
 
520
+ onWheel(event) {
521
+ if (!event.ctrlKey && !event.metaKey) return
522
+ event.preventDefault()
523
+ const delta = event.deltaMode === 1 ? event.deltaY * 16 : event.deltaY
524
+ this.editor.setZoom(this.editor.zoom * Math.exp(-delta / 200), { at: { x: event.clientX, y: event.clientY } })
525
+ }
526
+
507
527
  onMove(event) {
508
528
  if (this.editor.drag || this.free.dragging || this.resizing) return
509
529
  const hit = this.hit(event.target)
@@ -30,6 +30,7 @@ const paths = {
30
30
  "panels-right": '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M14 4v16"/><path d="M16.5 8h2M16.5 11h2" opacity=".6"/>',
31
31
  lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',
32
32
  plus: '<path d="M12 5v14M5 12h14"/>',
33
+ minus: '<path d="M5 12h14"/>',
33
34
  trash: '<path d="M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"/>',
34
35
  copy: '<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/>',
35
36
  move: '<path d="M12 3v18M3 12h18M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3"/>',
@@ -16,7 +16,7 @@ import { Color, Decoration, DecorationSet, Editor, Extension, Plugin, PluginKey,
16
16
  import { t } from "tess_edit/core/i18n"
17
17
  import { missingArguments, translationCalls } from "tess_edit/core/translations"
18
18
  import { valueCalls } from "tess_edit/core/values"
19
- import { showText } from "tess_edit/ui/canvas"
19
+ import { frameToPage, showText } from "tess_edit/ui/canvas"
20
20
  import { askText } from "tess_edit/ui/dialog"
21
21
  import { h } from "tess_edit/ui/dom"
22
22
  import { icon } from "tess_edit/ui/icons"
@@ -291,8 +291,8 @@ function tiptapAdapter(editor, scope) {
291
291
  // The caret's place in the iframe, in the page's viewport
292
292
  rect() {
293
293
  const caret = editor.view.coordsAtPos(editor.state.selection.from)
294
- const frame = editor.view.dom.ownerDocument.defaultView.frameElement?.getBoundingClientRect() || { left: 0, top: 0 }
295
- return { left: caret.left + frame.left, right: caret.right + frame.left, top: caret.top + frame.top, bottom: caret.bottom + frame.top }
294
+ const frame = editor.view.dom.ownerDocument.defaultView.frameElement
295
+ return frame ? frameToPage(frame, caret) : caret
296
296
  }
297
297
  }
298
298
  }
@@ -44,6 +44,7 @@ en:
44
44
  at_least: "At least"
45
45
  at_most: "At most"
46
46
  auto: "Auto"
47
+ back_to_100_0: "Back to 100% (⌘0)"
47
48
  background: "Background"
48
49
  background_image: "Background image"
49
50
  between_rows: "Between rows"
@@ -96,6 +97,7 @@ en:
96
97
  drag_blocks_onto_the_canvas_or_into_the_layers_tree_liquid_b: "Drag blocks onto the canvas or into the Layers tree. Liquid blocks wrap other blocks in {% for %} or {% if %}."
97
98
  drag_onto_the_canvas_or_click_to_add: "Drag onto the canvas, or click to add"
98
99
  drag_to_move: "Drag to move"
100
+ drag_to_move_it_to_another_panel: "Drag to move it to another panel"
99
101
  drag_to_resize: "Drag to resize"
100
102
  drag_to_set_the_column_s_width: "Drag to set the column's width"
101
103
  drop_a_cell_here: "Drop a cell here"
@@ -116,6 +118,7 @@ en:
116
118
  every_other_row: "Every other row"
117
119
  expand: "Expand"
118
120
  find_in_source: "Find in %{source}"
121
+ fit_the_canvas_1: "Fit the canvas (⇧1)"
119
122
  font_family: "Font family"
120
123
  font_size: "Font size"
121
124
  font_weight: "Font weight"
@@ -207,6 +210,8 @@ en:
207
210
  paragraph_style: "Paragraph style"
208
211
  part_of_the_layout: "Part of the layout"
209
212
  preview: "Preview"
213
+ put_it_in_a_panel_on_the_left: "Put it in a panel on the left"
214
+ put_it_in_a_panel_on_the_right: "Put it in a panel on the right"
210
215
  radius: "Radius"
211
216
  redo_z: "Redo (⇧⌘Z)"
212
217
  remove: "Remove"
@@ -282,3 +287,6 @@ en:
282
287
  whether_it_s_the_last: "Whether it's the last"
283
288
  width: "Width"
284
289
  without: "{% %{tag} %} without {% %{block} %}"
290
+ zoom: "Zoom"
291
+ zoom_in: "Zoom in (⌘+)"
292
+ zoom_out: "Zoom out (⌘−)"
@@ -44,6 +44,7 @@ nl:
44
44
  at_least: "Minstens"
45
45
  at_most: "Hoogstens"
46
46
  auto: "Automatisch"
47
+ back_to_100_0: "Terug naar 100% (⌘0)"
47
48
  background: "Achtergrond"
48
49
  background_image: "Achtergrondafbeelding"
49
50
  between_rows: "Tussen rijen"
@@ -96,6 +97,7 @@ nl:
96
97
  drag_blocks_onto_the_canvas_or_into_the_layers_tree_liquid_b: "Sleep blokken naar het canvas of in de boom bij Lagen. Liquid-blokken zetten andere blokken in {% for %} of {% if %}."
97
98
  drag_onto_the_canvas_or_click_to_add: "Sleep naar het canvas, of klik om toe te voegen"
98
99
  drag_to_move: "Sleep om te verplaatsen"
100
+ drag_to_move_it_to_another_panel: "Sleep om het naar een ander paneel te verplaatsen"
99
101
  drag_to_resize: "Sleep om het formaat te wijzigen"
100
102
  drag_to_set_the_column_s_width: "Sleep om de kolombreedte in te stellen"
101
103
  drop_a_cell_here: "Zet hier een cel neer"
@@ -116,6 +118,7 @@ nl:
116
118
  every_other_row: "Om de andere rij"
117
119
  expand: "Vergroten"
118
120
  find_in_source: "Zoeken in %{source}"
121
+ fit_the_canvas_1: "Canvas passend maken (⇧1)"
119
122
  font_family: "Lettertype"
120
123
  font_size: "Lettergrootte"
121
124
  font_weight: "Letterdikte"
@@ -207,6 +210,8 @@ nl:
207
210
  paragraph_style: "Alineastijl"
208
211
  part_of_the_layout: "Onderdeel van de layout"
209
212
  preview: "Voorbeeld"
213
+ put_it_in_a_panel_on_the_left: "Zet het in een paneel links"
214
+ put_it_in_a_panel_on_the_right: "Zet het in een paneel rechts"
210
215
  radius: "Afronding"
211
216
  redo_z: "Opnieuw (⇧⌘Z)"
212
217
  remove: "Verwijderen"
@@ -282,3 +287,6 @@ nl:
282
287
  whether_it_s_the_last: "Of het de laatste is"
283
288
  width: "Breedte"
284
289
  without: "{% %{tag} %} zonder {% %{block} %}"
290
+ zoom: "Zoom"
291
+ zoom_in: "Inzoomen (⌘+)"
292
+ zoom_out: "Uitzoomen (⌘−)"
@@ -1,3 +1,3 @@
1
1
  module TessEdit
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tess_edit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt