Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove blockly factory use of utils.dom.add/removeClass #6534

Merged
merged 6 commits into from
Oct 12, 2022
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
3 changes: 1 addition & 2 deletions blocks/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ const PROCEDURE_DEF_COMMON = {
this.argumentVarModels_.push(variable);
} else {
console.log(
'Failed to create a variable with name ' + varName +
', ignoring.');
`Failed to create a variable named "${varName}", ignoring.`);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/block_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,8 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
}

/**
* Updates the color of the block (and children) to match the current disabled
* state.
* Updates the colour of the block (and children) to match the current
* disabled state.
*
* @internal
*/
Expand Down
21 changes: 8 additions & 13 deletions core/shortcut_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export class ShortcutRegistry {
register(shortcut: KeyboardShortcut, opt_allowOverrides?: boolean) {
const registeredShortcut = this.shortcuts.get(shortcut.name);
if (registeredShortcut && !opt_allowOverrides) {
throw new Error(
'Shortcut with name "' + shortcut.name + '" already exists.');
throw new Error(`Shortcut named "${shortcut.name}" already exists.`);
}
this.shortcuts.set(shortcut.name, shortcut);

Expand All @@ -81,8 +80,7 @@ export class ShortcutRegistry {
const shortcut = this.shortcuts.get(shortcutName);

if (!shortcut) {
console.warn(
'Keyboard shortcut with name "' + shortcutName + '" not found.');
console.warn(`Keyboard shortcut named "${shortcutName}" not found.`);
return false;
}

Expand Down Expand Up @@ -110,9 +108,8 @@ export class ShortcutRegistry {
keyCode = String(keyCode);
const shortcutNames = this.keyMap.get(keyCode);
if (shortcutNames && !opt_allowCollision) {
throw new Error(
'Shortcut with name "' + shortcutName + '" collides with shortcuts ' +
shortcutNames.toString());
throw new Error(`Shortcut named "${
shortcutName}" collides with shortcuts "${shortcutNames}"`);
} else if (shortcutNames && opt_allowCollision) {
shortcutNames.unshift(shortcutName);
} else {
Expand All @@ -138,9 +135,8 @@ export class ShortcutRegistry {

if (!shortcutNames) {
if (!opt_quiet) {
console.warn(
'No keyboard shortcut with name "' + shortcutName +
'" registered with key code "' + keyCode + '"');
console.warn(`No keyboard shortcut named "${
shortcutName}" registered with key code "${keyCode}"`);
}
return false;
}
Expand All @@ -154,9 +150,8 @@ export class ShortcutRegistry {
return true;
}
if (!opt_quiet) {
console.warn(
'No keyboard shortcut with name "' + shortcutName +
'" registered with key code "' + keyCode + '"');
console.warn(`No keyboard shortcut named "${
shortcutName}" registered with key code "${keyCode}"`);
}
return false;
}
Expand Down
33 changes: 20 additions & 13 deletions demos/blockfactory/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,25 @@ BlockFactory.updateBlocksFlagDelayed = false;
*/
BlockFactory.STARTER_BLOCK_XML_TEXT =
'<xml xmlns="https://developers.google.com/blockly/xml">' +
'<block type="factory_base" deletable="false" movable="false">' +
'<value name="TOOLTIP">' +
'<block type="text" deletable="false" movable="false">' +
'<field name="TEXT"></field></block></value>' +
'<value name="HELPURL">' +
'<block type="text" deletable="false" movable="false">' +
'<field name="TEXT"></field></block></value>' +
'<value name="COLOUR">' +
'<block type="colour_hue">' +
'<mutation colour="#5b67a5"></mutation>' +
'<field name="HUE">230</field>' +
'</block></value></block></xml>';
'<block type="factory_base" deletable="false" movable="false">' +
'<value name="TOOLTIP">' +
'<block type="text" deletable="false" movable="false">' +
'<field name="TEXT"></field>' +
'</block>' +
'</value>' +
'<value name="HELPURL">' +
'<block type="text" deletable="false" movable="false">' +
'<field name="TEXT"></field>' +
'</block>' +
'</value>' +
'<value name="COLOUR">' +
'<block type="colour_hue">' +
'<mutation colour="#5b67a5"></mutation>' +
'<field name="HUE">230</field>' +
'</block>' +
'</value>' +
'</block>' +
'</xml>';

/**
* Change the language code format.
Expand Down Expand Up @@ -324,4 +331,4 @@ BlockFactory.manualEdit = function() {
BlockFactory.updateBlocksFlag = true;
BlockFactory.updateBlocksFlagDelayed = true;
BlockFactory.updateLanguage();
}
};
Loading