Skip to content

Releases: FIameCaster/prism-code-editor

Release 3.4.0-beta.1

27 Jul 14:33
Compare
Choose a tag to compare
Release 3.4.0-beta.1 Pre-release
Pre-release

Adds experimental autocomplete with definitions for HTML, CSS, JavaScript, TypeScript and ReactJSX (#26)

Release 3.3.3

15 Jul 14:50
Compare
Choose a tag to compare
  • Added this: void to editor methods, allowing type safe destructuring of the methods (c4aebcf)
  • The editorFromPlaceholder function now accepts text- and comment nodes as placeholders (aae5ebd)
  • Improved color contrast for search widget options in some themes (293565a)
  • Decreased specificity of the interpolation-punctuation selectors in many themes (1d81bee)
  • Brackets and tags with different parent tokens can now be matched together. This fixes bracket matching in ejs for example (8faa747)

Release 3.3.2

12 Jun 21:47
Compare
Choose a tag to compare
  • Switched from line commends to end of line comments for comment toggling in Abap (1c9648f)
  • Added some missing tokens to the GitHub Dark Dimmed and Night Owl themes (bbb559c)
  • Improved behavior when deleting spaces used for indentation (9709e75)
  • Fixed some commands scrolling the cursor into view in read-only mode (9709e75)
  • Improved cursor position extension on wrapping lines (f15b524)
  • Selection matches and the search widget are no longer hidden with display: none, instead being removed from the DOM (b0ea8cd)
  • The web components are now form-friendly thanks to @wyrmisis (#20)

Release 3.3.1

02 May 16:41
Compare
Choose a tag to compare
  • Added auto-indenting and comment toggling to the aliases of bash and xeora (550c39f)
  • Added support for tag matching in actionscript (7d8b049)
  • Fixed issue with the string pattern in typoscript (770e9bb)
  • Fixed the automatic closing of directive blocks in apacheconf (616b7f7)
  • Fixed automatic indentation and tag-closing in XML (ab15799)
  • Fixed the automatic tag closing affecting prologs (ab15799)
  • All attributes starting with on are now highlighted as JavaScript instead of just a few in markup (c333b81)
  • editor.options.value is no longer synchronized with editor.value when calling editor.setOptions() (a5b53b1)
  • Small improvements to multiple themes (5132cd3)

Release 3.3.0

18 Apr 16:51
Compare
Choose a tag to compare
  • Added comment toggling to the following languages: abap, agda, basic, batch, bbj, excel-formula, vbnet, yang and zig (3757059)
  • Fixed prism-code-editor/languages/bsl overriding comment toggling for bro instead of adding comment toggling to bsl (3757059)
  • Fixed incorrect tokens used for comment toggling in cshtml (3757059)
  • Added some language- aliases to the HTTP language (8818315)
  • Fixed line comments not being highlighted at the start of the first line in soy (276ca3a)
  • Small changes to the stylus language so it works better with bracket matching (c77f262)
  • Square- and round brackets are no longer converted to plain text in JSX contexts allowing them to be matched together (2cfc21d)
  • Small performance improvement for when only a single line changes (9289101)

Release 3.2.1

05 Apr 00:51
Compare
Choose a tag to compare

Search widget improvements

  • Fixed issue replacing adjacent matches there the previous match was selected instead (05a941d)
  • Fixed selection matches being highlighted after replacing using the keyboard shortcuts (05a941d)
  • Fixed issue where replacing empty matches with an empty string would delete a character (05a941d)
  • Fixed the textarea stealing focus from the find input in Safari (7645cee)
  • When the replace button selected the closest match, it was scrolled into view without scroll padding. Scroll padding is now used (05a941d)

Note: ReplaceAPI.replace no longer selects the closest match and only returns its index. Call ReplaceAPI.selectMatch afterwards if an index was returned instead.

Release 3.2.0

26 Mar 17:16
Compare
Choose a tag to compare

New features

Added comment toggling, automatic indentation, and tag-closing to nearly all languages. Previously this was only present in markup, markdown, xml, css, jsx, tsx, python and some c-like languages (18e814c)

Added two parameters to the matchBrackets() extension used to customize which punctuation tokens can be matched together. The extension now searches both the first and last characters in punctuation tokens instead of just the last character. This comes at a slight performance cost, but only testing the last character didn't work for a few languages (64c6041)

Added the ending position of the bracket to the Bracket type (64c6041)

Changes

The fullEditor() setup along with its web component have been marked as deprecated. This is because they'll get merged together with the basicEditor() setup in the next major release (2897736)

The NPM package no longer contains minified JavaScript code (#7) (56907f1)

Improvements

  • Improved patterns of multiline tokens in Haml, Pug and Sass grammars (fb025d9, 9e7f0f2)
  • Added bracket comments to CMake (c3c7614)
  • Small refactors to many Prism grammars (0cebe12)
  • Whitespace is no longer required between attributes in JSX tags (0a1d28a)
  • Improved escaping of braces in XQuery using {{ (4672340)

Better templating (7943a7c)

The placeholders for the templating are now simply whitespace instead of looking like ___PH0___. This has multiple advantages:

  1. It works with all grammars. Previously, grammars that could split the placeholders into multiple tokens couldn't be used as host grammars.
  2. It's less complex, requiring significantly less code.
  3. It sometimes leads to better highlighting.

Additionally, recursion was used to insert multiple placeholders into the same string. Highlighting '<??>'.repeat(5000) with PHP would therefore lead to a stack overflow. Rewriting this to a loop fixes the potential stack overflows and improves performance. In most cases the performance increase is in the ballpark of 10-20%, but in best-case scenarios it can be multiple times faster.

Bug fixes

  • Fixed selection often being incorrect after an undo (fc3c678, e4382f5)
  • JSX tags with a block comment at the end like <div /* */> no longer behave like self-closing tags (0a1d28a)
  • JSX fragments now automatically close when typing
  • HTML tags such as <a href=foo/> no longer behave like self-closing tags (0a1d28a)
  • Self closing tags are no longer case sensitive, so for example <INPUT> would be self-closing in HTML (0a1d28a)

Release 3.1.1

13 Mar 14:57
Compare
Choose a tag to compare

Fix tooltips that broke in version 3.1.0 (8eb668f)

Release 3.1.0

12 Mar 23:24
Compare
Choose a tag to compare

New features

History extension

Previously, the browser's native undo/redo was used. While this often worked well enough, it has its limitations. In Chrome and Safari, all form elements share the same undo stack, and in Firefox, hiding an element with display: none would clear its undo history. The new history extension has none of these issues. You can even transfer the history from an editor to another, but not without breaking the old editor.

The extension is tiny. Adding it to the demo website, only increases its JS bundle by 0.35kB gzipped.

The history extension has been added to the basic setup and the full setup. The extension can be accessed from PrismEditor.extensions.

// Here's how to import the extension
import { editHistory } from "prism-code-editor/commands"

New theme

Prism's Tomorrow Night theme has been implemented. It's on the demo website if you want to try it.

Note: I forgot to add this file to the package. This was fixed in 3.1.2

import "prism-code-editor/themes/prism-tomorrow.css"

Improvements

  • Significantly increased performance of the getClosestToken() utility, especially for long lines. This was achieved by using a TreeWalker for the searching instead of using querySelector() coupled with Range.toString() to find the position of the tokens. The performance increase can be anywhere from a few times faster for short lines to a greater than 100x improvement for lines 1000s of characters long. Not sure why you'd view minified code in an editor, but that will perform much better now (9f8ebe6)
  • Decreased gzipped size of all Prism languages by more than 10kB (5%) through refactoring and optimization.
  • An input event on the textarea now always updates the editor even if its value didn't change (7a3ddef)

Fixes

  • Added .js extensions to most imports. The type declarations now work properly with a moduleResolution of NodeNext or Node16 (b94978b)
  • Added type="button" to the copy button and all buttons in the search widget. If you had an editor inside a form, these buttons would previously submit the form when clicked. This is no longer the case (8ea416b)
  • Fixed potential empty matches that could lead to buggy highlighting in multiple languages (b28da8d)
  • The getLanguage() utility now supports languages with hyphens in their name (d214971)
  • Changed the default tab size of the web components from 0 to 2 spaces. This wasn't a big issue since 0 would internally be replaced with 2 (e2ad6e5)
  • Fixed alignment issue with the highlightSelectionMatches() extension in RTL mode (741bc85)
  • Fixed incorrect highlighting of capitalized generic functions in the TSX language (bf85599)
  • Added a language-jsx alias to spread tokens inside JSX tags (bf85599)

Search widget improvments

  • Selection change handlers no longer run with the incorrect selection after calling the insertText() utility if the search widget is open (7a3ddef)
  • Selection matches are no longer highlighted after replacing a match with the search widget (7a3ddef)
  • The keyboard shortcuts for the 4 toggle buttons now uses keyCode instead of code on Mac. This will work better with non-QWERTY keyboards on Mac (7a3ddef)

Release 3.0.1

16 Feb 17:51
Compare
Choose a tag to compare
  • Fenced code blocks with more than three backticks are now supported in markdown (e40eaa7)
  • Fixed empty script/style tags potentially breaking the highlighting of css/js inside later script/style tags (b84f011)
  • The bracket level no longer gets reset back to zero when entering a nested token, so the rainbow brackets now work as expected again (0f304a2)
  • The search match selected while typing in the search widget is now the match closest to where the cursor was last time the editor was focused. This means the editor's cursor will jump less around while searching (eb00bbc)