Skip to content

BBC Code #7836

@jdarwood007

Description

@jdarwood007

Description

This came up in a internal discussion. Tracking this for a future release to cleanup code.

We use this bit of ugly code in our [code] bbc

						// Fix the PHP code stuff...
						$data = str_replace("<pre style=\"display: inline;\">\t</pre>", "\t", implode('', $php_parts));
						$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);

						// Recent Opera bug requiring temporary fix. &nsbp; is needed before </code> to avoid broken selection.
						if (!empty($context['browser']['is_opera']))
							$data .= '&nbsp;';

It seems all webkit (at least chrome and edge verified) do not need this hack to make tabs/spaces work.
Firefox needs the .bbc_code css set to white-space: pre to work, but otherwise does not need this hack.

Suggested action here is to remove this extra work and just use the css

While researching this, I noticed we have new css attributes we can use in the future in addition to white-space
https://developer.mozilla.org/en-US/docs/Web/CSS/white-space-collapse
https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap

These seem to only be supported on chrome/edge at the moment. But hopefully they will be supported in the future on other browsers and can be implanted to better control the white-spacing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions