onlyoffice: support pdf documents

This commit is contained in:
undefined committed 2024-09-26 06:26:28 +08:00
1 parent 520c75d1d1
commit dcbca065e5
6 files changed
+38 -24

No files matched your search

@@ -83,7 +83,7 @@ function resourceUrl(service: string, src: string, url: string) {
declare module 'hydrooj' {
interface ModuleInterfaces {
richmedia: {
get: (src: string) => string | null;
get: (service: string, src: string, md: MarkdownIt) => string | null;
}
}
}
@@ -94,7 +94,7 @@ export function Media(md: MarkdownIt) {
let src = md.utils.escapeHtml(tokens[idx].attrGet('src'));
const service = md.utils.escapeHtml(tokens[idx].attrGet('service')).toLowerCase();
if (Hydro.module.richmedia?.[service]) {
const result = Hydro.module.richmedia[service].get(src);
const result = Hydro.module.richmedia[service].get(service, src, md);
if (result) return result;
}
if (service === 'pdf') {
@@ -1,18 +1,18 @@
import { Intent, Position, Toaster } from '@blueprintjs/core';
import { Intent, OverlayToaster, Position } from '@blueprintjs/core';
import $ from 'jquery';
import { tpl, zIndexManager } from 'vj/utils/base';
const ToasterContainer = document.createElement('div');
ToasterContainer.style.position = 'fixed';
ToasterContainer.style.bottom = '0px';
ToasterContainer.style.width = '100%';
ToasterContainer.style.zIndex = '9999';
document.body.append(ToasterContainer);
export const AppToaster = Toaster.create({
className: 'recipe-toaster',
position: Position.LEFT_BOTTOM,
usePortal: true,
} as any, ToasterContainer);
const AppToaster = OverlayToaster.createAsync(
{ position: Position.BOTTOM_LEFT, usePortal: false },
{ container: ToasterContainer },
);
interface NotificationOptions {
avatar?: string;
@@ -65,20 +65,20 @@ export default class Notification {
setTimeout(() => this.$n.remove(), 200);
}
static success(message: string, duration?: number) {
return AppToaster.show({ message, timeout: duration, intent: Intent.SUCCESS });
static async success(message: string, duration?: number) {
return (await AppToaster).show({ message, timeout: duration, intent: Intent.SUCCESS });
}
static info(message: string, duration?: number) {
return AppToaster.show({ message, timeout: duration, intent: Intent.PRIMARY });
static async info(message: string, duration?: number) {
return (await AppToaster).show({ message, timeout: duration, intent: Intent.PRIMARY });
}
static warn(message: string, duration?: number) {
return AppToaster.show({ message, timeout: duration, intent: Intent.WARNING });
static async warn(message: string, duration?: number) {
return (await AppToaster).show({ message, timeout: duration, intent: Intent.WARNING });
}
static error(message: string, duration?: number) {
return AppToaster.show({ message, timeout: duration, intent: Intent.DANGER });
static async error(message: string, duration?: number) {
return (await AppToaster).show({ message, timeout: duration, intent: Intent.DANGER });
}
}
+1 -1
View File
@@ -261,7 +261,7 @@ small, figcaption
.typo
word-wrap()
overflow: auto
overflow: auto hidden;
.typo a, .typo .link, .typo-a
&, &:visited, &:active, &:hover