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

Adds ability to add custom classes when adding a new block via class property in data object #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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