summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Bartelmeß <mba@fourplusone.de>2012-04-05 01:07:47 +0200
committerMatthias Bartelmeß <mba@fourplusone.de>2012-04-05 01:07:47 +0200
commit60942b09a44ece04fad24824de98270a80614ab8 (patch)
tree7bd13ec57223f187f9df50ba6ce2ec2e8ed014e6 /src
parent1b383dc9b80d0d721cc7a1052a2e6339dee307db (diff)
downloadetherpad-lite-60942b09a44ece04fad24824de98270a80614ab8.zip
fixing lineHasMarker
Diffstat (limited to 'src')
-rw-r--r--src/static/js/AttributeManager.js14
-rw-r--r--src/static/js/ace2_inner.js4
2 files changed, 13 insertions, 5 deletions
diff --git a/src/static/js/AttributeManager.js b/src/static/js/AttributeManager.js
index 5373a41d..6e3a2490 100644
--- a/src/static/js/AttributeManager.js
+++ b/src/static/js/AttributeManager.js
@@ -7,6 +7,10 @@ var AttributeManager = function(rep, applyChangesetCallback)
this.rep = rep;
this.applyChangesetCallback = applyChangesetCallback;
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({
@@ -21,7 +25,13 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
lineHasMarker: function(lineNum){
// 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){
@@ -80,8 +90,6 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
var builder = Changeset.builder(this.rep.lines.totalWidth());
var hasMarker = this.lineHasMarker(lineNum);
- // TODO
-
if(hasMarker){
ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]), [
[attributeName, attributeValue]
diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js
index 76992259..d4ae599a 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -3320,7 +3320,7 @@ function Ace2Inner(){
}
_.each(mods, function(mod){
- setLineListType.apply(this, mod);
+ setLineListType(mod[0], mod[1]);
});
return true;
}
@@ -4977,7 +4977,7 @@ function Ace2Inner(){
}
_.each(mods, function(mod){
- setLineListType.apply(this, mod);
+ setLineListType(mod[0], mod[1]);
});
}