mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
[fix] Ignore default line attribs when detecting edges of changeset (#3420)
When comparing original content with the changes made by the user, we need to ignore some line attribs that are added by content collector, otherwise we would consider the change started on the first char of the line -- the '*' that is added when line has line attribs. In order to be able to handle both #3354 and #3118, we need to take into account both the styles attribs (to fix #3354) and the line attribs defined by any of the plugins (to fix #3118), but we can ignore those extra line attribs that are added by Etherpad and do not add any functionality (`'lmkr', 'insertorder', 'start'`).
This commit is contained in:
parent
7729e5a1a9
commit
58c3154769
3 changed files with 117 additions and 8 deletions
|
@ -1778,19 +1778,15 @@ function Ace2Inner(){
|
|||
strikethrough: true,
|
||||
list: true
|
||||
};
|
||||
var OTHER_INCORPED_ATTRIBS = {
|
||||
insertorder: true,
|
||||
author: true
|
||||
};
|
||||
|
||||
function isStyleAttribute(aname)
|
||||
{
|
||||
return !!STYLE_ATTRIBS[aname];
|
||||
}
|
||||
|
||||
function isOtherIncorpedAttribute(aname)
|
||||
function isDefaultLineAttribute(aname)
|
||||
{
|
||||
return !!OTHER_INCORPED_ATTRIBS[aname];
|
||||
return AttributeManager.DEFAULT_LINE_ATTRIBUTES.indexOf(aname) !== -1;
|
||||
}
|
||||
|
||||
function insertDomLines(nodeToAddAfter, infoStructs, isTimeUp)
|
||||
|
@ -2757,9 +2753,12 @@ function Ace2Inner(){
|
|||
|
||||
function analyzeChange(oldText, newText, oldAttribs, newAttribs, optSelStartHint, optSelEndHint)
|
||||
{
|
||||
// we need to take into account both the styles attributes & attributes defined by
|
||||
// the plugins, so basically we can ignore only the default line attribs used by
|
||||
// Etherpad
|
||||
function incorpedAttribFilter(anum)
|
||||
{
|
||||
return !isOtherIncorpedAttribute(rep.apool.getAttribKey(anum));
|
||||
return !isDefaultLineAttribute(rep.apool.getAttribKey(anum));
|
||||
}
|
||||
|
||||
function attribRuns(attribs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue