html-code-editor.ts
Home
/
codeeditor-app /
elements /
code-editor /
html-code-editor.ts
import { CodeEditor } from "./code-editor";
import * as monaco from 'monaco-editor';
import initHtml from '!!raw-loader!./injects/editor-init.html';
import { createScript } from "../../../shared/create-script";
export class HtmlCodeEditor extends CodeEditor {
setInitInput(): string {
return initHtml;
}
setInitSettings(): void {
monaco.languages.registerCompletionItemProvider("html", {
provideCompletionItems: (model, position, context, token) => {
return {
suggestions: [
{
label: 'jqueryCDN',
kind: monaco.languages.CompletionItemKind.Snippet,
insertText: createScript('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js', false).toString(),
range: <any>null,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
}
]
}
}
});
}
}