mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-11 18:43:58 +02:00
Add ability to make the ace editor full-viewport.
Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
@@ -1851,6 +1851,34 @@ function IFM( params ) {
|
|||||||
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
||||||
self.editor.getSession().setMode( mode );
|
self.editor.getSession().setMode( mode );
|
||||||
}
|
}
|
||||||
|
self.editor.commands.addCommand({
|
||||||
|
name: "toggleFullscreen",
|
||||||
|
bindKey: "Ctrl-Shift-F",
|
||||||
|
exec: function(e) {
|
||||||
|
var el = e.container;
|
||||||
|
console.log("toggleFullscreen was called");
|
||||||
|
console.log("el.parentElement.tagName is "+el.parentElement.tagName);
|
||||||
|
if (el.parentElement.tagName == "BODY") {
|
||||||
|
el.remove();
|
||||||
|
var fieldset = document.getElementsByClassName('modal-body')[0].firstElementChild;
|
||||||
|
fieldset.insertBefore(el, fieldset.getElementsByTagName('button')[0].previousElementSibling);
|
||||||
|
el.style = Object.assign({}, ifm.tmpEditorStyles);
|
||||||
|
ifm.tmpEditorStyles = undefined;
|
||||||
|
} else {
|
||||||
|
ifm.tmpEditorStyles = Object.assign({}, el.style);
|
||||||
|
el.remove();
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.style.position = "absolute";
|
||||||
|
el.style.top = 0;
|
||||||
|
el.style.left = 0;
|
||||||
|
el.style.zIndex = 10000;
|
||||||
|
el.style.width = "100%";
|
||||||
|
el.style.height = "100%";
|
||||||
|
}
|
||||||
|
e.resize();
|
||||||
|
e.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
28
ifm.php
28
ifm.php
@@ -1851,6 +1851,34 @@ function IFM( params ) {
|
|||||||
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
||||||
self.editor.getSession().setMode( mode );
|
self.editor.getSession().setMode( mode );
|
||||||
}
|
}
|
||||||
|
self.editor.commands.addCommand({
|
||||||
|
name: "toggleFullscreen",
|
||||||
|
bindKey: "Ctrl-Shift-F",
|
||||||
|
exec: function(e) {
|
||||||
|
var el = e.container;
|
||||||
|
console.log("toggleFullscreen was called");
|
||||||
|
console.log("el.parentElement.tagName is "+el.parentElement.tagName);
|
||||||
|
if (el.parentElement.tagName == "BODY") {
|
||||||
|
el.remove();
|
||||||
|
var fieldset = document.getElementsByClassName('modal-body')[0].firstElementChild;
|
||||||
|
fieldset.insertBefore(el, fieldset.getElementsByTagName('button')[0].previousElementSibling);
|
||||||
|
el.style = Object.assign({}, ifm.tmpEditorStyles);
|
||||||
|
ifm.tmpEditorStyles = undefined;
|
||||||
|
} else {
|
||||||
|
ifm.tmpEditorStyles = Object.assign({}, el.style);
|
||||||
|
el.remove();
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.style.position = "absolute";
|
||||||
|
el.style.top = 0;
|
||||||
|
el.style.left = 0;
|
||||||
|
el.style.zIndex = 10000;
|
||||||
|
el.style.width = "100%";
|
||||||
|
el.style.height = "100%";
|
||||||
|
}
|
||||||
|
e.resize();
|
||||||
|
e.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
28
src/ifm.js
28
src/ifm.js
@@ -528,6 +528,34 @@ function IFM( params ) {
|
|||||||
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
if( self.inArray( mode, self.ace.modes.map( x => "ace/mode/"+x ) ) )
|
||||||
self.editor.getSession().setMode( mode );
|
self.editor.getSession().setMode( mode );
|
||||||
}
|
}
|
||||||
|
self.editor.commands.addCommand({
|
||||||
|
name: "toggleFullscreen",
|
||||||
|
bindKey: "Ctrl-Shift-F",
|
||||||
|
exec: function(e) {
|
||||||
|
var el = e.container;
|
||||||
|
console.log("toggleFullscreen was called");
|
||||||
|
console.log("el.parentElement.tagName is "+el.parentElement.tagName);
|
||||||
|
if (el.parentElement.tagName == "BODY") {
|
||||||
|
el.remove();
|
||||||
|
var fieldset = document.getElementsByClassName('modal-body')[0].firstElementChild;
|
||||||
|
fieldset.insertBefore(el, fieldset.getElementsByTagName('button')[0].previousElementSibling);
|
||||||
|
el.style = Object.assign({}, ifm.tmpEditorStyles);
|
||||||
|
ifm.tmpEditorStyles = undefined;
|
||||||
|
} else {
|
||||||
|
ifm.tmpEditorStyles = Object.assign({}, el.style);
|
||||||
|
el.remove();
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.style.position = "absolute";
|
||||||
|
el.style.top = 0;
|
||||||
|
el.style.left = 0;
|
||||||
|
el.style.zIndex = 10000;
|
||||||
|
el.style.width = "100%";
|
||||||
|
el.style.height = "100%";
|
||||||
|
}
|
||||||
|
e.resize();
|
||||||
|
e.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user