fix: #921 reference link render error (#947)

This commit is contained in:
Ran Luo 2019-04-15 22:54:13 +08:00 committed by Felix Häusler
parent 991441190d
commit d9f64bab58
3 changed files with 4 additions and 3 deletions

View File

@ -34,13 +34,14 @@ const updateCtrl = ContentState => {
} }
ContentState.prototype.checkNeedRender = function (cursor = this.cursor) { ContentState.prototype.checkNeedRender = function (cursor = this.cursor) {
const { labels } = this.stateRender
const { start: cStart, end: cEnd } = cursor const { start: cStart, end: cEnd } = cursor
const startBlock = this.getBlock(cStart.key) const startBlock = this.getBlock(cStart.key)
const endBlock = this.getBlock(cEnd.key) const endBlock = this.getBlock(cEnd.key)
const startOffset = cStart.offset const startOffset = cStart.offset
const endOffset = cEnd.offset const endOffset = cEnd.offset
for (const token of tokenizer(startBlock.text)) { for (const token of tokenizer(startBlock.text, undefined, undefined, labels)) {
if (token.type === 'text') continue if (token.type === 'text') continue
const { start, end } = token.range const { start, end } = token.range
const textLen = startBlock.text.length const textLen = startBlock.text.length
@ -50,7 +51,7 @@ const updateCtrl = ContentState => {
return true return true
} }
} }
for (const token of tokenizer(endBlock.text)) { for (const token of tokenizer(endBlock.text, undefined, undefined, labels)) {
if (token.type === 'text') continue if (token.type === 'text') continue
const { start, end } = token.range const { start, end } = token.range
const textLen = endBlock.text.length const textLen = endBlock.text.length

View File

@ -203,7 +203,6 @@ class Keyboard {
if (!start || !end) { if (!start || !end) {
return return
} }
if ( if (
!this.isComposed !this.isComposed
) { ) {

View File

@ -6,6 +6,7 @@ export default function referenceLink (h, cursor, block, token, outerClass) {
const labelClass = className === CLASS_OR_ID['AG_GRAY'] const labelClass = className === CLASS_OR_ID['AG_GRAY']
? CLASS_OR_ID['AG_REFERENCE_LABEL'] ? CLASS_OR_ID['AG_REFERENCE_LABEL']
: className : className
const { start, end } = token.range const { start, end } = token.range
const { const {
anchor, anchor,