When pushing BBCode button, text remains selected (solved)

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

When pushing BBCode button, text remains selected (solved)

Post by Linda Carter » Sun Sep 14, 2008 7:02 pm

First, let me explain this is only related to phpBB 2/3 and all BBCode boxes related. It's not happening on other scripts. :)

When you push any of these buttons above (B, I, U, Quote, Code, etc.), the default behavior is to move the cursor to the end of that text.

For example:

If you have that text (JKJJFGDJGfdjfgDJF = text):

*******SELECTED JKJJFGDJGfdjfgDJF *****SELECTED

And you select that area, pushing the B (Bold) button, the cursor will be moved to this point:

[ b ]JKJJFGDJGfdjfgDJF[ /b ]| (no spaces on the BBcode)

| = cursor of your keyboard.

Image

I know that vBulletin for example, is doing that the other way.

*******SELECTED JKJJFGDJGfdjfgDJF *****SELECTED

If you push the BBcode button, it will remain selected. This way:

[ b ]*******SELECTED JKJJFGDJGfdjfgDJF *******SELECTED[ /b ] (no spaces on the BBcode)

This may not sound important but can be very annoying if you need for example to aply another BBCode to that text (Bold + Underline, Italic, URL). vBulletin is not showing your cursor, it's keeping the text selected! :shock:

Image

Image

Back to phpBB:

I have tested on IE 6.0 (SP1) and as you can see, it's selecting the whole thing:

Image

This is not a flaw of Firefox, IE, or any other browser. It is something related to the way the phpBB core was designed. If I am able to use the BBCode that way (using both IE or Firefox, I can confirm you this) on vBulletin, why not here? It's only a matter of knowing what is the magic behind that trick. :idea:

Do you have any idea what is related to this scenario and the changes we must do to force phpBB to behave the way vB is dealing with this thing?
Last edited by Linda Carter on Mon Sep 15, 2008 1:54 am, edited 1 time in total.
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."

User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Re: [REQ] When pushing BBCode button, text remains selected

Post by MHobbit » Sun Sep 14, 2008 9:45 pm

While this is a valid request (for an alteration in functionality, if anything), please refrain from using this subject as a springboard for criticizing or comparing phpBB to vBulletin.
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."

User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

Re: [REQ] When pushing BBCode button, text remains selected

Post by Linda Carter » Sun Sep 14, 2008 10:54 pm

MHobbit wrote:While this is a valid request (for an alteration in functionality, if anything), please refrain from using this subject as a springboard for criticizing or comparing phpBB to vBulletin.
Sorry, that was not my first intention. And to correct my initial post, I don't think all other scripts are behaving this way (Invision is one of them).

I am not criticizing any free or paid scripts, just trying to figure out how to implement such features, which I find useful, here on phpBB 3. :)
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3467
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: [REQ] When pushing BBCode button, text remains selected

Post by bonelifer » Sun Sep 14, 2008 11:49 pm

LC, unfortunately you don't understand that the TONE and CONTEXT of your posts are very much critical. You don't just REQUEST features you freaking DEMAND them. That said, I was able to use Google to easily find the feature you are requesting. So maybe in the future you could possibly use better search terms.

BBCode Retain Selection -->> http://www.startrekguide.com/community/ ... &sk=t&sd=a


That said, as has been mentioned earlier in other posts possibly you might be better served by purchasing a vB license.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17009
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: [REQ] When pushing BBCode button, text remains selected

Post by DavidIQ » Mon Sep 15, 2008 12:35 am

That post is good for Mozilla browsers. To get IE browsers to also behave the same you'll also need to edit this part:

Code: Select all

	if ((clientVer >= 4) && is_ie && is_win)
	{
		// Get text selection
		theSelection = document.selection.createRange().text;

		if (theSelection)
		{
			// Add tags around selection
			document.selection.createRange().text = bbopen + theSelection + bbclose;
			document.forms[form_name].elements[text_name].focus();
			theSelection = '';
			return;
		}
	}
And replace with

Code: Select all

	if ((clientVer >= 4) && is_ie && is_win)
	{
		// Get text selection
		theSelection = document.selection.createRange().text;
		var sel = document.selection.createRange();

		if (theSelection)
		{
			// Add tags around selection
			document.selection.createRange().text = bbopen + theSelection + bbclose;
			document.forms[form_name].elements[text_name].focus();
			sel.moveStart('character', bbopen.length);
			sel.moveEnd('character', theSelection.length);
			sel.select();
			theSelection = '';
			return;
		}
	}
And I agree...the vB and phpBB comparisons are getting a bit old...especially when you do it in almost every post you make.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

Re: [REQ] When pushing BBCode button, text remains selected

Post by Linda Carter » Mon Sep 15, 2008 12:47 am

bonelifer wrote:LC, unfortunately you don't understand that the TONE and CONTEXT of your posts are very much critical.
If you take a look into all my posts around here you will see that I only wish to improve my board and at the same time, I am always making constructive criticism. Despite of some of you folks might believe, I don't think phpBB is worse than paid scripts, and vice-versa. Being free or paid doesn't matter, only your way of thinking and dealing with your product/community will make any difference.

Free or paid, that is the worst line of thinking:

"It's good the way it is, we will sit your asses here and you should accept no one here owns you anything, and if something comes up, good! If not, that's the way it is, be happy and don't bother asking and suggesting anything, no one is going to hear you. Do it yourself!".

On the other hand, this is something we should hear instead of the first pathetic response, and I am sure it's the line of thinking of some people around this community: "the resources are limited and the only people in charge who can make a difference don't have enough time or inclination to do so, all you can think of might be irrelevant for them at this time. But your suggestion was or will be considered someday if someone capable enough hears you in this pile of requests, thank you for understanding.".
bonelifer wrote:You don't just REQUEST features you freaking DEMAND them.
No one is demanding anything. If someone like you wants to help, it's very welcome to do so. And if you really want to know, I REALLY need what I am asking here. So, yes, I am freaking requesting them, because they are important to me, otherwise, I won't have a board. And to my knowledge, people are only wasting time complaining about something they care about. A paid license from a paid script will not solve all my problems. The owners are never supporting MODs, only the default package.
bonelifer wrote:That said, I was able to use Google to easily find the feature you are requesting. So maybe in the future you could possibly use better search terms.

BBCode Retain Selection -->> http://www.startrekguide.com/community/ ... &sk=t&sd=a
Thank you. Sadly, that code is only working with the proSilver style. The same changes can't be applied to subSilver2. They won't work at all. Which is too bad since I don't use proSilver most of the time. :cry:

P.S. David, this is the proSilver code from the MOD.

I also like to point out it's absolutelly necessary to specify this is something another script is doing because you will probably need to verify their code in order to apply the same changes here (how are you going to find out what they are doing? Perhaps you can't do that by just looking the phpBB core). That's why I am quoting vbulletin, Invision, SMF, any other names you might think of. :)

Code: Select all

    #
    #-----[ OPEN ]------------------------------------------
    #
    styles/prosilver/template/editor.js

    #
    #-----[ FIND ]------------------------------------------
    #

    txtarea.selectionStart = selEnd + open.length + close.length;
    txtarea.selectionEnd = txtarea.selectionStart;

    #
    #-----[ REPLACE WITH ]------------------------------------------
    #

    txtarea.selectionStart = selStart + open.length;
    txtarea.selectionEnd = selEnd + open.length;
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17009
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: [REQ] When pushing BBCode button, text remains selected

Post by DavidIQ » Mon Sep 15, 2008 1:00 am

Linda Carter wrote:P.S. David, this is the proSilver code from the MOD.
DavidIQ wrote:That post is good for Mozilla browsers. To get IE browsers to also behave the same you'll also need to edit this part...
Once you do the edits you'll know why. mozWrap function is where that code you posted goes at which doesn' apply to IE.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

Re: [REQ] When pushing BBCode button, text remains selected

Post by Linda Carter » Mon Sep 15, 2008 1:12 am

DavidIQ wrote:
Linda Carter wrote:P.S. David, this is the proSilver code from the MOD.
DavidIQ wrote:That post is good for Mozilla browsers. To get IE browsers to also behave the same you'll also need to edit this part...
Once you do the edits you'll know why. mozWrap function is where that code you posted goes at which doesn' apply to IE.
Sorry, but your code is not working, unless you are using a different IE version than mine (IE 6.0.2800.1106.xpsp2.050301-1526). I am also using Windows XP, Service Pack 1.

That's what is going on with IE 6 (proSilver), even after using that MOD and your code:
Image

EDIT: Firefox, IE 7 and Opera (working):
Image

EDIT: Confirmed! The code posted by David is only working with IE 7.0. IE 6 = will not work. I have tested now, using another machine. :shock:
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17009
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: [REQ] When pushing BBCode button, text remains selected

Post by DavidIQ » Mon Sep 15, 2008 1:22 am

Unfortunately my Internet's down right now (on mobile connection atm) so I can't exactly go to another computer and verify it's working. It's in place on my site.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17009
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: [REQ] When pushing BBCode button, text remains selected

Post by DavidIQ » Mon Sep 15, 2008 1:26 am

Linda Carter wrote:EDIT: Confirmed! The code posted by David is only working with IE 7.0. IE 6 = will not work. I have tested now, using another machine. :shock:
Cursed IE6! I'll have to take a look and debug when the Internet comes back.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

Re: When pushing BBCode button, text remains selected (solved)

Post by Linda Carter » Mon Sep 15, 2008 1:56 am

This issue was solved. Perhaps a delayed response from my request to refresh the style/cache? :?:

Now I am able to select the text while pushing the BBcode button on all styles! Using both Firefox (2/3) and IE (6.0 and 7.0).

Thank you, for all the help provided into this topic. :)
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."

User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Spokane, WA
Name: David Lewis
Contact:

Re: When pushing BBCode button, text remains selected (solved)

Post by Highway of Life » Mon Sep 15, 2008 10:14 am

LC, the comparisons are getting old, and it is the context that you request, it comes off as very demanding. -- I appreciate that you have made a conscious effort to no longer berate the software, the developers and the MOD Authors, but your requests have still been in the tone of a demand. My suggestion for the future when you are requesting a feature, instead of endlessly comparing Bulletin Board scripts, just tell us what you want, exactly how you want it. You don’t need to bring in specific software into the post.

For the record, what David, bonelifer, MHobbit, and everyone else who has replied to your topics when they suggest you buy vB or get a work-for-hire programmer, its because of the types of requests that you have. phpBB is not meant to have *everything*... other scripts may be. And since they always seem to have exactly what you are searching for, for your own good, why don’t you go with them? ... if not, you really should think about hiring a programmer to create these modifications for you, as they are truly unique to your situation. Whereas the MOD Community as a whole is aiming to please a much wider audience. -- again, we say this because of your unique situation, everyone seems to be in agreement that it would be a much better course of action, for your own good.

Glad you found a solution. :)
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.

Locked

Return to “[3.0.x] MOD Requests”