mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-28 15:21:14 +00:00
Fix tribute related bug (#2647)
* Fix tribute related bug * fix api client error
This commit is contained in:
parent
6754c08902
commit
bee4395706
3 changed files with 312 additions and 462 deletions
48
package.json
48
package.json
|
@ -28,10 +28,10 @@
|
||||||
"@babel/plugin-proposal-decorators": "^7.24.7",
|
"@babel/plugin-proposal-decorators": "^7.24.7",
|
||||||
"@babel/plugin-transform-class-properties": "^7.24.7",
|
"@babel/plugin-transform-class-properties": "^7.24.7",
|
||||||
"@babel/plugin-transform-runtime": "^7.24.7",
|
"@babel/plugin-transform-runtime": "^7.24.7",
|
||||||
"@babel/plugin-transform-typescript": "^7.24.7",
|
"@babel/plugin-transform-typescript": "^7.25.2",
|
||||||
"@babel/preset-env": "^7.24.7",
|
"@babel/preset-env": "^7.25.3",
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
"@babel/preset-typescript": "^7.24.7",
|
||||||
"@babel/runtime": "^7.24.7",
|
"@babel/runtime": "^7.25.0",
|
||||||
"@emoji-mart/data": "^1.2.1",
|
"@emoji-mart/data": "^1.2.1",
|
||||||
"autosize": "^6.0.1",
|
"autosize": "^6.0.1",
|
||||||
"babel-loader": "^9.1.3",
|
"babel-loader": "^9.1.3",
|
||||||
|
@ -48,10 +48,10 @@
|
||||||
"emoji-mart": "^5.6.0",
|
"emoji-mart": "^5.6.0",
|
||||||
"emoji-short-name": "^2.0.0",
|
"emoji-short-name": "^2.0.0",
|
||||||
"express": "~4.19.2",
|
"express": "~4.19.2",
|
||||||
"highlight.js": "^11.9.0",
|
"highlight.js": "^11.10.0",
|
||||||
"history": "^5.3.0",
|
"history": "^5.3.0",
|
||||||
"html-to-text": "^9.0.5",
|
"html-to-text": "^9.0.5",
|
||||||
"i18next": "^23.11.5",
|
"i18next": "^23.12.2",
|
||||||
"inferno": "^8.2.3",
|
"inferno": "^8.2.3",
|
||||||
"inferno-create-element": "^8.2.3",
|
"inferno-create-element": "^8.2.3",
|
||||||
"inferno-helmet": "^5.2.1",
|
"inferno-helmet": "^5.2.1",
|
||||||
|
@ -73,12 +73,12 @@
|
||||||
"markdown-it-sub": "^2.0.0",
|
"markdown-it-sub": "^2.0.0",
|
||||||
"markdown-it-sup": "^2.0.0",
|
"markdown-it-sup": "^2.0.0",
|
||||||
"mini-css-extract-plugin": "^2.9.0",
|
"mini-css-extract-plugin": "^2.9.0",
|
||||||
"qreator": "^9.2.0",
|
"qreator": "^9.3.0",
|
||||||
"register-service-worker": "^1.7.2",
|
"register-service-worker": "^1.7.2",
|
||||||
"run-node-webpack-plugin": "^1.3.0",
|
"run-node-webpack-plugin": "^1.3.0",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
"sanitize-html": "^2.13.0",
|
"sanitize-html": "^2.13.0",
|
||||||
"sass": "^1.77.4",
|
"sass": "^1.77.8",
|
||||||
"sass-loader": "^16.0.0",
|
"sass-loader": "^16.0.0",
|
||||||
"serialize-javascript": "^6.0.2",
|
"serialize-javascript": "^6.0.2",
|
||||||
"service-worker-webpack": "^1.0.0",
|
"service-worker-webpack": "^1.0.0",
|
||||||
|
@ -86,13 +86,13 @@
|
||||||
"tippy.js": "^6.3.7",
|
"tippy.js": "^6.3.7",
|
||||||
"toastify-js": "^1.12.0",
|
"toastify-js": "^1.12.0",
|
||||||
"tributejs": "^5.1.3",
|
"tributejs": "^5.1.3",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.93.0",
|
||||||
"webpack-cli": "^5.1.4",
|
"webpack-cli": "^5.1.4",
|
||||||
"webpack-node-externals": "^3.0.0"
|
"webpack-node-externals": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.24.7",
|
"@babel/core": "^7.25.2",
|
||||||
"@eslint/js": "^9.4.0",
|
"@eslint/js": "^9.8.0",
|
||||||
"@types/autosize": "^4.0.3",
|
"@types/autosize": "^4.0.3",
|
||||||
"@types/bootstrap": "^5.2.10",
|
"@types/bootstrap": "^5.2.10",
|
||||||
"@types/cookie": "^0.6.0",
|
"@types/cookie": "^0.6.0",
|
||||||
|
@ -100,34 +100,34 @@
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/html-to-text": "^9.0.4",
|
"@types/html-to-text": "^9.0.4",
|
||||||
"@types/lodash.isequal": "^4.5.8",
|
"@types/lodash.isequal": "^4.5.8",
|
||||||
"@types/markdown-it": "^14.1.1",
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@types/markdown-it-container": "^2.0.10",
|
"@types/markdown-it-container": "^2.0.10",
|
||||||
"@types/node": "^20.14.2",
|
"@types/node": "^22.0.2",
|
||||||
"@types/path-browserify": "^1.0.2",
|
"@types/path-browserify": "^1.0.2",
|
||||||
"@types/sanitize-html": "^2.11.0",
|
"@types/sanitize-html": "^2.11.0",
|
||||||
"@types/serialize-javascript": "^5.0.4",
|
"@types/serialize-javascript": "^5.0.4",
|
||||||
"@types/toastify-js": "^1.12.3",
|
"@types/toastify-js": "^1.12.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||||
"@typescript-eslint/parser": "^8.0.0",
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
"eslint": "^9.4.0",
|
"eslint": "^9.8.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-inferno": "^7.34.0",
|
"eslint-plugin-inferno": "^7.34.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"globals": "^15.3.0",
|
"globals": "^15.9.0",
|
||||||
"husky": "^9.0.11",
|
"husky": "^9.1.4",
|
||||||
"import-sort-style-module": "^6.0.0",
|
"import-sort-style-module": "^6.0.0",
|
||||||
"lint-staged": "^15.2.5",
|
"lint-staged": "^15.2.7",
|
||||||
"prettier": "^3.3.1",
|
"prettier": "^3.3.3",
|
||||||
"prettier-plugin-import-sort": "^0.0.7",
|
"prettier-plugin-import-sort": "^0.0.7",
|
||||||
"prettier-plugin-organize-imports": "^4.0.0",
|
"prettier-plugin-organize-imports": "^4.0.0",
|
||||||
"prettier-plugin-packagejson": "^2.5.0",
|
"prettier-plugin-packagejson": "^2.5.1",
|
||||||
"qs": "^6.12.1",
|
"qs": "^6.13.0",
|
||||||
"rimraf": "^6.0.0",
|
"rimraf": "^6.0.1",
|
||||||
"sortpack": "^2.4.0",
|
"sortpack": "^2.4.0",
|
||||||
"style-loader": "^4.0.0",
|
"style-loader": "^4.0.0",
|
||||||
"terser": "^5.31.0",
|
"terser": "^5.31.3",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.5.4",
|
||||||
"typescript-eslint": "^8.0.0",
|
"typescript-eslint": "^8.0.0",
|
||||||
"typescript-language-server": "^4.3.3",
|
"typescript-language-server": "^4.3.3",
|
||||||
"webpack-bundle-analyzer": "^4.10.2",
|
"webpack-bundle-analyzer": "^4.10.2",
|
||||||
|
|
718
pnpm-lock.yaml
718
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,9 @@ import markdown_it_highlightjs from "markdown-it-highlightjs/core";
|
||||||
import { Renderer, Token } from "markdown-it";
|
import { Renderer, Token } from "markdown-it";
|
||||||
import { instanceLinkRegex, relTags } from "./config";
|
import { instanceLinkRegex, relTags } from "./config";
|
||||||
import { lazyHighlightjs } from "./lazy-highlightjs";
|
import { lazyHighlightjs } from "./lazy-highlightjs";
|
||||||
import Tribute from "tributejs";
|
import { isBrowser } from "@utils/browser";
|
||||||
|
|
||||||
|
export let Tribute: any;
|
||||||
|
|
||||||
export let md: MarkdownIt = new MarkdownIt();
|
export let md: MarkdownIt = new MarkdownIt();
|
||||||
|
|
||||||
|
@ -38,6 +40,10 @@ export let customEmojisLookup: Map<string, CustomEmojiView> = new Map<
|
||||||
CustomEmojiView
|
CustomEmojiView
|
||||||
>();
|
>();
|
||||||
|
|
||||||
|
if (isBrowser()) {
|
||||||
|
Tribute = await import("tributejs");
|
||||||
|
}
|
||||||
|
|
||||||
export function mdToHtml(text: string, rerender: () => void) {
|
export function mdToHtml(text: string, rerender: () => void) {
|
||||||
return { __html: lazyHighlightjs.render(md, text, rerender) };
|
return { __html: lazyHighlightjs.render(md, text, rerender) };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue