toi cam thay minh la sieu nhan
This commit is contained in:
42
src/Document/document.service.ts
Normal file
42
src/Document/document.service.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { forwardRef, Inject, Injectable } from '@nestjs/common'
|
||||
|
||||
import Delta, { Op } from 'quill-delta'
|
||||
import { MinioService } from '../Minio/minio.service'
|
||||
import { DocumentDelta } from './document.type'
|
||||
import { JSDOM } from 'jsdom'
|
||||
@Injectable()
|
||||
export class DocumentService {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
private quill: any
|
||||
constructor(
|
||||
private readonly minio: MinioService,
|
||||
public document: JSDOM,
|
||||
) {
|
||||
;(async () => {
|
||||
await this.loadQuill()
|
||||
})()
|
||||
}
|
||||
|
||||
private async loadQuill() {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
||||
const { window } = new JSDOM('<!doctype html><html><body></body></html>')
|
||||
const { navigator } = window
|
||||
const { Node } = window
|
||||
global.window = window
|
||||
global.document = window.document
|
||||
global.navigator = navigator
|
||||
global.Node = Node
|
||||
}
|
||||
|
||||
const { default: Quill } = await import('quill')
|
||||
this.quill = Quill
|
||||
}
|
||||
|
||||
async handleOnChange(delta: DocumentDelta) {}
|
||||
|
||||
async handleOnSave() {}
|
||||
|
||||
async handleOnSync() {}
|
||||
|
||||
async requestSync() {}
|
||||
}
|
||||
Reference in New Issue
Block a user