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

Commit

Permalink
Adds ability to add custom classes when adding a new block via class …
Browse files Browse the repository at this point in the history
…property in data object
  • Loading branch information
alberttoledo committed Sep 24, 2019
1 parent e77201e commit 4c55545
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/blockStyleFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { Block } from './constants';
Get custom classnames for each of the different block types supported.
*/

const BASE_BLOCK_CLASS = 'md-block';

export default (block) => {
const classFromData = block.getData().get('class');
const customClassToApply = classFromData ? `${classFromData} ` : '';
const BASE_BLOCK_CLASS = `${customClassToApply}md-block`;

switch (block.getType()) {
case Block.BLOCKQUOTE:
return `${BASE_BLOCK_CLASS} ${BASE_BLOCK_CLASS}-quote md-RichEditor-blockquote`;
Expand Down

0 comments on commit 4c55545

Please sign in to comment.