From e90f5010721fc5474c42603e953a6daf1bc42889 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 2 Dec 2020 01:46:40 +0100 Subject: [PATCH] remove line bugfix --- src/publics/js/dev/page/editor/editable.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/publics/js/dev/page/editor/editable.js b/src/publics/js/dev/page/editor/editable.js index 9f799e6..81165ce 100644 --- a/src/publics/js/dev/page/editor/editable.js +++ b/src/publics/js/dev/page/editor/editable.js @@ -79,7 +79,7 @@ export default class Editable{ } break; default: - if(!e.ctrlKey && !e.altKey) PrismCustom.onCurrent(language).ApplyWithCaret(); + if(!e.ctrlKey && !e.altKey && getNodeFromAttribute('uuid')) PrismCustom.onCurrent(language).ApplyWithCaret(); } this.linesManager.change = true; }); @@ -259,10 +259,15 @@ export default class Editable{ previousSibling = previousSibling.previousSibling; } if(previousSibling !== null){ - const len = previousSibling.innerText.length; - previousSibling.innerHTML = (previousSibling.innerHTML + line.innerHTML).replace('

', '
'); + const len = previousSibling.innerText.length - previousSibling.getElementsByTagName('br').length; + previousSibling.innerHTML += line.innerHTML; //(previousSibling.innerHTML + ).replace('

', '
'); + for(const br of previousSibling.getElementsByTagName('br')) br.remove(); + if(previousSibling.firstChild.nodeName === 'BR'){ + console.log(`"${previousSibling.innerText}"`); + Caret.setPosition(previousSibling.firstChild, 0); + }else Caret.setPosition(previousSibling, len); line.remove(); - Caret.setPosition(previousSibling, len); + //new PrismCustom(previousSibling, language).ApplyWithCaret(); } }