Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is kind of a bug report and kind of a suggestion. When I use one of the BBCode buttons for a starting thing like "[b]", and I complete it myself, when I post the post (funny, right? Razz), it adds the end of it, so the end becomes something like "[/b][/b]". Is there a way to detect that it's been completed already so it won't repeat the end and have that get displayed? I remember seeing people have an extra "[/img]" tag at the end, and now i think that this is the reason.
It's kind of hard to handle it smartly, since doing the right thing would basically involve reimplementing the bbcode parser (which is Not Good Software to begin with). What do you think of making the buttons insert a pair of tags and place the cursor in the middle instead? That's relatively easy to implement correctly and should cut down on errors.
Can Javascript tell which text is selected by the cursor? I have used some IDEs which allow you to select text and press ( or { and it will surround the text with () or {}. Something like that with BBCode tags would be useful if you want to make already-typed text bold with "[b]".
commandblockguy wrote:
Can Javascript tell which text is selected by the cursor? I have used some IDEs which allow you to select text and press ( or { and it will surround the text with () or {}. Something like that with BBCode tags would be useful if you want to make already-typed text bold with "[b]".

You can already do that. If you select text and click on one of the tag buttons, it will surround it with that tag. Obviously, you can't do that in the quick reply area, because there are no buttons.
As for the tags auto-completing, I would suggest just not auto-completing them. I think most people are able to do it on their own Wink
Tari wrote:
It's kind of hard to handle it smartly, since doing the right thing would basically involve reimplementing the bbcode parser (which is Not Good Software to begin with). What do you think of making the buttons insert a pair of tags and place the cursor in the middle instead? That's relatively easy to implement correctly and should cut down on errors.


That seems like a good idea. When I first saw that it was going to place a pair of tags, I was about to say that moving the cursor to the middle would be annoying. If the cursor can jump, that's good.
jcgter777 wrote:
Tari wrote:
It's kind of hard to handle it smartly, since doing the right thing would basically involve reimplementing the bbcode parser (which is Not Good Software to begin with). What do you think of making the buttons insert a pair of tags and place the cursor in the middle instead? That's relatively easy to implement correctly and should cut down on errors.


That seems like a good idea. When I first saw that it was going to place a pair of tags, I was about to say that moving the cursor to the middle would be annoying. If the cursor can jump, that's good.


CodeWalrus does that, and I notice myself using the editor to insert tags on CodeWalrus much more than on Cemetech.

I think this is a good idea.

Another alternative is to have a counter for each tag, where you increment the counter when the opening version of that tag is encountered and decrease the counter when the closing version of that tag is detected. When all of the tags have been found, the number of closing tags you need to add or delete is found in the counter.
I've pushed a change that mostly just stops it from trying to close all tags (same as the 'close tags' button) when you submit a post, so that should prevent it from inserting extra tags in posts.

I also removed a bunch of compatibility shims for IE 5.5; hopefully nobody will miss those. Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement