Home Reference Source

application/components/common/simple-editor/util.js

  1. const findWithRegex = (regex, contentBlock, callback) => {
  2. const text = contentBlock.getText();
  3. let matchArr, start;
  4. while ((matchArr = regex.exec(text)) !== null) {
  5. start = matchArr.index;
  6. callback(start, start + matchArr[0].length);
  7. }
  8. }
  9.  
  10. export {findWithRegex};