Skip to content

Commit

Permalink
fix!: classes on text input bubble to match comment view (#7935)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega authored Mar 14, 2024
1 parent 67c3aae commit e91dd20
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 38 deletions.
12 changes: 10 additions & 2 deletions core/bubbles/bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export abstract class Bubble implements IBubble {
protected anchor: Coordinate,
protected ownerRect?: Rect,
) {
this.svgRoot = dom.createSvgElement(Svg.G, {}, workspace.getBubbleCanvas());
this.svgRoot = dom.createSvgElement(
Svg.G,
{'class': 'blocklyBubble'},
workspace.getBubbleCanvas(),
);
const embossGroup = dom.createSvgElement(
Svg.G,
{
Expand All @@ -100,7 +104,11 @@ export abstract class Bubble implements IBubble {
},
this.svgRoot,
);
this.tail = dom.createSvgElement(Svg.PATH, {}, embossGroup);
this.tail = dom.createSvgElement(
Svg.PATH,
{'class': 'blocklyBubbleTail'},
embossGroup,
);
this.background = dom.createSvgElement(
Svg.RECT,
{
Expand Down
49 changes: 13 additions & 36 deletions core/bubbles/textinput_bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ export class TextInputBubble extends Bubble {
protected ownerRect?: Rect,
) {
super(workspace, anchor, ownerRect);
dom.addClass(this.svgRoot, 'blocklyTextInputBubble');
({inputRoot: this.inputRoot, textArea: this.textArea} = this.createEditor(
this.contentContainer,
));
this.resizeGroup = this.createResizeHandle(this.svgRoot);
this.resizeGroup = this.createResizeHandle(this.svgRoot, workspace);
this.setSize(this.DEFAULT_SIZE, true);
}

Expand Down Expand Up @@ -126,7 +127,7 @@ export class TextInputBubble extends Bubble {
dom.HTML_NS,
'textarea',
) as HTMLTextAreaElement;
textArea.className = 'blocklyCommentTextarea';
textArea.className = 'blocklyTextarea blocklyText';
textArea.setAttribute('dir', this.workspace.RTL ? 'RTL' : 'LTR');

body.appendChild(textArea);
Expand Down Expand Up @@ -158,51 +159,27 @@ export class TextInputBubble extends Bubble {
}

/** Creates the resize handler elements and binds events to them. */
private createResizeHandle(container: SVGGElement): SVGGElement {
const resizeGroup = dom.createSvgElement(
Svg.G,
private createResizeHandle(
container: SVGGElement,
workspace: WorkspaceSvg,
): SVGGElement {
const resizeHandle = dom.createSvgElement(
Svg.IMAGE,
{
'class': this.workspace.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE',
'class': 'blocklyResizeHandle',
'href': `${workspace.options.pathToMedia}resize-handle.svg`,
},
container,
);
const size = 2 * Bubble.BORDER_WIDTH;
dom.createSvgElement(
Svg.POLYGON,
{'points': `0,${size} ${size},${size} ${size},0`},
resizeGroup,
);
dom.createSvgElement(
Svg.LINE,
{
'class': 'blocklyResizeLine',
'x1': size / 3,
'y1': size - 1,
'x2': size - 1,
'y2': size / 3,
},
resizeGroup,
);
dom.createSvgElement(
Svg.LINE,
{
'class': 'blocklyResizeLine',
'x1': (size * 2) / 3,
'y1': size - 1,
'x2': size - 1,
'y2': (size * 2) / 3,
},
resizeGroup,
);

browserEvents.conditionalBind(
resizeGroup,
resizeHandle,
'pointerdown',
this,
this.onResizePointerDown,
);

return resizeGroup;
return resizeHandle;
}

/**
Expand Down

0 comments on commit e91dd20

Please sign in to comment.