Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_texteditor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2015-09-01 13:29:23 +0300
committerTom Needham <needham.thomas@gmail.com>2015-09-01 13:29:23 +0300
commitf20e26b2def62ce65bc83f585286e46cf7b7b8bf (patch)
treeb19e0e90665e20629753a3b8c4ba0e0b1b0bf4f1
parentb2bc054039f2739f67261d7106226b521c3e7844 (diff)
Rebase
-rw-r--r--css/style.css26
-rw-r--r--js/editor.js63
2 files changed, 17 insertions, 72 deletions
diff --git a/css/style.css b/css/style.css
index 836df57..71496c5 100644
--- a/css/style.css
+++ b/css/style.css
@@ -23,8 +23,6 @@
height: 100%;
width: 100%;
overflow: hidden;
- min-height: 440px;
- position: relative;
}
#editor_wrap {
@@ -61,16 +59,6 @@
}
}
-#editor_next {
- height: 44px;
- border: none;
- background-color: transparent;
- margin: 0 !important;
- border-radius: 0;
- float: left;
- padding: 5px 8px;
-}
-
#editor_close {
float: right;
width: 34px;
@@ -83,7 +71,7 @@
opacity: 0.3;
}
-#editor_close:hover, #editor_next:hover {
+#editor_close:hover {
background-color: #ddd;
}
@@ -105,7 +93,7 @@
white-space: nowrap;
}
-#editor_controls small.lastsaved {
+#editor_controls small.saving-message {
float: left;
color: #ccc;
font-family: inherit;
@@ -114,15 +102,6 @@
overflow: hidden;
}
-/* This is to hide the saved time when getting narrow */
-@media(max-width: 540px) {
- #editor_controls small.lastsaved, div.editor_separator.lastsaved_separator {
- display: none;
- }
-
-
-}
-
#editor_overlay{
position: fixed;
top: 0%;
@@ -140,4 +119,5 @@ small.unsaved-star {
position:absolute;
padding: 9px 0 0 4px;
display: inline-block;
+ float: left;
}
diff --git a/js/editor.js b/js/editor.js
index 1e49e79..8fef31e 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -59,7 +59,9 @@ var Files_Texteditor = {
}
// Set the saving status
- $('#editor_controls small.lastsaved').text(t('files_texteditor', 'saving...'));
+ $('#editor_controls small.saving-message')
+ .text(t('files_texteditor', 'saving...'))
+ .show();
// Send to server
OCA.Files_Texteditor.saveFile(
window.aceEditor.getSession().getValue(),
@@ -72,12 +74,18 @@ var Files_Texteditor = {
$('small.unsaved-star').css('display', 'none');
OCA.Files_Texteditor.file.mtime = newmtime;
OCA.Files_Texteditor.file.edited = false;
- $('#editor_controls small.lastsaved')
- .text(t('files_texteditor', 'saved ')+moment().fromNow());
+ $('#editor_controls small.saving-message')
+ .text(t('files_texteditor', 'saved!'));
+ setTimeout(function() {
+ $('small.saving-message').fadeOut(200);
+ }, 2000);
},
function(message){
// Boo
- $('small.lastsaved').text(t('files_texteditor', 'saving failed!'));
+ $('small.saving-message').text(t('files_texteditor', 'failed!'));
+ setTimeout(function() {
+ $('small.saving-message').fadeOut(200);
+ }, 5000);
OCA.Files_Texteditor.edited = true;
}
);
@@ -171,39 +179,6 @@ var Files_Texteditor = {
},
/**
- * Handles the search box keyup event
- */
- _onSearchKeyup: function(event) {
- // if(!is_editor_shown) { return; } TODO replace this with appropriate replacement
- if($('#searchbox').val() == '') {
- // Hide clear button
- window.aceEditor.gotoLine(0);
- $('#editor_next').remove();
- } else {
- // New search
- // Reset cursor
- window.aceEditor.gotoLine(0);
- // Do search
- window.aceEditor.find($('#searchbox').val(), {
- backwards: false,
- wrap: false,
- caseSensitive: false,
- wholeWord: false,
- regExp: false
- });
- // Show next and clear buttons
- // check if already there
- if ($('#editor_next').length == 0) {
- var nextbtnhtml = '<button id="editor_next">'
- +t('files_texteditor', 'Next')
- +'</button>';
- $('small.lastsaved').after(nextbtnhtml);
- OCA.Files_Texteditor.setFilenameMaxLength();
- }
- }
- },
-
- /**
* Setup on page load
*/
initialize: function(container) {
@@ -285,7 +260,7 @@ var Files_Texteditor = {
var html =
'<small class="filename">'+escapeHTML(file.name)+'</small>'
+'<small class="unsaved-star" style="display: none">*</small>'
- +'<small class="lastsaved">'
+ +'<small class="saving-message">'
+'</small>'
+'<button id="editor_close" class="icon-close svg"></button>';
var controlBar = $('<div id="editor_controls"></div>').html(html);
@@ -309,13 +284,7 @@ var Files_Texteditor = {
// Get the width of the control bar
var controlBar = $('#editor_controls').width();
// Get the width of all of the other controls
- var controls = 0;
- if($('small.lastsaved').is(':visible')) {
- controls += $('small.lastsaved').outerWidth(true);
- }
- if($('#editor_next').is(':visible')) {
- controls += $('#editor_next').outerWidth(true);
- }
+ var controls = $('small.saving-message').outerWidth(true);
controls += $('small.unsaved-star').outerWidth(true);
controls += $('#editor_close').outerWidth(true);
// Set the max width
@@ -327,10 +296,6 @@ var Files_Texteditor = {
*/
bindControlBar: function() {
$('#editor_close').on('click', this._onCloseTrigger);
- $('#searchbox').on('input', this._onSearchKeyup);
- $('#content').on('click', '#editor_next', function() {
- window.aceEditor.findNext();
- });
$(window).resize(OCA.Files_Texteditor.setFilenameMaxLength);
window.onpopstate = function(e) {
OCA.Files_Texteditor._onCloseTrigger();