Skip to content

Commit

Permalink
web: Support align embed/object attribute (part of #4258)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhjacobs committed Dec 27, 2024
1 parent 333cebe commit e8b2415
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions web/packages/core/src/internal/player/inner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,36 @@ export class InnerPlayer {
}
}

const alignAttr = this.element.attributes.getNamedItem("align");
if (alignAttr !== undefined && alignAttr !== null) {
const alignValue = alignAttr.value.toLowerCase();

const alignCSS = (() => {
switch (alignValue) {
case "right":
return "vertical-align: top; float: right;";
case "left":
return "vertical-align: top; float: left;";
case "bottom":
return "vertical-align: baseline;";
case "top":
return "vertical-align: top;";
case "center":
return "vertical-align: middle;";
case "middle":
return "vertical-align: middle; vertical-align: -webkit-baseline-middle; vertical-align: -moz-middle-with-baseline;";
default:
return "";
}
})();

if (alignCSS) {
this.dynamicStyles.sheet.insertRule(
`:host { ${alignCSS} }`
);
}
}

const widthAttr = this.element.attributes.getNamedItem("width");
if (widthAttr !== undefined && widthAttr !== null) {
const width = InnerPlayer.htmlDimensionToCssDimension(
Expand Down

0 comments on commit e8b2415

Please sign in to comment.