diff --git a/src/meditor/index.js b/src/meditor/index.js
index cdf2be4..a264fbe 100644
--- a/src/meditor/index.js
+++ b/src/meditor/index.js
@@ -54,8 +54,10 @@ class MEditor extends Component {
}
}
},
+ placeholder: '',
readonly: false,
- disabled: false
+ disabled: false,
+ autofocus: false
}
static styles = [
@@ -156,7 +158,7 @@ class MEditor extends Component {
padding: 5px 8px;
line-height: 1.5;
border: 0;
- font-size: 14px;
+ font-size: var(--wc-meditor-font-size, 14px);
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
color: var(--color-dark-1);
background: none;
@@ -225,14 +227,10 @@ class MEditor extends Component {
left: 0;
top: 0;
z-index: 99;
- width: 80px;
height: 0;
- padding: 5px 0;
- line-height: 25px;
background: #fff;
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
- font-size: 13px;
opacity: 0;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
transition: all ease-in-out 0.2s;
&.fadein {
@@ -244,6 +242,8 @@ class MEditor extends Component {
}
.font-layer {
+ width: 120px;
+ padding: 5px 0;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
span {
@@ -521,6 +521,10 @@ class MEditor extends Component {
}
}
+ focus() {
+ this.$refs.editor?.focus()
+ }
+
/**
* 往文本框中插入内容
* @param {String} val [要插入的文本]
@@ -832,6 +836,8 @@ class MEditor extends Component {
ref="editor"
class="editor"
spellcheck="false"
+ placeholder=${this.placeholder}
+ autofocus=${this.autofocus}
:readOnly=${this.readOnly}
:disabled=${this.disabled}
@click=${this.#hideLayers}
@@ -850,12 +856,12 @@ class MEditor extends Component {
ref="header"
@click=${this.#setHeaderLevel}
>
- H1
- H2
- H3
- H4
- H5
- H6
+ 一级标题
+ 二级标题
+ 三级标题
+ 四级标题
+ 五级标题
+ 六级标题
`
: ''}
${hasTable