diff --git a/apps/editor/src/markdown/plugins/helper/markInfo.ts b/apps/editor/src/markdown/plugins/helper/markInfo.ts index 536a9645fa..08472ddf88 100644 --- a/apps/editor/src/markdown/plugins/helper/markInfo.ts +++ b/apps/editor/src/markdown/plugins/helper/markInfo.ts @@ -190,7 +190,11 @@ function customBlock(node: MdNode, start: MdPos, end: MdPos) { if (info) { marks.push( - markInfo(addOffsetPos(start, 2), addOffsetPos(start, syntaxLength + info.length), META) + markInfo( + addOffsetPos(start, syntaxEnd), + addOffsetPos(start, syntaxLength + info.length), + META + ) ); } diff --git a/apps/editor/src/ui/components/toolbar/tablePopupBody.ts b/apps/editor/src/ui/components/toolbar/tablePopupBody.ts index a5ad0798be..29a83562d4 100644 --- a/apps/editor/src/ui/components/toolbar/tablePopupBody.ts +++ b/apps/editor/src/ui/components/toolbar/tablePopupBody.ts @@ -106,18 +106,16 @@ export class TablePopupBody extends Component { return range; } - mounted() { - const { left, top } = this.refs.tableEl.getBoundingClientRect(); - - this.offsetRect = { - left: window.pageXOffset + left, - top: window.pageYOffset + top, - }; - } - updated() { if (!this.props.show) { this.setState({ colIdx: -1, rowIdx: -1 }); + } else if (this.state.colIdx === -1 && this.state.rowIdx === -1) { + const { left, top } = this.refs.tableEl.getBoundingClientRect(); + + this.offsetRect = { + left: window.pageXOffset + left, + top: window.pageYOffset + top, + }; } }