mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
Fix extra networks buttons when filename contains an apostrophe
This commit is contained in:
parent
bef51aed03
commit
d7f48472cc
@ -1,5 +1,5 @@
|
|||||||
<div class="copy-path-button card-button"
|
<div class="copy-path-button card-button"
|
||||||
title="Copy path to clipboard"
|
title="Copy path to clipboard"
|
||||||
onclick="extraNetworksCopyCardPath(event, '{filename}')"
|
onclick="extraNetworksCopyCardPath(event)"
|
||||||
data-clipboard-text="{filename}">
|
data-clipboard-text="{filename}">
|
||||||
</div>
|
</div>
|
@ -1,4 +1,4 @@
|
|||||||
<div class="edit-button card-button"
|
<div class="edit-button card-button"
|
||||||
title="Edit metadata"
|
title="Edit metadata"
|
||||||
onclick="extraNetworksEditUserMetadata(event, '{tabname}', '{extra_networks_tabname}', '{name}')">
|
onclick="extraNetworksEditUserMetadata(event, '{tabname}', '{extra_networks_tabname}')">
|
||||||
</div>
|
</div>
|
@ -1,4 +1,4 @@
|
|||||||
<div class="metadata-button card-button"
|
<div class="metadata-button card-button"
|
||||||
title="Show internal metadata"
|
title="Show internal metadata"
|
||||||
onclick="extraNetworksRequestMetadata(event, '{extra_networks_tabname}', '{name}')">
|
onclick="extraNetworksRequestMetadata(event, '{extra_networks_tabname}')">
|
||||||
</div>
|
</div>
|
@ -543,16 +543,18 @@ function requestGet(url, data, handler, errorHandler) {
|
|||||||
xhr.send(js);
|
xhr.send(js);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extraNetworksCopyCardPath(event, path) {
|
function extraNetworksCopyCardPath(event) {
|
||||||
navigator.clipboard.writeText(path);
|
navigator.clipboard.writeText(event.target.getAttribute("data-clipboard-text"));
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function extraNetworksRequestMetadata(event, extraPage, cardName) {
|
function extraNetworksRequestMetadata(event, extraPage) {
|
||||||
var showError = function() {
|
var showError = function() {
|
||||||
extraNetworksShowMetadata("there was an error getting metadata");
|
extraNetworksShowMetadata("there was an error getting metadata");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var cardName = event.target.parentElement.parentElement.getAttribute("data-name");
|
||||||
|
|
||||||
requestGet("./sd_extra_networks/metadata", {page: extraPage, item: cardName}, function(data) {
|
requestGet("./sd_extra_networks/metadata", {page: extraPage, item: cardName}, function(data) {
|
||||||
if (data && data.metadata) {
|
if (data && data.metadata) {
|
||||||
extraNetworksShowMetadata(data.metadata);
|
extraNetworksShowMetadata(data.metadata);
|
||||||
@ -566,7 +568,7 @@ function extraNetworksRequestMetadata(event, extraPage, cardName) {
|
|||||||
|
|
||||||
var extraPageUserMetadataEditors = {};
|
var extraPageUserMetadataEditors = {};
|
||||||
|
|
||||||
function extraNetworksEditUserMetadata(event, tabname, extraPage, cardName) {
|
function extraNetworksEditUserMetadata(event, tabname, extraPage) {
|
||||||
var id = tabname + '_' + extraPage + '_edit_user_metadata';
|
var id = tabname + '_' + extraPage + '_edit_user_metadata';
|
||||||
|
|
||||||
var editor = extraPageUserMetadataEditors[id];
|
var editor = extraPageUserMetadataEditors[id];
|
||||||
@ -578,6 +580,7 @@ function extraNetworksEditUserMetadata(event, tabname, extraPage, cardName) {
|
|||||||
extraPageUserMetadataEditors[id] = editor;
|
extraPageUserMetadataEditors[id] = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cardName = event.target.parentElement.parentElement.getAttribute("data-name");
|
||||||
editor.nameTextarea.value = cardName;
|
editor.nameTextarea.value = cardName;
|
||||||
updateInput(editor.nameTextarea);
|
updateInput(editor.nameTextarea);
|
||||||
|
|
||||||
|
@ -243,14 +243,12 @@ class ExtraNetworksPage:
|
|||||||
btn_metadata = self.btn_metadata_tpl.format(
|
btn_metadata = self.btn_metadata_tpl.format(
|
||||||
**{
|
**{
|
||||||
"extra_networks_tabname": self.extra_networks_tabname,
|
"extra_networks_tabname": self.extra_networks_tabname,
|
||||||
"name": html.escape(item["name"]),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
btn_edit_item = self.btn_edit_item_tpl.format(
|
btn_edit_item = self.btn_edit_item_tpl.format(
|
||||||
**{
|
**{
|
||||||
"tabname": tabname,
|
"tabname": tabname,
|
||||||
"extra_networks_tabname": self.extra_networks_tabname,
|
"extra_networks_tabname": self.extra_networks_tabname,
|
||||||
"name": html.escape(item["name"]),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user