StephenHaney / stephenhaney

2 stars 0 forks source link

2020 — Get contenteditable plaintext with correct linebreaks #6

Open StephenHaney opened 2 years ago

bonjourjoel commented 2 years ago

Thank you. I'm using it!

ntorrey commented 2 years ago

Thank you - me too! If the first childnode is a div an extra new line is added. So I just added an additional condition (i !== 0):

if (childNode.nodeName === 'DIV' && isOnFreshLine === false && i !== 0) {
  // Divs create new lines for themselves if they aren't already on one
  newValue += '\n'
}
RathanakSreang commented 1 year ago

Thanks