我是 botpress 的新手,正在从事一个我想禁用用户输入和发送按钮的项目。那么在当前的 botpress 版本中这可能吗?如果有人可以帮助我吗?
问问题
296 次
1 回答
-1
在文件 /data/assets/ui-studio/public/js/lite.7df1ba548a26568689c1.js 最后复制以下脚本。
var ua = window.navigator.userAgent;
var trident = ua.indexOf('Trident/');
var edge = ua.indexOf('Edge/');
var msie = ua.indexOf('MSIE ');
var intIE = 0 ;
var intcnt = 0 ;
if (trident > 0 || edge > 0 || msie > 0 ){
intIE = 1 ;
}
// target element that we will observe
const target = document.getElementById("app");
// config object
const config = {
childList: true,
subtree: true
};
function trackchange(mutations) {
var iframe = document.getElementById("app");
var str = iframe.outerHTML ;
var n = str.search("bpw-keyboard-quick_reply");
if (n > 1){
if (intIE < 1){
document.getElementById("input-message").placeholder = "Select from above options";
}
document.getElementById("btn-send").style.display = "none" ;
document.getElementById("input-message").disabled = true;
}else{
if (intIE < 1){
document.getElementById("input-message").placeholder = "Type here";
}
if (intcnt < 1){
intcnt = 0 ;
//document.getElementById("input-message").value = "Hi";
}
document.getElementById("btn-send").style.display = "" ;
document.getElementById("input-message").disabled = false;
}
}
// instantiating observer
const observer = new MutationObserver(trackchange);
// observing target
observer.observe(target, config);
于 2020-06-09T11:54:50.930 回答