我是新的botpress和工作在一个项目中,我想禁用用户输入和发送按钮。那么,在当前的botpress版本中,这是可能的吗?有没有人能帮我一下?
发布于 2020-06-09 19:54:51
在文件/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);https://stackoverflow.com/questions/60792510
复制相似问题