Skip to content
Open
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 @@ -162,6 +162,7 @@ internal fun NoteEditorScreen(
noteEditorViewModel::onAddSpanClick,
noteEditorViewModel::deleteSelection,
noteEditorViewModel::copySelection,
noteEditorViewModel::cutSelection,
noteEditorViewModel::clearSelections,
noteEditorViewModel::onAddCheckListClick,
noteEditorViewModel::onAddListItemClick
Expand Down Expand Up @@ -318,6 +319,7 @@ private fun BottomScreen(
onSpanSelected: (Span) -> Unit = {},
deleteSelection: () -> Unit = {},
copySelection: () -> Unit = {},
cutSelection: () -> Unit = {},
onClose: () -> Unit = {},
onCheckItem: () -> Unit = {},
onListItem: () -> Unit = {}
Expand Down Expand Up @@ -361,6 +363,7 @@ private fun BottomScreen(
onSpanClick = onSpanSelected,
onDelete = deleteSelection,
onCopy = copySelection,
onCut = cutSelection,
onClose = onClose,
checkboxClick = onCheckItem,
listItemClick = onListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ class NoteEditorKmpViewModel(
copyManager.copy(annotatedString)
}

override fun cutSelection() {
copySelection()
deleteSelection()
}

override fun deleteDocument() {
viewModelScope.launch(Dispatchers.Default) {
documentRepository.deleteDocument(writeopiaManager.getDocument())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ interface NoteEditorViewModel : BackstackInform, BackstackHandler {

fun copySelection()

fun cutSelection()

fun deleteDocument()

fun toggleFavorite()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCut
import androidx.compose.material.icons.filled.DeleteOutline
import androidx.compose.material.icons.outlined.FormatBold
import androidx.compose.material.icons.outlined.FormatItalic
Expand All @@ -34,6 +35,7 @@ fun EditionScreen(
listItemClick: () -> Unit = {},
onDelete: () -> Unit = {},
onCopy: () -> Unit = {},
onCut: () -> Unit = {},
onClose: () -> Unit = {},
) {
val iconPadding = PaddingValues(vertical = 4.dp)
Expand Down Expand Up @@ -131,6 +133,19 @@ fun EditionScreen(

Spacer(modifier = Modifier.width(spaceWidth))

Icon(
modifier = Modifier
.clip(clipShape)
.clickable(onClick = onCut)
.size(32.dp)
.padding(iconPadding),
imageVector = Icons.Default.ContentCut,
contentDescription = "Cut",
tint = tint
)

Spacer(modifier = Modifier.width(spaceWidth))

Icon(
modifier = Modifier
.clip(clipShape)
Expand Down