This repository was archived by the owner on Oct 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ var tags = [
50
50
"name" : "link" ,
51
51
"tag" : "link" ,
52
52
"src" : "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/link.svg" ,
53
- "fillers" : [ "[link=https://example.com" , "]Link [/link]" ] ,
53
+ "fillers" : [ "[link=https://example.com] " , "[/link]" ] ,
54
54
"formatter" : function ( part1 , part2 ) {
55
55
return "<a href='" + part1 + "' target='_newtab'>" + part2 + "</a>" ;
56
56
}
@@ -130,6 +130,10 @@ setTimeout(function() {
130
130
textarea . selectionEnd
131
131
) ;
132
132
133
+ if ( selection . length == 0 ) {
134
+ selection = "text" ;
135
+ }
136
+
133
137
// Generate new text, if just 1 filler, ex [br], don't attempt
134
138
// to use second part.
135
139
var newText = textarea . value . substring ( 0 , textarea . selectionStart )
@@ -179,7 +183,7 @@ function format() {
179
183
comments [ c ] . style . marginLeft = "3px" ;
180
184
}
181
185
182
- comments [ c ] . innerHTML = parse ( comments [ c ] . innerText ) ;
186
+ comments [ c ] . innerHTML = parse ( comments [ c ] . innerHTML ) ;
183
187
}
184
188
}
185
189
@@ -205,7 +209,8 @@ function parse(text) {
205
209
206
210
// If just 1 tag (Ex [br])
207
211
if ( tags [ t ] . fillers . length > 1 ) {
208
- regex += "(.*)" ;
212
+ // Lazy matching (?)
213
+ regex += "(.*?)" ;
209
214
210
215
// Second part of tag
211
216
regex += startBracket ;
Original file line number Diff line number Diff line change 1
1
// Loads javascript onto page
2
+ // Dirty method.
2
3
{ var s = document . createElement ( 'script' ) ;
3
4
s . src = chrome . extension . getURL ( 'smod.js' ) ;
4
5
( document . head || document . documentElement ) . appendChild ( s ) ; }
You can’t perform that action at this time.
0 commit comments