[#4022] fixed multi-line text paste in the Admin UI search bar

This commit is contained in:
Gani Georgiev
2023-12-24 11:13:17 +02:00
parent 1208edec92
commit 8d97eb0769
36 changed files with 64 additions and 43 deletions
+8 -1
View File
@@ -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) {
+2
View File
@@ -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;
}