Browse Source

Added a separation in rows for the editor toolbar, this will be handy to bring back the smiley in their own row

Signed-off-by: emanuele <emanuele45@gmail.com>
emanuele 13 years ago
parent
commit
1422ecaa70
2 changed files with 42 additions and 31 deletions
  1. 6 0
      Themes/default/css/jquery.sceditor.css
  2. 36 31
      Themes/default/scripts/jquery.sceditor.js

+ 6 - 0
Themes/default/css/jquery.sceditor.css

@@ -148,6 +148,12 @@ div.sceditor-dropdown, div.sceditor-dropdown div {
 			-khtml-border-radius: 4px;
 			border-radius: 4px;
 		}
+		div.sceditor-row {
+			overflow: hidden;
+			display: block;
+			zoom: 1; /* IE6 */
+			*display: inline;
+		}
 
 		.sceditor-button {
 			float: left;

+ 36 - 31
Themes/default/scripts/jquery.sceditor.js

@@ -250,42 +250,47 @@
 			};
 
 			$toolbar   = $('<div class="sceditor-toolbar" />');
-			var	groups = base.options.toolbar.split("|"),
-				group, buttons, accessibilityName, button, i;
-
-			for (i=0; i < groups.length; i++) {
-				group   = $('<div class="sceditor-group" />');
-				buttons = groups[i].split(",");
-
-				for (var x=0; x < buttons.length; x++) {
-					// the button must be a valid command otherwise ignore it
-					if(!base.commands.hasOwnProperty(buttons[x]))
-						continue;
+			var rows = base.options.toolbar.split("||");
+			for (var r=0; r < rows.length; r++) {
+				var row   = $('<div class="sceditor-row" />');
+				var	groups = rows[r].split("|"),
+					group, buttons, accessibilityName, button, i;
+
+				for (i=0; i < groups.length; i++) {
+					group   = $('<div class="sceditor-group" />');
+					buttons = groups[i].split(",");
+
+					for (var x=0; x < buttons.length; x++) {
+						// the button must be a valid command otherwise ignore it
+						if(!base.commands.hasOwnProperty(buttons[x]))
+							continue;
+
+						accessibilityName = base.commands[buttons[x]].tooltip ? base._(base.commands[buttons[x]].tooltip) : buttons[x];
+						
+						button = $('<a class="sceditor-button sceditor-button-' + buttons[x] +
+							' " unselectable="on"><div unselectable="on">' + accessibilityName + '</div></a>');
 
-					accessibilityName = base.commands[buttons[x]].tooltip ? base._(base.commands[buttons[x]].tooltip) : buttons[x];
-					
-					button = $('<a class="sceditor-button sceditor-button-' + buttons[x] +
-						' " unselectable="on"><div unselectable="on">' + accessibilityName + '</div></a>');
+						if(base.commands[buttons[x]].hasOwnProperty("tooltip"))
+							button.attr('title', base._(base.commands[buttons[x]].tooltip));
+							
+						if(base.commands[buttons[x]].exec)
+							button.data('sceditor-wysiwygmode', true);
+						else
+							button.addClass('disabled');
+							
+						if(base.commands[buttons[x]].txtExec)
+							button.data('sceditor-txtmode', true);
 
-					if(base.commands[buttons[x]].hasOwnProperty("tooltip"))
-						button.attr('title', base._(base.commands[buttons[x]].tooltip));
-						
-					if(base.commands[buttons[x]].exec)
-						button.data('sceditor-wysiwygmode', true);
-					else
-						button.addClass('disabled');
-						
-					if(base.commands[buttons[x]].txtExec)
-						button.data('sceditor-txtmode', true);
+						// add the click handler for the button
+						button.data("sceditor-command", buttons[x]);
+						button.click(buttonClick);
 
-					// add the click handler for the button
-					button.data("sceditor-command", buttons[x]);
-					button.click(buttonClick);
+						group.append(button);
+					}
 
-					group.append(button);
+					row.append(group);
 				}
-
-				$toolbar.append(group);
+				$toolbar.append(row);
 			}
 
 			// append the toolbar to the toolbarContainer option if given