[#4022] fixed multi-line text paste in the Admin UI search bar
This commit is contained in:
@@ -249,7 +249,14 @@
|
||||
editableCompartment.of(EditorView.editable.of(true)),
|
||||
readOnlyCompartment.of(EditorState.readOnly.of(false)),
|
||||
EditorState.transactionFilter.of((tr) => {
|
||||
return singleLine && tr.newDoc.lines > 1 ? [] : tr;
|
||||
if (singleLine && tr.newDoc.lines > 1) {
|
||||
if (!tr.changes?.inserted?.filter((i) => !!i.text.find((t) => t))?.length) {
|
||||
return []; // only empty lines
|
||||
}
|
||||
// it is ok to mutate the current transaction as we don't change the doc length
|
||||
tr.newDoc.text = [tr.newDoc.text.join(" ")];
|
||||
}
|
||||
return tr;
|
||||
}),
|
||||
EditorView.updateListener.of((v) => {
|
||||
if (!v.docChanged || disabled) {
|
||||
|
||||
@@ -494,7 +494,14 @@
|
||||
readOnlyCompartment.of(EditorState.readOnly.of(disabled)),
|
||||
langCompartment.of(ruleLang()),
|
||||
EditorState.transactionFilter.of((tr) => {
|
||||
return singleLine && tr.newDoc.lines > 1 ? [] : tr;
|
||||
if (singleLine && tr.newDoc.lines > 1) {
|
||||
if (!tr.changes?.inserted?.filter((i) => !!i.text.find((t) => t))?.length) {
|
||||
return []; // only empty lines
|
||||
}
|
||||
// it is ok to mutate the current transaction as we don't change the doc length
|
||||
tr.newDoc.text = [tr.newDoc.text.join(" ")];
|
||||
}
|
||||
return tr;
|
||||
}),
|
||||
EditorView.updateListener.of((v) => {
|
||||
if (!v.docChanged || disabled) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.searchbar {
|
||||
--searchHeight: 44px;
|
||||
|
||||
flex-shrink: 0;
|
||||
outline: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -34,6 +35,7 @@
|
||||
border: 0;
|
||||
background: none;
|
||||
min-height: 0;
|
||||
max-height: 110px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user