feat: add checkbox list #385

This commit is contained in:
Hufe
2024-04-07 22:05:35 +08:00
committed by GitHub
parent 237e570179
commit a546262b9d
8 changed files with 184 additions and 119 deletions
+4 -2
View File
@@ -3,7 +3,8 @@ import { ListStyle, ListType, UlStyle } from '../enum/List'
export const ulStyleMapping: Record<UlStyle, string> = {
[UlStyle.DISC]: '•',
[UlStyle.CIRCLE]: '◦',
[UlStyle.SQUARE]: '▫︎'
[UlStyle.SQUARE]: '▫︎',
[UlStyle.CHECKBOX]: '☑️'
}
export const listTypeElementMapping: Record<ListType, string> = {
@@ -15,5 +16,6 @@ export const listStyleCSSMapping: Record<ListStyle, string> = {
[ListStyle.DISC]: 'disc',
[ListStyle.CIRCLE]: 'circle',
[ListStyle.SQUARE]: 'square',
[ListStyle.DECIMAL]: 'decimal'
[ListStyle.DECIMAL]: 'decimal',
[ListStyle.CHECKBOX]: 'checkbox'
}
+4
View File
@@ -1,3 +1,5 @@
import { ZERO } from './Common'
export const NUMBER_REG = /[0-9]/
export const NUMBER_LIKE_REG = /[0-9.]/
export const CHINESE_REG = /[\u4e00-\u9fa5]/
@@ -13,3 +15,5 @@ export const UNICODE_SYMBOL_REG = new RegExp(
export const PUNCTUATION_REG =
/[、,。?!;:……「」“”‘’*()【】〔〕〖〗〘〙〚〛《》———﹝﹞–—\\/·.,!?;:`~<>()[\]{}'"|]/
export const START_LINE_BREAK_REG = new RegExp(`^[${ZERO}\n]`)
+4 -2
View File
@@ -6,7 +6,8 @@ export enum ListType {
export enum UlStyle {
DISC = 'disc', // 实心圆点
CIRCLE = 'circle', // 空心圆点
SQUARE = 'square' // 实心方块
SQUARE = 'square', // 实心方块
CHECKBOX = 'checkbox' // 复选框
}
export enum OlStyle {
@@ -17,5 +18,6 @@ export enum ListStyle {
DISC = UlStyle.DISC,
CIRCLE = UlStyle.CIRCLE,
SQUARE = UlStyle.SQUARE,
DECIMAL = OlStyle.DECIMAL
DECIMAL = OlStyle.DECIMAL,
CHECKBOX = UlStyle.CHECKBOX
}