mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: remove emojify.js
This commit is contained in:
1 parent
84c38cb571
commit
5f527658f8
27 files changed
+57
-138
No files matched your search
+2
-8
@@ -1,17 +1,11 @@
|
||||
import { AutoloadPage } from 'vj/misc/Page';
|
||||
import load from 'vj/components/wastyle/index';
|
||||
import Notification from 'vj/components/notification/index';
|
||||
import tpl from 'vj/utils/tpl';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
|
||||
const highlighterPage = new AutoloadPage('highlighterPage', () => {
|
||||
Promise.all([
|
||||
import('./prismjs'),
|
||||
UserContext.formatCode ? load() : [true, null],
|
||||
]).then(([{ default: prismjs }, [success, format]]) => {
|
||||
if (!success) Notification.error(`Astyle load fail: ${format}`);
|
||||
import('./prismjs').then(({ default: prismjs }) => {
|
||||
function runHighlight($container) {
|
||||
prismjs.highlightBlocks($container, success ? format : null);
|
||||
prismjs.highlightBlocks($container);
|
||||
$container.find('pre code').get().forEach((code) => {
|
||||
const $code = $(code);
|
||||
const $root = $code.parent().parent();
|
||||
@@ -70,7 +70,7 @@ function addInvisibles(grammar) {
|
||||
for (const name in grammar) {
|
||||
if (Object.prototype.hasOwnProperty.call(grammar, name) && !invisibles[name]) {
|
||||
if (name === 'rest') addInvisibles(grammar.rest);
|
||||
else handlerInvisiblesToken(grammar, name); // eslint-disable-line no-use-before-define
|
||||
else handlerInvisiblesToken(grammar, name); // eslint-disable-line @typescript-eslint/no-use-before-define
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,19 +95,12 @@ Prism.hooks.add('before-highlight', (env) => {
|
||||
});
|
||||
|
||||
const prismjsApiWrap = {
|
||||
highlightBlocks: ($dom, format) => {
|
||||
highlightBlocks: ($dom) => {
|
||||
$dom.find('pre code').get().forEach((code) => {
|
||||
const $code = $(code);
|
||||
const $pre = $code.parent();
|
||||
$pre.addClass('syntax-hl');
|
||||
const language = ($(code).attr('class') || '').trim();
|
||||
const astyle = language.match(/astyle-([a-z]+)/);
|
||||
if (format && astyle && astyle[1]) {
|
||||
const [success, result] = format($code.text(), `${UserContext.astyleOptions.trim()} mode=${astyle[1]}`);
|
||||
code.original = $code.text();
|
||||
if (!success) Notification.error('Code format fail');
|
||||
else $code.text(result);
|
||||
}
|
||||
// try to map the language name
|
||||
const m = language.match(/language-([a-z]+)/);
|
||||
if (m && m[1]) {
|
||||
|
||||
Reference in new issue
Block a user