Skip to content

Release 5.0.0

Latest

Choose a tag to compare

@antonmedv antonmedv released this 09 Nov 21:12
· 1 commit to master since this release
3d6073d

CodeJar 5 is a modernization release: a new build, real-browser tests, and a batch of editing bug fixes found by those tests. New demo and docs: https://antonmedv.github.io/codejar/

Breaking changes

  • codejar/cursor is removed. The cursorPosition, selectedText, textBeforeCursor and textAfterCursor helpers are gone. Use jar.save() for the caret position, or copy the helpers from 4.3.0.
  • Tab with a multi-line selection indents the selected lines instead of replacing the selection with a tab.
  • Shift+Tab outdents every selected line, using each line's full indentation (it used to count only the whitespace before the caret).
  • Auto-closing ignores Ctrl/Cmd shortcuts, so e.g. Cmd+[ no longer types []. AltGr (Ctrl+Alt) still types brackets.
  • Cut with nothing selected does nothing. It used to delete a character and empty the clipboard.
  • The package targets ES2022 (was ES2021).

Fixes

  • Undo right after typing (within 300 ms) now works, and redo brings the text back.
  • Undo history is recorded when the element already has focus when CodeJar starts (e.g. autofocus).
  • restore(pos) no longer modifies the object you pass in.
  • save() returns the right position when the selection is on the editor element itself, and no longer changes the DOM.
  • updateOptions({ spellcheck }) now takes effect.
  • destroy() cancels pending highlight and history updates, which used to throw after the element was removed.
  • Importing CodeJar no longer touches window, so it can be imported during server-side rendering.
  • Firefox: Enter at the end of the text no longer leaves a trailing space in the code.

Other

  • Options is exported as a type.
  • Built with Vite; tested in Chromium and Firefox with Vitest browser mode.
  • Published from GitHub Actions with npm trusted publishing and provenance.