fixes fixes...
This commit is contained in:
@@ -249,6 +249,11 @@ article > header, article > footer {
|
||||
color: #111;
|
||||
background-color: #fff;
|
||||
resize: vertical;
|
||||
/* Добавляем эти свойства для правильного отображения переносов */
|
||||
white-space: pre-wrap; /* Сохраняет пробелы и переносы строк, переносит текст */
|
||||
word-wrap: break-word; /* Переносит длинные слова */
|
||||
overflow-wrap: break-word; /* Альтернативное название word-wrap */
|
||||
tab-size: 4; /* Размер табуляции */
|
||||
}
|
||||
|
||||
#content:focus {
|
||||
|
||||
@@ -8,9 +8,21 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
let originalStyles = {};
|
||||
let isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
|
||||
|
||||
function normalizeContent(text) {
|
||||
// Заменяем множественные переносы на двойные
|
||||
text = text.replace(/\n{3,}/g, '\n\n');
|
||||
// Убираем пустые строки в начале и конце
|
||||
return text.trim();
|
||||
}
|
||||
|
||||
initEditor();
|
||||
|
||||
function initEditor() {
|
||||
// Нормализуем контент при загрузке
|
||||
if (contentTextarea.value) {
|
||||
contentTextarea.value = normalizeContent(contentTextarea.value);
|
||||
}
|
||||
autoResize();
|
||||
contentTextarea.addEventListener('input', autoResize);
|
||||
contentTextarea.addEventListener('input', processDialogues);
|
||||
|
||||
Reference in New Issue
Block a user