fix(core): update
This commit is contained in:
parent
e70d8abc8a
commit
bcadb1b97f
8
ts_web/00_commitinfo_data.ts
Normal file
8
ts_web/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@designestate/dees-editor',
|
||||
version: '1.0.68',
|
||||
description: 'an advanced editor for markdown documents based on monaco.'
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
import { DeesElement, property, html, customElement, TemplateResult, css, cssManager } from '@designestate/dees-element';
|
||||
import * as domtools from '@designestate/dees-domtools';
|
||||
|
||||
const deferred = domtools.plugins.smartpromise.defer();
|
||||
let aceDeferred: typeof deferred;
|
||||
|
||||
import type * as monaco from 'monaco-editor';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'dees-editor-ace': DeesEditorAce;
|
||||
}
|
||||
}
|
||||
|
||||
@customElement('dees-editor-ace')
|
||||
export class DeesEditorAce extends DeesElement {
|
||||
public static demo = () => html`
|
||||
<dees-editor-ace></dees-editor-ace>
|
||||
`;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
domtools.DomTools.setupDomTools();
|
||||
}
|
||||
|
||||
public static styles = [
|
||||
domtools.elementBasic.staticStyles,
|
||||
css`
|
||||
:host {
|
||||
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
`
|
||||
]
|
||||
|
||||
public render (): TemplateResult {
|
||||
return html`
|
||||
<div class="mainbox">
|
||||
<div id="container"></div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
public async firstUpdated (_changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
||||
super.firstUpdated(_changedProperties);
|
||||
const container = this.shadowRoot.getElementById('container');
|
||||
|
||||
/* if (!aceDeferred) {
|
||||
aceDeferred = domtools.plugins.smartpromise.defer();
|
||||
const scriptUrl = `https://cdn.jsdelivr.net/npm/monaco-editor/min/vs/loader.js`;
|
||||
const script = document.createElement('script');
|
||||
script.src = scriptUrl;
|
||||
script.onload = () => {
|
||||
aceDeferred.resolve();
|
||||
}
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
await aceDeferred.promise;
|
||||
|
||||
(window as any).require.config({
|
||||
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor/min/vs" }
|
||||
});
|
||||
(window as any).require([ "vs/editor/editor.main" ], function () {
|
||||
const editor: monaco.editor.IStandaloneCodeEditor = (window as any).monaco.editor.create(container, {
|
||||
value: "function hello() {\n\talert('Hello world!');\n}",
|
||||
language: 'javascript',
|
||||
theme: 'vs-dark',
|
||||
useShadowDOM: true
|
||||
});
|
||||
}); */
|
||||
|
||||
}
|
||||
}
|
@ -77,6 +77,9 @@ export class DeesEditor extends DeesElement {
|
||||
useShadowDOM: true
|
||||
});
|
||||
});
|
||||
|
||||
const css = await (await fetch('https://cdn.jsdelivr.net/npm/monaco-editor/min/vs/editor/editor.main.css')).text();
|
||||
const styleElement = document.createElement('style');
|
||||
styleElement.textContent = css;
|
||||
this.shadowRoot.append(styleElement);
|
||||
}
|
||||
}
|
@ -1,3 +1,2 @@
|
||||
export * from './dees-editor.js';
|
||||
export * from './dees-editor-ace.js';
|
||||
export * from './dees-terminal.js';
|
Loading…
Reference in New Issue
Block a user