var tag = $(this).attr('p:tag');
var handler = function() {
var text = editor.selection();
var tag = $(this).attr('p:tag');
var handler = function() {
var text = editor.selection();
editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
if (text.length == 0) {
var pos = editor.cursorPosition();
editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
if (text.length == 0) {
var pos = editor.cursorPosition();