MCPcopy Create free account
hub / github.com/NodeBB/nodebb-plugin-markdown / getLine

Function getLine

public/js/markdown.js:31–44  ·  view source on GitHub ↗
(text, selectionStart)

Source from the content-addressed store, hash-verified

29 });
30
31 function getLine(text, selectionStart) {
32 // Break apart into lines, return the line the cursor is in
33 const lines = text.split('\n');
34
35 return lines.reduce(function (memo, cur) {
36 if (typeof memo !== 'number') {
37 return memo;
38 } if (selectionStart > (memo + cur.length)) {
39 return memo + cur.length + 1;
40 }
41
42 return cur;
43 }, 0);
44 }
45};
46
47export function prepareFormattingTools() {

Callers 1

capturePasteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…