Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 1x 1x 1x 166x 166x 166x 441x 138x 303x 139x 164x 140x 166x 1x 957x | import type { Border } from 'roosterjs-content-model-types'; const BorderStyles = [ 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', ]; const BorderSizeRegex = /^(thin|medium|thick|[\d\.]+\w*)$/; /** * Extract an integrated border string with border width, style, color to value tuple * @param combinedBorder The integrated border style string * @returns An array with the splitted values */ export function extractBorderValues(combinedBorder?: string): Border { const result: Border = {}; const values = (combinedBorder || '').replace(/, /g, ',').split(' '); values.forEach(v => { if (BorderStyles.indexOf(v) >= 0 && !result.style) { result.style = v; } else if (BorderSizeRegex.test(v) && !result.width) { result.width = v; } else if (v && !result.color) { result.color = v; } }); return result; } /** * Combine border value array back to string * @param values Input string values * @param initialValue Initial value for those items without valid value */ export function combineBorderValue(value: Border): string { return [value.width || '', value.style || '', value.color || ''].join(' ').trim() || 'none'; } |