From 26c55f9a6fe5fb5bedc81616bbc39e8eff7761b2 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 24 Mar 2013 04:30:02 +0000 Subject: [PATCH 1/9] monospace block support --- ep_headings/.ep_initialized | 1 + ep_headings/package.json | 7 +++++-- ep_headings/static/css/editor.css | 4 +++- ep_headings/static/js/index.js | 2 +- ep_headings/static/js/shared.js | 3 ++- ep_headings/templates/editbarButtons.ejs | 3 ++- 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 ep_headings/.ep_initialized diff --git a/ep_headings/.ep_initialized b/ep_headings/.ep_initialized new file mode 100644 index 0000000..348ebd9 --- /dev/null +++ b/ep_headings/.ep_initialized @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/ep_headings/package.json b/ep_headings/package.json index b8363c3..081c19f 100644 --- a/ep_headings/package.json +++ b/ep_headings/package.json @@ -1,13 +1,16 @@ { "description": "Adds heading support to Etherpad Lite.", "name": "ep_headings", - "version": "0.1.5", + "version": "0.1.6", "author": "fourplusone ", "contributors": [ { "name": "Matthias Bartelmeß", "email": "mba@fourplusone.de" - } + }, + { "name": "John McLear", + "email": "john@mclear.co.uk" + } ], "dependencies": {}, "engines": { diff --git a/ep_headings/static/css/editor.css b/ep_headings/static/css/editor.css index 395e482..e9c7159 100644 --- a/ep_headings/static/css/editor.css +++ b/ep_headings/static/css/editor.css @@ -13,4 +13,6 @@ h3 { font-size: 1.17em; } h5 { font-size: .83em; } -h6 { font-size: .75em; } \ No newline at end of file +h6 { font-size: .75em; } + +h7 { font-family:monospace; } diff --git a/ep_headings/static/js/index.js b/ep_headings/static/js/index.js index fe42168..8133721 100644 --- a/ep_headings/static/js/index.js +++ b/ep_headings/static/js/index.js @@ -6,7 +6,7 @@ var headingClass = 'heading'; var cssFiles = ['ep_headings/static/css/editor.css']; // 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', 'h7']; var aceRegisterBlockElements = function(){ return tags; } diff --git a/ep_headings/static/js/shared.js b/ep_headings/static/js/shared.js index 88efb51..115bf61 100644 --- a/ep_headings/static/js/shared.js +++ b/ep_headings/static/js/shared.js @@ -1,8 +1,9 @@ var _ = require('ep_etherpad-lite/static/js/underscore'); -var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; +var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']; var collectContentPre = function(hook, context){ + console.log(context); var tname = context.tname; var state = context.state; var lineAttributes = state.lineAttributes diff --git a/ep_headings/templates/editbarButtons.ejs b/ep_headings/templates/editbarButtons.ejs index f1f985e..72a0e02 100644 --- a/ep_headings/templates/editbarButtons.ejs +++ b/ep_headings/templates/editbarButtons.ejs @@ -9,5 +9,6 @@ + - \ No newline at end of file + From 7034b9a266e1daa0d21287b605351896d11da711 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 24 Mar 2013 04:31:07 +0000 Subject: [PATCH 2/9] no need for this file --- ep_headings/.ep_initialized | 1 - 1 file changed, 1 deletion(-) delete mode 100644 ep_headings/.ep_initialized diff --git a/ep_headings/.ep_initialized b/ep_headings/.ep_initialized deleted file mode 100644 index 348ebd9..0000000 --- a/ep_headings/.ep_initialized +++ /dev/null @@ -1 +0,0 @@ -done \ No newline at end of file From 2587b6a84629b7b52b28dd8e1e73184b6c6e8a10 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 24 Mar 2013 22:34:54 +0000 Subject: [PATCH 3/9] remove debug msg --- ep_headings/static/js/shared.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ep_headings/static/js/shared.js b/ep_headings/static/js/shared.js index 115bf61..c5bc327 100644 --- a/ep_headings/static/js/shared.js +++ b/ep_headings/static/js/shared.js @@ -3,7 +3,6 @@ var _ = require('ep_etherpad-lite/static/js/underscore'); var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']; var collectContentPre = function(hook, context){ - console.log(context); var tname = context.tname; var state = context.state; var lineAttributes = state.lineAttributes From 4210b8e5392705eb232d83ce5914151213bc7af1 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 23 Nov 2013 16:59:29 +0000 Subject: [PATCH 4/9] support the file menu, change Style to Heading --- ep_headings/.gitignore | 2 ++ ep_headings/templates/fileMenu.ejs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 ep_headings/.gitignore create mode 100644 ep_headings/templates/fileMenu.ejs diff --git a/ep_headings/.gitignore b/ep_headings/.gitignore new file mode 100644 index 0000000..9a0e97c --- /dev/null +++ b/ep_headings/.gitignore @@ -0,0 +1,2 @@ +.ep_initialized +npm_debug.log diff --git a/ep_headings/templates/fileMenu.ejs b/ep_headings/templates/fileMenu.ejs new file mode 100644 index 0000000..e3d342c --- /dev/null +++ b/ep_headings/templates/fileMenu.ejs @@ -0,0 +1,14 @@ +
+
  • Heading + +
  • + From bdbbd966900207dee60d8b7f63b89cf70078bde5 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 23 Nov 2013 17:00:37 +0000 Subject: [PATCH 5/9] eejs stuff --- ep_headings/ep.json | 3 ++- ep_headings/index.js | 7 ++++++- ep_headings/static/js/index.js | 21 ++++++++++++++++----- ep_headings/templates/editbarButtons.ejs | 4 ++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/ep_headings/ep.json b/ep_headings/ep.json index 1b57928..23cdb3f 100644 --- a/ep_headings/ep.json +++ b/ep_headings/ep.json @@ -14,7 +14,8 @@ "hooks": { "eejsBlock_editbarMenuLeft": "ep_headings/index", "collectContentPre": "ep_headings/static/js/shared", - "collectContentPost": "ep_headings/static/js/shared" + "collectContentPost": "ep_headings/static/js/shared", + "eejsBlock_dd_format":"ep_headings/index" } } ] diff --git a/ep_headings/index.js b/ep_headings/index.js index f392815..399ee19 100644 --- a/ep_headings/index.js +++ b/ep_headings/index.js @@ -4,4 +4,9 @@ var eejs = require('ep_etherpad-lite/node/eejs/'); exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) { args.content = args.content + eejs.require("ep_headings/templates/editbarButtons.ejs"); return cb(); -} \ No newline at end of file +} + +exports.eejsBlock_dd_format = function (hook_name, args, cb) { + args.content = args.content + eejs.require("ep_headings/templates/fileMenu.ejs"); + return cb(); +} diff --git a/ep_headings/static/js/index.js b/ep_headings/static/js/index.js index 8133721..5938f67 100644 --- a/ep_headings/static/js/index.js +++ b/ep_headings/static/js/index.js @@ -13,20 +13,31 @@ var aceRegisterBlockElements = function(){ // Bind the event handler to the toolbar buttons var postAceInit = function(hook, context){ - var hs = $('#heading-selection'); + var hs = $('.heading-selection'); hs.on('change', function(){ var value = $(this).val(); var intValue = parseInt(value,10); if(!_.isNaN(intValue)){ - context.ace.callWithAce(function(ace){ - ace.ace_doInsertHeading(intValue); - },'insertheading' , true); - hs.val("dummy"); + applyHeading(context, intValue); } }) + $('.ep_heading_n').click(function(){applyHeading(context,-1)}); + $('.ep_heading_h1').click(function(){applyHeading(context,0)}); + $('.ep_heading_h2').click(function(){applyHeading(context,1)}); + $('.ep_heading_h3').click(function(){applyHeading(context,2)}); + $('.ep_heading_h4').click(function(){applyHeading(context,3)}); + $('.ep_heading_h5').click(function(){applyHeading(context,4)}); + $('.ep_heading_h6').click(function(){applyHeading(context,5)}); + $('.ep_heading_m').click(function(){applyHeading(context,6)}); }; +function applyHeading(context, heading){ + context.ace.callWithAce(function(ace){ + ace.ace_doInsertHeading(heading); + },'insertheading' , true); + $('.heading-selection').val("dummy"); +} // Our heading attribute will result in a heaading:h1... :h6 class function aceAttribsToClasses(hook, context){ diff --git a/ep_headings/templates/editbarButtons.ejs b/ep_headings/templates/editbarButtons.ejs index 72a0e02..c6370d3 100644 --- a/ep_headings/templates/editbarButtons.ejs +++ b/ep_headings/templates/editbarButtons.ejs @@ -1,6 +1,6 @@
  • -
  • - From 222009702321fdda5cd024afcb01a7273c553b06 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 23 Nov 2013 20:32:03 +0000 Subject: [PATCH 6/9] fix acl --- ep_headings/templates/editbarButtons.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ep_headings/templates/editbarButtons.ejs b/ep_headings/templates/editbarButtons.ejs index c6370d3..fdf6e92 100644 --- a/ep_headings/templates/editbarButtons.ejs +++ b/ep_headings/templates/editbarButtons.ejs @@ -1,5 +1,5 @@
  • -
  • +