mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 06:11:52 +00:00
Cleanup
This commit is contained in:
parent
4a5b2f32f6
commit
07ab7b2f05
@ -49,7 +49,6 @@ internal fun <T> SearchBarWithAutoCompletion(
|
|||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
snapshotFlow { textFieldState.text.toString() }
|
snapshotFlow { textFieldState.text.toString() }
|
||||||
.onEach { println("Text changed: $it") }
|
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.collect { searchTerm -> popupController.onQueryChanged(searchTerm) }
|
.collect { searchTerm -> popupController.onQueryChanged(searchTerm) }
|
||||||
}
|
}
|
||||||
@ -173,15 +172,11 @@ private class CompletionPopupController<T : Searchable>(
|
|||||||
|
|
||||||
fun onQueryChanged(searchTerm: String) {
|
fun onQueryChanged(searchTerm: String) {
|
||||||
if (skipPopupShowing) {
|
if (skipPopupShowing) {
|
||||||
println("Skipping opening the dropdown, because item was just autocompleted.")
|
|
||||||
|
|
||||||
skipPopupShowing = false
|
skipPopupShowing = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchTerm.isEmpty()) {
|
if (searchTerm.isEmpty()) {
|
||||||
println("Hiding popup, because query is empty.")
|
|
||||||
|
|
||||||
hidePopup()
|
hidePopup()
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -191,10 +186,8 @@ private class CompletionPopupController<T : Searchable>(
|
|||||||
moveSelectionToFirstItem()
|
moveSelectionToFirstItem()
|
||||||
|
|
||||||
if (filteredItems.isNotEmpty()) {
|
if (filteredItems.isNotEmpty()) {
|
||||||
println("Showing popup, because there are items matching the query.")
|
|
||||||
showPopup()
|
showPopup()
|
||||||
} else {
|
} else {
|
||||||
println("Hiding popup, because there are no items matching the query.")
|
|
||||||
hidePopup()
|
hidePopup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,8 +247,6 @@ private fun <T : Searchable> Modifier.handlePopupCompletionKeyEvents(
|
|||||||
return onPreviewKeyEvent { keyEvent ->
|
return onPreviewKeyEvent { keyEvent ->
|
||||||
if (keyEvent.type != KeyEventType.KeyDown) return@onPreviewKeyEvent false
|
if (keyEvent.type != KeyEventType.KeyDown) return@onPreviewKeyEvent false
|
||||||
|
|
||||||
println("${keyEvent.key} key is pressed")
|
|
||||||
|
|
||||||
return@onPreviewKeyEvent when (keyEvent.key) {
|
return@onPreviewKeyEvent when (keyEvent.key) {
|
||||||
Key.Tab, Key.Enter, Key.NumPadEnter -> {
|
Key.Tab, Key.Enter, Key.NumPadEnter -> {
|
||||||
onItemAutocompleteConfirmed(popupController.onItemAutocompleteConfirmed())
|
onItemAutocompleteConfirmed(popupController.onItemAutocompleteConfirmed())
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import javax.xml.transform.stream.StreamResult
|
|||||||
import javax.xml.xpath.XPathConstants
|
import javax.xml.xpath.XPathConstants
|
||||||
import javax.xml.xpath.XPathFactory
|
import javax.xml.xpath.XPathFactory
|
||||||
|
|
||||||
object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
internal object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
||||||
private val CSS_STYLEABLE_TAGS = listOf(
|
private val CSS_STYLEABLE_TAGS = listOf(
|
||||||
"linearGradient", "radialGradient", "pattern",
|
"linearGradient", "radialGradient", "pattern",
|
||||||
"filter", "clipPath", "mask", "symbol",
|
"filter", "clipPath", "mask", "symbol",
|
||||||
@ -25,9 +25,7 @@ object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun PainterProviderScope.patch(element: Element) {
|
override fun PainterProviderScope.patch(element: Element) {
|
||||||
val processedElement = element.inlineEmbeddedStylesCSS()
|
element.inlineEmbeddedStylesCSS()
|
||||||
|
|
||||||
println(PrintableElement(processedElement).writeToString())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.inlineEmbeddedStylesCSS(): Element {
|
private fun Element.inlineEmbeddedStylesCSS(): Element {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user