feat(bbcode): Added [nfo] and [pre] tags (#1923)

This commit is contained in:
Roman Kelesidis 2025-06-08 12:44:04 +03:00 committed by GitHub
commit f64c340563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

View file

@ -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)';

View file

@ -133,6 +133,10 @@ class BBCode
'[/box]' => $tpl['box_close'],
'[indent]' => '<div class="post-indent">',
'[/indent]' => '</div>',
'[pre]' => '<pre class="post-pre">',
'[/pre]' => '</pre>',
'[nfo]' => '<pre class="post-nfo">',
'[/nfo]' => '</pre>',
'[del]' => '<span class="post-s">',
'[/del]' => '</span>',
'[clear]' => '<div class="clear">&nbsp;</div>',

View file

@ -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
* ---------------------------------- */

View file

@ -75,7 +75,9 @@ ajax.callback.posts = function(data) {
<input type="button" value="&#8667;" name="codeIndent" title="{L_INDENT_TAG}" />&nbsp;
<input type="button" value="{L_SPOILER}" name="codeSpoiler" title="{L_SPOILER}" />
<input type="button" value="{L_ACRONYM}" name="codeAcronym" title="{L_ACRONYM_TITLE}" />
<input type="button" value="pre" name="codePre" title="{L_PRE_TAG}" />
<input type="button" value="box" name="codeBox" title="{L_BOX_TAG}" />
<input type="button" value="nfo" name="codeNfo" title="{L_NFO_TAG}" />
</span>
<div class="buttons floatR">
@ -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;