Simple WYSIWYG

Bug parsing quotes where username has space - Simple WYSIWYG

Bug parsing quotes where username has space

by gdub2 » Tue May 26, 2020 2:10 pm

When a quoted user has a space in their name, only the first segment of the name before the space is kept. The time becomes the user_id, and the post_id and time are blank.

As a workaround, I'm replacing the quotes and spaces in user parameter before loading CKEDITOR

Code: Select all

var msg_val = $('#message').val();
var foundAtPosition = 0;
while(-1 !== msg_val.indexOf('[quote="',foundAtPosition)) {
    foundAtPosition = msg_val.indexOf('quote="');
    var foundQuote = msg_val.indexOf('"',(foundAtPosition+8));
    var user_found = msg_val.substr(foundAtPosition+7,(foundQuote-(foundAtPosition+7)));
    var user_repl = user_found.replace(/ /g, '');
    var user_repl = user_repl.replace(/"/g, '');
    msg_val = msg_val.replace('"'+user_found+'"',user_repl);
}
$('#message').val(msg_val);
gdub2
Registered User
Posts: 3
Joined: Tue May 26, 2020 5:54 am
Contact: