mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-10 10:04:01 +02:00
Fix editor options
Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
50
src/ifm.js
50
src/ifm.js
@@ -484,7 +484,7 @@ function IFM(params) {
|
||||
// $(ihatethisfuckingpopoverworkaround.tip).find( '.popover-body' ).empty();
|
||||
|
||||
var aceSession = self.editor.getSession();
|
||||
var content = self.getNodesFromString(
|
||||
var content = self.getNodeFromString(
|
||||
Mustache.render(
|
||||
self.templates.file_editoroptions,
|
||||
{
|
||||
@@ -499,28 +499,32 @@ function IFM(params) {
|
||||
}
|
||||
)
|
||||
);
|
||||
content.forEach( function( el ) {
|
||||
if( el.id == "editor-wordwrap" )
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
self.editor.setOption( 'wrap', e.srcElement.checked );
|
||||
});
|
||||
else if( el.id == "editor-softtabs" )
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
self.editor.setOption( 'useSoftTabs', e.srcElement.checked );
|
||||
});
|
||||
else if( el.lastChild && el.lastChild.id == "editor-tabsize" )
|
||||
el.lastChild.addEventListener( 'keydown', function( e ) {
|
||||
if( e.key == 'Enter' ) {
|
||||
e.preventDefault();
|
||||
self.editor.setOption( 'tabSize', e.srcElement.value );
|
||||
}
|
||||
});
|
||||
else if( el.id == "editor-syntax" )
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
self.editor.getSession().setMode( e.target.value );
|
||||
});
|
||||
});
|
||||
return $(content);
|
||||
if( el = content.querySelector("#editor-wordwrap" )) {
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
aceSession.setOption( 'wrap', e.srcElement.checked );
|
||||
});
|
||||
}
|
||||
if( el = content.querySelector("#editor-softtabs" ))
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
aceSession.setOption( 'useSoftTabs', e.srcElement.checked );
|
||||
});
|
||||
if( el = content.querySelector("#editor-tabsize" )) {
|
||||
console.log("Found tabSize");
|
||||
el.addEventListener( 'keydown', function( e ) {
|
||||
console.log("Got keydown");
|
||||
console.log("Set tabsize to "+e.srcElement.value);
|
||||
if( e.key == 'Enter' ) {
|
||||
console.log("Saw ENTER key");
|
||||
e.preventDefault();
|
||||
aceSession.setOption( 'tabSize', e.srcElement.value );
|
||||
}
|
||||
});
|
||||
}
|
||||
if( el = content.querySelector("#editor-syntax" ))
|
||||
el.addEventListener( 'change', function( e ) {
|
||||
aceSession.getSession().setMode( e.target.value );
|
||||
});
|
||||
return content;
|
||||
|
||||
}
|
||||
});
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<div>
|
||||
<div class="form-check p-0">
|
||||
<input type="checkbox" id="editor-wordwrap"
|
||||
{{#wordwrap}}
|
||||
@@ -23,3 +24,4 @@
|
||||
{{/modes}}
|
||||
</select>
|
||||
{{/ace_includes}}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user