fix:修改输入框机制,部分取消的情况下不读取值

This commit is contained in:
ShakeFlower 2025-03-02 15:56:21 +08:00
parent 98c8411ee0
commit d851cde7b6
5 changed files with 23 additions and 18 deletions

View File

@ -2029,7 +2029,7 @@ actions.prototype._clickSL_favorite = function (page, offset) {
} else if (value) { } else if (value) {
alert("无效的输入!"); alert("无效的输入!");
} }
}); }, () => { });
} else { } else {
var v = core.saves.favorite.indexOf(index); var v = core.saves.favorite.indexOf(index);
core.playSound('确定'); core.playSound('确定');
@ -2591,7 +2591,7 @@ actions.prototype._clickNotes_new = function () {
} else { } else {
core.ui.closePanel(); core.ui.closePanel();
} }
}); }, () => { });
} }
actions.prototype._clickNotes_show = function () { actions.prototype._clickNotes_show = function () {
@ -2630,7 +2630,7 @@ actions.prototype._clickNotes_edit = function () {
} }
}); });
} }
}) }, () => { })
} }
} }
@ -2662,7 +2662,7 @@ actions.prototype._clickNotes_delete = function () {
core.drawText("已删除 " + data.sort().join(",") + " 号笔记"); core.drawText("已删除 " + data.sort().join(",") + " 号笔记");
} }
} }
}) }, () => { });
} }
} }

View File

@ -2316,7 +2316,7 @@ control.prototype.syncLoad = function () {
} else { } else {
core.control._syncLoad_http(idpassword.substring(0, 6), idpassword.substring(6)); core.control._syncLoad_http(idpassword.substring(0, 6), idpassword.substring(6));
} }
}); }, () => { });
} }
control.prototype._syncLoad_http = function (id, password) { control.prototype._syncLoad_http = function (id, password) {

View File

@ -1202,7 +1202,7 @@ utils.prototype.myconfirm = function (hint, yesCallback, noCallback) {
} }
////// 让用户输入一段文字 ////// ////// 让用户输入一段文字 //////
utils.prototype.myprompt = function (hint, value, callback) { utils.prototype.myprompt = function (hint, value, callback, failCallback) {
main.dom.inputDiv.style.display = 'block'; main.dom.inputDiv.style.display = 'block';
main.dom.inputMessage.innerHTML = hint.replace(/\n/g, '<br/>'); main.dom.inputMessage.innerHTML = hint.replace(/\n/g, '<br/>');
main.dom.inputBox.style.display = 'block'; main.dom.inputBox.style.display = 'block';
@ -1214,7 +1214,7 @@ utils.prototype.myprompt = function (hint, value, callback) {
}); });
core.status.holdingKeys = []; core.status.holdingKeys = [];
core.platform.successCallback = callback; core.platform.successCallback = callback;
core.platform.errorCallback = () => { }; core.platform.errorCallback = failCallback || callback;
} }
////// 动画显示某对象 ////// ////// 动画显示某对象 //////

View File

@ -3014,7 +3014,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
core.closePanel(); core.closePanel();
batchUse(id, value); batchUse(id, value);
}); }, () => { });
} }
addUIEventListener(x, y, w, h, todo); addUIEventListener(x, y, w, h, todo);
} }
@ -3823,7 +3823,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
* 本插件的修改方法如果您了解样板的绘制API基础的JS和面向对象您可以轻松读懂和修改本插件 * 本插件的修改方法如果您了解样板的绘制API基础的JS和面向对象您可以轻松读懂和修改本插件
* 以下给出一些快速修改的参考 * 以下给出一些快速修改的参考
* 1.如何了解选项的效果及修改已有的选项找到下方如下代码段: * 1.如何了解选项的效果及修改已有的选项找到下方如下代码段:
const settingMap = new Map([ const settingMap = new Map([
['autoGet', new Setting( ['autoGet', new Setting(
() => '自动拾取:' + (core.getFlag('autoGet', false) ? '开' : '关'), // 此项填一个函数,返回一个字符串,为该选项显示的文字内容 () => '自动拾取:' + (core.getFlag('autoGet', false) ? '开' : '关'), // 此项填一个函数,返回一个字符串,为该选项显示的文字内容
() => invertFlag('autoGet'), // 此项填一个函数,为点击该选项执行的效果 () => invertFlag('autoGet'), // 此项填一个函数,为点击该选项执行的效果
@ -4329,7 +4329,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else core.drawFailTip('错误:找不到该名称的物品!'); else core.drawFailTip('错误:找不到该名称的物品!');
} }
else core.drawFailTip('未知错误core.material.items不存在!'); else core.drawFailTip('未知错误core.material.items不存在!');
}); }, () => { });
}, },
'给选定的数字键绑定一个可快捷使用的物品。', '给选定的数字键绑定一个可快捷使用的物品。',
false, false,
@ -4427,7 +4427,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else { else {
core.drawFailTip('错误:不合法的名称!'); core.drawFailTip('错误:不合法的名称!');
} }
}); }, () => { });
}, },
'', '',
false, false,
@ -4451,7 +4451,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else { else {
core.drawFailTip('错误:不合法的值!'); core.drawFailTip('错误:不合法的值!');
} }
}); }, () => { });
}, },
'', '',
false, false,
@ -4499,7 +4499,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
} }
core.drawFailTip('错误:不合法的名称!'); core.drawFailTip('错误:不合法的名称!');
}); }, () => { });
}, },
'', '',
false, false,
@ -4520,7 +4520,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else { else {
core.drawFailTip('错误:不合法的值!'); core.drawFailTip('错误:不合法的值!');
} }
}); }, () => { });
}, },
'', '',
false, false,
@ -4576,7 +4576,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else { else {
core.drawFailTip('错误:不合法的名称!'); core.drawFailTip('错误:不合法的名称!');
} }
}); }, () => { });
}, },
'', '',
false, false,
@ -4599,7 +4599,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
core.setFlag('debug_flagValue', newValue); core.setFlag('debug_flagValue', newValue);
this.menu.drawContent(); this.menu.drawContent();
}); }, () => { });
}, },
'', '',
false, false,

9
runtime.d.ts vendored
View File

@ -2848,8 +2848,13 @@ interface utils {
/** 是否满足正则表达式 */ /** 是否满足正则表达式 */
matchRegex(pattern: string, string: string): string matchRegex(pattern: string, string: string): string
/** 让用户输入一段文字 */ /**
myprompt(hint: string, value: string, callback?: (data?: string) => any): void * @param hint
* @param value null时的默认值
* @param callback
* @param failCallback
*/
myprompt(hint: string, value: string, callback?: (data?: string) => any, failCallback?: (data?: string) => any): void
/** 动画显示某对象 */ /** 动画显示某对象 */
showWithAnimate(obj?: any, speed?: number, callback?: () => any): void showWithAnimate(obj?: any, speed?: number, callback?: () => any): void