| 109 | |
| 110 | // Creates an lookup table map object for the specified option or the default value |
| 111 | const createLookupTable = (option: keyof ElementSettings, defaultValue: string, extendWith?: SchemaMap): SchemaMap => { |
| 112 | const value = settings[option]; |
| 113 | |
| 114 | if (!value) { |
| 115 | // Get cached default map or make it if needed |
| 116 | let newValue = mapCache[option]; |
| 117 | |
| 118 | if (!newValue) { |
| 119 | newValue = createMap(defaultValue, extendWith); |
| 120 | mapCache[option] = newValue; |
| 121 | } |
| 122 | |
| 123 | return newValue; |
| 124 | } else { |
| 125 | // Create custom map |
| 126 | return makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/)); |
| 127 | } |
| 128 | }; |
| 129 | |
| 130 | const schemaType = settings.schema ?? 'html5'; |
| 131 | const schemaItems = SchemaLookupTable.makeSchema(schemaType); |