(view)
| 1310 | } |
| 1311 | |
| 1312 | function cutCommand(view) { |
| 1313 | const resolvedView = resolveView(view); |
| 1314 | if (!resolvedView) return false; |
| 1315 | const { state } = resolvedView; |
| 1316 | const ranges = state.selection.ranges; |
| 1317 | const segments = []; |
| 1318 | let changes = []; |
| 1319 | ranges.forEach((range) => { |
| 1320 | if (range.empty) { |
| 1321 | const line = state.doc.lineAt(range.head); |
| 1322 | segments.push(state.doc.sliceString(line.from, line.to)); |
| 1323 | changes.push({ from: line.from, to: line.to, insert: "" }); |
| 1324 | return; |
| 1325 | } |
| 1326 | segments.push(state.doc.sliceString(range.from, range.to)); |
| 1327 | changes.push({ from: range.from, to: range.to, insert: "" }); |
| 1328 | }); |
| 1329 | cordova.plugins.clipboard.copy(segments.join("\n")); |
| 1330 | resolvedView.dispatch({ |
| 1331 | changes, |
| 1332 | selection: EditorSelection.single( |
| 1333 | changes[0]?.from ?? state.selection.main.from, |
| 1334 | ), |
| 1335 | }); |
| 1336 | return true; |
| 1337 | } |
| 1338 | |
| 1339 | function pasteCommand(view) { |
| 1340 | const resolvedView = resolveView(view); |
nothing calls this directly
no test coverage detected