chore(plugins): promptlib 1.8.9 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
This commit is contained in:
1 parent
e017f8733f
commit
980481a897
3 files changed
+18
-10
No files matched your search
+2
-2
@@ -44,9 +44,9 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.8.8",
|
||||
"version": "1.8.9",
|
||||
"files": {
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"main.js": "7072f8ad6e80accc6cef1a42b44f1ed963f71fe090b75848fda70bc373cd05e2",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1545,18 +1545,26 @@
|
||||
syncTimer = setTimeout(function () { varEd.sync(textIn.value) }, 200)
|
||||
})
|
||||
// v1.6.2:正文上方「插入变量」——在光标处插入 {变量} 并选中变量名,直接打字即可替换
|
||||
var lastSel = { s: 0, e: 0 }
|
||||
function rememberSel () {
|
||||
lastSel.s = typeof textIn.selectionStart === 'number' ? textIn.selectionStart : 0
|
||||
lastSel.e = typeof textIn.selectionEnd === 'number' ? textIn.selectionEnd : lastSel.s
|
||||
}
|
||||
;['keyup', 'mouseup', 'input', 'select', 'blur'].forEach(function (ev) { textIn.addEventListener(ev, rememberSel) })
|
||||
var insVarBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-plp-insvar', title: '在光标处插入 {变量}', text: '+ 插入变量' })
|
||||
// 按钮按下时不要抢走 textarea 的焦点/选区(否则插入点会漂移到上一次位置)
|
||||
insVarBtn.addEventListener('pointerdown', function (e) { e.preventDefault(); rememberSel() })
|
||||
insVarBtn.addEventListener('click', function () {
|
||||
var v = textIn.value
|
||||
var s = (typeof textIn.selectionStart === 'number') ? textIn.selectionStart : v.length
|
||||
var e = (typeof textIn.selectionEnd === 'number') ? textIn.selectionEnd : v.length
|
||||
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 + '}'
|
||||
textIn.value = v.slice(0, s) + ins + v.slice(e)
|
||||
textIn.selectionStart = s + 1
|
||||
textIn.selectionEnd = s + 1 + name.length
|
||||
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)
|
||||
@@ -1755,7 +1763,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.8.8',
|
||||
version: '1.8.9',
|
||||
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.8",
|
||||
"version": "1.8.9",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"main.js": "7072f8ad6e80accc6cef1a42b44f1ed963f71fe090b75848fda70bc373cd05e2",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user