* 转发选区到 ProseMirror
()
| 1550 | * 转发选区到 ProseMirror |
| 1551 | */ |
| 1552 | private forwardSelection(): void { |
| 1553 | const pos = this.getPos(); |
| 1554 | if (pos === undefined) return; |
| 1555 | |
| 1556 | const { from, to } = this.cm.state.selection.main; |
| 1557 | const start = pos + 1 + from; |
| 1558 | const end = pos + 1 + to; |
| 1559 | |
| 1560 | const selection = TextSelection.create(this.view.state.doc, start, end); |
| 1561 | |
| 1562 | if (!this.view.state.selection.eq(selection)) { |
| 1563 | this.view.dispatch(this.view.state.tr.setSelection(selection)); |
| 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | /** |
| 1568 | * 跳出代码块 |
no test coverage detected