Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ module.exports = [
modifiers: ['const'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
},
{
selector: 'classProperty',
modifiers: ['static', 'readonly'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
},
],
'@typescript-eslint/consistent-type-assertions': 'error',

Expand Down
2 changes: 0 additions & 2 deletions plugins/field-angle/src/field_angle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ export class FieldAngle extends Blockly.FieldNumber {
*/
static readonly RADIUS: number = FieldAngle.HALF - 1;

/* eslint-disable @typescript-eslint/naming-convention */
static readonly DEFAULT_PRECISION = 15;
static readonly DEFAULT_MIN = 0;
static readonly DEFAULT_MAX = 360;
/* eslint-enable @typescript-eslint/naming-convention */

/**
* Whether the angle should increase as the angle picker is moved clockwise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ class HsvColour {
* Class for a colour input field that displays HSV slider widgets when clicked.
*/
export class FieldColourHsvSliders extends FieldColour {
/* eslint-disable @typescript-eslint/naming-convention */
/** The maximum value of the hue slider range. */
private static readonly HUE_SLIDER_MAX = 360;

Expand All @@ -206,7 +205,6 @@ export class FieldColourHsvSliders extends FieldColour {
* the minimum and maximum control points should be.
*/
static readonly THUMB_RADIUS = 12;
/* eslint-enable @typescript-eslint/naming-convention */

/** Helper colour structures to allow manipulation in the HSV colour space. */
private static readonly helperHsv: HsvColour = new HsvColour();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface DependentDropdownOptionsChangeJson
*/
export class DependentDropdownOptionsChange extends Blockly.Events.BlockBase {
/** The name to register with Blockly for the type of event. */
// eslint-disable-next-line @typescript-eslint/naming-convention

static readonly EVENT_TYPE: string = 'dropdown_options_change';

/** The name of the change event type for registering with Blockly. */
Expand Down
41 changes: 40 additions & 1 deletion plugins/field-multilineinput/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,39 @@ always a valid string, while its text could be any string entered into its
editor. Unlike a text input field, this field also supports newline characters
entered in the editor.

#### Editor keyboard shortcuts

The default keyboard mapping is:

| Key | Action |
| ----------- | ------------------------------------------------- |
| Enter | Commit the value and close the editor |
| Shift+Enter | Insert a newline at the cursor |
| Escape | Revert to the original value and close the editor |

With `FieldMultilineInput.enterCommits = false` the mapping is swapped:

| Key | Action |
| ----------- | ------------------------------------------------- |
| Enter | Insert a newline at the cursor |
| Shift+Enter | Commit the value and close the editor |
| Escape | Revert to the original value and close the editor |

`enterCommits` and `showHint` are global (static) settings that apply to all
fields. Set them once before creating your blocks:

```js
import {FieldMultilineInput} from '@blockly/field-multilineinput';

FieldMultilineInput.enterCommits = false; // default: true
FieldMultilineInput.showHint = false; // default: true
```

The constructor for this field accepts three optional parameters:

- `value`: The default text. Defaults to `""`.
- `validator`: A function that is called to validate what the user entered.
- `config`: An object with three optional properties:
- `config`: An object with optional properties:
- `maxLines`: The maximum number of lines displayed before scrolling
functionality is enabled. Defaults to `Infinity`.
- `spellcheck`: Whether spell checking is enabled. Defaults to `true`.
Expand Down Expand Up @@ -186,13 +214,24 @@ textMultiline.installBlock({

### API reference

Instance methods:

- `setMaxLines`: Sets the maximum number of displayed lines before
scrolling functionality is enabled.
- `getMaxLines`: Returns the maximum number of displayed lines before
scrolling functionality is enabled.
- `setSpellcheck`: Sets whether spell checking is enabled.
- `getSpellcheck`: Returns whether spell checking is enabled.

Static (global) properties:

- `FieldMultilineInput.enterCommits`: Whether pressing Enter commits the
value (`true`, default) or inserts a newline (`false`). Applies to all
fields.
- `FieldMultilineInput.showHint`: Whether the keyboard-shortcut hint bar is
shown in the editor. When `false`, no space is reserved for the hint bar.
Applies to all fields.

## License

Apache 2.0
Loading
Loading