調査アンケート: Blockly のご利用体験についてお聞かせください
アンケートを開始
ワークスペースの作成
Blockly ワークスペースは、Blockly の最上位コンポーネントです。これは UI であり、
ブロックを使ったプログラミングに使用できます。
ワークスペースとそのサブコンポーネントの詳細については、ビジュアル
用語集をご覧ください。
インジェクション div
Blockly ワークスペースは、<div>
に挿入する必要があります。これを「インジェクション」という
あります。
インジェクション div のサイズは静的に、または
動的にdiv 内のブロック状の要素を使用すると、
サイズを調整します。
次のコード スニペットは、静的にサイズ変更されるインジェクション div の HTML を示しています。
<div id="blocklyDiv" style="height: 480px; width: 600px;"></div>
インジェクション
インジェクションにより、HTML のサブ要素がすべて作成され、
できます。また、ワークスペースを取得するために必要な初期化もすべて行われます。
使用できます。
インジェクション関数には、インジェクション div の ID またはインジェクション
:
// Passes the ID.
const workspace = Blockly.inject('blocklyDiv', { /* config */ });
// Passes the injection div.
const workspace = Blockly.inject(
document.getElementById('blocklyDiv'), { /* config */ });
構成
ワークスペースは多数のオプション(レイアウトやスタイルなど)を使用して構成できる
確認できます。
構成オプションの詳細については、このモジュールの
構成オプション。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-08-22 UTC。
[null,null,["最終更新日 2024-08-22 UTC。"],[[["A Blockly workspace is a UI for programming with blocks and is injected into a `\u003cdiv\u003e` element called the injection div."],["The injection div can have static or dynamic sizing, with Blockly elements resizing accordingly."],["Injection creates the workspace UI and initializes it for use, taking either the injection div's ID or the div itself as input."],["Blockly workspaces are highly configurable, allowing you to customize layout, style, and other options during injection."]]],["Blockly workspaces, the UI for block programming, are injected into a designated `\u003cdiv\u003e` element called the \"injection div.\" This div can have a fixed or dynamic size, with Blockly elements resizing accordingly. Injection initializes the workspace UI and readies it for use. The `Blockly.inject()` function, which creates the workspace, accepts either the injection div's ID or the div itself. Workspace configuration, including layout and style, is set during the injection process.\n"]]