Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
add block specific classnames in atomic blocks for styling
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed Sep 28, 2016
1 parent c0cbab8 commit 0a7ff30
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ node_modules
dist/
hash.json
lib/
wiki/
8 changes: 6 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
max-width: 50px;
}

.md-block-atomic-wrapper.md-block-atomic-wrapper-separator {
border-color: transparent;
}

.github-fork-ribbon:before {
background-color: #090;
}
Expand Down Expand Up @@ -300,12 +304,12 @@
if (blockProps.components[type]) {
const AtComponent = blockProps.components[type];
return (
<div className="md-block-atomic-wrapper">
<div className={`md-block-atomic-wrapper md-block-atomic-wrapper-${type}`}>
<AtComponent data={data} />
</div>
);
}
return <p>Atomic block of type <b>{type}</b> is not supported.</p>;
return <p>Block of type <b>{type}</b> is not supported.</p>;
};


Expand Down
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
min-height: 3px;
max-width: 50px;
}
.md-block-atomic-wrapper.md-block-atomic-wrapper-separator {
border-color: transparent;
}
</style>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class MediumDraftEditor extends React.Component {
placeholder={this.props.placeholder}
spellCheck={editorEnabled && this.props.spellCheck}
/>
{showAddButton ? (
{(showAddButton && this.props.sideButtons.length > 0) ? (
<AddButton
editorState={editorState}
getEditorState={this.getEditorState}
Expand Down
5 changes: 2 additions & 3 deletions src/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,18 @@ const AtomicSeparatorComponent = (props) => (

const AtomicBlock = (props) => {
const { blockProps, block } = props;
console.log(props);
const entity = Entity.get(block.getEntityAt(0));
const data = entity.getData();
const type = entity.getType();
if (blockProps.components[type]) {
const AtComponent = blockProps.components[type];
return (
<div className="md-block-atomic-wrapper">
<div className={`md-block-atomic-wrapper md-block-atomic-wrapper-${type}`}>
<AtComponent data={data} />
</div>
);
}
return <p>Atomic block of type <b>{type}</b> is not supported.</p>;
return <p>Block of type <b>{type}</b> is not supported.</p>;
};


Expand Down

0 comments on commit 0a7ff30

Please sign in to comment.