feat(editor): add code input component and editor-bare, replace dees-editor usage, and add modal contentPadding
This commit is contained in:
@@ -15,14 +15,14 @@ import type * as monaco from 'monaco-editor';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'dees-editor': DeesEditor;
|
||||
'dees-editor-bare': DeesEditorBare;
|
||||
}
|
||||
}
|
||||
|
||||
@customElement('dees-editor')
|
||||
export class DeesEditor extends DeesElement {
|
||||
@customElement('dees-editor-bare')
|
||||
export class DeesEditorBare extends DeesElement {
|
||||
// DEMO
|
||||
public static demo = () => html` <dees-editor></dees-editor> `;
|
||||
public static demo = () => html` <dees-editor-bare></dees-editor-bare> `;
|
||||
|
||||
// STATIC
|
||||
public static monacoDeferred: ReturnType<typeof domtools.plugins.smartpromise.defer>;
|
||||
@@ -86,17 +86,17 @@ export class DeesEditor extends DeesElement {
|
||||
const container = this.shadowRoot.getElementById('container');
|
||||
const monacoCdnBase = `https://cdn.jsdelivr.net/npm/monaco-editor@${MONACO_VERSION}`;
|
||||
|
||||
if (!DeesEditor.monacoDeferred) {
|
||||
DeesEditor.monacoDeferred = domtools.plugins.smartpromise.defer();
|
||||
if (!DeesEditorBare.monacoDeferred) {
|
||||
DeesEditorBare.monacoDeferred = domtools.plugins.smartpromise.defer();
|
||||
const scriptUrl = `${monacoCdnBase}/min/vs/loader.js`;
|
||||
const script = document.createElement('script');
|
||||
script.src = scriptUrl;
|
||||
script.onload = () => {
|
||||
DeesEditor.monacoDeferred.resolve();
|
||||
DeesEditorBare.monacoDeferred.resolve();
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
await DeesEditor.monacoDeferred.promise;
|
||||
await DeesEditorBare.monacoDeferred.promise;
|
||||
|
||||
(window as any).require.config({
|
||||
paths: { vs: `${monacoCdnBase}/min/vs` },
|
||||
1
ts_web/elements/00group-editor/dees-editor-bare/index.ts
Normal file
1
ts_web/elements/00group-editor/dees-editor-bare/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dees-editor-bare.js';
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
domtools
|
||||
} from '@design.estate/dees-element';
|
||||
import { themeDefaultStyles } from '../../00theme.js';
|
||||
import { DeesEditorBare } from '../dees-editor-bare/dees-editor-bare.js';
|
||||
|
||||
const deferred = domtools.plugins.smartpromise.defer();
|
||||
|
||||
@@ -51,7 +52,7 @@ export class DeesEditorMarkdown extends DeesElement {
|
||||
return html`
|
||||
<div class="gridcontainer">
|
||||
<div class="editorContainer">
|
||||
<dees-editor
|
||||
<dees-editor-bare
|
||||
.language=${'markdown'}
|
||||
.content=${`# a test content
|
||||
|
||||
@@ -75,7 +76,7 @@ const hello = 'yes'
|
||||
\`\`\`
|
||||
`}
|
||||
wordWrap="bounded"
|
||||
></dees-editor>
|
||||
></dees-editor-bare>
|
||||
</div>
|
||||
<div class="outletContainer">
|
||||
<dees-editormarkdownoutlet></dees-editormarkdownoutlet>
|
||||
@@ -86,8 +87,8 @@ const hello = 'yes'
|
||||
|
||||
public async firstUpdated(_changedPropertiesArg) {
|
||||
await super.firstUpdated(_changedPropertiesArg);
|
||||
const editor = this.shadowRoot.querySelector('dees-editor');
|
||||
|
||||
const editor = this.shadowRoot.querySelector('dees-editor-bare') as DeesEditorBare;
|
||||
|
||||
// lets care about wiring the markdown stuff.
|
||||
const markdownOutlet = this.shadowRoot.querySelector('dees-editormarkdownoutlet');
|
||||
const smartmarkdownInstance = new domtools.plugins.smartmarkdown.SmartMarkdown();
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './dees-editor.js';
|
||||
@@ -1,4 +1,4 @@
|
||||
// Editor Components
|
||||
export * from './dees-editor/index.js';
|
||||
export * from './dees-editor-bare/index.js';
|
||||
export * from './dees-editor-markdown/index.js';
|
||||
export * from './dees-editor-markdownoutlet/index.js';
|
||||
|
||||
Reference in New Issue
Block a user