mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	refactor(react/ribbon): solve type errors
This commit is contained in:
		| @@ -143,7 +143,7 @@ export default class MobileLayout { | |||||||
|                                     .css("font-size", "larger") |                                     .css("font-size", "larger") | ||||||
|                                     .css("align-items", "center") |                                     .css("align-items", "center") | ||||||
|                                     .child(new ToggleSidebarButtonWidget().contentSized()) |                                     .child(new ToggleSidebarButtonWidget().contentSized()) | ||||||
|                                     .child(new NoteTitleWidget().contentSized().css("position", "relative").css("padding-left", "0.5em")) |                                     .child(NoteTitleWidget().contentSized().css("position", "relative").css("padding-left", "0.5em")) | ||||||
|                                     .child(new MobileDetailMenuWidget(true).contentSized()) |                                     .child(new MobileDetailMenuWidget(true).contentSized()) | ||||||
|                             ) |                             ) | ||||||
|                             .child(new SharedInfoWidget()) |                             .child(new SharedInfoWidget()) | ||||||
|   | |||||||
| @@ -5,15 +5,13 @@ interface FormTextAreaProps extends Omit<TextareaHTMLAttributes, "onBlur" | "onC | |||||||
|     currentValue: string; |     currentValue: string; | ||||||
|     onChange?(newValue: string): void; |     onChange?(newValue: string): void; | ||||||
|     onBlur?(newValue: string): void; |     onBlur?(newValue: string): void; | ||||||
|     rows: number; |  | ||||||
|     inputRef?: RefObject<HTMLTextAreaElement> |     inputRef?: RefObject<HTMLTextAreaElement> | ||||||
| } | } | ||||||
| export default function FormTextArea({ inputRef, id, onBlur, onChange, rows, currentValue, className, ...restProps }: FormTextAreaProps) { | export default function FormTextArea({ inputRef, id, onBlur, onChange, currentValue, className, ...restProps }: FormTextAreaProps) { | ||||||
|     return ( |     return ( | ||||||
|         <textarea |         <textarea | ||||||
|             ref={inputRef} |             ref={inputRef} | ||||||
|             id={id} |             id={id} | ||||||
|             rows={rows} |  | ||||||
|             className={`form-control ${className ?? ""}`} |             className={`form-control ${className ?? ""}`} | ||||||
|             onChange={(e) => { |             onChange={(e) => { | ||||||
|                 onChange?.(e.currentTarget.value); |                 onChange?.(e.currentTarget.value); | ||||||
|   | |||||||
| @@ -27,10 +27,14 @@ export default function CollectionPropertiesTab({ note }: TabContext) { | |||||||
|   const viewTypeWithDefault = viewType ?? "grid"; |   const viewTypeWithDefault = viewType ?? "grid"; | ||||||
|   const properties = bookPropertiesConfig[viewTypeWithDefault].properties; |   const properties = bookPropertiesConfig[viewTypeWithDefault].properties; | ||||||
|  |  | ||||||
|   return (note && |   return ( | ||||||
|     <div className="book-properties-widget"> |     <div className="book-properties-widget"> | ||||||
|  |       {note && ( | ||||||
|  |         <> | ||||||
|           <CollectionTypeSwitcher viewType={viewTypeWithDefault} setViewType={setViewType} /> |           <CollectionTypeSwitcher viewType={viewTypeWithDefault} setViewType={setViewType} /> | ||||||
|           <BookProperties note={note} properties={properties} /> |           <BookProperties note={note} properties={properties} /> | ||||||
|  |         </> | ||||||
|  |       )} | ||||||
|     </div> |     </div> | ||||||
|   ); |   ); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,7 +14,8 @@ export default function InheritedAttributesTab({ note, componentId }: TabContext | |||||||
|     const [ attributeDetailWidgetEl, attributeDetailWidget ] = useLegacyWidget(() => new AttributeDetailWidget()); |     const [ attributeDetailWidgetEl, attributeDetailWidget ] = useLegacyWidget(() => new AttributeDetailWidget()); | ||||||
|  |  | ||||||
|     function refresh() { |     function refresh() { | ||||||
|         const attrs = note.getAttributes().filter((attr) => attr.noteId !== this.noteId); |         if (!note) return; | ||||||
|  |         const attrs = note.getAttributes().filter((attr) => attr.noteId !== note.noteId); | ||||||
|         attrs.sort((a, b) => { |         attrs.sort((a, b) => { | ||||||
|             if (a.noteId === b.noteId) { |             if (a.noteId === b.noteId) { | ||||||
|                 return a.position - b.position; |                 return a.position - b.position; | ||||||
| @@ -29,15 +30,15 @@ export default function InheritedAttributesTab({ note, componentId }: TabContext | |||||||
|  |  | ||||||
|     useEffect(refresh, [ note ]); |     useEffect(refresh, [ note ]); | ||||||
|     useTriliumEventBeta("entitiesReloaded", ({ loadResults }) => { |     useTriliumEventBeta("entitiesReloaded", ({ loadResults }) => { | ||||||
|         if (loadResults.getAttributeRows(componentId).find((attr) => attributes.isAffecting(attr, this.note))) { |         if (loadResults.getAttributeRows(componentId).find((attr) => attributes.isAffecting(attr, note))) { | ||||||
|             this.refresh(); |             refresh(); | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|      |      | ||||||
|     return ( |     return ( | ||||||
|         <div className="inherited-attributes-widget"> |         <div className="inherited-attributes-widget"> | ||||||
|             <div className="inherited-attributes-container"> |             <div className="inherited-attributes-container"> | ||||||
|                 {inheritedAttributes?.length > 0 ? ( |                 {inheritedAttributes?.length ? ( | ||||||
|                     joinElements(inheritedAttributes.map(attribute => ( |                     joinElements(inheritedAttributes.map(attribute => ( | ||||||
|                         <InheritedAttribute |                         <InheritedAttribute | ||||||
|                             attribute={attribute} |                             attribute={attribute} | ||||||
|   | |||||||
| @@ -108,12 +108,12 @@ export const SEARCH_OPTIONS: SearchOption[] = [ | |||||||
| function SearchOption({ note, title, titleIcon, children, help, attributeName, attributeType, additionalAttributesToDelete }: { | function SearchOption({ note, title, titleIcon, children, help, attributeName, attributeType, additionalAttributesToDelete }: { | ||||||
|   note: FNote; |   note: FNote; | ||||||
|   title: string, |   title: string, | ||||||
|   titleIcon: string, |   titleIcon?: string, | ||||||
|   children?: ComponentChildren, |   children?: ComponentChildren, | ||||||
|   help: ComponentChildren, |   help?: ComponentChildren, | ||||||
|   attributeName: string, |   attributeName: string, | ||||||
|   attributeType: AttributeType, |   attributeType: AttributeType, | ||||||
|   additionalAttributesToDelete: { type: "label" | "relation", name: string }[] |   additionalAttributesToDelete?: { type: "label" | "relation", name: string }[] | ||||||
| }) { | }) { | ||||||
|   return ( |   return ( | ||||||
|     <tr> |     <tr> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user