Skip to content
Open
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
10 changes: 6 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ name: "CodeQL"

on:
push:
branches: [ 'master', 'stable*', 'v[0-9]*' ]
branches: [ 'main', 'stable*', 'v[0-9]*' ]
paths-ignore:
- webapp/public/vs/language/typescript/tsWorker.js
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ main ]
schedule:
- cron: '34 6 * * 0'

# Permissions required by OpenID Connect to access Azure.
permissions:
contents: read
actions: read
security-events: write

jobs:
Expand All @@ -39,9 +40,10 @@ jobs:
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed


steps:
- name: Checkout repository
uses: actions/checkout@main
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pxt-buildpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:

permissions:
contents: write
issues: write
pull-requests: write
actions: write

jobs:
filter-vtags:
Expand Down
16 changes: 8 additions & 8 deletions webapp/src/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,11 @@ export class Editor extends toolboxeditor.ToolboxEditor {
Blockly.config.connectingSnapRadius = 96;

this.editor = Blockly.inject(blocklyDiv, this.getBlocklyOptions(forceHasCategories)) as Blockly.WorkspaceSvg;

// Add block change listener to log block changes
this.editor.addChangeListener((ev: any) => {
if (ev.type === Blockly.Events.CREATE ||
ev.type === Blockly.Events.DELETE ||
if (ev.type === Blockly.Events.CREATE ||
ev.type === Blockly.Events.DELETE ||
ev.type === Blockly.Events.CHANGE) {
this.logCurrentBlocks();
}
Expand Down Expand Up @@ -1031,11 +1031,11 @@ export class Editor extends toolboxeditor.ToolboxEditor {

private logCurrentBlocks() {
if (!this.editor) return;

const blocks = this.editor.getAllBlocks(false); // Don't include child blocks
const blockTypes = blocks.map(block => block.type);
console.log('Current blocks in workspace:', blockTypes);

// Group and count block types
const blockCounts: pxt.Map<number> = {};
blocks.forEach(block => {
Expand All @@ -1051,14 +1051,14 @@ export class Editor extends toolboxeditor.ToolboxEditor {

public getBlockTypeCounts(): pxt.Map<number> {
if (!this.editor) return {};

const blocks = this.editor.getAllBlocks(false);
const counts: pxt.Map<number> = {};

blocks.forEach(block => {
counts[block.type] = (counts[block.type] || 0) + 1;
});

return counts;
}

Expand Down