ElkArte Community

General => Site Feedback => Topic started by: ahrasis on October 30, 2014, 10:05:28 pm

Title: No tab in [code][/code]?
Post by: ahrasis on October 30, 2014, 10:05:28 pm
All posted code has no tab (though actually they have tab(s)). Am I the only one seeing this?
Title: Re: No tab in [code][/code]?
Post by: Spuds on October 31, 2014, 08:20:40 am
Which browser?

I did find an error in the wizzy code tag that will be fixed in 1.02

In testing with FF pasted and selected code retains its tabs as below:

Code: [Select]
						if (base.ieUnselectable !== false)
{
content = $(content);
content.find(':not(input,textarea)').filter(function() {return this.nodeType === 1;}).attr('unselectable', 'on');
}
Title: Re: No tab in [code][/code]?
Post by: IchBin on October 31, 2014, 06:33:29 pm
Removed the tabs in chrome for me just now when testing it.

Code: [Select]
// Check if compressed output is enabled, supported, and not already being done.
if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
{
// If zlib is being used, turn off output compression.
if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
$modSettings['enableCompressedOutput'] = 0;
else
{
@ob_end_clean();
ob_start('ob_gzhandler');
}
}
Title: Re: No tab in [code][/code]?
Post by: Spuds on October 31, 2014, 09:33:31 pm
Does anyone remember when chrome was the cool kid?   :P

Looks like its not rendering white-space: pre for some reason.   If I look at these posts in chrome they are not tabbed, although if I select them and plop them in notepad they do have the tabs, just they are not being rendered as whitespace.  I've tried a couple of things but no luck just yet :(  Ideas anyone?
Title: Re: No tab in [code][/code]?
Post by: ahrasis on October 31, 2014, 11:22:26 pm
Yes. It seems good in FF and IE. It behaves like that only in Chrome. Chrome bugs?
Title: Re: No tab in [code][/code]?
Post by: Spuds on November 01, 2014, 11:08:14 am
It would seem, or some white space conflict somewhere in the css,.

I tried a variety of things on those spans and the container itself with no real change.  When you look at those spans in chrome dev you fill find them but they all have a width of 0px, for all I know its the font or something obscure like that.

What seems to work in chrome and FF is to do the following:
add this css below the .bbc_code declaration (note, what are there two in there, looks like a left over when something was consolidated ?)
Code: [Select]
.bbc_code .tab {
    display: inline-block;
    white-space: pre;
    width: 4ex;
}
The width + display forces chrome to have a width, and the white-space is needed for FF to preserve the tabs on a select and copy.

Then in Subs.php find
Code: (find) [Select]
$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
Code: (replace) [Select]
$data = str_replace("\t", "<span class=\"tab\">\t</span>", $data);

There is probably a better solution but thats all I could come up with.