mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-28 06:17:46 +01:00
Adding bbcode parsing
because so many furry sites are just forks of phpBB.
This commit is contained in:
parent
6337b1b130
commit
31d28ba292
2 changed files with 19 additions and 4 deletions
|
@ -5,9 +5,22 @@
|
|||
import store from './utils/store';
|
||||
import { $, $$ } from './utils/dom';
|
||||
|
||||
import bbcode from 'bbcode';
|
||||
|
||||
function parseBBcode() {
|
||||
let description = document.querySelectorAll('.image-description .block .block__content .paragraph');
|
||||
if (description.length > 0) {
|
||||
description.forEach(el => {
|
||||
el.innerHTML = bbcode.parse(el.innerHTML);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
parseBBcode();
|
||||
|
||||
let touchMoved = false;
|
||||
|
||||
function formResult({target, detail}) {
|
||||
function formResult({ target, detail }) {
|
||||
|
||||
const elements = {
|
||||
'#description-form': '.image-description',
|
||||
|
@ -16,6 +29,7 @@ function formResult({target, detail}) {
|
|||
|
||||
function showResult(resultEl, formEl, response) {
|
||||
resultEl.innerHTML = response;
|
||||
parseBBcode();
|
||||
resultEl.classList.remove('hidden');
|
||||
formEl.classList.add('hidden');
|
||||
formEl.querySelector('input[type="submit"],button').disabled = false;
|
||||
|
@ -83,4 +97,4 @@ function setupEvents() {
|
|||
document.addEventListener('touchmove', () => touchMoved = true);
|
||||
}
|
||||
|
||||
export { setupEvents };
|
||||
export { setupEvents };
|
|
@ -21,7 +21,8 @@
|
|||
"normalize-scss": "^8.0.0",
|
||||
"sass": "^1.75.0",
|
||||
"typescript": "^5.4",
|
||||
"vite": "^5.2"
|
||||
"vite": "^5.2",
|
||||
"bbcode": "^0.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/dom": "^10.1.0",
|
||||
|
@ -34,4 +35,4 @@
|
|||
"vitest": "^1.5.3",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue