2.0.1
🆕 What's in this release?
This is a major release, with several aims:
- ⌨️ Make
<code-input>
work more like a<textarea>
, including more HTML form compatibility (demo) - thank you especially to @vanowm - 🧹 Add TypeScript support - please see WebCoder49/code-input-for-typescript
- 🎉 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.
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