replace all \r\n with \n
This commit is contained in:
parent
35f74aa1ed
commit
ccb867d121
|
@ -88,10 +88,15 @@ TextArea.prototype.getWord = function(pos, val) {
|
|||
return word;
|
||||
}
|
||||
|
||||
function cleanNewlines(str) {
|
||||
var s = str.replace('\r\n|\r|\n', '\n');
|
||||
return s;
|
||||
}
|
||||
|
||||
//takes an srt as param, loads into txtarea
|
||||
TextArea.prototype.fromSrt = function(srt) {
|
||||
var spans = [];
|
||||
srt = srt.replace('\r\n|\r|\n', '\n')
|
||||
srt = cleanNewlines(srt);
|
||||
srt = strip(srt);
|
||||
var srt_ = srt.split('\n\n');
|
||||
for(s in srt_) {
|
||||
|
@ -184,7 +189,7 @@ function spansToSrt(arr, fmt, start_no) {
|
|||
//returns textarea formatted to .srt
|
||||
TextArea.prototype.toSrt = function(fmt) {
|
||||
if (!fmt) var fmt = 'srt';
|
||||
var text = this.elem.val();
|
||||
var text = cleanNewlines(this.elem.val());
|
||||
var lines = [];
|
||||
lines = text.split("\n");
|
||||
var i=0;
|
||||
|
|
|
@ -187,6 +187,7 @@ function saveEncore() {
|
|||
Shortcuts: <br /><br />
|
||||
Esc: Pause / Unpause <br />
|
||||
Insert: Insert time-code<br />
|
||||
PageUp / PageDown: Volume Up / Down<br />
|
||||
Double-click in Textarea: insert time-code <br />
|
||||
Double-click on video: insert time-code<br />
|
||||
Double-click on time-code in textarea: Seek video to time-code. <br />
|
||||
|
|
Loading…
Reference in New Issue
Block a user