Skip to content

Commit

Permalink
Fix double border in Column. Closes #290
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jun 20, 2023
1 parent 673f038 commit 3bdd9a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<mj-body>
<!-- Company Header -->
<mj-section background-color="#f0f0f0">
<mj-column>
<mj-column border="10px solid #F45E43">
<mj-text font-family="Barlow">A first line of text</mj-text>
<mj-spacer height="50px" />
</mj-column>
Expand Down
13 changes: 10 additions & 3 deletions src/components/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ export default (editor: Editor, { opt, coreMjmlModel, coreMjmlView, sandboxEl }:
},

renderStyle() {
const model_style = this.model.get('style') || {};
const style = Object.keys(this.model.get('style')).map(attr=>`${attr}:${model_style[attr]};`);
this.el.setAttribute('style', `${this.attributes.style} ${style.join(' ')} ${this.el.getAttribute('style')}`);
const { model, attributes, el } = this;
const modelStyle = model.get('style') || {};
const stylable = model.get('stylable') as string[];
const styles = Object.keys(modelStyle)
.filter(prop => stylable.indexOf(prop) > -1)
.map(prop => `${prop}:${modelStyle[prop]};`);
const styleResult = `${attributes.style} ${styles.join(' ')} ${el.getAttribute('style')}`;
el.setAttribute('style', styleResult);
// #290 Fix double borders
el.firstElementChild?.setAttribute('style', '');
this.checkVisibility();
},

Expand Down

0 comments on commit 3bdd9a8

Please sign in to comment.