@bygga.dev/editor 1.9.10 → 1.9.12

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.
package/README.md CHANGED
@@ -184,6 +184,12 @@ A missing locale label falls back to the default locale, then to the bare id. Yo
184
184
  backend must later resolve every id it sees; see
185
185
  [Sending and publishing](#sending-and-publishing).
186
186
 
187
+ A tag can also be a link's whole url — an unsubscribe or "view in browser" link, say:
188
+ type `{{unsubscribe}}` as the url in the link dialog or a button's URL field. The editor
189
+ keeps it as typed (it only puts `https://` in front of something that starts like a host
190
+ name, `www.example.com`), and the compiled email carries it in the `href` for your
191
+ backend to replace with the full url.
192
+
187
193
  ### `brand` property
188
194
  The colours and fonts your embed permits, the look new blocks start with, values for
189
195
  your block plugins, and which block tiles to offer — a **menu, never a rewrite of a
@@ -262,7 +268,7 @@ editor.brand = {
262
268
  align: 'center', level: 2, padding: 8, background: '#ffffff',
263
269
  margin: { top: 0, right: 0, bottom: 16, left: 0 } },
264
270
  text: { font: 'arial', fontSize: 16, color: '#333333', align: 'left',
265
- paragraphSpacing: 8 },
271
+ paragraphSpacing: 8, lineHeight: 1.5 },
266
272
  button: { background: '#2f2a72', textColor: '#ffffff', font: 'arial',
267
273
  fontSize: 16, bold: true, align: 'center',
268
274
  padding: { top: 12, right: 24, bottom: 12, left: 24 },
@@ -281,7 +287,8 @@ Each style can also set the block's box — `margin` and `padding` (a number or
281
287
  `{ top, right, bottom, left }`), `borderRadius` (a number, or
282
288
  `{ topLeft, topRight, bottomRight, bottomLeft }`), and `border`
283
289
  (`{ width, color?, style? }`, `style` one of `solid`, `dashed`, `dotted`) — plus
284
- `underline` for header and text, `paragraphSpacing` (`0`, `4`, `8`, `12`, `16`,
290
+ `underline` and `lineHeight` (the space between lines as a multiple of the text's
291
+ size: `1`, `1.1`, `1.2`, `1.3`, `1.4`, `1.5`, `1.6`, `1.8` or `2`) for header and text, `paragraphSpacing` (`0`, `4`, `8`, `12`, `16`,
285
292
  `20`, `24` or `32` px) for text, and `minWidth` (whole px) for a button: the narrowest
286
293
  it is drawn, which a longer label still widens. Classic Outlook for Windows ignores a
287
294
  minimum width and draws the button at its label's width.
@@ -290,7 +297,7 @@ A style is a **starting value, written into the block when it is placed** — ex
290
297
  if the author had chosen each setting by hand. Revising your Brand changes the blocks
291
298
  placed next, never the ones already in your documents, and the compiled email knows
292
299
  nothing about Brands. A header's title and a button carry their whole style from the
293
- moment they appear; a text block is placed with its alignment, background and padding,
300
+ moment they appear; a text block is placed with its alignment, spacing, background and padding,
294
301
  and the face, size, colour and weight are applied to what the author types into an
295
302
  empty paragraph (a mark needs text to sit on). The author can change any of it
296
303
  afterwards, as with any block.
@@ -540,8 +547,8 @@ means no controls — same as no `ai` at all.
540
547
  actions. It runs on their selection, or on the whole block when nothing is selected, one
541
548
  paragraph at a time: each paragraph or heading is its own `run` call, all sent at once, so
542
549
  a block keeps its paragraphs, heading level, line breaks and styling. The answers land
543
- together as one undo step, around anything the author typed while waiting. The button is
544
- disabled while requests are in flight.
550
+ together as one undo step, around anything the author typed while waiting. While requests
551
+ are in flight, a ring turns around the button and it can't start another run.
545
552
 
546
553
  ### Implementing the endpoint
547
554
 
@@ -658,7 +665,7 @@ the whole flow (including the failure path):
658
665
  ai: {
659
666
  actions: ['proofread', 'rewrite', 'shorten', 'expand'],
660
667
  run: async ({ action, text }) => {
661
- await new Promise((r) => setTimeout(r, 400)) // see the pending state
668
+ await new Promise((r) => setTimeout(r, 1200)) // see the progress ring
662
669
  if (text.includes('boom')) throw new Error('mock failure')
663
670
  return `[${action}] ${text}`
664
671
  },