Move bulk edit to built-in functionality

This commit is contained in:
Cohee 2023-10-21 21:02:06 +03:00
parent 7e116f8b1f
commit 65402eaa23
5 changed files with 15 additions and 39 deletions

View File

@ -87,6 +87,7 @@
<script type="module" src="scripts/personas.js"></script>
<script type="module" src="scripts/server-history.js"></script>
<script type="module" src="scripts/setting-search.js"></script>
<script type="module" src="scripts/bulk-edit.js"></script>
<title>SillyTavern</title>
</head>
@ -3708,6 +3709,8 @@
<div id="rm_print_characters_pagination">
<i id="charListGridToggle" class="fa-solid fa-table-cells-large menu_button" title="Toggle character grid view"></i>
<i id="bulkEditButton" class="fa-solid fa-edit menu_button bulkEditButton" title="Bulk edit characters"></i>
<i id="bulkDeleteButton" class="fa-solid fa-trash menu_button bulkDeleteButton" title="Bulk delete characters" style="display: none;""></i>
</div>
<div id="rm_print_characters_block" class="flexFlowColumn"></div>
</div>

View File

@ -1,4 +1,4 @@
import { characters, getCharacters, handleDeleteCharacter, callPopup } from "../../../script.js";
import { characters, getCharacters, handleDeleteCharacter, callPopup } from "../script.js";
let is_bulk_edit = false;
@ -64,23 +64,6 @@ async function onDeleteButtonClick() {
}
}
/**
* Adds the bulk edit and delete buttons to the UI.
*/
function addButtons() {
const editButton = $(
"<i id='bulkEditButton' class='fa-solid fa-edit menu_button bulkEditButton' title='Bulk edit characters'></i>"
);
const deleteButton = $(
"<i id='bulkDeleteButton' class='fa-solid fa-trash menu_button bulkDeleteButton' title='Bulk delete characters' style='display: none;'></i>"
);
$("#charListGridToggle").after(editButton, deleteButton);
$("#bulkEditButton").on("click", onEditButtonClick);
$("#bulkDeleteButton").on("click", onDeleteButtonClick);
}
/**
* Enables bulk selection by adding a checkbox next to each character.
*/
@ -111,7 +94,7 @@ function disableBulkSelect() {
/**
* Entry point that runs on page load.
*/
jQuery(async () => {
addButtons();
// loadSettings();
jQuery(() => {
$("#bulkEditButton").on("click", onEditButtonClick);
$("#bulkDeleteButton").on("click", onDeleteButtonClick);
});

View File

@ -1,11 +0,0 @@
{
"display_name": "Bulk Card Editor",
"loading_order": 9,
"requires": [],
"optional": [],
"js": "index.js",
"css": "style.css",
"author": "city-unit",
"version": "1.0.0",
"homePage": "https://github.com/city-unit"
}

View File

@ -1,7 +0,0 @@
.bulk_select_checkbox {
align-self: center;
}
#rm_print_characters_block.bulk_select .wide100pLess70px {
width: calc(100% - 85px);
}

View File

@ -1171,6 +1171,14 @@ input[type="file"] {
align-items: center;
}
.bulk_select_checkbox {
align-self: center;
}
#rm_print_characters_block.bulk_select .wide100pLess70px {
width: calc(100% - 85px);
}
#rm_print_characters_block {
overflow-y: auto;
flex-grow: 1;