mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
4.22.5
* Added: Setting to hide unrelated results from the FFZ Control Center when searching. This is now enabled by default. * Added: Setting to control whether the height of the Emote Menu is expanded. This is now disabled by default. * Changed: When searching in the FFZ Control Center, pills are displayed in the navigation tree showing how many matching results there are. * Changed: Update the method used for searching for channels and games, hopefully resulting in more accurate results. * Changed: When searching for users in an auto-complete field, display a check-mark for verified users. * Changed: When searching for users in an auto-complete field, respect the user's preference for rounded avatars. * Fixed: Lazy load Markdown when possible to save on initial download size.
This commit is contained in:
parent
ff4bb24a9a
commit
f0d68527b8
21 changed files with 435 additions and 164 deletions
|
@ -9,6 +9,7 @@ import {has, maybe_call, once} from 'utilities/object';
|
|||
|
||||
import Tooltip from 'utilities/tooltip';
|
||||
import Module from 'utilities/module';
|
||||
import awaitMD, {getMD} from 'utilities/markdown';
|
||||
|
||||
export default class TooltipProvider extends Module {
|
||||
constructor(...args) {
|
||||
|
@ -60,9 +61,9 @@ export default class TooltipProvider extends Module {
|
|||
this.types.markdown = (target, tip) => {
|
||||
tip.add_class = 'ffz-tooltip--markdown';
|
||||
|
||||
const md = this.getMarkdown();
|
||||
const md = getMD();
|
||||
if ( ! md )
|
||||
return this.loadMarkdown().then(md => md.render(target.dataset.title));
|
||||
return awaitMD().then(md => md.render(target.dataset.title));
|
||||
|
||||
return md.render(target.dataset.title);
|
||||
};
|
||||
|
@ -71,46 +72,8 @@ export default class TooltipProvider extends Module {
|
|||
this.types.html = target => target.dataset.title;
|
||||
|
||||
this.onFSChange = this.onFSChange.bind(this);
|
||||
|
||||
this.loadMarkdown = once(this.loadMarkdown);
|
||||
|
||||
}
|
||||
|
||||
getMarkdown(callback) {
|
||||
if ( this._md )
|
||||
return this._md;
|
||||
|
||||
if ( callback )
|
||||
this.loadMarkdown().then(md => callback(md));
|
||||
}
|
||||
|
||||
async loadMarkdown() { // eslint-disable-line class-methods-use-this
|
||||
if ( this._md )
|
||||
return this._md;
|
||||
|
||||
const [MD, MILA] = await Promise.all([
|
||||
import(/* webpackChunkName: 'markdown' */ 'markdown-it'),
|
||||
import(/* webpackChunkName: 'markdown' */ 'markdown-it-link-attributes')
|
||||
]);
|
||||
|
||||
const md = this._md = new MD.default({
|
||||
html: false,
|
||||
linkify: true
|
||||
});
|
||||
|
||||
md.use(MILA.default, {
|
||||
attrs: {
|
||||
class: 'ffz-tooltip',
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
'data-tooltip-type': 'link'
|
||||
}
|
||||
});
|
||||
|
||||
return md;
|
||||
}
|
||||
|
||||
|
||||
onEnable() {
|
||||
const container = this.getRoot();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue