Skip to content

Commit

Permalink
feat: expose property to hide the print margin
Browse files Browse the repository at this point in the history
  • Loading branch information
Soc Sieng committed Sep 25, 2020
1 parent 10b19b7 commit fa18dcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
25 changes: 13 additions & 12 deletions README.md
Expand Up @@ -54,18 +54,19 @@ npm install ace-custom-element

## Supported properties

| Property | Attribute | Type | Default value | Description |
| :----------- | :------------ | :----------- | :-------------------------------------------- | :------------------------------------------------------- |
| `editor` | - | `Ace.Editor` | - | A reference to the ace editor. |
| `value` | `value` | `string` | `""` | Editor text value. |
| `mode` | `mode` | `string` | `ace/mode/javascript` | Editor mode. |
| `theme` | `theme` | `string` | `ace/theme/eclipse` | Editor theme. |
| `tabSize` | `tab-size` | `number` | `2` | Editor tab size. |
| `readonly` | `readonly` | `boolean` | `false` | Places editor in readonly mode. |
| `softTabs` | `soft-tabs` | `boolean` | `false` | Sets editor to use soft tabs. |
| `wrap` | `wrap` | `boolean` | `false` | Sets editor to wrap text. |
| `hideGutter` | `hide-gutter` | `boolean` | `false` | Hides the editor gutter. |
| `basePath` | `base-path` | `string` | `ace/` folder relative to module import path. | Specifies the location to load additional ACE resources. |
| Property | Attribute | Type | Default value | Description |
| :---------------- | :------------------ | :----------- | :-------------------------------------------- | :------------------------------------------------------- |
| `editor` | - | `Ace.Editor` | - | A reference to the ace editor. |
| `value` | `value` | `string` | `""` | Editor text value. |
| `mode` | `mode` | `string` | `ace/mode/javascript` | Editor mode. |
| `theme` | `theme` | `string` | `ace/theme/eclipse` | Editor theme. |
| `tabSize` | `tab-size` | `number` | `2` | Editor tab size. |
| `readonly` | `readonly` | `boolean` | `false` | Places editor in readonly mode. |
| `softTabs` | `soft-tabs` | `boolean` | `false` | Sets editor to use soft tabs. |
| `wrap` | `wrap` | `boolean` | `false` | Sets editor to wrap text. |
| `hideGutter` | `hide-gutter` | `boolean` | `false` | Hides the editor gutter. |
| `hidePrintMargin` | `hide-print-margin` | `boolean` | `false` | Hides the print margin (vertical ruler). |
| `basePath` | `base-path` | `string` | `ace/` folder relative to module import path. | Specifies the location to load additional ACE resources. |

## Supported events

Expand Down
4 changes: 4 additions & 0 deletions src/AceEditor.ts
Expand Up @@ -48,6 +48,9 @@ class AceEditor extends HTMLElement {
@NotifyBooleanAttribute()
hideGutter?: boolean;

@NotifyBooleanAttribute()
hidePrintMargin?: boolean;

@NotifyAttribute()
basePath?: string;

Expand Down Expand Up @@ -99,6 +102,7 @@ class AceEditor extends HTMLElement {
editor.setHighlightGutterLine(!this.readonly);

editor.renderer.setShowGutter(!this.hideGutter);
editor.renderer.setShowPrintMargin(!this.hidePrintMargin);

editor.getSession().setUseWrapMode(!!this.wrap);

Expand Down

0 comments on commit fa18dcb

Please sign in to comment.