From e2d85b79a50352502e037c0129c281218364408c Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 27 Aug 2007 21:01:42 +0000 Subject: [PATCH] Added underline button to toolbar. Useful for things like book titles. --- controller/Html_cleaner.py | 1 + static/css/style.css | 4 ++++ static/js/Wiki.js | 5 +++++ view/Toolbar.py | 1 + 4 files changed, 11 insertions(+) diff --git a/controller/Html_cleaner.py b/controller/Html_cleaner.py index 5b2153e..ac0fee6 100644 --- a/controller/Html_cleaner.py +++ b/controller/Html_cleaner.py @@ -36,6 +36,7 @@ class Html_cleaner(HTMLParser): 'ul', 'p', 'strong', + 'u', ] # A list of tags that are forcibly removed from the input. Tags that diff --git a/static/css/style.css b/static/css/style.css index 236e706..be738ea 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -86,6 +86,10 @@ ol li { font-style: italic; } +#underline { + text-decoration: underline; +} + #title { font-weight: bold; } diff --git a/static/js/Wiki.js b/static/js/Wiki.js index d928e89..cafaecd 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -101,6 +101,7 @@ Wiki.prototype.populate = function ( result ) { connect( window, "onunload", function ( event ) { self.editor_focused( null, true ); } ); connect( "bold", "onclick", function ( event ) { self.toggle_button( event, "bold" ); } ); connect( "italic", "onclick", function ( event ) { self.toggle_button( event, "italic" ); } ); + connect( "underline", "onclick", function ( event ) { self.toggle_button( event, "underline" ); } ); connect( "title", "onclick", function ( event ) { self.toggle_button( event, "title", "h3" ); } ); connect( "insertUnorderedList", "onclick", function ( event ) { self.toggle_button( event, "insertUnorderedList" ); } ); connect( "insertOrderedList", "onclick", function ( event ) { self.toggle_button( event, "insertOrderedList" ); } ); @@ -442,6 +443,9 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) { // ctrl-i: italic } else if ( code == 73 ) { this.toggle_button( event, "italic" ); + // ctrl-u: underline + } else if ( code == 85 ) { + this.toggle_button( event, "underline" ); // ctrl-t: title } else if ( code == 84 ) { this.toggle_button( event, "title", "h3" ); @@ -498,6 +502,7 @@ Wiki.prototype.update_toolbar = function() { if ( this.focused_editor ) { this.update_button( "bold" ); this.update_button( "italic" ); + this.update_button( "underline" ); this.update_button( "title", "h3" ); this.update_button( "insertUnorderedList" ); this.update_button( "insertOrderedList" ); diff --git a/view/Toolbar.py b/view/Toolbar.py index df0c304..1c6a54a 100644 --- a/view/Toolbar.py +++ b/view/Toolbar.py @@ -8,6 +8,7 @@ class Toolbar( Div ): Ul( Li( Input( type = u"button", value = u"B", id = u"bold", title = u"bold [ctrl-B]", class_ = u"button" ) ), Li( Input( type = u"button", value = u"I", id = u"italic", title = u"italic [ctrl-I]", class_ = u"button" ) ), + Li( Input( type = u"button", value = u"U", id = u"underline", title = u"underline [ctrl-U]", class_ = u"button" ) ), Li( Input( type = u"button", value = u"T", id = u"title", title = u"title [ctrl-T]", class_ = u"button" ) ), Li( Input( type = u"button", value = u"•", id = u"insertUnorderedList", title = u"unordered list [ctrl-U]", class_ = u"button" ) ), Li( Input( type = u"button", value = u"1.", id = u"insertOrderedList", title = u"numbered list [ctrl-1]", class_ = u"button" ) ),