Обновил добавление обновлений
This commit is contained in:
@@ -271,6 +271,48 @@
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.format-guide {
|
||||
margin-top: 8px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid rgba(0, 255, 136, 0.18);
|
||||
border-radius: 12px;
|
||||
background: rgba(0, 255, 136, 0.045);
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.format-guide code {
|
||||
color: #00ff88;
|
||||
background: rgba(0, 255, 136, 0.10);
|
||||
border: 1px solid rgba(0, 255, 136, 0.22);
|
||||
border-radius: 7px;
|
||||
padding: 1px 6px;
|
||||
}
|
||||
|
||||
.format-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.format-btn {
|
||||
min-height: 30px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid rgba(0, 255, 136, 0.28);
|
||||
border-radius: 999px;
|
||||
color: #9cf3c8;
|
||||
background: rgba(0, 255, 136, 0.055);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.format-btn:hover {
|
||||
color: #00ff88;
|
||||
background: rgba(0, 255, 136, 0.12);
|
||||
}
|
||||
|
||||
.add-row-btn {
|
||||
min-height: 38px;
|
||||
padding: 0 14px;
|
||||
@@ -493,7 +535,14 @@
|
||||
<label class="field-label" for="operatorActions">Что сделать оператору</label>
|
||||
<textarea class="field-textarea" id="operatorActions" name="operator_actions" placeholder="Каждое действие с новой строки">Скачать новый проект vMix перед работой с матчем.
|
||||
Полностью заменить все файлы проекта.</textarea>
|
||||
<div class="helper-text">Каждая строка станет отдельным пунктом списка.</div>
|
||||
<div class="helper-text">Каждая строка станет отдельным пунктом списка. Можно выделять клавиши и важные слова.</div>
|
||||
<div class="format-guide">
|
||||
Формат: <code>`F5`</code> — клавиша/команда, <code>**важно**</code> — выделенное слово.
|
||||
</div>
|
||||
<div class="format-toolbar" data-format-for="operatorActions">
|
||||
<button type="button" class="format-btn" data-snippet="`F5`">⌨️ Клавиша</button>
|
||||
<button type="button" class="format-btn" data-snippet="**важно**">✨ Выделить слово</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -517,7 +566,21 @@
|
||||
|
||||
<div class="update-item-text">
|
||||
<label class="field-label">Описание</label>
|
||||
<textarea class="field-textarea" name="item_text" placeholder="Опишите изменение. Каждая строка станет отдельным абзацем." required></textarea>
|
||||
<textarea class="field-textarea" name="item_text" placeholder="Пример:
|
||||
1. Нажмите `1`, чтобы уменьшить таймер на секунду.
|
||||
2. Нажмите `2`, чтобы увеличить таймер на секунду.
|
||||
|
||||
Можно выделить **важный текст**." required></textarea>
|
||||
<div class="format-guide">
|
||||
Красивый список: <code>1. Первый пункт</code> или <code>- Первый пункт</code><br>
|
||||
Клавиши/команды: <code>`F5`</code>, <code>`1`</code>. Выделение слов: <code>**важно**</code>.
|
||||
</div>
|
||||
<div class="format-toolbar">
|
||||
<button type="button" class="format-btn" data-snippet="1. Первый пункт 2. Второй пункт">🔢 Список</button>
|
||||
<button type="button" class="format-btn" data-snippet="- Первый пункт - Второй пункт">• Маркеры</button>
|
||||
<button type="button" class="format-btn" data-snippet="`F5`">⌨️ Клавиша</button>
|
||||
<button type="button" class="format-btn" data-snippet="**важно**">✨ Выделить слово</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="update-item-image">
|
||||
@@ -663,6 +726,37 @@
|
||||
updateItemsEditor.appendChild(clone);
|
||||
}
|
||||
|
||||
function insertSnippet(textarea, snippet) {
|
||||
if (!textarea || !snippet) return;
|
||||
const start = textarea.selectionStart ?? textarea.value.length;
|
||||
const end = textarea.selectionEnd ?? textarea.value.length;
|
||||
const before = textarea.value.slice(0, start);
|
||||
const after = textarea.value.slice(end);
|
||||
const spacerBefore = before && !before.endsWith("\n") ? "\n" : "";
|
||||
const spacerAfter = after && !snippet.endsWith("\n") ? "\n" : "";
|
||||
const insertion = spacerBefore + snippet + spacerAfter;
|
||||
|
||||
textarea.value = before + insertion + after;
|
||||
const cursorPosition = before.length + insertion.length;
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(cursorPosition, cursorPosition);
|
||||
}
|
||||
|
||||
document.addEventListener("click", (event) => {
|
||||
const button = event.target.closest(".format-btn");
|
||||
if (!button) return;
|
||||
|
||||
const snippet = button.dataset.snippet || "";
|
||||
const explicitTargetId = button.closest(".format-toolbar")?.dataset.formatFor;
|
||||
let textarea = explicitTargetId ? document.getElementById(explicitTargetId) : null;
|
||||
|
||||
if (!textarea) {
|
||||
textarea = button.closest(".update-item-text")?.querySelector("textarea");
|
||||
}
|
||||
|
||||
insertSnippet(textarea, snippet);
|
||||
});
|
||||
|
||||
parserForms.forEach((form) => {
|
||||
form.addEventListener("submit", () => {
|
||||
const parserTitle = form.dataset.parserTitle || "Запуск парсера";
|
||||
|
||||
Reference in New Issue
Block a user