Skip to content

Commit e828e2f

Browse files
authored
[#155] 워크스페이스 캔버스, html 태그, css 클래스 블록 우클릭 시 발생하는 에러 해결, CSS 툴박스 input창 클릭 시 에러 발생 해결 (#241)
* 🐛 fix: 워크스페이스 캔버스에서 우클릭 시 발생하는 에러 발생 문제 해결 * 🐛 fix: html 태그 블록 우클릭 시 발생하는 에러 해결 * 🐛 fix: CSS 클래스 블록의 context 메뉴가 툴박스에서만 렌더링되도록 변경 * 🐛 fix: CSS블록 툴박스 input창 클릭 시 발생하는 에러 해결 * 🐛 fix: 빌드 오류 수정
1 parent 2c9e07b commit e828e2f

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

Diff for: apps/client/src/core/styleFlyout.ts

+8
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ export default class StyleFlyout extends FixedFlyout {
248248
);
249249
this.setOutput(true);
250250
this.setStyle(`defaultBlockCss`);
251+
this.showContextMenu = (e: PointerEvent) => {
252+
const transfromX = this.getSvgRoot().transform.baseVal[0].matrix.e;
253+
if (transfromX !== 8) {
254+
return;
255+
}
256+
const menuOptions = this.generateContextMenu();
257+
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
258+
};
251259
},
252260
};
253261
}

Diff for: apps/client/src/core/tabbedToolbox.ts

+3
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ export default class TabbedToolbox extends Blockly.Toolbox {
328328
}
329329
this.contentArea_.innerHTML = '';
330330
}
331+
332+
// eslint-disable-next-line no-unused-vars
333+
protected onClick_(_e: PointerEvent): void {}
331334
}
332335

333336
Blockly.Css.register(`

Diff for: apps/client/src/shared/blockly/createCssClassBlock.ts

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ export const createCssClassBlock = (cssClassName: string) => {
1212
);
1313
this.setOutput(true);
1414
this.setStyle(`defaultBlockCss`);
15+
this.showContextMenu = (e: PointerEvent) => {
16+
const transfromX = this.getSvgRoot().transform.baseVal[0].matrix.e;
17+
if (transfromX !== 8) {
18+
return;
19+
}
20+
const menuOptions = this.generateContextMenu();
21+
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
22+
};
1523
},
1624
};
1725
}

Diff for: apps/client/src/shared/blockly/defineBlocks.ts

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const defineBlockWithDefaults = (
4040
.appendField(new CustomTagFieldLabel(removePreviousTypeName(blockName)));
4141
this.appendStatementInput('children').appendField();
4242
}
43+
this.showContextMenu = () => {};
4344
};
4445

4546
Blockly.Blocks[blockName] = blockDefinition;

Diff for: apps/client/src/widgets/workspace/WorkspaceContent/WorkspaceContent.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export const WorkspaceContent = () => {
180180
{ passive: false }
181181
);
182182

183+
newWorkspace.showContextMenu = () => {};
184+
183185
newWorkspace.addChangeListener(handleAutoConversion);
184186
newWorkspace.addChangeListener(handleBlockClick2);
185187

0 commit comments

Comments
 (0)