Fix the issue #15

Former-commit-id: d5430b0482e7e5667100f5f69ba9b90c6619cd3c
This commit is contained in:
Physton
2023-05-15 22:50:44 +08:00
parent eb95c3d062
commit 6806398a3f
3 changed files with 20 additions and 16 deletions

View File

@@ -1 +1 @@
cb870b3742b3e83ac89f08b9841a9115131224b9
706592d31f4f3646416dfce090ebae74c34b077e

View File

@@ -1 +1 @@
7e449e96dd7b8b442459cfe2d7e3fa5b86f309e0
03ddcd9a096c97f3cad381aebab30a9b7e3a0a0f

View File

@@ -363,20 +363,23 @@ export default {
this.$refs.translateSetting.open(this.translateApi)
},
handlePaste() {
const $paste = document.getElementById('paste')
// 拷贝一个新的按钮
const $pasteNew = $paste.cloneNode(true)
$pasteNew.id = 'paste-new'
// 加到原来的按钮后面一个
$paste.parentNode.insertBefore($pasteNew, $paste.nextSibling)
// 原来的按钮隐藏
$paste.style.display = 'none'
// 监听新按钮点击事件
$pasteNew.addEventListener('click', () => {
this.openPastePopup()
})
this.pasteTitle = $paste.title
this.pasteBtn = $paste
const $pastes = gradioApp().querySelectorAll("#paste")
if (!$pastes || $pastes.length <= 0) return
$pastes.forEach(($paste, index) => {
// 拷贝一个新的按钮
const $pasteNew = $paste.cloneNode(true)
$pasteNew.id = 'paste-new-' + index
// 加到原来的按钮后面一个
$paste.parentNode.insertBefore($pasteNew, $paste.nextSibling)
// 原来的按钮隐藏
$paste.style.display = 'none'
// 监听新按钮点击事件
$pasteNew.addEventListener('click', () => {
this.pasteBtn = $paste
this.openPastePopup()
})
this.pasteTitle = $paste.title
});
},
openPastePopup() {
this.pasteContent = ''
@@ -396,6 +399,7 @@ export default {
let ids = []
for (const item of this.prompts) {
if (item.tab == ele.id) {
console.log(item)
ids.push(item.id)
if (item.neg) {
$textareaNeg = item.$textarea