Below is the Laravel form I have, and I need to extract the text in a way that retains its original format:
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 150px;
right: 150px;
bottom: 150px;
left: 150px;
}
.ace_editor {
border: 1px solid lightgray;
margin: auto;
height: 65%;
width: 55%;
}
.scrollmargin {
height: 80px;
text-align: center;
}
</style>
{!! Form::open(['action' => 'ProblemsController@store']) !!}
<div id="editor"></div>
<input type="textarea" name="codeSrc" id="codeSrc" style="display: none;">
{{Form::submit('Submit')}}
{!! Form::close() !!}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/chrome");
editor.session.setMode("ace/mode/c_cpp");
//here I am taking the text from the hidden textarea
editor.session.on('change', function(delta) {
var content=document.getElementById('hiddenInput');
content.value=editor.getValue();
});
</script>
I need the input text to be preserved as follows:
// Your First C++ Program
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
The goal is to transfer it to a .cpp file and execute it without any modifications.