react-lz-editor-whkfzyx
Version:
An open source react rich-text editor (mordern react editor includes media support such as texts, images, videos, audios, links etc.), development based on Draft-Js and Ant-design, good support html, markdown, draft-raw mode.
42 lines (31 loc) • 1.24 kB
JavaScript
;
var _require = require('immutable'),
List = _require.List;
var ulStyleType = List(['disc', 'circle', 'square', 'image']);
var olStyleType = List(['decimalType1', 'decimalType2', 'decimalType3']);
var DraftBlockTypeAnalysis = {
getDraftBlockTypeAnalysis: function getDraftBlockTypeAnalysis(blockType) {
switch (blockType) {
case 'unordered-list-item-disc':
case 'unordered-list-item-circle':
case 'unordered-list-item-square':
case 'unordered-list-item-image':
return 'unordered-list-item';
case 'ordered-list-item-decimal-type1':
case 'ordered-list-item-decimal-type2':
case 'ordered-list-item-decimal-type3':
return 'ordered-list-item';
default:
return blockType;
}
},
getUlStyleType: function getUlStyleType(styleKey) {
styleKey = styleKey % ulStyleType.size;
return ulStyleType.get(styleKey, 'disc');
},
getOlStyleType: function getOlStyleType(styleKey) {
styleKey = styleKey % olStyleType.size;
return olStyleType.get(styleKey, 'decimalType1');
}
};
module.exports = DraftBlockTypeAnalysis;