forked from Gitlink/forgeplus-react
73 lines
1.6 KiB
Plaintext
73 lines
1.6 KiB
Plaintext
|
|
/**
|
||
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
||
|
|
* All rights reserved.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the BSD-style license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||
|
|
*
|
||
|
|
* @providesModule DefaultDraftBlockRenderMap
|
||
|
|
* @format
|
||
|
|
* @flow
|
||
|
|
*/
|
||
|
|
|
||
|
|
'use strict';
|
||
|
|
|
||
|
|
import type { DraftBlockRenderConfig } from './DraftBlockRenderConfig';
|
||
|
|
import type { CoreDraftBlockType } from './DraftBlockType';
|
||
|
|
|
||
|
|
const { Map } = require('immutable');
|
||
|
|
const React = require('react');
|
||
|
|
|
||
|
|
const cx = require('fbjs/lib/cx');
|
||
|
|
|
||
|
|
type DefaultCoreDraftBlockRenderMap = Map<CoreDraftBlockType, DraftBlockRenderConfig>;
|
||
|
|
|
||
|
|
const UL_WRAP = <ul className={cx('public/DraftStyleDefault/ul')} />;
|
||
|
|
const OL_WRAP = <ol className={cx('public/DraftStyleDefault/ol')} />;
|
||
|
|
const PRE_WRAP = <pre className={cx('public/DraftStyleDefault/pre')} />;
|
||
|
|
|
||
|
|
const DefaultDraftBlockRenderMap: DefaultCoreDraftBlockRenderMap = Map({
|
||
|
|
'header-one': {
|
||
|
|
element: 'h1'
|
||
|
|
},
|
||
|
|
'header-two': {
|
||
|
|
element: 'h2'
|
||
|
|
},
|
||
|
|
'header-three': {
|
||
|
|
element: 'h3'
|
||
|
|
},
|
||
|
|
'header-four': {
|
||
|
|
element: 'h4'
|
||
|
|
},
|
||
|
|
'header-five': {
|
||
|
|
element: 'h5'
|
||
|
|
},
|
||
|
|
'header-six': {
|
||
|
|
element: 'h6'
|
||
|
|
},
|
||
|
|
'unordered-list-item': {
|
||
|
|
element: 'li',
|
||
|
|
wrapper: UL_WRAP
|
||
|
|
},
|
||
|
|
'ordered-list-item': {
|
||
|
|
element: 'li',
|
||
|
|
wrapper: OL_WRAP
|
||
|
|
},
|
||
|
|
blockquote: {
|
||
|
|
element: 'blockquote'
|
||
|
|
},
|
||
|
|
atomic: {
|
||
|
|
element: 'figure'
|
||
|
|
},
|
||
|
|
'code-block': {
|
||
|
|
element: 'pre',
|
||
|
|
wrapper: PRE_WRAP
|
||
|
|
},
|
||
|
|
unstyled: {
|
||
|
|
element: 'div',
|
||
|
|
aliasedElements: ['p']
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
module.exports = DefaultDraftBlockRenderMap;
|