how i can get more headers ?
2 posters
Page 1 of 1
how i can get more headers ?
hi
i want add more headers in the headers button in sceditor
like that :
H2
h3
H4
[h5]H5[/h5]
Re: how i can get more headers ?
Hi @coolkool,
You could use this JavaScript in all the pages to redefine the header command :
Then you'll just need a JavaScript set "in the topics" to parse the tags that weren't parsed server-side.
You could use this JavaScript in all the pages to redefine the header command :
- Code:
$(function() {
if(!$.sceditor) return;
$.sceditor.command.set("headers", {
// Creates the dropdown for both WYSIWYG and Source modes
createDropdown: function(editor, callback) {
var $content = $("<div />");
for (var i=1; i<= 6; i++) {
$(
'<a class="sceditor-header-option" href="#">' +
'<h' + i + '>Heading ' + i + '</h' + i + '>' +
'</a>'
)
.data('headersize', i)
.click(function (e) {
callback($(this).data('headersize'));
editor.closeDropDown(true);
e.preventDefault();
})
.appendTo($content);
}
return $content;
},
// WYSIWYG mode
exec: function(caller) {
var editor = this;
var $content = $.sceditor.command.get("headers").createDropdown(editor, function(size) {
editor.execCommand("formatblock", "<h" + size + ">");
});
editor.createDropDown(caller, "header-picker", $content);
},
// Source mode
txtExec: function(caller) {
var editor = this;
var $content = $.sceditor.command.get("headers").createDropdown(editor, function(size) {
editor.insert('[h' + size + ']', '[/h' + size + ']');
});
editor.createDropDown(caller, "header-picker", $content);
},
tooltip: "Format Headers"
});
});
Then you'll just need a JavaScript set "in the topics" to parse the tags that weren't parsed server-side.
- Code:
$(function() {
for (var a = $('.postbody'), i = 0, j = a.length; i < j; i++) {
if (/\[h\d+\].*?\[\/h\d+\]/i.test(a[i].innerHTML)) {
a[i].innerHTML = a[i].innerHTML.replace(/\[h(\d+)\](.*?)\[\/h\d+\]/ig, '<h$1>$2</h$1>');
}
}
});
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum