Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ private fun ApplicationScope.App(onCloseRequest: () -> Unit = ::exitApplication)
false
}

KeyboardCommands.isCutEvent(keyEvent) -> {
sendEvent(KeyboardEvent.CUT)
false
}

KeyboardCommands.isQuestionEvent(keyEvent) -> {
sendEvent(KeyboardEvent.AI_QUESTION)
false
Expand Down
1 change: 1 addition & 0 deletions application/core/utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
alias(libs.plugins.compose.multiplatform)
alias(libs.plugins.compose.multiplatform.compiler)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.ktlint)
}

kotlin {
Expand Down
889 changes: 749 additions & 140 deletions application/core/utils/config/ktlint/baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ class SharedPreferencesInjector private constructor(val sharedPreferences: Share

fun singleton() = instance ?: throw IllegalStateException("SharedPreferencesInjector not initialized!")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ object KeyboardCommands {
keyEvent.key.keyCode == Key.C.keyCode &&
keyEvent.type == KeyEventType.KeyUp

fun isCutEvent(keyEvent: KeyEvent) =
keyEvent.isCommandTrigger() &&
keyEvent.key.keyCode == Key.X.keyCode &&
keyEvent.type == KeyEventType.KeyUp

fun isQuestionEvent(keyEvent: KeyEvent) =
keyEvent.isCommandTrigger() &&
keyEvent.key.keyCode == Key.K.keyCode &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ import androidx.compose.ui.input.key.KeyEvent
expect fun KeyEvent.isCommandTrigger(): Boolean

expect fun KeyEvent.isMultiSelectionTrigger(): Boolean

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import io.writeopia.common.utils.persistence.daos.NotesConfigurationCommonDao

interface AppDaosInjection {
fun provideConfigurationDao(): NotesConfigurationCommonDao

fun provideFolderDao(): FolderCommonDao
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.isAltPressed
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.isMetaPressed
import androidx.compose.ui.input.key.isShiftPressed
import org.jetbrains.skiko.OS
import org.jetbrains.skiko.hostOs

Expand All @@ -26,4 +25,3 @@ actual fun KeyEvent.isMultiSelectionTrigger(): Boolean = when (hostOs) {
OS.Ios -> this.isCtrlPressed && this.isMetaPressed
else -> this.isCtrlPressed && this.isAltPressed
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.isAltPressed
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.isMetaPressed
import androidx.compose.ui.input.key.isShiftPressed
import org.jetbrains.skiko.OS
import org.jetbrains.skiko.hostOs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.isAltPressed
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.isMetaPressed
import androidx.compose.ui.input.key.isShiftPressed
import org.jetbrains.skiko.OS
import org.jetbrains.skiko.hostOs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class NoteEditorKmpViewModel(
copySelection()
}

KeyboardEvent.CUT -> {
copySelection()
deleteSelection()
}

KeyboardEvent.AI_QUESTION -> {
askAiBySelection()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ enum class KeyboardEvent {
LINK,
LOCAL_SAVE,
COPY,
CUT,
AI_QUESTION,
CANCEL,
IDLE,
UNDO,
REDO
REDO,
}