diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt index 30ac05c..7672c4f 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt @@ -106,6 +106,20 @@ fun MainScreenWithDrawer( val currentActiveFilePath = sharedScreenModel.activeFilePath.value val fileName = currentActiveFilePath.substringAfterLast('/') + var sourceTitle = sharedScreenModel.songTitle.value + val originalPath = remember(sourceTitle) { + if (!currentActiveFilePath.contains("_tmp") && !currentActiveFilePath.contains("/tmp/")) { + currentActiveFilePath + } else { + currentActiveFilePath + } + } + + var sourceContent = sharedScreenModel.fileContent.value ?: "" + var codeContent by remember { mutableStateOf(sourceContent?: "") } + LaunchedEffect(sourceContent) { + codeContent = sourceContent + } val saveLauncher = rememberFileSaveLauncher { chosenPath -> if (chosenPath != null) { scope.launch(Dispatchers.IO) { @@ -246,7 +260,13 @@ fun MainScreenWithDrawer( ) { FloatingActionButton( onClick = { - //sharedScreenModel. + scope.launch { + codeContent = sourceContent + + withContext(Dispatchers.Main) { + solfaScreenModel.loadExternalFile(originalPath) + } + } }, modifier = Modifier.alpha(0.45f) ) { Icon(