+ + Element{' '} + { + if (!filterValue) { + return HTML_TAGS + } + + return fuzzysort + .go(filterValue, HTML_TAGS) + .map((res) => res.target) + }} + onItemSelected={(selectedItem) => { + const defaultStyles = DEFAULT_STYLES[selectedItem] || {} + const mergedStyles = { ...defaultStyles, ...value.style } + const defaultAttributes = DEFAULT_ATTRIBUTES[selectedItem] || {} + const mergedAttributes = { + ...defaultAttributes, + ...(value.attributes || {}), + } + const fullValue = { + ...value, + attributes: mergedAttributes, + tagName: selectedItem, + style: mergedStyles, + } + if (isProseElement(selectedItem) && !fullValue.children?.length) { + fullValue.children = [{ type: 'text', value: '' }] + } + onChange(fullValue) + }} + items={HTML_TAGS} + value={value.tagName} + /> + + + + onChange({ ...value, attributes: newAttributes }) + } + element={value.tagName as string} + /> + +
- - Tag name{' '} - { - return HTML_TAGS.filter((el) => el.startsWith(filterValue)) - }} - onItemSelected={(selectedItem) => { - const defaultStyles = DEFAULT_STYLES[selectedItem] || {} - const mergedStyles = { ...defaultStyles, ...value.style } - onChange({ - ...value, - tagName: selectedItem, - style: mergedStyles, - }) - }} - items={HTML_TAGS} - value={value.tagName} - /> - - - - onChange({ ...value, attributes: newAttributes }) - } - element={value.tagName as string} - /> - -