ep_headings
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -17,3 +17,4 @@ { | ||
"collectContentPre": "ep_headings/static/js/shared", | ||
"collectContentPost": "ep_headings/static/js/shared" | ||
"collectContentPost": "ep_headings/static/js/shared", | ||
"getLineHTMLForExport": "ep_headings/index" | ||
} | ||
@@ -20,0 +21,0 @@ } |
52
index.js
@@ -1,7 +0,53 @@ | ||
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) { | ||
args.content = args.content + eejs.require("ep_headings/templates/editbarButtons.ejs"); | ||
return cb(); | ||
} | ||
} | ||
function getInlineStyle(header) { | ||
switch (header) { | ||
case "h1": | ||
return "font-size: 2.0em;line-height: 120%;"; | ||
break; | ||
case "h2": | ||
return "font-size: 1.5em;line-height: 120%;"; | ||
break; | ||
case "h3": | ||
return "font-size: 1.17em;line-height: 120%;"; | ||
break; | ||
case "h4": | ||
return "line-height: 120%;"; | ||
break; | ||
case "h5": | ||
return "font-size: 0.83em;line-height: 120%;"; | ||
break; | ||
case "h6": | ||
return "font-size: 0.75em;line-height: 120%;"; | ||
break; | ||
case "code": | ||
return "font-family: monospace"; | ||
} | ||
return ""; | ||
} | ||
// 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, 'heading', apool); | ||
} | ||
} | ||
return header; | ||
} |
{ | ||
"description": "Adds heading support to Etherpad Lite.", | ||
"name": "ep_headings", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"author": "fourplusone <info@fourplusone.de>", | ||
"contributors": [ | ||
{ | ||
"name": "Matthias Bartelmeß", | ||
"email": "mba@fourplusone.de" | ||
} | ||
{ | ||
"name": "Matthias Bartelmeß", | ||
"email": "mba@fourplusone.de" | ||
}, | ||
{ | ||
"name": "John McLear", | ||
"email": "john@mclear.co.uk" | ||
}, | ||
{ | ||
"name": "Gedion Woldeselassie (https://github.com/gedion)", | ||
"email": "gwy321@gmail.com" | ||
} | ||
], | ||
@@ -12,0 +20,0 @@ "dependencies": {}, |
@@ -9,3 +9,3 @@ var _, $, jQuery; | ||
// All our tags are block elements, so we just return them. | ||
var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; | ||
var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'code']; | ||
var aceRegisterBlockElements = function(){ | ||
@@ -12,0 +12,0 @@ return tags; |
var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; | ||
var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'code']; | ||
@@ -5,0 +5,0 @@ var collectContentPre = function(hook, context){ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8408
10
208