mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 15:03:57 +00:00
multiline filter on paste
This commit is contained in:
@@ -234,6 +234,22 @@ export default function DataFilterControl({ isReadOnly = false, filterType, filt
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function handlePaste(event) {
|
||||||
|
var pastedText = undefined;
|
||||||
|
// @ts-ignore
|
||||||
|
if (window.clipboardData && window.clipboardData.getData) {
|
||||||
|
// IE
|
||||||
|
// @ts-ignore
|
||||||
|
pastedText = window.clipboardData.getData('Text');
|
||||||
|
} else if (event.clipboardData && event.clipboardData.getData) {
|
||||||
|
pastedText = event.clipboardData.getData('text/plain');
|
||||||
|
}
|
||||||
|
if (pastedText && pastedText.includes('\n')) {
|
||||||
|
event.preventDefault();
|
||||||
|
setFilterText(createMultiLineFilter('is', pastedText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FilterDiv>
|
<FilterDiv>
|
||||||
<FilterInput
|
<FilterInput
|
||||||
@@ -244,6 +260,7 @@ export default function DataFilterControl({ isReadOnly = false, filterType, filt
|
|||||||
onChange={updateFilterState}
|
onChange={updateFilterState}
|
||||||
state={filterState}
|
state={filterState}
|
||||||
onBlur={applyFilter}
|
onBlur={applyFilter}
|
||||||
|
onPaste={handlePaste}
|
||||||
/>
|
/>
|
||||||
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
|
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
|
||||||
<i className="fas fa-filter" />
|
<i className="fas fa-filter" />
|
||||||
|
|||||||
Reference in New Issue
Block a user