*/
M.atto_title = M.atto_title || {
init : function(params) {
- var click_h1 = function(e, elementid) {
- e.preventDefault();
- if (!M.editor_atto.is_active(elementid)) {
- M.editor_atto.focus(elementid);
- }
- document.execCommand('formatBlock', false, '<h1>');
+ var click_h3 = function(e, elementid) {
+ M.atto_title.change_title(e, elementid, '<h3>');
};
- var click_h2 = function(e, elementid) {
- e.preventDefault();
- if (!M.editor_atto.is_active(elementid)) {
- M.editor_atto.focus(elementid);
- }
- document.execCommand('formatBlock', false, '<h2>');
+ var click_h4 = function(e, elementid) {
+ M.atto_title.change_title(e, elementid, '<h4>');
+ };
+ var click_h5 = function(e, elementid) {
+ M.atto_title.change_title(e, elementid, '<h5>');
+ };
+ var click_pre = function(e, elementid) {
+ M.atto_title.change_title(e, elementid, '<pre>');
};
var click_blockquote = function(e, elementid) {
- e.preventDefault();
- if (!M.editor_atto.is_active(elementid)) {
- M.editor_atto.focus(elementid);
- }
- document.execCommand('formatBlock', false, '<blockquote>');
+ M.atto_title.change_title(e, elementid, '<blockquote>');
};
var click_p = function(e, elementid) {
- e.preventDefault();
- if (!M.editor_atto.is_active(elementid)) {
- M.editor_atto.focus(elementid);
- }
- document.execCommand('formatBlock', false, '<p>');
+ M.atto_title.change_title(e, elementid, '<p>');
};
- var h1 = '<h1>' + M.util.get_string('h1', 'atto_title') + '</h1>';
- var h2 = '<h2>' + M.util.get_string('h2', 'atto_title') + '</h2>';
- var blockquote = '<p> ' + M.util.get_string('blockquote', 'atto_title') + '</p>';
- var p = '<p>' + M.util.get_string('p', 'atto_title') + '</p>';
+ var h3 = '<h3>' + M.util.get_string('h3', 'atto_title') + '</h3>';
+ var h4 = '<h4>' + M.util.get_string('h4', 'atto_title') + '</h4>';
+ var h5 = '<h5>' + M.util.get_string('h5', 'atto_title') + '</h5>';
+ var pre = '<pre>' + M.util.get_string('pre', 'atto_title') + '</pre>';
+ var blockquote = '<p> ' + M.util.get_string('blockquote', 'atto_title') + '</p>';
+ var p = '<p>' + M.util.get_string('p', 'atto_title') + '</p>';
M.editor_atto.add_toolbar_menu(params.elementid,
'title',
params.icon,
[
- {'text' : h1, 'handler' : click_h1},
- {'text' : h2, 'handler' : click_h2},
+ {'text' : h3, 'handler' : click_h3},
+ {'text' : h4, 'handler' : click_h4},
+ {'text' : h5, 'handler' : click_h5},
+ {'text' : pre, 'handler' : click_pre},
{'text' : blockquote, 'handler' : click_blockquote},
{'text' : p, 'handler' : click_p}
]);
+ },
+
+ change_title : function(e, elementid, node) {
+ e.preventDefault();
+ if (!M.editor_atto.is_active(elementid)) {
+ M.editor_atto.focus(elementid);
+ }
+ document.execCommand('formatBlock', false, node);
}
};
+