Skip to content

Inkkit 0.3.1

Choose a tag to compare

@aicayzer aicayzer released this 26 Oct 17:17
· 45 commits to main since this release
b00bb0b

Inkkit 0.3.1

Authored reference text, a repaired selection and gap cursor, new host controls, and edits that keep more of the source an author wrote.

Added

  • FileReference.raw and WikiLinkReference.raw give the Markdown of a file embed or wiki link as the document holds it, including its alias, escapes and a table cell's \|. Use it to match a reference to the text in snapshot(), and to tell [[Plan]] from [[Plan|Plan]].
  • refreshReferences(targets?, expectedGeneration?) resolves wiki links and file embeds again, all of them or those whose target matches. It works in a read-only editor and during composition, and a file card stays as it is until the new answer differs.
  • appendImages(images, expectedGeneration?) adds images as the last blocks without moving focus, scrolling or changing the selection. It returns false in source and TXT modes or without an image adapter, and a document that ends in an unclosed code fence refuses it with preservation.
  • ImageAdapter.contextMenu(reference, point, context) lets a host show its own menu, such as Save Image, on an image. Inkkit selects the image and suppresses the web view's menu only when the hook is set.
  • EditorOptions.linkSchemes lists extra link schemes, such as things, that render, open through events.openLink, pass format('link') and stay in copied HTML. javascript, data, vbscript and file are refused with invalid-argument, and pasted HTML and print keep only the built-in schemes.
  • The shortcut names indent and outdent, bound by default to Tab and Shift-Tab, let a host choose other keys for list indentation.
  • A host slash command that throws or rejects reports the new slash-command-failed error code, with the original error as cause. An InkKitError that the command throws is reported unchanged.

Fixed

  • A screenshot that the clipboard holds as both PNG and TIFF is inserted once. Images in one paste or drop collapse into one when their bytes are identical, or when a PNG and a TIFF have the same pixel size and matching names. Different images still insert separately.
  • Text typed at the end of an existing link no longer joins it. Typing s after [docs](docs) saves [docs](docs)s, not [docss](docs), and a space typed there is saved outside the link. This holds for keys, insertText and composed text, for inline links, reference links and angle autolinks.
  • A link started with format('link', { destination }) takes the text typed next until the first whitespace or until the caret moves. Text that replaces part or all of a link's label, by typing, plain-text paste or find and replace, stays in the link. Bare addresses keep growing as you type them. The Markdown support page has the rules under typing at a link's edges.
  • Typing in link text keeps bold, italic, strikethrough and highlight outside the link. Typing X in **[a b](u)** now saves **[a b](u)X**, not [**a bX**](u).
  • A new line or item in a quote, callout or list keeps the document's own quote markers and indentation, so a pasted line break no longer saves a lazy continuation line, and an item added to an indented list is no longer refused.
  • Tab and Shift+Tab on a list item keep its source, including its emphasis delimiters. Lifting a paragraph out of a quote that opens a list item no longer writes a <br /> line, and Backspace after a typed code fence takes the fence back.
  • Typing ; after &amp, &copy or &#35 saves the characters typed instead of being refused, and text typed inside an unknown reference such as &am; lands in the right place.
  • Enter beside an unsupported callout inside a quote or list item no longer refuses the edit, and a tight list beside such a callout keeps its authored lines.
  • A fenced or indented code block in a document that uses lone CR line endings is saved with CR, not LF.
  • A paragraph that holds only %%c%% stays on one line unless it holds a line break. A comment written on three lines stays on three.
  • The selection is painted by one editor at a time. It no longer stays highlighted after focus moves to another editor or to text elsewhere on the page, and it no longer draws the full-width bars that WebKit added.

Appearance

  • The gap cursor after a final table, image, callout or divider is a 2px caret, one line tall, in the accent color.
  • --inkkit-selection-background colors selected text while the editor has focus in an active window. --inkkit-inactive-selection-background colors it while the window is inactive, while focus is in a host field, or after blur().
  • Wiki links share the link color and hover underline. A link that WikiLinkAdapter.resolve reports as missing gets a dashed underline, which also shows in forced-colors mode, and the wikiMissing label as its accessible description.

Compatibility

This release has one source-breaking change and one new error code.

  • raw is required. FileReference.raw and WikiLinkReference.raw are required properties. A host test double or fixture that builds either type does not compile until it supplies raw. Code that only reads references is unaffected.
  • A new error code. slash-command-failed joins the closed EditorErrorCode list. A host with an exhaustive switch over error codes needs a new branch.
  • Everything else is additive. refreshReferences, appendImages, ImageAdapter.contextMenu, EditorOptions.linkSchemes, the indent and outdent shortcut names, and the two selection tokens change nothing for a host that does not use them. The default Tab and Shift-Tab behaviour in lists is the same as before.
  • Saved bytes differ in a few edits. The list, quote, link, character reference, lone-CR and comment fixes above change what an edit writes to the document, and in each case the new bytes are closer to the authored source. Source outside an edit is unchanged, and unsupported syntax is still refused.
  • Links no longer grow at their ends. An inline or reference link, or an angle autolink, is now a non-inclusive mark, so text typed at either end stays outside it. Code that extended a link by typing at its end must type inside the label instead. No public method or option changed.
  • Shared formatting is written once. Formatting that a link shares with the text beside it is written around both, so **[a b](u)** plus a typed X saves **[a b](u)X**, not [**a b**](u)**X**. Collapsed and shortcut references and autolinks are not changed.
  • Identical images in one paste insert once. A host that passes the same bytes twice to paste now gets one image.

Apps must adopt the published package separately.