Skip to content

Commit

Permalink
[#155] 워크스페이스 캔버스, html 태그, css 클래스 블록 우클릭 시 발생하는 에러 해결, CSS 툴박스 inpu…
Browse files Browse the repository at this point in the history
…t창 클릭 시 에러 발생 해결 (#241)

* 🐛 fix: 워크스페이스 캔버스에서 우클릭 시 발생하는 에러 발생 문제 해결

* 🐛 fix: html 태그 블록 우클릭 시 발생하는 에러 해결

* 🐛 fix: CSS 클래스 블록의 context 메뉴가 툴박스에서만 렌더링되도록 변경

* 🐛 fix: CSS블록 툴박스 input창 클릭 시 발생하는 에러 해결

* 🐛 fix: 빌드 오류 수정
  • Loading branch information
lee0jae330 authored Dec 5, 2024
1 parent 2c9e07b commit e828e2f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/client/src/core/styleFlyout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ export default class StyleFlyout extends FixedFlyout {
);
this.setOutput(true);
this.setStyle(`defaultBlockCss`);
this.showContextMenu = (e: PointerEvent) => {
const transfromX = this.getSvgRoot().transform.baseVal[0].matrix.e;
if (transfromX !== 8) {
return;
}
const menuOptions = this.generateContextMenu();
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
};
},
};
}
Expand Down
3 changes: 3 additions & 0 deletions apps/client/src/core/tabbedToolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ export default class TabbedToolbox extends Blockly.Toolbox {
}
this.contentArea_.innerHTML = '';
}

// eslint-disable-next-line no-unused-vars
protected onClick_(_e: PointerEvent): void {}
}

Blockly.Css.register(`
Expand Down
8 changes: 8 additions & 0 deletions apps/client/src/shared/blockly/createCssClassBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ export const createCssClassBlock = (cssClassName: string) => {
);
this.setOutput(true);
this.setStyle(`defaultBlockCss`);
this.showContextMenu = (e: PointerEvent) => {
const transfromX = this.getSvgRoot().transform.baseVal[0].matrix.e;
if (transfromX !== 8) {
return;
}
const menuOptions = this.generateContextMenu();
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
};
},
};
}
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/shared/blockly/defineBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const defineBlockWithDefaults = (
.appendField(new CustomTagFieldLabel(removePreviousTypeName(blockName)));
this.appendStatementInput('children').appendField();
}
this.showContextMenu = () => {};
};

Blockly.Blocks[blockName] = blockDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export const WorkspaceContent = () => {
{ passive: false }
);

newWorkspace.showContextMenu = () => {};

newWorkspace.addChangeListener(handleAutoConversion);
newWorkspace.addChangeListener(handleBlockClick2);

Expand Down

0 comments on commit e828e2f

Please sign in to comment.