mirror of https://github.com/onweru/compose.git

weru
12.14.2020 b4bc8de7b1507acc3d0c825cf70dc84d7717b9ba
assets/js/functions.js
@@ -108,14 +108,16 @@
}
function wrapText(text, context, wrapper = 'div') {
  let c = context.innerHTML;
  let c = context.textContent;
  let index = c.indexOf(text);
  console.log(context);
  // h1, h2, h3, h4, h5, h6, p, code, a,
  if (index >= 0) {
    let stop = index + text.length;
    let s = c.substring(index,stop);
    let before = c.substring(0,index);
    let after = c.substring(stop);
    c = `${before}<${wrapper}>${s}</${wrapper}>${after}`;
    context.innerHTML = c;
    context.textContent = c;
  }
}