@aochuang/client-sdk 1.0.284 → 1.0.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -715,6 +715,16 @@ export default {
|
|
|
715
715
|
end
|
|
716
716
|
}
|
|
717
717
|
},
|
|
718
|
+
getMentionReplaceRange () {
|
|
719
|
+
const range = this.cacheInputRange || this.getSelectionTextRange()
|
|
720
|
+
if (!this.suggestionsNearsetInfo || !this.suggestionsNearsetInfo.isAtContext) {
|
|
721
|
+
return {
|
|
722
|
+
start: range.start,
|
|
723
|
+
end: range.end
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return this.getSuggestionsReplaceRange()
|
|
727
|
+
},
|
|
718
728
|
insertInputText (str) {
|
|
719
729
|
if (this.disabled) {
|
|
720
730
|
return
|
|
@@ -745,10 +755,12 @@ export default {
|
|
|
745
755
|
if (!mentionNode) {
|
|
746
756
|
return
|
|
747
757
|
}
|
|
748
|
-
|
|
758
|
+
const replaceRange = this.getMentionReplaceRange()
|
|
759
|
+
const selectedLength = Math.max(0, replaceRange.end - replaceRange.start)
|
|
760
|
+
const nextLength = this.getInputText().length - selectedLength + (mentionNode.textContent || '').length + 1
|
|
761
|
+
if (this.hasMaxlength() && nextLength > this.maxlength) {
|
|
749
762
|
return
|
|
750
763
|
}
|
|
751
|
-
const replaceRange = this.getSuggestionsReplaceRange()
|
|
752
764
|
this.setSelectionByTextRange(replaceRange.start, replaceRange.end)
|
|
753
765
|
this.insertNodesAtSelection([
|
|
754
766
|
mentionNode,
|