-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMS message input box allows rich text which can cause problems #400
Comments
Hmmm.... I recall that there was a reason. I think it was in order to get
it out of the context of the form, though I'm not sure. I'll have a look
this weekend.
Some js should fix that....
https://stackoverflow.com/questions/24408028/html5-contenteditable-div-accept-only-plaintext.
Suggests something like:
function convertToPlaintext() {
var textContent = this.textContent;
this.innerHTML = "";
this.textContent = textContent;
}
var contentEditableNodes = document.querySelectorAll('[contenteditable]');
[].forEach.call(contentEditableNodes, function(div) {
div.addEventListener("input", convertToPlaintext, false);
});
…On Wed, Aug 9, 2017, 12:36 Tom Barrett ***@***.***> wrote:
Hey @vanoudt <https://github.com/vanoudt>
Do you remember why the input box for SMS messages got changed from a
textarea to a div with contenteditable=true ? I can't find the PR that it
came from (I did some manual merging at the time)
I think it is causing some problems for users who paste URLs in there -
they end up as rich text when then chokes things...
https://github.com/tbar0970/jethro-pmm/blob/3d9449fd117fff88e45ce715d28c01478a619677/include/sms_sender.class.php#L194
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#400>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABMNw_xX0ABnvRt279zumioWsZ9jAmi4ks5sWTdagaJpZM4OxlXR>
.
|
Thanks for that. Yes, we could fix it with JS, but if there's a way to get the basic textbox to work for us that would be simpler. If we're constructing the AJAX request in our own JS then changing div.innerHTML to textbox.value shouldn't be hard... but maybe there's more to it. |
Hmmm... Let me do some experimentation and get backto you!
…On Wed, Aug 9, 2017, 12:55 Tom Barrett ***@***.***> wrote:
Thanks for that. Yes, we could fix it with JS, but if there's a way to get
the basic textbox to work for us that would be simpler. If we're
constructing the AJAX request in our own JS then changing div.innerHTML to
textbox.value shouldn't be hard... but maybe there's more to it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#400 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABMNw7kmBpb3NBOBPosPHnNed-wEkB86ks5sWTu_gaJpZM4OxlXR>
.
|
Got an idea on fixing this, and the text encoding issue at the same
time.... Will put in a pull request in the next week or so...
On Wed, Aug 9, 2017, 13:05 Nicholas van Rheede van Oudtshoorn <
vanoudt@gmail.com> wrote:
… Hmmm... Let me do some experimentation and get backto you!
On Wed, Aug 9, 2017, 12:55 Tom Barrett ***@***.***> wrote:
> Thanks for that. Yes, we could fix it with JS, but if there's a way to
> get the basic textbox to work for us that would be simpler. If we're
> constructing the AJAX request in our own JS then changing div.innerHTML to
> textbox.value shouldn't be hard... but maybe there's more to it.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#400 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABMNw7kmBpb3NBOBPosPHnNed-wEkB86ks5sWTu_gaJpZM4OxlXR>
> .
>
|
I still can't remember why I changed it to the div - still think it might be the "forms within forms" issue, not sure why.... But PR #411 fixes this problem.... |
Hey @vanoudt
Do you remember why the input box for SMS messages got changed from a textarea to a div with contenteditable=true ? I can't find the PR that it came from (I did some manual merging at the time)
I think it is causing some problems for users who paste URLs in there - they end up as rich text which then confuses the character counter and/or chokes things further down the line...
jethro-pmm/include/sms_sender.class.php
Line 194 in 3d9449f
The text was updated successfully, but these errors were encountered: