ep_font_color
Advanced tools
Comparing version 0.0.7 to 0.0.9
{ | ||
"description": "Apply colors to fonts", | ||
"name": "ep_font_color", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "John McLear", |
@@ -33,13 +33,17 @@ var _, $, jQuery; | ||
function aceAttribsToClasses(hook, context){ | ||
if(context.key == 'colors'){ | ||
return ['colors:' + context.value ]; | ||
if(context.key.indexOf("color:") !== -1){ | ||
var color = /(?:^| )color:([A-Za-z0-9]*)/.exec(context.key); | ||
return ['color:' + color[1] ]; | ||
} | ||
if(context.key == 'color'){ | ||
return ['color:' + context.value ]; | ||
} | ||
} | ||
// Here we convert the class colors:h1 into a tag | ||
// Here we convert the class color:red into a tag | ||
exports.aceCreateDomLine = function(name, context){ | ||
var cls = context.cls; | ||
var domline = context.domline; | ||
var colorsType = /(?:^| )colors:([A-Za-z0-9]*)/.exec(cls); | ||
var colorsType = /(?:^| )color:([A-Za-z0-9]*)/.exec(cls); | ||
@@ -76,7 +80,7 @@ var tagIndex; | ||
documentAttributeManager.setAttributesOnRange(rep.selStart, rep.selEnd, [ | ||
['colors', colors[level]] | ||
['color', colors[level]] | ||
]); | ||
}else{ | ||
documentAttributeManager.setAttributesOnRange(rep.selStart, rep.selEnd, [ | ||
['colors', ''] | ||
['color', ''] | ||
]); | ||
@@ -83,0 +87,0 @@ } |
@@ -6,9 +6,5 @@ var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var collectContentPre = function(hook, context){ | ||
var tname = context.tname; | ||
var state = context.state; | ||
var lineAttributes = state.lineAttributes | ||
var tagIndex = _.indexOf(colors, tname); | ||
if(tagIndex >= 0){ | ||
lineAttributes['color'] = colors[tagIndex]; | ||
var color = /(?:^| )color:([A-Za-z0-9]*)/.exec(context.cls); | ||
if(color && color[1]){ | ||
context.cc.doAttrib(context.state, color[0]); | ||
} | ||
@@ -18,2 +14,3 @@ }; | ||
var collectContentPost = function(hook, context){ | ||
/* | ||
var tname = context.tname; | ||
@@ -27,2 +24,3 @@ var state = context.state; | ||
} | ||
*/ | ||
}; | ||
@@ -29,0 +27,0 @@ |
Sorry, the diff of this file is not supported yet
8142
12
174