chore(plugins): promptlib 1.8.18 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 42s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 42s
This commit is contained in:
1 parent
983eb511b4
commit
de1a38e211
3 files changed
+11
-19
No files matched your search
+2
-2
@@ -44,9 +44,9 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.8.17",
|
||||
"version": "1.8.18",
|
||||
"files": {
|
||||
"main.js": "236507e6ee1d0bd0fe911145515ba9e20aa2c6666c5bbff221eb6565fb164146",
|
||||
"main.js": "65f209d8a1d6706aa5e78ad5e9d466d20d3ad5d4bd9c91f2c172d10b594c1137",
|
||||
"styles.css": "ad03f9581e8ae57465098f6c7a3f664a0309680d74ff6384a12801737df87085"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1556,23 +1556,15 @@
|
||||
insVarBtn.addEventListener('pointerdown', function (e) { e.preventDefault(); rememberSel() })
|
||||
insVarBtn.addEventListener('click', function () {
|
||||
var v = textIn.value
|
||||
textIn.focus()
|
||||
// 先把选区恢复到用户最后的光标位置,再交给浏览器原生插入
|
||||
try { textIn.setSelectionRange(Math.min(lastSel.s, v.length), Math.min(lastSel.e, v.length)) } catch (e) { /* ignore */ }
|
||||
var s = textIn.selectionStart, e = textIn.selectionEnd
|
||||
var s = Math.min(Math.max(lastSel.s || 0, 0), v.length)
|
||||
var e = Math.min(Math.max(lastSel.e == null ? s : lastSel.e, s), v.length)
|
||||
var name = s !== e ? String(v.slice(s, e)).replace(/\s+/g, '').slice(0, 24) : '新变量'
|
||||
if (!name) name = '新变量'
|
||||
var ins = '{' + name + '}'
|
||||
var ok = false
|
||||
try { ok = document.execCommand('insertText', false, ins) } catch (err) { ok = false }
|
||||
if (!ok) {
|
||||
textIn.value = v.slice(0, s) + ins + v.slice(e)
|
||||
textIn.setSelectionRange(s + 1, s + 1 + name.length)
|
||||
} else {
|
||||
var pos = textIn.selectionStart
|
||||
textIn.setSelectionRange(pos - ins.length + 1, pos - 1)
|
||||
}
|
||||
lastSel = { s: textIn.selectionStart, e: textIn.selectionEnd }
|
||||
textIn.focus()
|
||||
textIn.value = v.slice(0, s) + ins + v.slice(e)
|
||||
textIn.setSelectionRange(s + 1, s + 1 + name.length)
|
||||
lastSel = { s: s + 1, e: s + 1 + name.length }
|
||||
dirty = true
|
||||
paintHl()
|
||||
varEd.sync(textIn.value)
|
||||
@@ -1771,7 +1763,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.8.17',
|
||||
version: '1.8.18',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
|
||||
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.8.17",
|
||||
"version": "1.8.18",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "236507e6ee1d0bd0fe911145515ba9e20aa2c6666c5bbff221eb6565fb164146",
|
||||
"main.js": "65f209d8a1d6706aa5e78ad5e9d466d20d3ad5d4bd9c91f2c172d10b594c1137",
|
||||
"styles.css": "ad03f9581e8ae57465098f6c7a3f664a0309680d74ff6384a12801737df87085"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user