diff options
Diffstat (limited to 'src/client/views/EditableView.tsx')
-rw-r--r-- | src/client/views/EditableView.tsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index f94f4be86..f5271f749 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -58,6 +58,7 @@ export interface EditableProps { wrap?: string; // nowrap, pre-wrap, etc schemaFieldType?: SchemaFieldType; + prohibitedText?: Array<string>; onClick?: () => void; updateAlt?: (newAlt: string) => void; updateSearch?: (value: string) => void; @@ -203,8 +204,13 @@ export class EditableView extends ObservableReactComponent<EditableProps> { } }; + // checkForInvalidText = (text: string) => { + // const regX = new RegExp(new Array<string>(...this._props.prohibitedText), 'g') + // } + @action finalizeEdit(value: string, shiftDown: boolean, lostFocus: boolean, enterKey: boolean) { + //if (invalid) raise error if (this._props.SetValue(value, shiftDown, enterKey)) { this._editing = false; this._props.isEditingCallback?.(false); @@ -252,7 +258,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> { onChange: this._props.autosuggestProps.onChange, }} /> - ) : this._props.oneLine !== false && this._props.GetValue()?.toString().indexOf('\n') === -1 ? ( + ) : ( this._props.oneLine !== false && this._props.GetValue()?.toString().indexOf('\n') === -1 ? ( <input className="editableView-input" ref={r => { this._inputref = r; }} // prettier-ignore @@ -284,7 +290,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> { onClick={this.stopPropagation} onPointerUp={this.stopPropagation} /> - ); + )); } staticDisplay = () => { @@ -319,8 +325,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> { if ((this._editing && gval !== undefined)) { return this._props.sizeToContent ? ( <div style={{ display: 'grid', minWidth: 100 }}> - <div style={{ display: 'inline-block', position: 'relative', height: 0, width: '100%', overflow: 'hidden' }}>{gval}</div> - {this.renderEditor()} + <div style={{ display: 'inline-block', position: 'relative', height: 0, width: '100%', overflow: 'hidden' }}>{this.renderEditor()}</div> </div> ) : ( <div > |