summaryrefslogtreecommitdiff
path: root/src/static/js
diff options
context:
space:
mode:
authorMatthias Bartelmeß <mba@fourplusone.de>2012-04-07 02:14:19 +0200
committerMatthias Bartelmeß <mba@fourplusone.de>2012-04-07 02:14:19 +0200
commit2db74150eef92bae40f4a2a3f2c3de798d24127e (patch)
tree60e2f0fbbd91df1c607829241cbf95336fd547da /src/static/js
parenta0235126e420c536dc2f54b730ea58766f1857c3 (diff)
downloadetherpad-lite-2db74150eef92bae40f4a2a3f2c3de798d24127e.zip
linestylefilter now uses attributemanager to find lineattributemarkers
Diffstat (limited to 'src/static/js')
-rw-r--r--src/static/js/linestylefilter.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/static/js/linestylefilter.js b/src/static/js/linestylefilter.js
index f328bd56..1cbfac29 100644
--- a/src/static/js/linestylefilter.js
+++ b/src/static/js/linestylefilter.js
@@ -32,6 +32,8 @@ var Changeset = require('./Changeset');
var hooks = require('./pluginfw/hooks');
var linestylefilter = {};
var _ = require('./underscore');
+var AttributeManager = require('./AttributeManager');
+
linestylefilter.ATTRIB_CLASSES = {
'bold': 'tag:b',
@@ -40,6 +42,9 @@ linestylefilter.ATTRIB_CLASSES = {
'strikethrough': 'tag:s'
};
+var lineAttributeMarker = 'lineAttribMarker';
+exports.lineAttributeMarker = lineAttributeMarker;
+
linestylefilter.getAuthorClassName = function(author)
{
return "author-" + author.replace(/[^a-y0-9]/g, function(c)
@@ -68,14 +73,19 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun
function attribsToClasses(attribs)
{
var classes = '';
+ var isLineAttribMarker = false;
+
Changeset.eachAttribNumber(attribs, function(n)
{
- var key = apool.getAttribKey(n);
+ var key = apool.getAttribKey(n);
if (key)
{
var value = apool.getAttribValue(n);
if (value)
{
+ if (!isLineAttribMarker && _.indexOf(AttributeManager.lineAttributes, key) >= 0){
+ isLineAttribMarker = true;
+ }
if (key == 'author')
{
classes += ' ' + linestylefilter.getAuthorClassName(value);
@@ -99,10 +109,12 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun
key: key,
value: value
}, " ", " ", "");
- }
+ }
}
}
});
+
+ if(isLineAttribMarker) classes += ' ' + lineAttributeMarker;
return classes.substring(1);
}