@@ -19,7 +19,7 @@ sf.tags = [
19
19
"name" : "bold" ,
20
20
"tag" : "b" ,
21
21
"src" : "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/bold.svg" ,
22
- "fillers" : [ "[b] " , "[/b] " ] ,
22
+ "fillers" : [ "** " , "** " ] ,
23
23
"formatter" : function ( part1 , part2 ) {
24
24
return "<b>" + part2 + "</b>" ;
25
25
}
@@ -28,7 +28,7 @@ sf.tags = [
28
28
"name" : "italics" ,
29
29
"tag" : "i" ,
30
30
"src" : "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/italic.svg" ,
31
- "fillers" : [ "[i] " , "[/i] " ] ,
31
+ "fillers" : [ "* " , "* " ] ,
32
32
"formatter" : function ( part1 , part2 ) {
33
33
return "<i>" + part2 + "</i>" ;
34
34
}
@@ -42,19 +42,10 @@ sf.tags = [
42
42
return "<u>" + part2 + "</u>" ;
43
43
}
44
44
} ,
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
- } ,
54
45
{
55
46
"name" : "color" ,
56
47
"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" ,
58
49
"fillers" : [ "[color=red]" , "[/color]" ] ,
59
50
"formatter" : function ( part1 , part2 ) {
60
51
return "<span style='color:" + part1 + "'>" + part2 + "</span>" ;
@@ -64,11 +55,20 @@ sf.tags = [
64
55
"name" : "link" ,
65
56
"tag" : "link" ,
66
57
"src" : "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/link.svg" ,
67
- "fillers" : [ "[link=" , "]Link [/link]" ] ,
58
+ "fillers" : [ "[link=URLHERE] " , "[/link]" ] ,
68
59
"formatter" : function ( part1 , part2 ) {
69
60
return "<a href='" + part1 + "' target='_newtab'>" + part2 + "</a>" ;
70
61
}
71
62
} ,
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
+ } ,
72
72
{
73
73
"name" : "easteregg" ,
74
74
"tag" : "easteregg" ,
@@ -110,6 +110,7 @@ sf.init = function() {
110
110
111
111
var icon = document . createElement ( "img" ) ;
112
112
icon . src = sf . tags [ t ] . src ;
113
+ icon . title = sf . tags [ t ] . name ;
113
114
114
115
// Help icon
115
116
if ( sf . tags [ t ] . help ) {
@@ -125,14 +126,9 @@ sf.init = function() {
125
126
sf . formatter . appendChild ( icon ) ;
126
127
continue ;
127
128
}
128
-
129
+
130
+ // Set up code for each icon
129
131
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.
136
132
icon . onclick = function ( event ) {
137
133
var textarea = event . target . parentElement . parentElement . children [ 1 ] ;
138
134
var fillers = event . target . fillers ;
@@ -217,6 +213,7 @@ sf.parseMD = function(text) {
217
213
// Bold, then italics
218
214
text = text . replace ( / \* \* ( .* ?) \* \* / g, "<b>$1</b>" ) ;
219
215
text = text . replace ( / \* ( .* ?) \* / g, "<i>$1</i>" ) ;
216
+ text = text . replace ( / ( h t t p s : | h t t p : | w w w \. ) ( [ ^ \" \> \< ] * $ ) / gm, "<a href='$1$2'>$1$2</a>" ) ;
220
217
return text ;
221
218
}
222
219
0 commit comments