From f64c340563378a364e1f00c64b17ac1c79531302 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 8 Jun 2025 12:44:04 +0300 Subject: [PATCH] feat(bbcode): Added `[nfo]` and `[pre]` tags (#1923) --- library/language/source/main.php | 2 ++ src/Legacy/BBCode.php | 4 ++++ styles/templates/default/css/globals.css | 20 ++++++++++++++++++++ styles/templates/default/posting_editor.tpl | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/library/language/source/main.php b/library/language/source/main.php index 6c103c30d..80059d74b 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1844,6 +1844,8 @@ $lang['UNDERLINE'] = 'Underline text: [u]text[/u] (Ctrl+U)'; $lang['STRIKEOUT'] = 'Strikeout text: [s]text[/s] (Ctrl+S)'; $lang['BOX_TAG'] = 'Frame around text: [box]text[/box] or [box=#333,#888]text[/box]'; $lang['INDENT_TAG'] = 'Insert indent: [indent]text[/indent]'; +$lang['PRE_TAG'] = 'Preformatted text: [pre]text[/pre]'; +$lang['NFO_TAG'] = 'NFO: [nfo]text[/nfo]'; $lang['SUPERSCRIPT'] = 'Superscript text: [sup]text[/sup]'; $lang['SUBSCRIPT'] = 'Subscript text: [sub]text[/sub]'; $lang['QUOTE_TITLE'] = 'Quote text: [quote]text[/quote] (Ctrl+Q)'; diff --git a/src/Legacy/BBCode.php b/src/Legacy/BBCode.php index 6c12d7602..330fc6a02 100644 --- a/src/Legacy/BBCode.php +++ b/src/Legacy/BBCode.php @@ -133,6 +133,10 @@ class BBCode '[/box]' => $tpl['box_close'], '[indent]' => '
', '[/indent]' => '
', + '[pre]' => '
',
+            '[/pre]' => '
', + '[nfo]' => '
',
+            '[/nfo]' => '
', '[del]' => '', '[/del]' => '', '[clear]' => '
 
', diff --git a/styles/templates/default/css/globals.css b/styles/templates/default/css/globals.css index 36d38c47d..534df58a9 100644 --- a/styles/templates/default/css/globals.css +++ b/styles/templates/default/css/globals.css @@ -392,6 +392,26 @@ a.gen, a.med, a.genmed, a.small, a.gensmall { display: inline-block; } +.post_body pre { + border: none; + background: transparent; + padding: 0; + margin: 0; +} + +.post-pre { + white-space: pre-wrap; + font-family: "Lucida Console", Consolas, monospace; +} + +.post-nfo { + font-size: 13px; + line-height: 1em; + white-space: pre; + font-family: Consolas, monospace; + overflow-y: hidden; +} + /* ---------------------------------- * Code blocks * ---------------------------------- */ diff --git a/styles/templates/default/posting_editor.tpl b/styles/templates/default/posting_editor.tpl index e8da89c82..44621a158 100644 --- a/styles/templates/default/posting_editor.tpl +++ b/styles/templates/default/posting_editor.tpl @@ -75,7 +75,9 @@ ajax.callback.posts = function(data) {   + +
@@ -209,6 +211,8 @@ function checkForm(form) { bbcode.addTag("codeAcronym", 'acronym="text"', "/acronym", "", ctrl); bbcode.addTag("codeBox", "box", null, "", ctrl); bbcode.addTag("codeIndent", "indent", null, "", ctrl); + bbcode.addTag("codePre", "pre", null, "", ctrl); + bbcode.addTag("codeNfo", "nfo", null, "", ctrl); bbcode.addTag("fontFace", function (e) { var v = e.value;