mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-20 06:29:53 +01:00
fixing lineHasMarker
This commit is contained in:
parent
1b383dc9b8
commit
60942b09a4
2 changed files with 13 additions and 5 deletions
|
@ -7,6 +7,10 @@ var AttributeManager = function(rep, applyChangesetCallback)
|
||||||
this.rep = rep;
|
this.rep = rep;
|
||||||
this.applyChangesetCallback = applyChangesetCallback;
|
this.applyChangesetCallback = applyChangesetCallback;
|
||||||
this.author = '';
|
this.author = '';
|
||||||
|
|
||||||
|
// If the first char in a line has one of the following attributes
|
||||||
|
// it will be considered as a line marker
|
||||||
|
this.lineAttributes = ['list'];
|
||||||
};
|
};
|
||||||
|
|
||||||
AttributeManager.prototype = _(AttributeManager.prototype).extend({
|
AttributeManager.prototype = _(AttributeManager.prototype).extend({
|
||||||
|
@ -21,7 +25,13 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
|
||||||
|
|
||||||
lineHasMarker: function(lineNum){
|
lineHasMarker: function(lineNum){
|
||||||
// get "list" attribute of first char of line
|
// get "list" attribute of first char of line
|
||||||
return this.getAttributeOnLine(lineNum, 'list');
|
var that = this;
|
||||||
|
|
||||||
|
return _.find(this.lineAttributes, function(attribute){
|
||||||
|
return that.getAttributeOnLine(lineNum, attribute) != '';
|
||||||
|
}) !== undefined;
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getAttributeOnLine: function(lineNum, attributeName){
|
getAttributeOnLine: function(lineNum, attributeName){
|
||||||
|
@ -80,8 +90,6 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
|
||||||
var builder = Changeset.builder(this.rep.lines.totalWidth());
|
var builder = Changeset.builder(this.rep.lines.totalWidth());
|
||||||
var hasMarker = this.lineHasMarker(lineNum);
|
var hasMarker = this.lineHasMarker(lineNum);
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
if(hasMarker){
|
if(hasMarker){
|
||||||
ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]), [
|
ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]), [
|
||||||
[attributeName, attributeValue]
|
[attributeName, attributeValue]
|
||||||
|
|
|
@ -3320,7 +3320,7 @@ function Ace2Inner(){
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(mods, function(mod){
|
_.each(mods, function(mod){
|
||||||
setLineListType.apply(this, mod);
|
setLineListType(mod[0], mod[1]);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4977,7 +4977,7 @@ function Ace2Inner(){
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(mods, function(mod){
|
_.each(mods, function(mod){
|
||||||
setLineListType.apply(this, mod);
|
setLineListType(mod[0], mod[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue