Improvement: #414 Add functional bracket auto-completion (#428)

* Improvement: #414 Add functional bracket auto-completion

* bugFix: #414 wrong action with delete auto-complation function

* bugfix: Fixed bullet order list chinese input error
This commit is contained in:
enyaxu 2018-07-27 22:54:56 +08:00 committed by Ran Luo
parent 41736a88e5
commit 486eb933b0

View File

@ -407,6 +407,19 @@ const updateCtrl = ContentState => {
const inputChar = text.charAt(+offset - 1)
const preInputChar = text.charAt(+offset - 2)
const postInputChar = text.charAt(+offset)
/* eslint-disable no-useless-escape */
if (
(event.inputType.indexOf('delete') === -1) &&
(inputChar === postInputChar) &&
(
(autoPairQuote && /[']{1}/.test(inputChar)) ||
(autoPairQuote && /["]{1}/.test(inputChar)) ||
(autoPairBracket && /[\}\]\)]{1}/.test(inputChar)) ||
(autoPairMarkdownSyntax && /[*_]{1}/.test(inputChar))
)
) {
text = text.substring(0, offset) + text.substring(offset + 1)
} else {
/* eslint-disable no-useless-escape */
// Not Unicode aware, since things like \p{Alphabetic} or \p{L} are not supported yet
if (
@ -424,6 +437,7 @@ const updateCtrl = ContentState => {
text = text.substring(0, offset) + text.substring(offset + 1)
}
}
}
block.text = text
if (beginRules['reference_definition'].test(text)) {
needRenderAll = true