diff --git a/lib/fi.js b/lib/fi.js index d326f26..3109f0a 100644 --- a/lib/fi.js +++ b/lib/fi.js @@ -849,12 +849,21 @@ const ctrl = ( function() { function saveTranscript() { + // Prepare history + let transcript = history + let lastLinePos = transcript.trim().lastIndexOf( "\n" ); + + if ( lastLinePos > 0 ) { + transcript = transcript.substring( 0, lastLinePos ); + } + + // Prepare HTML infraestructure const link = document.createElement( "a" ); link.id = "hiddenSave"; link.style.display = "none"; link.download = "transcription.txt"; - link.href = "data:text/plain," + encodeURI( history ); + link.href = "data:text/plain," + encodeURI( transcript ); document.body.appendChild( link ); link.click(); diff --git a/lib/verbs.js b/lib/verbs.js index b4b17bb..948f632 100644 --- a/lib/verbs.js +++ b/lib/verbs.js @@ -2343,16 +2343,8 @@ const transcriptAction = actions.crea( "transcript", ); transcriptAction.exe = function(s) { - var toret = ""; - - if ( ctrl.saveTranscript() ) { - toret += "Transcripción guardada."; - } else { - toret += "Error guardando Transcripción \ - (localStorage no soportado?)."; - } - - return toret; + ctrl.saveTranscript(); + return "Transcripción guardada."; } transcriptAction.doIt = function(s) {