1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/17326] Updated js to use same as pages ext and fixed icon bug

PHPBB-17326
This commit is contained in:
Daniel James
2025-02-07 17:02:26 +00:00
committed by Marc Alexander
parent 97728da9be
commit 220b655150
3 changed files with 20 additions and 7 deletions

View File

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