fix empty selection handles appear on calc

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I56a263711bd034ff1a56357eb5efe713fe076db3
This commit is contained in:
Mert Tumer 2022-03-10 15:36:40 +03:00 committed by Mert Tümer
parent 1b38510012
commit 3335e2f330

View file

@ -7009,6 +7009,8 @@ L.MessageStore = L.Class.extend({
return;
}
this._cleanUpSelectionMessages(this._ownMessages);
var ownMessages = this._ownMessages;
Object.keys(this._ownMessages).forEach(function (msgType) {
callback(ownMessages[msgType]);
@ -7018,5 +7020,17 @@ L.MessageStore = L.Class.extend({
Object.keys(othersMessages).forEach(function (msgType) {
othersMessages[msgType].forEach(callback);
});
},
_cleanUpSelectionMessages: function(messages) {
// must be called only from _replayPrintTwipsMsg !!
// check if textselection is empty
// if it is, we need to handle textselectionstart and textselectionend
// otherwise we get handles without selection and they also may appear in the wrong cell
// but it is also reproducible on the same cell too. e.g. selection handles without selection
if (!messages && !messages['textselection'] && messages['textselection'] !== 'textselection: ')
return;
messages['textselectionstart'] = 'textselectionstart: ';
messages['textselectionend'] = 'textselectionend: ';
}
});