更新meditor

master
yutent 2023-10-12 18:44:09 +08:00
parent 779aeb65a2
commit 5dec1ebdb7
1 changed files with 9 additions and 17 deletions

View File

@ -155,7 +155,7 @@ class MEditor extends Component {
flex: 1;
display: flex;
width: 100%;
min-height: 300px;
min-height: 200px;
border-radius: 3px;
.editor,
@ -577,17 +577,6 @@ class MEditor extends Component {
Addon.h.call(this, level)
}
#chnageColor(ev) {
if (ev.target === ev.currentTarget) {
return
}
this.$refs.color.classList.remove('fadein')
this.$refs.editor.focus()
this.restoreSelection()
this.exec(ACTTION.color, ev.target.dataset.value)
this.saveSelection()
}
#insertLink(ev) {
let value = this.$refs.linkinput.value.trim()
if (value) {
@ -605,9 +594,11 @@ class MEditor extends Component {
if (this.#gridx < 0 || this.#gridy < 0) {
return
}
let thead = `\n\n${'| 表头 '.repeat(this.#gridx)}|\n`
let pipe = `${'| -- '.repeat(this.#gridx)}|\n`
let tbody = ('| '.repeat(this.#gridx) + '|\n').repeat(this.#gridy)
let thead = `\n\n${'| 表头 '.repeat(this.#gridx + 1)}|\n`
let pipe = `${'| -- '.repeat(this.#gridx + 1)}|\n`
let tbody = ('| '.repeat(this.#gridx + 1) + '|\n').repeat(
this.#gridy + 1
)
this.#gridx = -1
this.#gridy = -1
this.insert(thead + pipe + tbody, false)
@ -899,14 +890,15 @@ class MEditor extends Component {
}
mounted() {
let pb = ~~(this.clientHeight * 0.6)
pb = pb < 64 ? 64 : pb
Addon.preview.call(this, this)
this.$refs.editor.style.paddingBottom = pb + 'px'
}
unmounted() {}
render() {
// console.log(this.#toolbar, this.value)
return html`
<div class="meditor">
<header