Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Editable bugfix #39

Merged
merged 2 commits into from
Dec 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/publics/js/dev/page/editor/editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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('<br><br>', '<br>');
const len = previousSibling.innerText.length - previousSibling.getElementsByTagName('br').length;
previousSibling.innerHTML += line.innerHTML; //(previousSibling.innerHTML + ).replace('<br><br>', '<br>');
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();
}
}

Expand Down