ep_font_family
Advanced tools
Comparing version 0.2.1 to 0.2.3
@@ -22,3 +22,4 @@ { | ||
"stylesForExport" : "ep_font_family/index", | ||
"exportHtmlAdditionalTags" : "ep_font_family/index" | ||
"exportHtmlAdditionalTags" : "ep_font_family/index", | ||
"asyncLineHTMLForExport": "ep_font_family/index" | ||
} | ||
@@ -25,0 +26,0 @@ } |
21
index.js
var eejs = require('ep_etherpad-lite/node/eejs/'); | ||
var fonts = ["arial", "times-new-roman", "calibri", "helvetica", "courier", "palatino", "garamond", "bookman", "avant-garde"]; | ||
var fonts = ["fontarial", "fonttimes-new-roman", "fontcalibri", "fonthelvetica", "fontcourier", "fontpalatino", "fontgaramond", "fontbookman", "fontavant-garde"]; | ||
var fs = require('fs'); | ||
@@ -27,3 +27,3 @@ | ||
var font = fonts[i]; | ||
attr[font] = 'tag:'+font; | ||
attr[font] = 'tag:font'+font; | ||
}; | ||
@@ -48,1 +48,18 @@ cb(attr); | ||
}; | ||
exports.asyncLineHTMLForExport = function (hook, context, cb) { | ||
cb(rewriteLine); | ||
} | ||
function rewriteLine(context){ | ||
var lineContent = context.lineContent; | ||
fonts.forEach(function(font){ | ||
if(lineContent){ | ||
var fontName = font.substring(4); | ||
lineContent = lineContent.replace("<"+font, "<span style='font-family:"+fontName+"'"); | ||
lineContent = lineContent.replace("</"+font, "</span"); | ||
} | ||
}); | ||
return lineContent; | ||
} |
{ | ||
"description": "Add support for different Fonts", | ||
"name": "ep_font_family", | ||
"version": "0.2.1", | ||
"version": "0.2.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "John McLear", |
var $, jQuery; | ||
var $ = require('ep_etherpad-lite/static/js/rjquery').$; | ||
var fonts = ["arial", "times-new-roman", "calibri", "helvetica", "courier", "palatino", "garamond", "bookman", "avant-garde"]; | ||
var fonts = ["fontarial", "fonttimes-new-roman", "fontcalibri", "fonthelvetica", "fontcourier", "fontpalatino", "fontgaramond", "fontbookman", "fontavant-garde"]; | ||
@@ -13,5 +13,6 @@ /***** | ||
$.each(fonts, function(k, font){ | ||
font = font.substring(4); | ||
var fontString = capitaliseFirstLetter(font) | ||
fontString = fontString.split("-").join(" "); | ||
fontFamily.append("<option value='"+font+"'>"+fontString+"</option>"); | ||
fontFamily.append("<option value='font"+font+"'>"+fontString+"</option>"); | ||
}); | ||
@@ -18,0 +19,0 @@ fontFamily.on('change', function(){ |
@@ -6,3 +6,3 @@ exports.collectContentPre = function(hook, context){ | ||
var tagIndex = tname; | ||
var fonts = ["arial", "times-new-roman", "calibri", "helvetica", "courier", "palatino", "garamond", "bookman", "avant-garde"]; | ||
var fonts = ["fontarial", "fonttimes-new-roman", "fontcalibri", "fonthelvetica", "fontcourier", "fontpalatino", "fontgaramond", "fontbookman", "fontavant-garde"]; | ||
if(fonts.indexOf(tname) !== -1){ | ||
@@ -9,0 +9,0 @@ context.cc.doAttrib(state, tname); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8877
231