+
+ selectedTags.includes(tag.id))}
+ focusedIndex={safeInlineFocusedIndex}
+ onRemoved={handleUntag}
+ >
+
+
+
+
+
+ {t['com.affine.page-properties.tags.selector-header-title']()}
+
+
+
+ {tagOptions.map((tag, idx) => {
+ const commonProps = {
+ ...(safeFocusedIndex === idx ? { focused: 'true' } : {}),
+ onClick: () => onSelectTagOption(tag),
+ onMouseEnter: () => setFocusedIndex(idx),
+ ['data-testid']: 'tag-selector-item',
+ ['data-focused']: safeFocusedIndex === idx,
+ className: styles.tagSelectorItem,
+ };
+ if (isCreateNewTag(tag)) {
+ return (
+
+ {t['Create']()}{' '}
+
+
+ );
+ } else {
+ return (
+
+
+
+
{
+ onTagChange(tag.id, property, value);
+ }}
+ jumpToTag={jumpToTag}
+ colors={tagColors}
+ >
+
+
+
+
+
+ );
+ }
+ })}
+
+
+
+
+
+ );
+};
+
+export const TagsInlineEditor = ({
+ readonly,
+ placeholder,
+ className,
+ ...props
+}: TagsInlineEditorProps) => {
+ const empty = !props.selectedTags || props.selectedTags.length === 0;
+ const selectedTags = useMemo(() => {
+ return props.selectedTags
+ .map(id => props.tags.find(tag => tag.id === id))
+ .filter(tag => tag !== undefined);
+ }, [props.selectedTags, props.tags]);
+ return (
+