MCPcopy Create free account
hub / github.com/TruthHun/BookStack / prepareCopyCut

Function prepareCopyCut

static/mergely/lib/codemirror.js:1260–1284  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1258 });
1259
1260 function prepareCopyCut(e) {
1261 if (signalDOMEvent(cm, e)) return
1262 if (cm.somethingSelected()) {
1263 lastCopied = cm.getSelections();
1264 if (input.inaccurateSelection) {
1265 input.prevInput = "";
1266 input.inaccurateSelection = false;
1267 te.value = lastCopied.join("\n");
1268 selectInput(te);
1269 }
1270 } else if (!cm.options.lineWiseCopyCut) {
1271 return;
1272 } else {
1273 var ranges = copyableRanges(cm);
1274 lastCopied = ranges.text;
1275 if (e.type == "cut") {
1276 cm.setSelections(ranges.ranges, null, sel_dontScroll);
1277 } else {
1278 input.prevInput = "";
1279 te.value = ranges.text.join("\n");
1280 selectInput(te);
1281 }
1282 }
1283 if (e.type == "cut") cm.state.cutIncoming = true;
1284 }
1285 on(te, "cut", prepareCopyCut);
1286 on(te, "copy", prepareCopyCut);
1287

Callers

nothing calls this directly

Calls 3

signalDOMEventFunction · 0.70
selectInputFunction · 0.70
copyableRangesFunction · 0.70

Tested by

no test coverage detected