3.0.0 • Published 7 months ago

@granite-elements/ace-widget v3.0.0

Weekly downloads
97
License
MIT
Repository
github
Last release
7 months ago

Published on Vaadin  Directory Stars on vaadin.com/directory Published on webcomponents.org

ace-widget

Even more embeddable code editor Custom Element - just one tag, and no JS needed to provide Ace - The High Performance Code Editor

Originally based on pjako's fork of PolymerLabs ace-element.

Modern implementation using Lit 3.1

The legacy Polymer implementation is still available as ace-widget-old.js

Doc and demo

https://lostinbrittany.github.io/ace-widget/

Usage example

<script type="module" src="@granite-elements/ace-widget/ace-widget.js"></script>

<ace-widget placeholder="Write something... Anything..." initial-focus>
</ace-widget>

Install

Install the component using npm:

$ npm i @granite-elements/ace-widget --save

Once installed, import it in your application:

import '@granite-elements/ace-widget/ace-widget.js';

Running demos and tests in browser

  1. Fork the ace-widget repository and clone it locally.

  2. Make sure you have npm installed.

  3. When in the ace-widget directory, run npm install to install dependencies.

  4. Serve the project using the development server:

    npm start

This will automatically open the demo page in your default browser.

Simple Test Page

A simplified test page is also available at /demo/simple.html. This page contains a minimal setup with just one editor instance and controls for toggling debug features. It's useful for quick testing and debugging.

Attributes

AttributeTypeDefaultDescription
themeString | Editor#setTheme at Ace API
modeString | EditSession#setMode at Ace API
font-sizeString | Editor#setFontSize at Ace API
softtabsBoolean | EditSession#setUseSoftTabs() at Ace API
tab-sizeBoolean | Session#setTabSize() at Ace API
readonlyBoolean | Editor#setReadOnly() at Ace API
wrapBoolean | Session#setWrapMode() at Ace API
autoCompleteObject | Callback for langTools.addCompleter like the example at Ace API
minlinesNumber15Editor.setOptions({minlines: minlines})
maxlinesNumber30Editor.setOptions({minlines: maxlines})
initialFocusBoolean | If true, Editor.focus() is called upon initialisation
placeholderString | A placeholder text to show when the editor is empty
verboseBooleanfalseIf true, outputs basic debug information to the console
debugBooleanfalseIf true, outputs detailed debug information to the console
disableWorkerBooleanfalseIf true, disables Ace editor worker scripts (useful for environments where workers don't work)

Properties

NameDescription
editorAce editor object.
valueeditor.get-/setValue()

Events

NameDescription
editor-contentTriggered when editor content gets changed
editor-readyTriggered once Ace editor instance is created.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Implementation Details

This component is built with Lit 3.1, a modern, lightweight web component library. It provides a clean, efficient wrapper around the Ace editor with reactive properties and a simple API.

License

MIT License

3.0.0

7 months ago

2.2.7-b1

7 years ago

2.2.6

7 years ago

2.2.5

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago