Skip to content

Commit 8e9de98

Browse files
committed
prefer static constants to computed constants
1 parent 9efce5c commit 8e9de98

File tree

1 file changed

+20
-19
lines changed
  • packages/fields-document/src/DocumentEditor

1 file changed

+20
-19
lines changed

packages/fields-document/src/DocumentEditor/index.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,27 @@ import {
4141
createDocumentEditor
4242
} from './editor-shared'
4343

44-
const orderedListStyles = ['lower-roman', 'decimal', 'lower-alpha']
45-
const unorderedListStyles = ['square', 'disc', 'circle']
46-
47-
let styles: any = {
44+
const styles = {
4845
flex: 1,
49-
}
50-
51-
let listDepth = 10
52-
53-
while (listDepth--) {
54-
let arr = Array.from({ length: listDepth })
55-
if (arr.length) {
56-
styles[arr.map(() => `ol`).join(' ')] = {
57-
listStyle: orderedListStyles[listDepth % 3],
58-
}
59-
styles[arr.map(() => `ul`).join(' ')] = {
60-
listStyle: unorderedListStyles[listDepth % 3],
61-
}
62-
}
63-
}
46+
'ol ol ol ol ol ol ol ol ol': { listStyle: 'lower-roman' },
47+
'ol ol ol ol ol ol ol ol': { listStyle: 'lower-alpha' },
48+
'ol ol ol ol ol ol ol': { listStyle: 'decimal' },
49+
'ol ol ol ol ol ol': { listStyle: 'lower-roman' },
50+
'ol ol ol ol ol': { listStyle: 'lower-alpha' },
51+
'ol ol ol ol': { listStyle: 'decimal' },
52+
'ol ol ol': { listStyle: 'lower-roman' },
53+
'ol ol': { listStyle: 'lower-alpha' },
54+
'ol': { listStyle: 'decimal' },
55+
'ul ul ul ul ul ul ul ul ul': { listStyle: 'square' },
56+
'ul ul ul ul ul ul ul ul': { listStyle: 'circle' },
57+
'ul ul ul ul ul ul ul': { listStyle: 'disc' },
58+
'ul ul ul ul ul ul': { listStyle: 'square' },
59+
'ul ul ul ul ul': { listStyle: 'circle' },
60+
'ul ul ul ul': { listStyle: 'disc' },
61+
'ul ul ul': { listStyle: 'square' },
62+
'ul ul': { listStyle: 'circle' },
63+
'ul': { listStyle: 'disc' }
64+
} as const
6465

6566
const HOTKEYS: Record<string, Mark> = {
6667
'mod+b': 'bold',

0 commit comments

Comments
 (0)