mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17326] Updated js to use same as pages ext and fixed icon bug
PHPBB-17326
This commit is contained in:
parent
97728da9be
commit
220b655150
3 changed files with 20 additions and 7 deletions
|
@ -53,7 +53,7 @@
|
|||
<dt><label for="bbcode_font_icon">{{ lang('BBCODE_FONT_ICON') }}</label><br><span>{{ lang('BBCODE_FONT_ICON_EXPLAIN', '<a href="https://fontawesome.com/v6/icons/" target="_blank">', '</a>') }}</span></dt>
|
||||
<dd>
|
||||
<input type="text" name="bbcode_font_icon" id="bbcode_font_icon" value="{{ BBCODE_FONT_ICON }}" />
|
||||
{{ Icon('font', BBCODE_FONT_ICON, '', false, '', {'id':'bbcode_icon_preview'}) }}
|
||||
{{ Icon('font', ' ', '', false, '', {'id':'bbcode_icon_preview'}) }}
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -279,11 +279,24 @@ function parse_document(container)
|
|||
});
|
||||
|
||||
// Live update BBCode font icon preview
|
||||
$('#bbcode_font_icon').on('keyup', function(e) {
|
||||
const iconName = $(this).val();
|
||||
if (iconName.match(/^[\w-]+$/)) {
|
||||
$('#bbcode_icon_preview').attr('class', "o-icon o-icon-font fa-fw fas icon fa-" + $(this).val());
|
||||
}
|
||||
const updateIconClass = (element, newClass) => {
|
||||
element.classList.forEach(className => {
|
||||
if (className.startsWith('fa-') && className !== 'fa-fw') {
|
||||
element.classList.remove(className);
|
||||
}
|
||||
});
|
||||
|
||||
element.classList.add(`fa-${newClass}`);
|
||||
};
|
||||
|
||||
const pageIconFont = document.getElementById('bbcode_font_icon');
|
||||
|
||||
pageIconFont.addEventListener('keyup', function() {
|
||||
updateIconClass(this.nextElementSibling, this.value);
|
||||
});
|
||||
|
||||
pageIconFont.addEventListener('blur', function() {
|
||||
updateIconClass(this.nextElementSibling, this.value);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
@ -103,7 +103,7 @@ class acp_bbcodes
|
|||
'S_EDIT_BBCODE' => true,
|
||||
'U_BACK' => $this->u_action,
|
||||
'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''),
|
||||
|
||||
'L_BBCODE_USAGE_EXPLAIN' => sprintf($user->lang['BBCODE_USAGE_EXPLAIN'], '<a href="#down">', '</a>'),
|
||||
'BBCODE_MATCH' => $bbcode_match,
|
||||
'BBCODE_TPL' => $bbcode_tpl,
|
||||
'BBCODE_HELPLINE' => $bbcode_helpline,
|
||||
|
|
Loading…
Add table
Reference in a new issue