Skip to content

Commit

Permalink
dont use js for texteditor sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Aug 3, 2013
1 parent 266f1e0 commit 9afcc8f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
23 changes: 19 additions & 4 deletions files_texteditor/css/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
#editor{
position: fixed;
#editor {
position: relative;
display: block;
top: 6.8em;
top: 0;
left: 0;
z-index: 20;
height: 100%;
width: 100%;
}
#editor_save{

#editor_container{
position: absolute;
display: block;
top: 0;
left: 0;
padding-top: 38px;
height: 100%;
width: 100%;
box-sizing: border-box;
}

#editor_save {
margin-left: 7px;
float: left;
}
26 changes: 8 additions & 18 deletions files_texteditor/js/editor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
function setEditorSize() {
// Sets the size of the text editor window.
fillWindow($('#editor'));
}

function getFileExtension(file) {
var parts = file.split('.');
return parts[parts.length - 1];
Expand Down Expand Up @@ -193,7 +188,7 @@ function showFileEditor(dir, filename) {
// Delete any old editors
$('#editor').remove();
// Loads the file editor and display it.
$('#content').append('<div id="editor"></div>');
$('#content').append('<div id="editor_container"><div id="editor"></div></div>');
var data = $.getJSON(
OC.filePath('files_texteditor', 'ajax', 'loadfile.php'),
{file: filename, dir: dir},
Expand All @@ -218,7 +213,6 @@ function showFileEditor(dir, filename) {
if ( ! result.data.writeable ) {
aceEditor.setReadOnly(true);
}
setEditorSize();
if (result.data.mime && result.data.mime === 'text/html') {
setSyntaxMode('html');
} else {
Expand Down Expand Up @@ -262,9 +256,9 @@ function showFileEditor(dir, filename) {
// Fades out the editor.
function hideFileEditor() {
OC.Breadcrumb.pop();
if ($('#editor').attr('data-edited') == 'true') {
if ($('#editor_container').attr('data-edited') == 'true') {
// Hide, not remove
$('#editorcontrols,#editor').hide();
$('#editorcontrols,#editor_container').hide();
// Fade out editor
// Reset document title
document.title = $('body').attr('old_title');
Expand All @@ -275,7 +269,7 @@ function hideFileEditor() {
is_editor_shown = false;
} else {
// Fade out editor
$('#editor, #editorcontrols').remove();
$('#editor_container, #editorcontrols').remove();
// Reset document title
document.title = $('body').attr('old_title');
$('.actions,#file_access_panel').show();
Expand All @@ -289,17 +283,13 @@ function reopenEditor() {
$('.actions,#file_action_panel').hide();
$('#content table').hide();
$('#controls .last').not('#breadcrumb_file').removeClass('last');
$('#editor').show();
$('#editor_container').show();
$('#editorcontrols').show();
OC.Breadcrumb.push($('#editor').attr('data-filename') + ' *', '#');
document.title = $('#editor').attr('data-filename') + ' * - ownCloud';
OC.Breadcrumb.push($('#editor_container').attr('data-filename') + ' *', '#');
document.title = $('#editor_container').attr('data-filename') + ' * - ownCloud';
is_editor_shown = true;
}

// resizes the editor window
$(window).resize(function () {
setEditorSize();
});
var is_editor_shown = false;
$(document).ready(function () {
if (typeof FileActions !== 'undefined') {
Expand Down Expand Up @@ -348,7 +338,7 @@ $(document).ready(function () {
};
// Binds the file save and close editor events, and gotoline button
bindControlEvents();
$('#editor').remove();
$('#editor_container').remove();
$('#notification').click(function () {
if ($('#notification').data('reopeneditor')) {
reopenEditor();
Expand Down

0 comments on commit 9afcc8f

Please sign in to comment.