@@ -860,19 +848,10 @@ h1.title{
document.addEventListener('DOMContentLoaded', function () {
// Initialize Quill with your specific configuration
var quill = new Quill('#workarea', {
- theme: 'snow',
+ theme: 'snow',
modules: {
- toolbar: {
- container: toolbarOptions,
- clipboard: {
- matchVisual: true,
- },
- ImageResize: {
- displaySize: true,
- modules: ['Resize', 'DisplaySize', 'Toolbar']
- }
- },
- }
+ toolbar: toolbarOptions,
+ }
});
var chat_Div = $("#workarea");
@@ -883,14 +862,14 @@ h1.title{
$('#workarea').focus(function () {
rtc_hide_and_show(chatRtc);
});
-
+
document.getElementById('sidebarToggle2').addEventListener('click', function () {
var sidebar = document.getElementById('rightSidebar');
document.body.classList.toggle('sidebar-open');
- if (sidebar.style.width === '250px') {
+ if (sidebar.style.width === '350px') {
sidebar.style.width = '0';
} else {
- sidebar.style.width = '250px';
+ sidebar.style.width = '350px';
}
});
@@ -898,10 +877,10 @@ h1.title{
document.getElementById('sidebarToggle3').addEventListener('click', function () {
var sidebar = document.getElementById('rightSidebar');
document.body.classList.toggle('sidebar-open');
- if (sidebar.style.width === '250px') {
+ if (sidebar.style.width === '350px') {
sidebar.style.width = '0';
} else {
- sidebar.style.width = '250px';
+ sidebar.style.width = '350px';
}
});
@@ -920,6 +899,8 @@ h1.title{
var mathCheckbox = document.getElementById('Choicemath_messageInput');
var mathField = document.getElementById('workarea_math');
var richText = document.getElementById('workarea');
+ var quillrichText = document.getElementById('messageInput_rtc');
+
// Ensure MathQuill field is initially hidden
$(mathField).hide();
// $(richText1).show();
@@ -927,11 +908,13 @@ h1.title{
if (mathCheckbox.checked) {
$(mathField).show();
$(richText).hide();
- rtc_hide_and_show(chatRtc);
+ $('#messageInput_rtc').hide();
} else {
$(mathField).hide();
+ $(mathField).css('margin-bottom', '0');
$(richText).show();
- rtc_hide_and_show(chatRtc);
+ $('#messageInput_rtc').hide();
+
}
});
@@ -954,12 +937,12 @@ h1.title{
async function sendMessage(quill) {
- var workarea = document.getElementById('workarea');
+
+ var workarea = document.getElementById('workarea').querySelector('.ql-editor').innerHTML;
var mathField = document.getElementById('workarea_math');
- var messagesContainer = document.getElementById('messages');
- console.log("workarea",workarea);
- console.log("mathField",mathField);
- console.log("messagesContainer",messagesContainer);
+ // console.log("workarea",workarea);
+ // console.log("mathField",mathField);
+ // console.log("messagesContainer",messagesContainer);
var content = '';
@@ -971,14 +954,21 @@ h1.title{
content = await convertToLatex(mathFieldContent);
} else {
- content = quill.root.innerHTML.trim();
+ content = document.getElementById('workarea').querySelector('.ql-editor').innerHTML;
+
}
// Log the content to the console
- console.log("Message Content: ", content);
+ // console.log("Message Content: ", content);
if (content !== '') {
+
+
+ var messagesContainer = document.getElementById('messages');
+
+ // console.log(messagesContainer)
+
// var messageElement = document.createElement('div');
// messageElement.className = 'message';
messagesContainer.innerHTML += content;
@@ -989,6 +979,9 @@ h1.title{
if ($('#Choicemath_messageInput').prop('checked')) {
// Clear the math field content
+ var mathJaxContainer = document.getElementById('workarea_math');
+ // console.log(mathJaxContainer.value)
+ mathJaxContainer.value = "";
// mathField.latex('');
} else {
quill.setText('');
@@ -1006,12 +999,12 @@ h1.title{
return new Promise(async(resolve, reject) => {
if (!/
|<\/p>/i.test(text)) {
- console.log('text:' , text)
+ // console.log('text:' , text)
if (mathStatusBoolean) {
- console.log('text1:' , text)
+ // console.log('text1:' , text)
// Use MathJax to convert the text to LaTeX
const cov = await MathJax.tex2chtml(text).outerHTML;
- console.log('cov:' , cov);
+ // console.log('cov:' , cov);
resolve(cov);
//return cov;
} else {
@@ -1020,8 +1013,10 @@ h1.title{
//return text;
}
} else {
+
+ // console.log("pq")
const cov = await MathJax.tex2chtml(text).outerHTML;
- console.log('cov:' , cov)
+ // console.log('cov:' , cov)
resolve(cov);
//return cov;
}
@@ -1029,32 +1024,33 @@ h1.title{
});
}
+