1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 06:57:54 +02:00

fix(bbcode): highlight.js does not work after changing post content (#3817)

* fix(bbcode): highlight.js does not work after changing post content

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* chore(bbcode): organize bbcode code

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

---------

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
Sami Mazouz
2023-05-02 09:39:43 +01:00
committed by GitHub
parent b4f3f0558e
commit d7fcd8a9e5
4 changed files with 101 additions and 26 deletions

View File

@@ -7,36 +7,14 @@
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\BBCode;
use Flarum\Extend;
use s9e\TextFormatter\Configurator;
use s9e\TextFormatter\Renderer;
return [
new Extend\Locales(__DIR__.'/locale'),
(new Extend\Formatter)
->render(function (Renderer $renderer, $context, string $xml) {
$renderer->setParameter('L_WROTE', resolve('translator')->trans('flarum-bbcode.forum.quote.wrote'));
return $xml;
})
->configure(function (Configurator $config) {
$config->BBCodes->addFromRepository('B');
$config->BBCodes->addFromRepository('I');
$config->BBCodes->addFromRepository('U');
$config->BBCodes->addFromRepository('S');
$config->BBCodes->addFromRepository('URL');
$config->BBCodes->addFromRepository('IMG');
$config->BBCodes->addFromRepository('EMAIL');
$config->BBCodes->addFromRepository('CODE');
$config->BBCodes->addFromRepository('QUOTE', 'default', [
'authorStr' => '<xsl:value-of select="@author"/> <xsl:value-of select="$L_WROTE"/>'
]);
$config->BBCodes->addFromRepository('LIST');
$config->BBCodes->addFromRepository('DEL');
$config->BBCodes->addFromRepository('COLOR');
$config->BBCodes->addFromRepository('CENTER');
$config->BBCodes->addFromRepository('SIZE');
$config->BBCodes->addFromRepository('*');
}),
->render(Render::class)
->configure(Configure::class),
];