Skip to content

2.0.1

Compare
Choose a tag to compare
@WebCoder49 WebCoder49 released this 10 Jul 09:06
· 88 commits to main since this release
0242a75

馃啎 What's in this release?

This is a major release, with several aims:

  1. 鈱笍 Make <code-input> work more like a <textarea>, including more HTML form compatibility (demo) - thank you especially to @vanowm
  2. 馃Ч Add TypeScript support - please see WebCoder49/code-input-for-typescript
  3. 馃帀 Keep adding optional plugins from the open-source community - please see plugins/README.md

(+bug fix for template not registering bug)

馃攲 API Changes

鈿狅笍 This section is only useful for library users transferring their code-input version from v1.<something> to v2.<something>. If you're a new user, please see the README file; otherwise, please click.

In order to carry out significant progress with the library, and in order to make the code cleaner, some changes have been made to how you should use the library. Methods from versions 1.* still exist, but are deprecated so will not be improved.

General Changes

Reason Old Usage New Usage
To match <textarea> elements <code-input> value attribute for text content <code-input> inner HTML for text content (see README for usage)
More intuitive for object-oriented programming and TypeScript codeInput.templates.custom(...) new codeInput.Template(...)
Clean, consistent code codeInput.templates.character_limit() codeInput.templates.characterLimit()
Clean, consistent code codeInput.templates.rainbow_text(...) codeInput.templates.rainbowText(...)

More Technical/Less-Used Changes

(click to view if you are building a code-input plugin or coming across bugs)
Reason Old Usage New Usage
Remove unnecessary function calls <code-input element>.querySelector("textarea") <code-input element>.textareaElement
Remove unnecessary function calls <code-input element>.querySelector("pre") <code-input element>.preElement
Remove unnecessary function calls <code-input element>.querySelector("pre code") <code-input element>.codeElement
More flexibility and fewer bugs when creating plugins Plugin.observedAttributes = ["attrib1", "attrib2"] In constructor of plugin: super(["attrib1", "attrib2"])
More flexibility when creating plugins All observed attributes detected exactly * symbol represents wilcard = any piece of text (see Test plugin)
Clean, consistent code Other snake_case functions camelCase

As always, if you find any bugs or have any ideas for new features, please submit an issue or pull request.

Full Changelog: v1.5.1...v2.0.1