Content deleted Content added
m Not so simple |
m Bold and italics supported by default. |
||
Line 12:
{
// Setup key handler.
window.addEventListener("
{
if(e.altKey && e.key.match(/\d/g))
{
var number = e.key === "0" ? 10 : parseInt(e.key);
if(!this.inserts[number - 1]) return;
this.insert(number - 1);
}
else if(e.ctrlKey && (e.key == "i" || e.key == "b"))
{
this.insert(e.key);
}
});
Line 37 ⟶ 41:
},
insert: function(
{
const txtarea = document.getElementById("wpTextbox1");
Line 51 ⟶ 55:
}
var tag;
// Put selected text into the tag. Replace \n's with actual newlines.▼
if(id == "i") tag = "''_''";
var result = this.inserts[number].replace("_", txtarea.value.substring(start, end)).replace(/\\n/g, "\n");▼
else if(id == "b") tag = "'''_'''";
else tag = this.inserts[id];
▲ var result =
// Update txtarea.
|