Microsoft Webchat Autoscroll - PullRequest
       0

Microsoft Webchat Autoscroll

1 голос
/ 31 января 2020

Автопрокрутка не работает в чате. Пробовал ниже в Chrome и Firefox последние версии

Пробовал это и не работает: Microsoft BotFramework-WebChat

Пробовал это и не работает : https://github.com/microsoft/BotFramework-WebChat/issues/1031

 <!DOCTYPE html>
    <html>
    	<head>
    	<style>
    	     #webchat {
                     height: 50%;
                     width: 50%;
                     }
    	</style>
    	</head>
        <body>
          <div id="webchat" role="main"></div>
          <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
          <script>	
    	const styleOptions = {
                bubbleBackground: 'rgba(0, 0, 255, .1)',
                bubbleFromUserBackground: 'rgba(0, 255, 0, .1)',
    	botAvatarInitials: 'Me',
    	userAvatarInitials: 'You',
                hideUploadButton: true,			
             };
             var token = "thetoken;         
             var d1 = window.WebChat.createDirectLine({ token }); 
             var botContainer = document.getElementById('webchat');
    		
             // Tried activityMiddleware 
             const activityMiddleware = () => (next) => (card) => {
    		  return (
    			(children) => {
    			  scrollToBottom()
    			  return next(card)(children)
    			}
    		  );
    		};

             // Tried Store
             const store = window.WebChat.createStore(
             {},
             ({ dispatch }) => next => action => {
              if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {
                document.querySelector('ul[role="list"]').lastChild.scrollIntoView({behavior: 'smooth', block: 'start'});
              }
              return next(action);
              }
              );

            window.WebChat.renderWebChat({ directLine: d1, styleOptions }, botContainer,store );
            // tried window.WebChat.renderWebChat({ directLine: d1, styleOptions }, botContainer );
            // tried window.WebChat.renderWebChat({ directLine: d1, styleOptions }, botContainer,activityMiddleware );
    		
    		
          </script>
       </body>
    </html>

1 Ответ

0 голосов
/ 31 января 2020

Это работает с window.WebChat.renderWebChat ({directLine: d1, store: store}, botContainer);

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...