[3.2.1] Custom BBCode - CODE-like tag

Get help developing custom BBCodes or request one.
Post Reply
User avatar
LHammonds
Registered User
Posts: 13
Joined: Wed May 31, 2017 12:02 am

[3.2.1] Custom BBCode - CODE-like tag

Post by LHammonds » Wed Sep 06, 2017 3:16 pm

Greetings.

I have some issues with a custom BBCode and I'm hoping someone here can help fix this issues.

The purpose:
A custom BBCode that works just like the CODE tag section but allows just the COLOR tag so important bits can be highlighted. If all BBCode tags have to be enabled, that is fine too.

Current problem 1:
When Firefox end-users (no matter the version) select the text in the code box, none of the carriage returns are preserved and pastes like a long, continuous string.

EDIT: Current workaround is to use a browser other than Firefox but still would like to make it work correctly like it does for the CODE tag.

Current problem #2:
Very long lines will go off screen and not stay within the selection window...looking very odd.

EDIT: Current workaround is to use the pre-wrap setting.

BBCode Configuration

Usage:

Code: Select all

[mycode]{TEXT}[/mycode]
Replacement:

Code: Select all

<div style="background-color: #fff; color: #040; white-space: pre; border: 1px solid #000; font: Courier, monospace">{TEXT}</div>
Example Page
HammondsLegacy Tutorial Forum

Attached are screenshots of the example page in various browsers.

Microsoft Edge v38
phpbbcode-edge-38.jpg
Microsoft Internet Explorer v11
phpbbcode-msie-11.jpg
Google Chrome v58 (Problem 1 observed)
phpbbcode-chrome-58.jpg
Mozilla Firefox v55 (Problem 1 and 2 observed)
phpbbcode-firefox-55.jpg
Thanks,
LHammonds
Last edited by LHammonds on Wed Sep 06, 2017 5:49 pm, edited 4 times in total.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50744
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [3.2.1] Custom BBCode - CODE-like tag

Post by Brf » Wed Sep 06, 2017 3:53 pm

I am not able to duplicate your "Problem 1".
From your example post, I can Copy from either code-box and paste into Notepad, preserving all of the line-breaks.
Attachments
Code-test.png

User avatar
LHammonds
Registered User
Posts: 13
Joined: Wed May 31, 2017 12:02 am

Re: [3.2.1] Custom BBCode - CODE-like tag

Post by LHammonds » Wed Sep 06, 2017 4:20 pm

Brf wrote:
Wed Sep 06, 2017 3:53 pm
I am not able to duplicate your "Problem 1".
From your example post, I can Copy from either code-box and paste into Notepad, preserving all of the line-breaks.
Sounds like I need to verify in multiple browsers:
  • MS Internet Explorer v11, copy/paste preserves line breaks.
  • MS Edge v38, copy/paste preserves line breaks.
  • Google Chrome v58, copy/paste preserves line breaks.
  • Firefox v55, copy/paste has no line breaks
hmm...I'll download the portable version of Firefox to make sure it is just the browser and not some plugin/extension getting in the way. One of my followers initially reported it to me and I only tested it on my main browser...Firefox.

EDIT: Seems all the Firefox versions I tested (8, 45 and 55) do not preserve the line breaks in the custom BBCode but they do with the default "CODE" tag. I'll update the original post.
Last edited by LHammonds on Wed Sep 06, 2017 4:53 pm, edited 1 time in total.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50744
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [3.2.1] Custom BBCode - CODE-like tag

Post by Brf » Wed Sep 06, 2017 4:27 pm

I stopped using Firefox months ago. It was giving nothing but problems.

User avatar
LHammonds
Registered User
Posts: 13
Joined: Wed May 31, 2017 12:02 am

Re: [3.2.1] Custom BBCode - CODE-like tag

Post by LHammonds » Wed Sep 06, 2017 5:28 pm

Changing "white-space: pre" to "white-space: pre-wrap" allows the text to wrap around but preserves the line breaks when doing copy/paste so I might go with that even though it does not match how it works with the CODE tag which improves problem #2

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 3 guests