Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 2fe6737

Browse files
author
Daniel
committed
Last minute fixes
1 parent b81a9cc commit 2fe6737

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

javascript.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sf.tags = [
1919
"name": "bold",
2020
"tag": "b",
2121
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/bold.svg",
22-
"fillers": ["[b]", "[/b]"],
22+
"fillers": ["**", "**"],
2323
"formatter": function(part1, part2) {
2424
return "<b>" + part2 + "</b>";
2525
}
@@ -28,7 +28,7 @@ sf.tags = [
2828
"name": "italics",
2929
"tag": "i",
3030
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/italic.svg",
31-
"fillers": ["[i]", "[/i]"],
31+
"fillers": ["*", "*"],
3232
"formatter": function(part1, part2) {
3333
return "<i>" + part2 + "</i>";
3434
}
@@ -42,19 +42,10 @@ sf.tags = [
4242
return "<u>" + part2 + "</u>";
4343
}
4444
},
45-
{
46-
"name": "code",
47-
"tag": "code",
48-
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/code-view.svg",
49-
"fillers": ["[code]", "[/code]"],
50-
"formatter": function(part1, part2) {
51-
return "<code>" + part2 + "</code>";
52-
}
53-
},
5445
{
5546
"name": "color",
5647
"tag": "color",
57-
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/font-color.svg",
48+
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Design/paint-brush-line.svg",
5849
"fillers": ["[color=red]", "[/color]"],
5950
"formatter": function(part1, part2) {
6051
return "<span style='color:" + part1 + "'>" + part2 + "</span>";
@@ -64,11 +55,20 @@ sf.tags = [
6455
"name": "link",
6556
"tag": "link",
6657
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/link.svg",
67-
"fillers": ["[link=", "]Link[/link]"],
58+
"fillers": ["[link=URLHERE]", "[/link]"],
6859
"formatter": function(part1, part2) {
6960
return "<a href='" + part1 + "' target='_newtab'>" + part2 + "</a>";
7061
}
7162
},
63+
{
64+
"name": "code",
65+
"tag": "code",
66+
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/code-view.svg",
67+
"fillers": ["[code]", "[/code]"],
68+
"formatter": function(part1, part2) {
69+
return "<code>" + part2 + "</code>";
70+
}
71+
},
7272
{
7373
"name": "easteregg",
7474
"tag": "easteregg",
@@ -110,6 +110,7 @@ sf.init = function() {
110110

111111
var icon = document.createElement("img");
112112
icon.src = sf.tags[t].src;
113+
icon.title = sf.tags[t].name;
113114

114115
// Help icon
115116
if (sf.tags[t].help) {
@@ -125,14 +126,9 @@ sf.init = function() {
125126
sf.formatter.appendChild(icon);
126127
continue;
127128
}
128-
129+
130+
// Set up code for each icon
129131
icon.fillers = sf.tags[t].fillers;
130-
131-
// This may look janky, but with Chrome extensions,
132-
// Everything is jank. Basically I have to set custom
133-
// properties to the element in order to get data without
134-
// having functions, which would require some "injection"
135-
// garbage.
136132
icon.onclick = function(event) {
137133
var textarea = event.target.parentElement.parentElement.children[1];
138134
var fillers = event.target.fillers;
@@ -217,6 +213,7 @@ sf.parseMD = function(text) {
217213
// Bold, then italics
218214
text = text.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>");
219215
text = text.replace(/\*(.*?)\*/g, "<i>$1</i>");
216+
text = text.replace(/(https:|http:|www\.)([^\"\>\<]*$)/gm, "<a href='$1$2'>$1$2</a>");
220217
return text;
221218
}
222219

0 commit comments

Comments
 (0)