Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
Line 160:
templateTools[buttonId] = {
type: 'element',
element: (function(syntax, title) {
return
.
.
'
'
'border
'
'
'
'font-
.hover(
function() { $(this).css('background', '#eaecf0'); }, function() { $(this).css('background', '#f8f9fa'); }
)
.click(function(e) {
e.preventDefault();
// Get the textarea
const textarea = $('#wpTextbox1')[0];
if (textarea) {
// Insert the template syntax at cursor position
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
const text = textarea.value;
textarea.value = text.substring(0, start) +
// Move cursor to end of inserted text
textarea.selectionStart = textarea.selectionEnd = start +
textarea.focus();
}
});
};
})(templateSyntax, displayTitle)
};
}
|