2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-27 13:11:01 -06:00

WIP: Multilines paste input fixed

This commit is contained in:
Pierre-Henri Lavigne 2024-09-17 01:22:23 +09:00
parent f798a4e9d8
commit 7404f73ba5
No known key found for this signature in database
GPG Key ID: E2D1C9E2BBD3007D

View File

@ -2546,7 +2546,6 @@ EasyMDE.prototype.render = function (el) {
newText = headingCheckRow(oldText, cm);
if (oldText !== newText) { // A modification has been made
obj.text[r] = newText.substring(obj.from.ch);
// obj.from.ch = 0;
}
}
}
@ -2558,9 +2557,16 @@ EasyMDE.prototype.render = function (el) {
line: obj.from.line,
ch: obj.from.ch + 8,
});
console.log( obj.txt[r] );
console.log( endText );
obj.text[r] = headingCheckRow(obj.text[r], cm);
if (/#/.test(endText)) {
var oldText = obj.text[r] + endText,
newText = headingCheckRow(oldText, cm);
if (oldText !== newText) { // A modification has been made
obj.text[r] = newText.replace(endText, '');
}
}
else {
obj.text[r] = headingCheckRow(obj.text[r], cm);
}
}
else { // 2nd and next rows
obj.text[r] = headingCheckRow(obj.text[r], cm);