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

Function prepareCopyCut

static/editor.md/lib/codemirror/lib/codemirror.js:1222–1243  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1220 });
1221
1222 function prepareCopyCut(e) {
1223 if (cm.somethingSelected()) {
1224 lastCopied = cm.getSelections();
1225 if (input.inaccurateSelection) {
1226 input.prevInput = "";
1227 input.inaccurateSelection = false;
1228 te.value = lastCopied.join("\n");
1229 selectInput(te);
1230 }
1231 } else {
1232 var ranges = copyableRanges(cm);
1233 lastCopied = ranges.text;
1234 if (e.type == "cut") {
1235 cm.setSelections(ranges.ranges, null, sel_dontScroll);
1236 } else {
1237 input.prevInput = "";
1238 te.value = ranges.text.join("\n");
1239 selectInput(te);
1240 }
1241 }
1242 if (e.type == "cut") cm.state.cutIncoming = true;
1243 }
1244 on(te, "cut", prepareCopyCut);
1245 on(te, "copy", prepareCopyCut);
1246

Callers

nothing calls this directly

Calls 2

selectInputFunction · 0.70
copyableRangesFunction · 0.70

Tested by

no test coverage detected