<aside> ✏️
Blockly 클래스들을 이용한 Block 커스텀하기! 시리즈
<aside> ✏️
목차
</aside>
<g>
태그이다.document.getElementById
형식으로 가져오듯이, 블록 요소 또한 blockId값을 가지고 가져와 수정해줄 수 있지 않을까 생각했다.export class BlockBase extends AbstractEvent {
override isBlank = true;
/** The ID of the block associated with this event. */
blockId?: string;
/**
* @param opt_block The block this event corresponds to.
* Undefined for a blank event.
*/
constructor(opt_block?: Block) {
super();
this.isBlank = !opt_block;
if (!opt_block) return;
this.blockId = opt_block.id;
this.workspaceId = opt_block.workspace.id;
}
~~진짜 변태같다~~
newWorkspace.addChangeListener((event) => {
if (event instanceof Blockly.Events.Click && event.blockId) {
console.log(event);
}
})
blockId
값이 보이는가..? ㅎ