diff options
4 files changed, 32 insertions, 65 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index 898a98c98..e2490cec8 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -7,7 +7,6 @@ import { DocumentIconContainer } from './nodes/DocumentIcon'; import { FieldView, FieldViewProps } from './nodes/FieldView'; import { ObservableReactComponent } from './ObservableReactComponent'; import { OverlayView } from './OverlayView'; -import { SchemaFieldType } from './collections/collectionSchema/SchemaColumnHeader'; export interface EditableProps { /** @@ -289,14 +288,16 @@ export class EditableView extends ObservableReactComponent<EditableProps> { staticDisplay = () => { let toDisplay; const gval = this._props.GetValue()?.replace(/\n/g, '\\r\\n'); - if (this._props.inputString){ - toDisplay = <input className="editableView-input" - value={gval} - placeholder={this._props.inputStringPlaceholder} - readOnly - style={{ display: this._props.display, overflow: 'auto', pointerEvents: 'none', fontSize: this._props.fontSize, width: '100%', margin: 0, background: this._props.background}} - // eslint-disable-next-line jsx-a11y/no-autofocus - /> + if (this._props.inputString) { + toDisplay = ( + <input + className="editableView-input" + value={gval} + placeholder={this._props.inputStringPlaceholder} + readOnly + style={{ display: this._props.display, overflow: 'auto', pointerEvents: 'none', fontSize: this._props.fontSize, width: '100%', margin: 0, background: this._props.background }} + /> + ); } else { toDisplay = ( <span diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx index 92c69c3cf..3122aa587 100644 --- a/src/client/views/collections/CollectionCardDeckView.tsx +++ b/src/client/views/collections/CollectionCardDeckView.tsx @@ -22,7 +22,6 @@ import { GPTPopup, GPTPopupMode } from '../pdf/GPTPopup/GPTPopup'; import './CollectionCardDeckView.scss'; import { CollectionSubView, SubCollectionViewProps } from './CollectionSubView'; import { computedFn } from 'mobx-utils'; -import { DocumentDecorations } from '../DocumentDecorations'; enum cardSortings { Time = 'time', diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index 5444a7a57..2f604aaa5 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -38,7 +38,7 @@ import { CollectionView } from './CollectionView'; import { TreeSort } from './TreeSort'; import './TreeView.scss'; -// eslint-disable-next-line @typescript-eslint/no-var-requires +// eslint-disable-next-line @typescript-eslint/no-require-imports const { TREE_BULLET_WIDTH } = require('../global/globalCssVariables.module.scss'); // prettier-ignore export interface TreeViewProps { @@ -500,9 +500,7 @@ export class TreeView extends ObservableReactComponent<TreeViewProps> { !(key in ids) && doc[key] !== ComputedField.undefined && (ids[key] = key); }); - // eslint-disable-next-line no-restricted-syntax for (const key of Object.keys(ids).slice().sort()) { - // eslint-disable-next-line no-continue if (this._props.skipFields?.includes(key) || key === 'title' || key === 'treeView_Open') continue; const contents = doc[key]; let contentElement: (JSX.Element | null)[] | JSX.Element = []; diff --git a/src/client/views/newlightbox/components/EditableText/EditableText.tsx b/src/client/views/newlightbox/components/EditableText/EditableText.tsx index e9e7ca264..6273e1859 100644 --- a/src/client/views/newlightbox/components/EditableText/EditableText.tsx +++ b/src/client/views/newlightbox/components/EditableText/EditableText.tsx @@ -1,16 +1,16 @@ -import * as React from 'react' -import './EditableText.scss' -import { Size } from 'browndash-components' +import * as React from 'react'; +import './EditableText.scss'; +import { Size } from 'browndash-components'; export interface IEditableTextProps { - text: string - placeholder?: string - editing: boolean - onEdit: (newText: string) => void - setEditing: (editing: boolean) => void - backgroundColor?: string - size?: Size - height?: number + text: string; + placeholder?: string; + editing: boolean; + onEdit: (newText: string) => void; + setEditing: (editing: boolean) => void; + backgroundColor?: string; + size?: Size; + height?: number; } /** @@ -20,46 +20,15 @@ export interface IEditableTextProps { * @returns */ export const EditableText = (props: IEditableTextProps) => { - const { - editing, - height, - size, - text, - onEdit, - setEditing, - backgroundColor, - placeholder, - } = props + const { editing, height, text, onEdit, setEditing, backgroundColor, placeholder } = props; - const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => { - onEdit(event.target.value) - } + const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => { + onEdit(event.target.value); + }; - return editing ? ( - <input - style={{ background: backgroundColor, height: height }} - placeholder={placeholder} - size={1} - className="lb-editableText" - autoFocus - onChange={handleOnChange} - onBlur={() => setEditing(false)} - defaultValue={text} - ></input> - ) : ( - <input - style={{ background: backgroundColor, height: height }} - placeholder={placeholder} - size={1} - className="lb-editableText" - autoFocus - onChange={handleOnChange} - onBlur={() => setEditing(false)} - defaultValue={text} - ></input> - // <div className="lb-displayText" onClick={(e) => { - // e.stopPropagation() - // setEditing(true) - // }}>{text}</div> - ) -} + return editing ? ( + <input style={{ background: backgroundColor, height: height }} placeholder={placeholder} size={1} className="lb-editableText" autoFocus onChange={handleOnChange} onBlur={() => setEditing(false)} defaultValue={text}></input> + ) : ( + <input style={{ background: backgroundColor, height: height }} placeholder={placeholder} size={1} className="lb-editableText" autoFocus onChange={handleOnChange} onBlur={() => setEditing(false)} defaultValue={text}></input> + ); +}; |