Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite575bdc

Browse files
committed
fix wrong offset...
fixichord/At.js#247 and related toichord#31
1 parent9fbe44f commite575bdc

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

‎dist/jquery.caret.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ InputCaret = (function() {
233233
var$inputor,at_rect,end_range,format,html,mirror,start_range;
234234
$inputor=this.$inputor;
235235
format=function(value){
236-
return$('<div></div>').text(value).html().replace(/\r\n|\r|\n/g,"<br/>").replace(/\s/g,"&nbsp;");
236+
value=value.replace(/<|>|`|"|&/g,'?').replace(/\r\n|\r|\n/g,"<br/>");
237+
if(/firefox/i.test(navigator.userAgent)){
238+
value=value.replace(/\s/g,'&nbsp;');
239+
}
240+
returnvalue;
237241
};
238242
if(pos===void0){
239243
pos=this.getPos();

‎dist/jquery.caret.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/jquery.caret.coffee‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ class InputCaret
156156
getPosition: (pos)->
157157
$inputor=@$inputor
158158
format= (value)->
159-
$('<div></div>').text(value).html()
160-
.replace(/\r\n|\r|\n/g,"<br/>")
161-
.replace(/\s/g,"&nbsp;")
159+
value=value.replace(/<|>|`|"|&/g,'?').replace(/\r\n|\r|\n/g,"<br/>")
160+
if/firefox/i.testnavigator.userAgent
161+
value=value.replace(/\s/g,'&nbsp;')
162+
value
162163
pos=this.getPos()if posisundefined
163164
start_range=$inputor.val().slice(0, pos)
164165
end_range=$inputor.val().slice(pos)

‎src/jquery.caret.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ InputCaret = (function() {
234234
var$inputor,at_rect,end_range,format,html,mirror,start_range;
235235
$inputor=this.$inputor;
236236
format=function(value){
237-
return$('<div></div>').text(value).html().replace(/\r\n|\r|\n/g,"<br/>").replace(/\s/g,"&nbsp;");
237+
value=value.replace(/<|>|`|"|&/g,'?').replace(/\r\n|\r|\n/g,"<br/>");
238+
if(/firefox/i.test(navigator.userAgent)){
239+
value=value.replace(/\s/g,'&nbsp;');
240+
}
241+
returnvalue;
238242
};
239243
if(pos===void0){
240244
pos=this.getPos();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp