ep_font_color
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -8,2 +8,3 @@ { | ||
"aceInitialized": "ep_font_color/static/js/index", | ||
"aceEditorCSS": "ep_font_color/static/js/index", | ||
"aceCreateDomLine": "ep_font_color/static/js/index", | ||
@@ -17,3 +18,5 @@ "aceAttribsToClasses": "ep_font_color/static/js/index", | ||
"collectContentPost": "ep_font_color/static/js/shared", | ||
"getLineHTMLForExport": "ep_font_color/index", | ||
"exportHtmlAdditionalTagsWithData": "ep_font_color/exportHTML", | ||
"stylesForExport": "ep_font_color/exportHTML", | ||
"getLineHTMLForExport": "ep_font_color/exportHTML", | ||
"eejsBlock_dd_format":"ep_font_color/index" | ||
@@ -20,0 +23,0 @@ } |
25
index.js
var eejs = require('ep_etherpad-lite/node/eejs/'); | ||
var Changeset = require("ep_etherpad-lite/static/js/Changeset"); | ||
exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) { | ||
@@ -12,25 +11,1 @@ args.content = args.content + eejs.require("ep_font_color/templates/editbarButtons.ejs"); | ||
} | ||
function getInlineStyle(color) { | ||
return "color: "+color+";"; | ||
} | ||
// line, apool,attribLine,text | ||
exports.getLineHTMLForExport = function (hook, context) { | ||
var header = _analyzeLine(context.attribLine, context.apool); | ||
if (header) { | ||
var inlineStyle = getInlineStyle(header); | ||
return "<" + header + " style=\"" + inlineStyle + "\">" + context.text.substring(1) + "</" + header + ">"; | ||
} | ||
} | ||
function _analyzeLine(alineAttrs, apool) { | ||
var header = null; | ||
if (alineAttrs) { | ||
var opIter = Changeset.opIterator(alineAttrs); | ||
if (opIter.hasNext()) { | ||
var op = opIter.next(); | ||
header = Changeset.opAttributeValue(op, 'colors', apool); | ||
} | ||
} | ||
return header; | ||
} |
{ | ||
"description": "Apply colors to fonts", | ||
"name": "ep_font_color", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"license": "Apache-2.0", | ||
"author": { | ||
@@ -12,3 +13,7 @@ "name": "John McLear", | ||
"node": "*" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/JohnMcLear/ep_font_color.git" | ||
} | ||
} |
@@ -5,3 +5,3 @@ var _, $, jQuery; | ||
var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var colorsClass = 'colors'; | ||
var cssFiles = ["ep_font_color/static/css/color.css"]; | ||
@@ -32,3 +32,3 @@ // All our colors are block elements, so we just return them. | ||
// Our colors attribute will result in a heaading:h1... :h6 class | ||
// Our colors attribute will result in a color:red... _yellow class | ||
function aceAttribsToClasses(hook, context){ | ||
@@ -54,8 +54,8 @@ if(context.key.indexOf("color:") !== -1){ | ||
if (tagIndex !== undefined && tagIndex >= 0){ | ||
var tag = colors[tagIndex]; | ||
var modifier = { | ||
extraOpenTags: '<span style="color: ' + tag + ';">', | ||
extraCloseTags: '</span>', | ||
extraOpenTags: '', | ||
extraCloseTags: '', | ||
cls: cls | ||
@@ -69,5 +69,4 @@ }; | ||
// Find out which lines are selected and assign them the colors attribute. | ||
// Passing a level >= 0 will set a colors on the selected lines, level < 0 | ||
// Find out which lines are selected and assign them the color attribute. | ||
// Passing a level >= 0 will set a colors on the selected lines, level < 0 | ||
// will remove it | ||
@@ -80,12 +79,9 @@ function doInsertColors(level){ | ||
} | ||
if(level >= 0){ | ||
documentAttributeManager.setAttributesOnRange(rep.selStart, rep.selEnd, [ | ||
['color', colors[level]] | ||
]); | ||
}else{ | ||
documentAttributeManager.setAttributesOnRange(rep.selStart, rep.selEnd, [ | ||
['color', ''] | ||
]); | ||
var new_color = ["color", ""]; | ||
if(level >= 0) { | ||
new_color = ["color", colors[level]]; | ||
} | ||
documentAttributeManager.setAttributesOnRange(rep.selStart, rep.selEnd, [new_color]); | ||
} | ||
@@ -100,3 +96,7 @@ | ||
function aceEditorCSS(){ | ||
return cssFiles; | ||
}; | ||
// Export all hooks | ||
@@ -106,1 +106,2 @@ exports.aceInitialized = aceInitialized; | ||
exports.aceAttribsToClasses = aceAttribsToClasses; | ||
exports.aceEditorCSS = aceEditorCSS; |
@@ -8,3 +8,3 @@ var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
if(color && color[1]){ | ||
context.cc.doAttrib(context.state, color[0]); | ||
context.cc.doAttrib(context.state, "color::" + color[1]); | ||
} | ||
@@ -11,0 +11,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
30091
19
420
1