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