Unfortunately, even on this site, quoting the selected text does not work on mobile devices. The button does not appear.
On a desktop, this option does not work in Firefox - in this case, the button appears but does not function.
Quote from: Daretary on March 27, 2023, 07:44:13 AMOn a desktop, this option does not work in Firefox - in this case, the button appears but does not function.
Works with Firefox 91.11.0 (Debian Linux).
Works for me on Firefox 111 on Windows 10, or did yesterday anyway.
Arantor, but how to make it work on mobile devices and Ipad?
It's never worked on mobile as far as I know, I dint think it was ever implemented.
Topic split.
Please avoid re-opening ancient topics which were solved for the original poster and may or may not be related to your own issues.
The quoting works fine for me on a PC in Firefox
as Arantor notes, mobile use of quote selected text is completely different.
Other platforms treat it as the same, though.
Yes, sorry, addons got in the way in Firefox.
It will be necessary to invent something additionally on mobile devices.
Something like this:
function getSelectedText() {
var text = "";
var activeEl = document.activeElement;
var selectionStart = activeEl.selectionStart;
var selectionEnd = activeEl.selectionEnd;
if (selectionStart !== undefined && selectionEnd !== undefined) {
text = activeEl.value.substring(selectionStart, selectionEnd);
}
return text;
}
if (selectedText) {
dQuoteText = selectedText;
}
But it still "runs away" in else:
if (dQuoteText) {
sceditorInstance.insert(sQuoteText.match(/^\[quote(.*)]/ig) + dQuoteText + '[/quote]' + '\n');
} else {
sceditorInstance.insert(sQuoteText + '\n');
}
The problem isn't getting the selected text but detecting text is selected at all.
I'll take a look when I'm done with work.
OK so I have a provisional fix. This needs so much more testing than I can currently give it.
Themes/default/scripts/quotedText.js, line 123 or thereabouts.
$(document).on('mouseup', '.inner, .list_posts', function() {
$(document).on('mouseup pointerup', '.inner, .list_posts', function() {
Same file, further down. Line 135.
if (typeof oSelected.text == 'undefined' || oSelected.text == false)
if (typeof oSelected.text == 'undefined' || oSelected.text == false || oSelected.text == '')
If it doesn't work in Firefox for you before you make any changes, I suggest this is your theme - check the browser console, because I just tested it on my dev setup on Firefox to verify I hadn't broken it on desktop.
I tested this on an iPad that's not particularly current so it's probably good, but it may be twitchy in ways I didn't obviously find. Give it a go, let me know how it works out for you.
You'll probably want to make the change then delete all the minified_(hash).js files to ensure iPads pick it up, because Safari in general is pretty awful at holding onto things it really shouldn't.
Arantor, you are great! Two lines fixed this problem! Your life hack is urgently needed in SMF 2.1.4 :)
Everything works on the phone.
As for Firefox - I wrote above that the reason was in the addon. Unfortunately, I can't part with my favorite Swift Selection Search, so I'll have to do without quoting selected text in this browser. :)
I didn't see the bit about addons :-[ bit of a shame it's hijacking the browser like that.
If more folks can test it, I can make a pull request for its inclusion in 2.1.4 or something like that.
Arantor, in mobile browsers, where "Copy, Search" or "Copy, Share" pops up when selected - this does not work. And a lot of people in mobile browsers have pop tooltips when they select text.
Don't know what to say, it works normally for me even with my patch installed (Safari, iPad)
Quote from: Daretary on March 28, 2023, 05:42:40 AM...in mobile browsers, where "Copy, Search" or "Copy, Share" pops up when selected - this does not work.
Yes, does not work with IceCatMobile on my Android.
Doesn't work here, or with the patch, or what? In any case what exactly about it "doesn't work"?
Note that I don't own a single Android device so any testing I do is... limited. I don't know how Android is supposed to work so I don't know what it is or is not doing that it should...
Quote from: Arantor on March 28, 2023, 06:18:13 AMDoesn't work here, or with the patch, or what? In any case what exactly about it "doesn't work"?
It does not work on my forum, with the patch. When i select text, only the "Quote" Button appears. Only full-quote is possible.
And did you follow the notes about purging the minified files in case the old JavaScript is cached?
I switched "Minimize CSS and JavaScript files" off and again on (in the Admin Panel). All "minified_*.js" files were created new.
And that doesn't stop your browser caching the older versions anyway :(
I forgot: I also quit the browser/cleared the browsercache, and signed off and on.
But i will check this all again this evening.
I added touchend and it finally worked for me on Android.
Now that line looks like this:
$(document).on('mouseup pointerup touchend', '.inner, .list_posts', function() {
But it stopped working on IOS. ;D
Quote from: Daretary on March 28, 2023, 02:11:35 PMI added touchend and it finally worked for me on Android.
With this, the button "Quote Selected Text" appears after selecting text, but has no function. Clicking on it leaves the Reply Field empty, and the browser says "Loading...", but nothing happens.
Maybe my IceCat Browser is the problem.
touchend isn't quite the same thing as pointerup, which is why it doesn't actually work. touchend is functionally: I have moved my finger across the device and now released my finger. It fundamentally doesn't deal with selections, because it's not text selection.
I have settled on a small CSS code to complete the code snippets posted by
@Arantor index.css
.inner {
padding: 7px 8px 2px 2px;
margin: 0;
border-top: 1px solid #bfbfbf;
box-shadow: 0 1px 0 #fff inset;
min-height: 85px;
word-wrap: break-word; /* IE fallback */
overflow-wrap: break-word;
touch-action: manipulation; /* Add this line */
}
This keeps the built-in selection box from popping up and getting in the way, while zooming and panning are left alone. Tested on Chrome 109 on my Schok Volt SV55 running Android 11.
Alas, touch-action: manipulation did not help in my case. I removed minified_ and went from a private tab to completely exclude the cache.
Android 10, STK-L21, Chrome 111.0.5563.115
Private doesn't exclude the cache in Chrome, sorry.
The solution in Improved Quote Selected Text on mobile devices (SMF 2.1) (https://www.simplemachines.org/community/index.php?topic=586135.0) works for me until the SMF Team fixes this bug.
Marking solved as OP has been here two days ago and not provided any further input.