Load quill.js CSS locally
This commit is contained in:
parent
1c0d30e5a2
commit
f4acc29670
|
@ -162,12 +162,8 @@ export class ConsoleGlobalMessageManager {
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try{
|
try{
|
||||||
// Start loading CSS
|
|
||||||
const cssPromise = ConsoleGlobalMessageManager.loadCss();
|
|
||||||
// Import quill
|
// Import quill
|
||||||
const {default: Quill}:any = await import("quill"); // eslint-disable-line @typescript-eslint/no-explicit-any
|
const {default: Quill}:any = await import("quill"); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
// Wait for CSS to be loaded
|
|
||||||
await cssPromise;
|
|
||||||
|
|
||||||
const toolbarOptions = [
|
const toolbarOptions = [
|
||||||
['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
||||||
|
@ -266,27 +262,6 @@ export class ConsoleGlobalMessageManager {
|
||||||
this.divMessageConsole.appendChild(section);
|
this.divMessageConsole.appendChild(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static loadCss(): Promise<void> {
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
|
||||||
if (ConsoleGlobalMessageManager.cssLoaded) {
|
|
||||||
resolve();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const fileref = document.createElement("link")
|
|
||||||
fileref.setAttribute("rel", "stylesheet")
|
|
||||||
fileref.setAttribute("type", "text/css")
|
|
||||||
fileref.setAttribute("href", "https://cdn.quilljs.com/1.3.7/quill.snow.css");
|
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref);
|
|
||||||
ConsoleGlobalMessageManager.cssLoaded = true;
|
|
||||||
fileref.onload = () => {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
fileref.onerror = () => {
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage(){
|
sendMessage(){
|
||||||
const inputType = HtmlUtils.getElementByIdOrFail<HTMLInputElement>(INPUT_TYPE_CONSOLE);
|
const inputType = HtmlUtils.getElementByIdOrFail<HTMLInputElement>(INPUT_TYPE_CONSOLE);
|
||||||
if(AUDIO_TYPE !== inputType.value && MESSAGE_TYPE !== inputType.value){
|
if(AUDIO_TYPE !== inputType.value && MESSAGE_TYPE !== inputType.value){
|
||||||
|
|
Loading…
Reference in New Issue