Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/rc/v11.0.0' into flyout-button…
Browse files Browse the repository at this point in the history
…-navigation
  • Loading branch information
mikeharv committed Apr 8, 2024
2 parents 5e3608e + 3cded5a commit 38c22aa
Show file tree
Hide file tree
Showing 203 changed files with 9,584 additions and 17,207 deletions.
4 changes: 2 additions & 2 deletions codelabs/context_menu_option/context_menu_option.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Each menu option in the registry has several properties:

- `callback`: A function called when the menu option is clicked.
- `scopeType`: An enum indicating when this option should be shown.
- `displayText`: The text to show in the menu. Either a string or a function that returns a string.
- `displayText`: The text to show in the menu. Either a string, or HTML, or a function that returns either of the former.
- `preconditionFn`: Function that returns one of `'enabled'`, `'disabled'`, or `'hidden'` to determine whether and how the menu option should be rendered.
- `weight`: A number that determines the sort order of the option. Options with higher weights appear later in the context menu.
- `id`: A unique string id for the option.
Expand Down Expand Up @@ -282,7 +282,7 @@ callback: function(scope) {

## Display text

So far the `displayText` has always been a simple string, but it can also be a function that returns a string. This can be useful when you want a context-dependent message.
So far the `displayText` has always been a simple string, but it can also be HTML, or a function that returns either of the former. Using a function can be useful when you want a context-dependent message.

When defined as a function `displayText` accepts a `scope` argument, just like `callback` and `preconditionFn`.

Expand Down
24 changes: 12 additions & 12 deletions examples/blockly-angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions examples/blockly-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions examples/blockly-rtc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions examples/custom-renderer-codelab/src/renderers/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

import * as Blockly from 'blockly/core';

/**
* The ConstantProvider holds rendering-related constants such as colour
* and size information.
*/
class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
/** @override */
constructor() {
// Set up all of the constants from the base provider.
super();
Expand Down Expand Up @@ -81,7 +86,7 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
}

/**
* @returns Rectangular notch for use with previous and next connections.
* @returns {Object} Rectangular notch for use with previous and next connections.
*/
makeRectangularPreviousConn() {
const width = this.NOTCH_WIDTH;
Expand All @@ -90,8 +95,8 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
/**
* Since previous and next connections share the same shape you can define
* a function to generate the path for both.
* @param dir Multiplier for the horizontal direction of the path (-1 or 1)
* @returns SVGPath line for use with previous and next connections.
* @param {number} dir Multiplier for the horizontal direction of the path (-1 or 1)
* @returns {Object} SVGPath line for use with previous and next connections.
*/
function makeMainPath(dir) {
return Blockly.utils.svgPaths.line([
Expand All @@ -112,7 +117,7 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
}

/**
* @returns Rectangular puzzle tab for use with input and output connections.
* @returns {Object} Rectangular puzzle tab for use with input and output connections.
*/
makeRectangularInputConn() {
const width = this.TAB_WIDTH;
Expand All @@ -121,8 +126,8 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
/**
* Since input and output connections share the same shape you can define
* a function to generate the path for both.
* @param dir Multiplier for the vertical direction of the path (-1 or 1)
* @returns SVGPath line for use with input and output connections.
* @param {number} dir Multiplier for the vertical direction of the path (-1 or 1)
* @returns {Object} SVGPath line for use with input and output connections.
*/
function makeMainPath(dir) {
return Blockly.utils.svgPaths.line([
Expand All @@ -143,7 +148,9 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
}
}

/** The CustomRenderer class incorporates our custom ConstantProvider. */
export class CustomRenderer extends Blockly.blockRendering.Renderer {
/** @override */
constructor() {
super();
}
Expand Down
6 changes: 6 additions & 0 deletions examples/keyboard-navigation-codelab/src/cursors/custom.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import * as Blockly from 'blockly/core';

/** A custom cursor that skips previous and next connections. */
export class CustomCursor extends Blockly.Cursor {
/** @override */
constructor() {
super();
}

/** @override */
next() {
const curNode = this.getCurNode();
if (!curNode) {
Expand All @@ -26,6 +29,7 @@ export class CustomCursor extends Blockly.Cursor {
return newNode;
}

/** @override */
in() {
const curNode = this.getCurNode();
if (!curNode) {
Expand All @@ -43,6 +47,7 @@ export class CustomCursor extends Blockly.Cursor {
return newNode;
}

/** @override */
prev() {
const curNode = this.getCurNode();
if (!curNode) {
Expand All @@ -64,6 +69,7 @@ export class CustomCursor extends Blockly.Cursor {
return newNode;
}

/** @override */
out() {
const curNode = this.getCurNode();
if (!curNode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as Blockly from 'blockly/core';

/** A custom Marker that causes an entire block to flash when marked. */
class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
/** @override */
constructor(workspace, constants, marker) {
super(workspace, constants, marker);
}
Expand Down Expand Up @@ -30,6 +32,7 @@ class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
}
}

/** @override */
showWithBlock_(curNode) {
// Get the block from the AST Node
const block = curNode.getLocation();
Expand Down Expand Up @@ -78,11 +81,14 @@ class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
}
}

/** A renderer that uses our custom marker. */
class CustomRenderer extends Blockly.geras.Renderer {
/** @override */
constructor(name) {
super(name);
}

/** @override */
makeMarkerDrawer(workspace, marker) {
return new CustomMarkerSvg(workspace, this.getConstants(), marker);
}
Expand Down
12 changes: 6 additions & 6 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions examples/sample-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions gh-pages/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ <h4>
</p>
</div>
</a>
<a class="card" href="plugins/renderer-inline-row-separators/test/index.html">
<img srcset="media/inline-inputs.png 2x">
<div>
<h4>
Inline Input Blocks
</h4>
<p>
A custom renderer and example blocks that treat dummy inputs between value inputs as line breaks, rendering the value inputs on separate lines inside of the block.
</p>
</div>
</a>
<a class="card" href="plugins/block-shareable-procedures/test/index.html">
<img srcset="media/procedure-blocks.png 2x">
<div>
Expand Down Expand Up @@ -315,7 +304,7 @@ <h4>
Disable Top Blocks
</h4>
<p>
A plugin that hides the 'Enable' context menu option for orphan blocks. Works with the <code>Blockly.Events.disableOrphans</code> change listener in core.
A plugin that hides the 'Enable' context menu option for orphan blocks. Works with the <code>disableOrphans</code> change listener in core.
</p>
</div>
</a>
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 38c22aa

Please sign in to comment.