mirror of
https://github.com/google/blockly.git
synced 2026-04-26 23:20:22 +02:00
chore(docs): fix broken links
Primarily to reference docs, also links to the GitHub repo prior to the monorepo reshuffle.
This commit is contained in:
@@ -29,4 +29,4 @@ Blockly.ContextMenuRegistry.registry.unregister('workspaceDelete');
|
||||
|
||||
### Default items
|
||||
|
||||
For a list of the default registry items that Blockly provides, look at [contextmenu_items.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/contextmenu_items.ts). Each entry contains both the `id` and the `weight`.
|
||||
For a list of the default registry items that Blockly provides, look at [contextmenu_items.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/contextmenu_items.ts). Each entry contains both the `id` and the `weight`.
|
||||
|
||||
@@ -9,7 +9,7 @@ description: How to override the constants in a renderer.
|
||||
|
||||
A **ConstantsProvider** holds all rendering-related constants. This includes sizing information and colours. Blockly provides a base **ConstantsProvider** with all required fields set to default values.
|
||||
|
||||
The **ConstantsProvider** `constructor()` sets all static properties, such as `NOTCH_WIDTH` and `NOTCH_HEIGHT`. For a full list of properties, see [constants.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/renderers/common/constants.ts).
|
||||
The **ConstantsProvider** `constructor()` sets all static properties, such as `NOTCH_WIDTH` and `NOTCH_HEIGHT`. For a full list of properties, see [constants.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/renderers/common/constants.ts).
|
||||
|
||||
Only override the necessary subset of the constants, rather than all of them. To do so:
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ The outline of the block is a single [SVG path](https://developer.mozilla.org/en
|
||||
|
||||
Each sub-path is a string of [path commands](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#path_commands) that describe the appropriate shape. These commands must use relative (rather than absolute) coordinates.
|
||||
|
||||
SVG path commands can be written as strings, but Blockly provides a set of [utility functions](/reference/blockly.utils_namespace.svgpaths_namespace) to make writing and reading paths easier.
|
||||
SVG path commands can be written as strings, but Blockly provides a set of [utility functions](/reference/blockly.utils.svgpaths) to make writing and reading paths easier.
|
||||
|
||||
### `init()`
|
||||
|
||||
A connection's shape is stored as an object with information about its width, height, and sub-path. These objects are created in the `ConstantProvider`s `init()` function. Here is the start of the default implementation. The complete definition can be found inside [`constants.ts`](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/renderers/common/constants.ts).
|
||||
A connection's shape is stored as an object with information about its width, height, and sub-path. These objects are created in the `ConstantProvider`s `init()` function. Here is the start of the default implementation. The complete definition can be found inside [`constants.ts`](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/renderers/common/constants.ts).
|
||||
|
||||
```js
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ init() {
|
||||
|
||||
### `shapeFor(connection)`
|
||||
|
||||
The `shapeFor(connection)` function maps from connection to connection shape. Here is the default implementation, which can be found inside [`constants.ts`](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/renderers/common/constants.ts). It returns a puzzle tab for input/output connections and a notch for previous/next connections:
|
||||
The `shapeFor(connection)` function maps from connection to connection shape. Here is the default implementation, which can be found inside [`constants.ts`](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/renderers/common/constants.ts). It returns a puzzle tab for input/output connections and a notch for previous/next connections:
|
||||
|
||||
```js
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ see [Colour formats](/guides/configure/web/appearance/colour-formats).
|
||||
Note the British spelling. Failure to set the colour results in a black block.
|
||||
|
||||
You can also set the block color using the
|
||||
[`Block.setColour(..)`](/reference/blockly.block_class.setcolour_1_method)
|
||||
[`Block.setColour(..)`](/reference/blockly.block.setcolour)
|
||||
function, or by using [themes](/guides/configure/web/appearance/themes)
|
||||
and defining a block style.
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ toolbox categories, plus a distinct colour for dynamic variables:
|
||||
```
|
||||
|
||||
These string values can be used in both the JSON definitions and
|
||||
[`block.setColour(..)`](/reference/blockly.block_class.setcolour_1_method).
|
||||
[`block.setColour(..)`](/reference/blockly.block.setcolour).
|
||||
|
||||
You can add your own colour constants by adding to `Blockly.Msg`:
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ custom CSS classes:
|
||||
```
|
||||
|
||||
For more information, see [Customizing fields with
|
||||
CSS](/guides/create-custom-blocks/fields/customizing-fields/creating#customizing-with-css)
|
||||
CSS](/guides/create-custom-blocks/fields/customizing-fields/creating#css)
|
||||
or [Create the icon's
|
||||
view](/guides/create-custom-blocks/icons/creating-custom-icons/basic-implementation#create-the-icons-view).
|
||||
|
||||
@@ -284,7 +284,7 @@ When Blockly is injected, it adds a `<style>` tag as a child of the `<head>`
|
||||
tag. The rules in this tag come from:
|
||||
|
||||
- The `Blockly.css` namespace. To see these rules, open
|
||||
[core/css.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/css.ts) and
|
||||
[core/css.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/css.ts) and
|
||||
search for `let content`.
|
||||
- Individual components, which call `Blockly.css.register` to add
|
||||
component-specific CSS rules. Because `css.register` adds these rules to the
|
||||
|
||||
@@ -310,7 +310,7 @@ JavaScript.
|
||||
</Tabs>
|
||||
If no theme
|
||||
is provided then it will default to the
|
||||
[Classic Theme](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/theme/classic.ts).
|
||||
[Classic Theme](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/theme/classic.ts).
|
||||
|
||||
#### Dynamic themes
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ directly.
|
||||
## Configuration options \{#the-options-dictionary\}
|
||||
|
||||
The configuration object implements
|
||||
[`Blockly.BlocklyOptions`](/reference/blockly.blocklyoptions_interface)
|
||||
[`Blockly.BlocklyOptions`](/reference/blockly.blocklyoptions)
|
||||
and has the following options. Note that several of these options change their
|
||||
default value based on whether the provided toolbox has categories or not.
|
||||
|
||||
@@ -70,8 +70,8 @@ default value based on whether the provided toolbox has categories or not.
|
||||
[Grid]: /guides/configure/web/grid
|
||||
[media]: /guides/configure/web/media
|
||||
[Move]: /guides/configure/web/move
|
||||
[setIsReadOnly]: /reference/blockly.workspace_class.setisreadonly_1_method
|
||||
[isReadOnly]: /reference/blockly.workspace_class.isreadonly_1_method
|
||||
[setIsReadOnly]: /reference/blockly.workspace.setisreadonly
|
||||
[isReadOnly]: /reference/blockly.workspace.isreadonly
|
||||
[renderer]: /guides/create-custom-blocks/renderers/create-custom-renderers/basic-implementation
|
||||
[RTL demo]: https://raspberrypifoundation.github.io/blockly-samples/examples/rtl-demo/
|
||||
[Themes]: /guides/configure/web/appearance/themes
|
||||
|
||||
@@ -459,16 +459,16 @@ steps:
|
||||
items.
|
||||
|
||||
[block-default-menu-image]: /images/context-menus/block-default-menu.png
|
||||
[context-menu-items-source]: https://github.com/RaspberryPiFoundation/blockly/blob/main/core/contextmenu_items.ts
|
||||
[i-context-menu]: /reference/blockly.icontextmenu_interface
|
||||
[i-focusable-node]: /reference/blockly.ifocusablenode_interface
|
||||
[RegistryItem]: /reference/blockly.contextmenuregistry_namespace.registryitem_typealias
|
||||
[context-menu-items-source]: https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/contextmenu_items.ts
|
||||
[i-context-menu]: /reference/blockly.icontextmenu
|
||||
[i-focusable-node]: /reference/blockly.ifocusablenode
|
||||
[RegistryItem]: /reference/blockly.contextmenuregistry.registryitem
|
||||
[Scope]: #scope
|
||||
[enabled-image]: /images/context-menus/enabled-option.png
|
||||
[disabled-image]: /images/context-menus/disabled-option.png
|
||||
[customContextMenu]: /reference/blockly.blocksvg_class.customcontextmenu_property
|
||||
[configureContextMenu]: /reference/blockly.workspacesvg_class.configurecontextmenu_property
|
||||
[ContextMenuOption]: /reference/blockly.contextmenuregistry_namespace.contextmenuoption_typealias
|
||||
[LegacyContextMenuOption]: /reference/blockly.contextmenuregistry_namespace.legacycontextmenuoption_interface
|
||||
[customContextMenu]: /reference/blockly.blocksvg.customcontextmenu
|
||||
[configureContextMenu]: /reference/blockly.workspacesvg.configurecontextmenu
|
||||
[ContextMenuOption]: /reference/blockly.contextmenuregistry.contextmenuoption
|
||||
[LegacyContextMenuOption]: /reference/blockly.contextmenuregistry.legacycontextmenuoption
|
||||
[coordinate-systems]: /guides/configure/web/metrics_manager#coordinate-systems
|
||||
[keyboard-navigation-plugin]: /guides/configure/web/keyboard-nav
|
||||
|
||||
@@ -153,15 +153,15 @@ Blockly.clipboard.registry.register('MY_PASTER', new MyPaster());
|
||||
```
|
||||
|
||||
[implement-paster]: /guides/configure/web/copy-paste#implement-a-paster
|
||||
[ICopyable]: /reference/blockly.icopyable_interface
|
||||
[IDeletable]: /reference/blockly.ideletable_interface
|
||||
[IDraggable]: /reference/blockly.idraggable_interface
|
||||
[ICopyData]: /reference/blockly.icopyable_namespace.icopydata_interface
|
||||
[IPaster]: /reference/blockly.ipaster_interface
|
||||
[ISelectable]: /reference/blockly.iselectable_interface
|
||||
[ICopyable]: /reference/blockly.icopyable
|
||||
[IDeletable]: /reference/blockly.ideletable
|
||||
[IDraggable]: /reference/blockly.idraggable
|
||||
[ICopyData]: /reference/blockly.icopyable.icopydata
|
||||
[IPaster]: /reference/blockly.ipaster
|
||||
[ISelectable]: /reference/blockly.iselectable
|
||||
[default-keyboard-shortcuts]: /guides/configure/web/keyboard-shortcuts#default-shortcuts
|
||||
[context-menu-option]: /guides/configure/web/context-menus
|
||||
[custom-draggables]: /guides/configure/web/dragging/draggable
|
||||
[multiselect-plugin]: https://www.npmjs.com/package/@mit-app-inventor/blockly-plugin-workspace-multiselect
|
||||
[cross-tab-copy-paste-plugin]: https://www.npmjs.com/package/@blockly/plugin-cross-tab-copy-paste
|
||||
[clipboard-namespace]: /reference/blockly.clipboard_namespace
|
||||
[clipboard-namespace]: /reference/blockly.clipboard
|
||||
|
||||
@@ -28,23 +28,23 @@ The following Blockly classes can be replaced:
|
||||
For information about how to replace a renderer, see [Create custom
|
||||
renderers](/guides/create-custom-blocks/renderers/create-custom-renderers/basic-implementation).
|
||||
|
||||
[`Blockly.dragging.Dragger`]: /reference/blockly.dragging_namespace.dragger_class
|
||||
[`Blockly.IDragger`]: /reference/blockly.idragger_interface
|
||||
[`Blockly.ConnectionChecker`]: /reference/blockly.connectionchecker_class
|
||||
[`Blockly.IConnectionChecker`]: /reference/blockly.iconnectionchecker_interface
|
||||
[`Blockly.InsertionMarkerPreviewer`]: /reference/blockly.insertionmarkerpreviewer_class
|
||||
[`Blockly.IConnectionPreviewer`]: /reference/blockly.iconnectionpreviewer_interface
|
||||
[`Blockly.HorizontalFlyout`]: /reference/blockly.horizontalflyout_class
|
||||
[`Blockly.VerticalFlyout`]: /reference/blockly.verticalflyout_class
|
||||
[`Blockly.IFlyout`]: /reference/blockly.iflyout_interface
|
||||
[`Blockly.MetricsManager`]: /reference/blockly.metricsmanager_class
|
||||
[`Blockly.IMetricsManager`]: /reference/blockly.imetricsmanager_interface
|
||||
[`Blockly.Toolbox`]: /reference/blockly.toolbox_class
|
||||
[`Blockly.IToolbox`]: /reference/blockly.itoolbox_interface
|
||||
[`Blockly.VariableMap`]: /reference/blockly.variablemap_class
|
||||
[`Blockly.IVariableMap`]: /reference/blockly.ivariablemap_interface
|
||||
[`Blockly.VariableModel`]: /reference/blockly.variablemodel_class
|
||||
[`Blockly.IVariableModel`]: /reference/blockly.ivariablemodel_interface
|
||||
[`Blockly.dragging.Dragger`]: /reference/blockly.dragging.dragger
|
||||
[`Blockly.IDragger`]: /reference/blockly.idragger
|
||||
[`Blockly.ConnectionChecker`]: /reference/blockly.connectionchecker
|
||||
[`Blockly.IConnectionChecker`]: /reference/blockly.iconnectionchecker
|
||||
[`Blockly.InsertionMarkerPreviewer`]: /reference/blockly.insertionmarkerpreviewer
|
||||
[`Blockly.IConnectionPreviewer`]: /reference/blockly.iconnectionpreviewer
|
||||
[`Blockly.HorizontalFlyout`]: /reference/blockly.horizontalflyout
|
||||
[`Blockly.VerticalFlyout`]: /reference/blockly.verticalflyout
|
||||
[`Blockly.IFlyout`]: /reference/blockly.iflyout
|
||||
[`Blockly.MetricsManager`]: /reference/blockly.metricsmanager
|
||||
[`Blockly.IMetricsManager`]: /reference/blockly.imetricsmanager
|
||||
[`Blockly.Toolbox`]: /reference/blockly.toolbox
|
||||
[`Blockly.IToolbox`]: /reference/blockly.itoolbox
|
||||
[`Blockly.VariableMap`]: /reference/blockly.variablemap
|
||||
[`Blockly.IVariableMap`]: /reference/blockly.ivariablemap
|
||||
[`Blockly.VariableModel`]: /reference/blockly.variablemodel
|
||||
[`Blockly.IVariableModel`]: /reference/blockly.ivariablemodel
|
||||
|
||||
## Create a replacement class
|
||||
|
||||
|
||||
@@ -47,6 +47,6 @@ Blockly.Blocks['my_block'] = {
|
||||
|
||||
[draggable]: /guides/configure/web/dragging/draggable
|
||||
[draggable-implementation]: /guides/configure/web/dragging/draggable#implementation
|
||||
[setDragStrategy]: /reference/blockly.blocksvg_class.setdragstrategy_1_method
|
||||
[IDraggable]: /reference/blockly.idraggable_interface
|
||||
[IDragStrategy]: /reference/blockly.idragstrategy_interface
|
||||
[setDragStrategy]: /reference/blockly.blocksvg.setdragstrategy
|
||||
[IDraggable]: /reference/blockly.idraggable
|
||||
[IDragStrategy]: /reference/blockly.idragstrategy
|
||||
|
||||
@@ -232,12 +232,12 @@ For more information about copying pasting see [Copy paste][copy-paste].
|
||||
|
||||
{/* This doesn't exist yet */}
|
||||
[events]: /guides/configure/web/events
|
||||
[IRenderedElement]: /reference/blockly.irenderedelement_interface
|
||||
[IDraggable]: /reference/blockly.idraggable_interface
|
||||
[IDeletable]: /reference/blockly.ideletable_interface
|
||||
[ISelectable]: /reference/blockly.iselectable_interface
|
||||
[setSelected]: /reference/blockly.common_namespace.setselected_2_function
|
||||
[IRenderedElement]: /reference/blockly.irenderedelement
|
||||
[IDraggable]: /reference/blockly.idraggable
|
||||
[IDeletable]: /reference/blockly.ideletable
|
||||
[ISelectable]: /reference/blockly.iselectable
|
||||
[setSelected]: /reference/blockly.common
|
||||
[svg-group]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
|
||||
[Coordinate]: /reference/blockly.utils_namespace.coordinate_class
|
||||
[drag-target]: /reference/blockly.dragtarget_class
|
||||
[Coordinate]: /reference/blockly.utils.coordinate
|
||||
[drag-target]: /reference/blockly.dragtarget
|
||||
[copy-paste]: /guides/configure/web/copy-paste
|
||||
|
||||
@@ -169,6 +169,6 @@ const myWorkspace = Blockly.inject('blocklyDiv', {
|
||||
```
|
||||
|
||||
[draggable]: /guides/configure/web/dragging/draggable
|
||||
[drag-target]: /reference/blockly.dragtarget_class
|
||||
[drag-target]: /reference/blockly.dragtarget
|
||||
[scroll-options-plugin]: https://www.npmjs.com/package/@blockly/plugin-scroll-options
|
||||
[IDragger]: /reference/blockly.idragger_interface
|
||||
[IDragger]: /reference/blockly.idragger
|
||||
|
||||
@@ -133,7 +133,7 @@ and causing side effects.
|
||||
|
||||
## Event types
|
||||
|
||||
Refer to the [reference documentation](/reference/blockly.events_namespace)
|
||||
Refer to the [reference documentation](/reference/blockly.events)
|
||||
for information about individual events.
|
||||
|
||||
## Demo
|
||||
|
||||
@@ -271,8 +271,8 @@ in an exception.
|
||||
|
||||
If you write a custom component from scratch, you'll need to implement the focus
|
||||
interfaces yourself. See the reference documentation for
|
||||
[`IFocusableTree`](/reference/blockly.ifocusabletree_interface) and
|
||||
[`IFocusableNode`](/reference/blockly.ifocusablenode_interface) more
|
||||
[`IFocusableTree`](/reference/blockly.ifocusabletree) and
|
||||
[`IFocusableNode`](/reference/blockly.ifocusablenode) more
|
||||
information.
|
||||
|
||||
After you have implemented your class, test it against the keyboard navigation
|
||||
@@ -367,7 +367,7 @@ manager just changes the actively focused node to passive focus.)
|
||||
|
||||
Positionables are components that are positioned on top of the workspace and
|
||||
implement
|
||||
[`IPositionable`](/reference/blockly.ipositionable_interface).
|
||||
[`IPositionable`](/reference/blockly.ipositionable).
|
||||
Examples are the trashcan and the backpack in the [backpack
|
||||
plugin](https://www.npmjs.com/package/@blockly/workspace-backpack).
|
||||
Positionables are not yet integrated into the focus system.
|
||||
|
||||
@@ -34,14 +34,14 @@ user presses a key (or combination of keys), Blockly:
|
||||
## Scope
|
||||
|
||||
A
|
||||
[`Scope`](/reference/blockly.contextmenuregistry_namespace.scope_interface)
|
||||
[`Scope`](/reference/blockly.contextmenuregistry.scope)
|
||||
object identifies the Blockly component that currently has focus. Scope objects
|
||||
are passed to `preconditionFn` and `callback`, which use them to decide whether
|
||||
a shortcut applies to a particular component and, if so, how to apply it.
|
||||
|
||||
To use a `Scope` object, use its `focusedNode` property. This is an object that
|
||||
implements
|
||||
[`IFocusableNode`](/reference/blockly.ifocusablenode_interface). This
|
||||
[`IFocusableNode`](/reference/blockly.ifocusablenode). This
|
||||
interface is implemented by all Blockly components that the user can focus on,
|
||||
including workspaces, blocks, fields, comments, and your own custom components;
|
||||
for more information, see [Focus system](/guides/configure/web/focus).
|
||||
@@ -58,7 +58,7 @@ preconditionFn(workspace, scope) {
|
||||
## The KeyboardShortcut interface
|
||||
|
||||
Objects in the shortcut registry implement the
|
||||
[`KeyboardShortcut`](/reference/blockly.shortcutregistry_namespace.keyboardshortcut_interface)
|
||||
[`KeyboardShortcut`](/reference/blockly.shortcutregistry.keyboardshortcut)
|
||||
interface. This contains the following properties.
|
||||
|
||||
### name (required)
|
||||
@@ -135,7 +135,7 @@ it.
|
||||
|
||||
An array of keys (or combinations of keys) that activate this shortcut. To
|
||||
identify keys, use the keycodes in
|
||||
[`Blockly.utils.KeyCodes`](/reference/blockly.utils_namespace.keycodes_enum).
|
||||
[`Blockly.utils.KeyCodes`](/reference/blockly.utils.keycodes).
|
||||
For example:
|
||||
|
||||
```js
|
||||
@@ -148,7 +148,7 @@ const logFieldsShortcut = {
|
||||
|
||||
If you want map additional keys to an existing shortcut -- for example, you want
|
||||
to add keys to a [default shortcut](#default-shortcuts) -- you can call
|
||||
[`Blockly.ShortcutRegistry.registry.addKeyMapping`](/reference/blockly.shortcutregistry_class.addkeymapping_1_method).
|
||||
[`Blockly.ShortcutRegistry.registry.addKeyMapping`](/reference/blockly.shortcutregistry.addkeymapping).
|
||||
This is not common.
|
||||
|
||||
#### Key combinations
|
||||
@@ -269,7 +269,7 @@ Blockly.ShortcutRegistry.registry.register(modLogFieldsShortcut);
|
||||
|
||||
The shortcut registry is prepopulated with a number of shortcuts. You can find
|
||||
these in
|
||||
[https://github.com/RaspberryPiFoundation/blockly/blob/main/core/shortcut_items.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/shortcut_items.ts).
|
||||
[https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/shortcut_items.ts](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/shortcut_items.ts).
|
||||
The shortcuts are defined in the `registerXxxx` functions.
|
||||
|
||||
## Keyboard navigation shortcuts
|
||||
|
||||
@@ -114,7 +114,7 @@ the bounding box around any blocks or workspace comments.
|
||||
|
||||
:::note
|
||||
Content metrics do not take into account block comments, only [workspace
|
||||
comments](/reference/blockly.comments_namespace.workspacecomment_class/).
|
||||
comments](/reference/blockly.comments.workspacecomment).
|
||||
:::
|
||||
|
||||
<Image
|
||||
|
||||
@@ -173,7 +173,7 @@ When you register a serializer you must provide several things:
|
||||
order](/guides/configure/web/serialization#deserialization-order).
|
||||
|
||||
You can base the priority of your serializer on the [built-in
|
||||
priorities](/reference/blockly.serialization_namespace.priorities_namespace)
|
||||
priorities](/reference/blockly.serialization.priorities)
|
||||
|
||||
When `Blockly.serialization.workspaces.save` is called, each serializer's `save`
|
||||
function will be called, and its data will be added to the final JSON output:
|
||||
@@ -218,7 +218,7 @@ For information on how to migrate to JSON, see the [migration guide].
|
||||
### APIs
|
||||
|
||||
For information about the XML system's APIs see the [reference
|
||||
documentation](/reference/blockly.xml_namespace).
|
||||
documentation](/reference/blockly.xml).
|
||||
|
||||
### Block hooks
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ out.](/images/toolbox-disabled.png)
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
You can also programmatically disable or enable a block by using
|
||||
[`setDisabledReason`](/reference/blockly.block_class.setdisabledreason_1_method).
|
||||
[`setDisabledReason`](/reference/blockly.block.setdisabledreason).
|
||||
|
||||
## Configure your blocks
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ Most of [Blockly's translations](/guides/contribute/core/translating) are done b
|
||||
using Translatewiki. Unfortunately, Klingon is not in their language matrix.
|
||||
As a result, Klingon contributors need to edit two files manually:
|
||||
|
||||
[msg/json/tlh.json](https://github.com/RaspberryPiFoundation/blockly/blob/main/msg/json/tlh.json)
|
||||
[msg/json/tlh.json](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/msg/json/tlh.json)
|
||||
and
|
||||
[demos/code/msg/tlh.js](https://github.com/RaspberryPiFoundation/blockly/blob/main/demos/code/msg/tlh.js)
|
||||
[demos/code/msg/tlh.js](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/demos/code/msg/tlh.js)
|
||||
|
||||
See the `en` files in each directory for the English phrases (including
|
||||
those not yet translated to Klingon).
|
||||
|
||||
@@ -25,7 +25,7 @@ public functions that no longer comply with the style guide.
|
||||
|
||||
- Use linting and formatting tools.
|
||||
- We use [eslint](http://eslint.org/) and have an [`eslint.config.mjs`
|
||||
file](https://github.com/RaspberryPiFoundation/blockly/blob/main/eslint.config.mjs)
|
||||
file](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/eslint.config.mjs)
|
||||
set up with rules for our preferred style.
|
||||
- We use [prettier](https://prettier.io/) for automatic formatting.
|
||||
- Run `npm run lint` to run the linter and `npm run format` to run the
|
||||
|
||||
@@ -38,7 +38,7 @@ suite.
|
||||
|
||||
We have a number of helper functions specific to Blockly that may be useful when
|
||||
writing tests. These can be found in
|
||||
[core](https://github.com/RaspberryPiFoundation/blockly/blob/main/tests/mocha/test_helpers/)
|
||||
[core](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/tests/mocha/test_helpers/)
|
||||
and in
|
||||
[blockly-samples](https://github.com/RaspberryPiFoundation/blockly-samples/blob/main/plugins/dev-tools/src/test_helpers.mocha.js).
|
||||
|
||||
|
||||
@@ -83,4 +83,4 @@ For more information, see [Generate and run
|
||||
code](/guides/app-integration/run-code).
|
||||
|
||||
[custom-code-generator]: /codelabs/custom-generator/codelab-overview
|
||||
[js-code-generator]: https://github.com/RaspberryPiFoundation/blockly/blob/main/generators/javascript/javascript_generator.ts
|
||||
[js-code-generator]: https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/generators/javascript/javascript_generator.ts
|
||||
|
||||
@@ -70,15 +70,15 @@ Because the definition functions are mixed in to the block object:
|
||||
|
||||
- The `this` keyword in definition functions refers to the block object. That
|
||||
is, it can be used to access the public methods and properties in the
|
||||
[`Block`](/reference/blockly.block_class) (or
|
||||
[`BlockSvg`](/reference/blockly.blocksvg_class)) class.
|
||||
[`Block`](/reference/blockly.block) (or
|
||||
[`BlockSvg`](/reference/blockly.blocksvg)) class.
|
||||
|
||||
Blockly defines a small number of functions you can use to customize blocks. The
|
||||
most common of these is `init`, which Blockly calls to initialize a block and
|
||||
which is used to define the block's look and feel. For a complete list, see the
|
||||
function-valued properties in the
|
||||
[`Block`](/reference/blockly.block_class#properties) and
|
||||
[`BlockSvg`](/reference/blockly.blocksvg_class#properties) classes.
|
||||
[`Block`](/reference/blockly.block) and
|
||||
[`BlockSvg`](/reference/blockly.blocksvg#properties) classes.
|
||||
These properties effectively form an interface for block definitions to
|
||||
implement; all of them are optional.
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ This section summarizes the objects and functions used to define custom blocks.
|
||||
|
||||
### Blockly.Blocks
|
||||
|
||||
[`Blockly.Blocks`](/reference/blockly.blocks_variable) is an object
|
||||
[`Blockly.Blocks`](/reference/blockly.blocks) is an object
|
||||
that stores block definitions. Its keys are block type names and its values are
|
||||
block definition objects. Use `Blockly.Blocks` when defining blocks with
|
||||
JavaScript:
|
||||
@@ -184,7 +184,7 @@ Blockly.Blocks['my_block'].setColour(150);
|
||||
|
||||
### defineBlocksWithJsonArray
|
||||
|
||||
[`defineBlocksWithJsonArray`](/reference/blockly.common_namespace.defineblockswithjsonarray_1_function)
|
||||
[`defineBlocksWithJsonArray`](/reference/blockly.common.defineblockswithjsonarray)
|
||||
accepts an array of JSON objects, creates block definitions from them, and adds
|
||||
them to `Blockly.Blocks`.
|
||||
|
||||
@@ -207,7 +207,7 @@ Blockly.common.defineBlocksWithJsonArray([
|
||||
|
||||
### createBlockDefinitionsFromJsonArray and defineBlocks
|
||||
|
||||
[`createBlockDefinitionsFromJsonArray`](/reference/blockly.common_namespace.createblockdefinitionsfromjsonarray_1_function)
|
||||
[`createBlockDefinitionsFromJsonArray`](/reference/blockly.common.createblockdefinitionsfromjsonarray)
|
||||
accepts an array of JSON objects and returns an object that maps block type
|
||||
names to block definitions. This is generally used with `defineBlocks`, which
|
||||
adds the block definitions to `Blockly.Blocks`.
|
||||
@@ -233,7 +233,7 @@ Blockly.common.defineBlocks(myBlockDefinitions);
|
||||
|
||||
### Block.jsonInit
|
||||
|
||||
[`jsonInit`](/reference/blockly.block_class.jsoninit_1_method)
|
||||
[`jsonInit`](/reference/blockly.block.jsoninit)
|
||||
accepts a JSON object and calls the corresponding methods on `Block`. For
|
||||
example, a JSON object with the key-value pair `colour: 150` results in a call
|
||||
to `this.setColour(150)`. Use `jsonInit` in an `init` function to load a JSON
|
||||
|
||||
@@ -52,7 +52,7 @@ fields' values are usually not dynamic, so they are usually not serialized.
|
||||
Serialized fields include:
|
||||
|
||||
- [Checkbox](/guides/create-custom-blocks/fields/built-in-fields/checkbox)
|
||||
- [Colour](/guides/create-custom-blocks/fields/built-in-fields/colour)
|
||||
- [Colour](https://www.npmjs.com/package/@blockly/field-colour)
|
||||
- [Dropdown](/guides/create-custom-blocks/fields/built-in-fields/dropdown)
|
||||
- [Number](/guides/create-custom-blocks/fields/built-in-fields/number)
|
||||
- [Text Input](/guides/create-custom-blocks/fields/built-in-fields/text-input)
|
||||
|
||||
@@ -87,7 +87,7 @@ can act like buttons that exist on blocks.
|
||||
|
||||
The on click handler can be set in the [JavaScript Constructor](#creation) or
|
||||
using the
|
||||
[`setOnClickHandler`](/reference/blockly.fieldimage_class.setonclickhandler_1_method)
|
||||
[`setOnClickHandler`](/reference/blockly.fieldimage.setonclickhandler)
|
||||
function.
|
||||
|
||||
Here is an example of an on click handler that collapses the block when
|
||||
|
||||
@@ -74,7 +74,7 @@ collapsed.](/images/fields/label/collapsed.png)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
The [`appendField`](/reference/blockly.input_class.appendfield_1_method)
|
||||
The [`appendField`](/reference/blockly.input.appendfield)
|
||||
function accepts both `FieldLabel` objects and, more commonly, strings to create
|
||||
labels.
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ The `value` should cast to a number. If it does not 0 will be used.
|
||||
## Constraints
|
||||
|
||||
Constraints can be set in the field definition, or by using the
|
||||
[setConstraints](/reference/blockly.fieldnumber_class.setconstraints_1_method)
|
||||
[setConstraints](/reference/blockly.fieldnumber.setconstraints)
|
||||
function.
|
||||
|
||||
### Minimum value
|
||||
|
||||
@@ -180,7 +180,7 @@ return a string, `null`, or `undefined`.
|
||||
|
||||
Here's an example of a validator that only accepts some predefined variables as
|
||||
options. These variables would need to be defined with the
|
||||
[`Workspace.getVariableMap().createVariable`](/reference/blockly.ivariablemap_interface.createvariable_1_methodsignature)
|
||||
[`Workspace.getVariableMap().createVariable`](/reference/blockly.ivariablemap.createvariable)
|
||||
function when the workspace is loaded.
|
||||
|
||||
```js
|
||||
|
||||
+8
-8
@@ -107,7 +107,7 @@ You also need to define your `fromJson` function. Your implementation should
|
||||
first dereference any [references to localization
|
||||
tokens](/guides/configure/web/translations#use-localization-tokens-in-json)
|
||||
using
|
||||
[`replaceMessageReferences`](/reference/blockly.utils_namespace.parsing_namespace.replacemessagereferences_1_function),
|
||||
[`replaceMessageReferences`](/reference/blockly.utils.parsing.replacemessagereferences),
|
||||
and then pass the values to the constructor.
|
||||
|
||||
```js
|
||||
@@ -225,11 +225,11 @@ When overriding `bindEvents_` you should always call the base function.
|
||||
:::
|
||||
|
||||
To bind to an event you should generally use the
|
||||
[`Blockly.utils.browserEvents.conditionalBind`](/reference/blockly.utils_namespace.browserevents_namespace.conditionalbind_1_function)
|
||||
[`Blockly.utils.browserEvents.conditionalBind`](/reference/blockly.utils.browserevents.conditionalbind)
|
||||
function. This method of binding events filters out secondary touches during
|
||||
drags. If you want your handler to run even in the middle of an in-progress drag
|
||||
you can use the
|
||||
[`Blockly.browserEvents.bind`](/reference/blockly.utils_namespace.browserevents_namespace.bind_1_function)
|
||||
[`Blockly.browserEvents.bind`](/reference/blockly.utils.browserevents.bind)
|
||||
function.
|
||||
|
||||
## Disposing
|
||||
@@ -398,7 +398,7 @@ currently there is no way to enforce this pattern.
|
||||
### isDirty\_
|
||||
|
||||
`isDirty_` is a flag used in the
|
||||
[`setValue`](/reference/blockly.field_class.setvalue_1_method)
|
||||
[`setValue`](/reference/blockly.field.setvalue)
|
||||
function, as well as other parts of the field, to tell if the field needs to be
|
||||
re-rendered. If the field's display value has changed, `isDirty_` should usually
|
||||
be set to `true`.
|
||||
@@ -411,7 +411,7 @@ field](/guides/create-custom-blocks/fields/anatomy-of-a-field).
|
||||
|
||||
If the text of your field is different than the value of your field, you should
|
||||
override the
|
||||
[`getText`](/reference/blockly.field_class.gettext_1_method)function
|
||||
[`getText`](/reference/blockly.field.gettext_)function
|
||||
to provide the correct text.
|
||||
|
||||
```js
|
||||
@@ -447,7 +447,7 @@ the `DropDownDiv`.
|
||||
|
||||

|
||||
|
||||
The [`WidgetDiv`](/reference/blockly.widgetdiv_namespace) is used to
|
||||
The [`WidgetDiv`](/reference/blockly.widgetdiv) is used to
|
||||
provide editors that do not live inside of a box. Number fields use the
|
||||
`WidgetDiv` to cover the field with an HTML text input box. While the
|
||||
`DropDownDiv` handles positioning for you, the `WidgetDiv` does not. Elements
|
||||
@@ -504,7 +504,7 @@ showEditor_() {
|
||||
:::note
|
||||
Creating widget HTML programmatically can be quite long-winded so it is
|
||||
not provided here. For an example of this see the implementation of [Text Input
|
||||
Field](https://github.com/RaspberryPiFoundation/blockly/blob/main/core/field_textinput.ts)
|
||||
Field](https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/core/field_textinput.ts)
|
||||
.
|
||||
:::
|
||||
|
||||
@@ -560,7 +560,7 @@ property to `true`.
|
||||
### Defaults
|
||||
|
||||
The default `render_` function sets the display text to the result of the
|
||||
[`getDisplayText_`](/reference/blockly.field_class.getdisplaytext__1_method)
|
||||
[`getDisplayText_`](/reference/blockly.field.getdisplaytext_)
|
||||
function. The `getDisplayText_` function returns the field's `value_` property
|
||||
cast to a string, after it has been truncated to respect the maximum text
|
||||
length.
|
||||
|
||||
+3
-3
@@ -168,7 +168,7 @@ The warning above means that Blockly has detected you are using an old method fo
|
||||
field, and would like you to use the new method.
|
||||
|
||||
For more information about the `isDirty_` property see
|
||||
[isDirty\_](/guides/create-custom-blocks/fields/customizing-fields/creating#isdirty-).
|
||||
[isDirty\_](/guides/create-custom-blocks/fields/customizing-fields/creating#isdirty_).
|
||||
|
||||
### init
|
||||
|
||||
@@ -310,9 +310,9 @@ handling](/guides/create-custom-blocks/fields/customizing-fields/creating#value-
|
||||
|
||||
We recommend that you never access or update the `text_` property of your
|
||||
field directly. Instead, use the
|
||||
[`getText`](/reference/blockly.field_class.gettext_1_method) function
|
||||
[`getText`](/reference/blockly.field.gettext_) function
|
||||
to access the user readable text of your field and the
|
||||
[`setValue`](/reference/blockly.field_class.setvalue_1_method) function
|
||||
[`setValue`](/reference/blockly.field.setvalue) function
|
||||
to update the stored value of your field.
|
||||
|
||||
For more information about a field's value vs its text see
|
||||
|
||||
@@ -80,7 +80,7 @@ Blockly.Blocks['validator_example'] = {
|
||||
```
|
||||
|
||||
- With
|
||||
[`setValidator`](/reference/blockly.field_class.setvalidator_1_method).
|
||||
[`setValidator`](/reference/blockly.field.setvalidator).
|
||||
|
||||
```js
|
||||
Blockly.Blocks['validator_example'] = {
|
||||
|
||||
+13
-13
@@ -192,18 +192,18 @@ dispose() {
|
||||
```
|
||||
|
||||
[bubble]: /guides/create-custom-blocks/icons/creating-custom-icons/use-bubbles
|
||||
[IIcon]: /reference/blockly.iicon_interface
|
||||
[Icon]: /reference/blockly.icons_namespace.icon_class
|
||||
[getType]: /reference/blockly.iicon_interface.gettype_1_methodsignature
|
||||
[IIcon]: /reference/blockly.iicon
|
||||
[Icon]: /reference/blockly.icons.icon
|
||||
[getType]: /reference/blockly.iicon.gettype
|
||||
[registering]: /guides/create-custom-blocks/icons/creating-custom-icons/save-and-load#register-icon-classes
|
||||
[getIcon]: /reference/blockly.block_class.geticon_1_method
|
||||
[initView]: /reference/blockly.iicon_interface.initview_1_methodsignature
|
||||
[blockly-utils-dom]: /reference/blockly.utils_namespace.dom_namespace
|
||||
[getSize]: /reference/blockly.iicon_interface.getsize_1_methodsignature
|
||||
[getIcon]: /reference/blockly.block.geticon
|
||||
[initView]: /reference/blockly.iicon.initview
|
||||
[blockly-utils-dom]: /reference/blockly.utils.dom
|
||||
[getSize]: /reference/blockly.iicon.getsize
|
||||
[renderer]: /guides/create-custom-blocks/renderers/overview
|
||||
[getWeight]: /reference/blockly.iicon_interface.getweight_1_methodsignature
|
||||
[onClick]: /reference/blockly.iicon_interface.onclick_1_methodsignature
|
||||
[updateEditable]: /reference/blockly.iicon_interface.updateeditable_1_methodsignature
|
||||
[isShownWhenCollapsed]: /reference/blockly.iicon_interface.isshownwhencollapsed_1_methodsignature
|
||||
[updateCollapsed]: /reference/blockly.iicon_interface.updatecollapsed_1_methodsignature
|
||||
[dispose]: /reference/blockly.iicon_interface.dispose_1_methodsignature
|
||||
[getWeight]: /reference/blockly.iicon.getweight
|
||||
[onClick]: /reference/blockly.iicon.onclick
|
||||
[updateEditable]: /reference/blockly.iicon.updateeditable
|
||||
[isShownWhenCollapsed]: /reference/blockly.iicon.isshownwhencollapsed
|
||||
[updateCollapsed]: /reference/blockly.iicon.updatecollapsed
|
||||
[dispose]: /reference/blockly.iicon.dispose
|
||||
|
||||
+5
-5
@@ -80,8 +80,8 @@ dispose() {
|
||||
}
|
||||
```
|
||||
|
||||
[built-in-bubbles]: /reference/blockly.bubbles_namespace
|
||||
[blockly-utils-dom]: /reference/blockly.utils_namespace.dom_namespace
|
||||
[bubble]: /reference/blockly.bubbles_namespace.bubble_class
|
||||
[setSize]: /reference/blockly.bubbles_namespace.bubble_class.setsize_1_method
|
||||
[dispose]: /reference/blockly.bubbles_namespace.bubble_class.dispose_1_method
|
||||
[built-in-bubbles]: /reference/blockly.bubbles
|
||||
[blockly-utils-dom]: /reference/blockly.utils.dom
|
||||
[bubble]: /reference/blockly.bubbles.bubble
|
||||
[setSize]: /reference/blockly.bubbles.bubble.setsize
|
||||
[dispose]: /reference/blockly.bubbles.bubble.dispose
|
||||
|
||||
+4
-4
@@ -41,7 +41,7 @@ class MyCommentIcon extends Blockly.icons.CommentIcon {
|
||||
|
||||
To customize your icon, you can override methods in `ICommentIcon` (described in
|
||||
the following sections) and
|
||||
[`Blockly.icons.Icon`](/reference/blockly.icons_namespace.icon_class)
|
||||
[`Blockly.icons.Icon`](/reference/blockly.icons.icon)
|
||||
(described in [Create custom
|
||||
icons](/guides/create-custom-blocks/icons/creating-custom-icons/basic-implementation)).
|
||||
Do not override `getType`, which must return `Blockly.icons.IconType.COMMENT`.
|
||||
@@ -157,9 +157,9 @@ comment icon, such as when the user clicks "Add Comment" on the context menu or
|
||||
you call `myBlock.setCommentText()`.
|
||||
|
||||
[ICommentIcon]: /reference/blockly.icommenticon_interface
|
||||
[IHasBubble]: /reference/blockly.ihasbubble_interface
|
||||
[IHasBubble]: /reference/blockly.ihasbubble
|
||||
[use-bubbles]: /guides/create-custom-blocks/icons/creating-custom-icons/use-bubbles
|
||||
[ISerializable]: /reference/blockly.iserializable_interface
|
||||
[CommentState]: /reference/blockly.icons_namespace.commentstate_interface
|
||||
[ISerializable]: /reference/blockly.iserializable
|
||||
[CommentState]: /reference/blockly.icons.commentstate
|
||||
[icon-serialization]: /guides/create-custom-blocks/icons/creating-custom-icons/save-and-load
|
||||
[comment-icon-image]: /images/block-icons/comment-icon-outline.png
|
||||
|
||||
+5
-5
@@ -99,10 +99,10 @@ class myIcon extends Blockly.icons.Icon {
|
||||
Blockly.icons.registry.register(new Blockly.icons.IconType('my_icon'), myIcon);
|
||||
```
|
||||
|
||||
[ISerializable]: /reference/blockly.iserializable_interface
|
||||
[ISerializable]: /reference/blockly.iserializable
|
||||
[registering]: /guides/create-custom-blocks/icons/creating-custom-icons/save-and-load#register-icon-classes
|
||||
[saveState]: /reference/blockly.iserializable_interface.savestate_1_methodsignature
|
||||
[loadState]: /reference/blockly.iserializable_interface.loadstate_1_methodsignature
|
||||
[IconType]: /reference/blockly.icons_namespace.icontype_class
|
||||
[getType]: /reference/blockly.iicon_interface.gettype_1_methodsignature
|
||||
[saveState]: /reference/blockly.iserializable.savestate
|
||||
[loadState]: /reference/blockly.iserializable.loadstate
|
||||
[IconType]: /reference/blockly.icons.icontype
|
||||
[getType]: /reference/blockly.iicon.gettype
|
||||
[serializer]: /guides/configure/web/serialization#serializer-hooks
|
||||
|
||||
+5
-5
@@ -79,8 +79,8 @@ isBubbleVisible() {
|
||||
}
|
||||
```
|
||||
|
||||
[IIcon]: /reference/blockly.iicon_interface
|
||||
[IHasBubble]: /reference/blockly.ihasbubble_interface
|
||||
[setBubbleVisible]: /reference/blockly.ihasbubble_interface.setbubblevisible_1_methodsignature
|
||||
[bubbleIsVisible]: /reference/blockly.ihasbubble_interface.bubbleisvisible_1_methodsignature
|
||||
[onLocationChange]: /reference/blockly.iicon_interface.onlocationchange_1_methodsignature
|
||||
[IIcon]: /reference/blockly.iicon
|
||||
[IHasBubble]: /reference/blockly.ihasbubble
|
||||
[setBubbleVisible]: /reference/blockly.ihasbubble.setbubblevisible
|
||||
[bubbleIsVisible]: /reference/blockly.ihasbubble.bubbleisvisible
|
||||
[onLocationChange]: /reference/blockly.iicon.onlocationchange
|
||||
|
||||
@@ -24,4 +24,4 @@ or copyright information in a pop-up bubble.
|
||||
|
||||
[fields-vs-icons]: /guides/create-custom-blocks/fields/fields-vs-icons
|
||||
[custom-icons]: /guides/create-custom-blocks/icons/creating-custom-icons/basic-implementation
|
||||
[icons-reference]: /reference/blockly.icons_namespace
|
||||
[icons-reference]: /reference/blockly.icons
|
||||
|
||||
@@ -238,5 +238,5 @@ connection checker.
|
||||
|
||||
[connection-type]: /guides/create-custom-blocks/define/block-anatomy#connections
|
||||
[event-system]: /guides/configure/web/events
|
||||
[BlockMove]: /reference/blockly.events_namespace.blockmove_class
|
||||
[BlockMove]: /reference/blockly.events.blockmove
|
||||
[custom-connection-checker]: /guides/create-custom-blocks/inputs/connection_checker
|
||||
|
||||
@@ -208,7 +208,7 @@ For more information about registration, see
|
||||
[built-in-replacement-preview-image]: /images/connections/built-in-replacement-preview.png
|
||||
[built-in-insertion-preview-image]: /images/connections/built-in-insertion-preview.png
|
||||
[built-in-previewer-image]: /images/connections/built-in-previewer.gif
|
||||
[IConnectionPreviewer]: /reference/blockly.iconnectionpreviewer_interface
|
||||
[IConnectionPreviewer]: /reference/blockly.iconnectionpreviewer
|
||||
[insertion-marker]: /guides/get-started/workspace-anatomy#insertion-marker
|
||||
[custom-renderer]: /guides/create-custom-blocks/renderers/create-custom-renderers/basic-implementation
|
||||
[inject-subclasses]: /guides/configure/web/customization#injecting-subclasses
|
||||
|
||||
@@ -49,7 +49,7 @@ unlike [custom fields][custom-fields], you can't override
|
||||
built-in inputs, and you can't add custom JSON configuration to them.
|
||||
:::
|
||||
|
||||
[Input]: /reference/blockly.inputs_namespace.input_class
|
||||
[makeConnection]: /reference/blockly.inputs_namespace.input_class.makeconnection_1_method
|
||||
[Input]: /reference/blockly.inputs.input
|
||||
[makeConnection]: /reference/blockly.inputs.input.makeconnection
|
||||
[json-block-def]: /guides/create-custom-blocks/define/json-and-js
|
||||
[custom-fields]: /guides/create-custom-blocks/fields/customizing-fields/creating
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ Blockly.Blocks['my_procedure_call'] = {
|
||||
|
||||
You can also add the ability for users to modify the procedure model. Calling
|
||||
the `insertParameter`, `deleteParameter`, or `setReturnTypes`
|
||||
[methods](/reference/blockly.procedures_namespace.iproceduremodel_interface)
|
||||
[methods](/reference/blockly.procedures.iproceduremodel)
|
||||
will automatically trigger your blocks to rerender (via `doProcedureUpdate`).
|
||||
|
||||
Options for creating UIs to modify the procedure model include using
|
||||
|
||||
+2
-2
@@ -126,5 +126,5 @@ class MyParameterModel {
|
||||
```
|
||||
|
||||
[shareable-procedures]: https://www.npmjs.com/package/@blockly/block-shareable-procedures
|
||||
[IProcedureModel]: /reference/blockly.procedures_namespace.iproceduremodel_interface
|
||||
[IParameterModel]: /reference/blockly.procedures_namespace.iparametermodel_interface
|
||||
[IProcedureModel]: /reference/blockly.procedures.iproceduremodel
|
||||
[IParameterModel]: /reference/blockly.procedures.iparametermodel
|
||||
|
||||
@@ -37,8 +37,8 @@ block, like jagged edges for collapsed blocks.
|
||||
And finally, the constant provider also defines various values for things like
|
||||
the padding between different elements, or the minimum heights of rows.
|
||||
|
||||
[ConstantProvider]: /reference/blockly.blockrendering_namespace.constantprovider_class
|
||||
[Notch]: /reference/blockly.blockrendering_namespace.constantprovider_class.notch_property
|
||||
[PuzzleTab]: /reference/blockly.blockrendering_namespace.constantprovider_class.puzzle_tab_property
|
||||
[ConstantProvider]: /reference/blockly.blockrendering.constantprovider
|
||||
[Notch]: /reference/blockly.blockrendering.constantprovider.notch
|
||||
[PuzzleTab]: /reference/blockly.blockrendering.constantprovider.puzzle_tab
|
||||
[connection-check]: /guides/create-custom-blocks/inputs/connection-checks
|
||||
[shapeFor]: /reference/blockly.blockrendering_namespace.constantprovider_class.shapefor_1_method
|
||||
[shapeFor]: /reference/blockly.blockrendering.constantprovider.shapefor
|
||||
|
||||
@@ -16,9 +16,9 @@ Blockly to do this.
|
||||
|
||||
The drawer also updates the offsets of connections within the block.
|
||||
|
||||
[Drawer]: /reference/blockly.blockrendering_namespace.drawer_class
|
||||
[Drawer]: /reference/blockly.blockrendering.drawer
|
||||
[paths]: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
|
||||
[render-info]: /guides/create-custom-blocks/renderers/concepts/info
|
||||
[path-object]: /guides/create-custom-blocks/renderers/concepts/path-object
|
||||
[constants]: /guides/create-custom-blocks/renderers/concepts/constants
|
||||
[svg-path-utils]: /reference/blockly.utils_namespace.svgpaths_namespace
|
||||
[svg-path-utils]: /reference/blockly.utils.svgpaths
|
||||
|
||||
@@ -53,7 +53,7 @@ depending on the elements to either side of the spacer.
|
||||
|
||||
[render-info]: /guides/create-custom-blocks/renderers/concepts/info
|
||||
[row]: /guides/create-custom-blocks/renderers/concepts/rows
|
||||
[field-element]: /reference/blockly.blockrendering_namespace.field_class
|
||||
[getSize]: /reference/blockly.field_class.getsize_1_method
|
||||
[field-element]: /reference/blockly.blockrendering.field
|
||||
[getSize]: /reference/blockly.field.getsize
|
||||
[element-image]: /images/rendering/debug-renderer/element.png
|
||||
[element-spacer-image]: /images/rendering/debug-renderer/element-spacer.png
|
||||
|
||||
@@ -27,7 +27,7 @@ which are organized into non-overlapping [rows][row], and
|
||||
Then the [drawer][drawer] uses that organized layout information to create the
|
||||
SVG paths representing the block.
|
||||
|
||||
[RenderInfo]: /reference/blockly.blockrendering_namespace.renderinfo_class
|
||||
[RenderInfo]: /reference/blockly.blockrendering.renderinfo
|
||||
[drawer]: /guides/create-custom-blocks/renderers/concepts/drawer
|
||||
[row]: /guides/create-custom-blocks/renderers/concepts/rows
|
||||
[element]: /guides/create-custom-blocks/renderers/concepts/elements
|
||||
|
||||
@@ -26,7 +26,7 @@ It also handles:
|
||||
- Applying [theme colors][theme] to the SVG elements.
|
||||
- Applying other styling to the SVG elements.
|
||||
|
||||
[PathObject]: /reference/blockly.blockrendering_namespace.pathobject_class
|
||||
[PathObject]: /reference/blockly.blockrendering.pathobject
|
||||
[theme]: /guides/configure/web/appearance/themes#block-style
|
||||
[built-in-renderers]: /guides/create-custom-blocks/renderers/overview#built-in-renderers
|
||||
[drawer]: /guides/create-custom-blocks/renderers/concepts/drawer
|
||||
|
||||
@@ -16,7 +16,7 @@ And it contains code for wiring them all together when it renders a block.
|
||||
If you want to change just one part of an existing renderer (e.g. the constants)
|
||||
you can subclass the relevant factory method.
|
||||
|
||||
[Renderer]: /reference/blockly.blockrendering_namespace.renderer_class
|
||||
[Renderer]: /reference/blockly.blockrendering.renderer
|
||||
[constants]: /guides/create-custom-blocks/renderers/concepts/constants
|
||||
[render-info]: /guides/create-custom-blocks/renderers/concepts/info
|
||||
[path-object]: /guides/create-custom-blocks/renderers/concepts/path-object
|
||||
|
||||
@@ -48,8 +48,8 @@ The bounds of the row spacers are determined by the
|
||||
[render info][render-info] itself. After measuring all of the rows of the block,
|
||||
the [render info][render-info] inserts spaces of its chosen size between rows.
|
||||
|
||||
[Row]: /reference/blockly.blockrendering_namespace.row_class
|
||||
[RowSpacer]: /reference/blockly.blockrendering_namespace.spacerrow_class
|
||||
[Row]: /reference/blockly.blockrendering.row
|
||||
[RowSpacer]: /reference/blockly.blockrendering.spacerrow
|
||||
[render-info]: /guides/create-custom-blocks/renderers/concepts/info
|
||||
[external-vs-inline]: /guides/create-custom-blocks/define/inline-vs-external
|
||||
[element]: /guides/create-custom-blocks/renderers/concepts/elements
|
||||
|
||||
+5
-5
@@ -89,16 +89,16 @@ const workspace = Blockly.inject(blocklyDiv, {
|
||||
});
|
||||
```
|
||||
|
||||
[Renderer]: /reference/blockly.blockrendering_namespace.renderer_class
|
||||
[Renderer]: /reference/blockly.blockrendering.renderer
|
||||
[renderer-concept]: /guides/create-custom-blocks/renderers/concepts/renderer
|
||||
[base-renderer-image]: /images/rendering/renderers/base-renderer.png
|
||||
[built-in-renderers]: /guides/create-custom-blocks/renderers/overview#built-in-renderers
|
||||
[renderer-component]: /guides/create-custom-blocks/renderers/concepts/overview
|
||||
[connection-shape]: /guides/create-custom-blocks/renderers/create-custom-renderers/connection-shapes
|
||||
[constants]: /guides/create-custom-blocks/renderers/concepts/constants
|
||||
[makeConstants]: /reference/blockly.blockrendering_namespace.renderer_class.makeconstants__1_method
|
||||
[makeRenderInfo]: /reference/blockly.blockrendering_namespace.renderer_class.makerenderinfo__1_method
|
||||
[makePathObject]: /reference/blockly.blockrendering_namespace.renderer_class.makepathobject_1_method
|
||||
[makeDrawer]: /reference/blockly.blockrendering_namespace.renderer_class.makedrawer__1_method
|
||||
[makeConstants]: /reference/blockly.blockrendering.renderer.makeconstants_
|
||||
[makeRenderInfo]: /reference/blockly.blockrendering.renderer.makerenderinfo_
|
||||
[makePathObject]: /reference/blockly.blockrendering.renderer.makepathobject
|
||||
[makeDrawer]: /reference/blockly.blockrendering.renderer.makedrawer_
|
||||
[inject-config]: /guides/configure/web/configuration_struct
|
||||
[custom-renderer-codelab]: /codelabs/custom-renderer/codelab-overview
|
||||
|
||||
+15
-15
@@ -307,27 +307,27 @@ export class Drawer extends Blockly.blockRendering.Drawer {
|
||||
[internal-inputs-image]: /images/rendering/connection-shapes/internal-inputs.png
|
||||
[basic-implementation]: /guides/create-custom-blocks/renderers/create-custom-renderers/basic-implementation
|
||||
[constants]: /guides/create-custom-blocks/renderers/concepts/constants
|
||||
[BaseConstants]: /reference/blockly.blockrendering_namespace.constantprovider_class
|
||||
[GerasConstants]: /reference/blockly.geras_namespace.constantprovider_class
|
||||
[ZelosConstants]: /reference/blockly.zelos_namespace.constantprovider_class
|
||||
[NOTCH_WIDTH]: /reference/blockly.blockrendering_namespace.constantprovider_class.notch_width_property
|
||||
[NOTCH_HEIGHT]: /reference/blockly.blockrendering_namespace.constantprovider_class.notch_height_property
|
||||
[TAB_WIDTH]: /reference/blockly.blockrendering_namespace.constantprovider_class.tab_width_property
|
||||
[TAB_HEIGHT]: /reference/blockly.blockrendering_namespace.constantprovider_class.tab_height_property
|
||||
[BaseConstants]: /reference/blockly.blockrendering.constantprovider
|
||||
[GerasConstants]: /reference/blockly.geras.constantprovider
|
||||
[ZelosConstants]: /reference/blockly.zelos.constantprovider
|
||||
[NOTCH_WIDTH]: /reference/blockly.blockrendering.constantprovider.notch_width
|
||||
[NOTCH_HEIGHT]: /reference/blockly.blockrendering.constantprovider.notch_height
|
||||
[TAB_WIDTH]: /reference/blockly.blockrendering.constantprovider.tab_width
|
||||
[TAB_HEIGHT]: /reference/blockly.blockrendering.constantprovider.tab_height
|
||||
[path-object]: /guides/create-custom-blocks/renderers/concepts/path-object
|
||||
[makeNotch]: /reference/blockly.blockrendering_namespace.constantprovider_class.makenotch_1_method
|
||||
[makePuzzleTab]: /reference/blockly.blockrendering_namespace.constantprovider_class.makepuzzletab_1_method
|
||||
[makeNotch]: /reference/blockly.blockrendering.constantprovider.makenotch
|
||||
[makePuzzleTab]: /reference/blockly.blockrendering.constantprovider.makepuzzletab
|
||||
[connection-check]: /guides/create-custom-blocks/inputs/connection-checks
|
||||
[shapeFor]: /reference/blockly.blockrendering_namespace.constantprovider_class.shapefor_1_method
|
||||
[shapeFor]: /reference/blockly.blockrendering.constantprovider.shapefor
|
||||
[basic-shapes]: #basic-shapes
|
||||
[custom-input]: /guides/create-custom-blocks/inputs/creating-custom-inputs
|
||||
[measurable]: /guides/create-custom-blocks/renderers/concepts/overview#block-measurables
|
||||
[InputConnection]: /reference/blockly.blockrendering_namespace.inputconnection_class
|
||||
[InputConnection]: /reference/blockly.blockrendering.inputconnection
|
||||
[render-info]: /guides/create-custom-blocks/renderers/concepts/info
|
||||
[addInput]: /reference/blockly.blockrendering_namespace.renderinfo_class.addinput__1_method
|
||||
[addInput]: /reference/blockly.blockrendering.renderinfo.addinput_
|
||||
[row]: /guides/create-custom-blocks/renderers/concepts/rows
|
||||
[shouldStartNewRow]: /reference/blockly.blockrendering_namespace.renderinfo_class.shouldstartnewrow__1_method
|
||||
[shouldStartNewRow]: /reference/blockly.blockrendering.renderinfo.shouldstartnewrow_
|
||||
[drawer]: /guides/create-custom-blocks/renderers/concepts/drawer
|
||||
[drawOutline]: /reference/blockly.blockrendering_namespace.drawer_class.drawoutline__1_method
|
||||
[drawInternals]: /reference/blockly.blockrendering_namespace.drawer_class.drawinternals__1_method
|
||||
[drawOutline]: /reference/blockly.blockrendering.drawer.drawoutline_
|
||||
[drawInternals]: /reference/blockly.blockrendering.drawer.drawinternals_
|
||||
[svg-path]: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
|
||||
|
||||
@@ -5,7 +5,7 @@ image: images/blockly_banner.png
|
||||
---
|
||||
|
||||
{/* Whenever you update this page update the following as well! */}
|
||||
{/* https://github.com/RaspberryPiFoundation/blockly/blob/main/scripts/package/README.md */}
|
||||
{/* https://github.com/RaspberryPiFoundation/blockly/blob/main/packages/blockly/scripts/package/README.md */}
|
||||
|
||||
# Get the code
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ let referenceSidebar = [];
|
||||
try {
|
||||
referenceSidebar = require('./docs/reference/_reference.js').referenceSidebar;
|
||||
} catch {
|
||||
console.warn('Reference sidebar not found — run "npm run docs" in packages/blockly to generate it.');
|
||||
console.warn(
|
||||
'Reference sidebar not found — run "npm run docs" in packages/blockly to generate it.',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user