Fix cursor in thumbnails

This commit is contained in:
yflory 2017-11-02 19:11:27 +01:00
parent fd7bb3aadb
commit 8de9a596f1
6 changed files with 17 additions and 9 deletions

View File

@ -7,7 +7,6 @@ define([
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/sframe-app-framework.js', '/common/sframe-app-framework.js',
'/common/common-util.js', '/common/common-util.js',
'/common/common-thumbnail.js',
'/common/modes.js', '/common/modes.js',
'cm/lib/codemirror', 'cm/lib/codemirror',
@ -46,7 +45,6 @@ define([
SFCommon, SFCommon,
Framework, Framework,
Util, Util,
Thumb,
Modes, Modes,
CMeditor) CMeditor)
{ {
@ -350,11 +348,13 @@ define([
getContainer: getThumbnailContainer, getContainer: getThumbnailContainer,
filter: function (el, before) { filter: function (el, before) {
if (before) { if (before) {
$(el).parents().css('overflow', 'visible'); // Overflow visible to the parents makes it look better but
// it creates chaos in the editbale area
//$(el).parents().css('overflow', 'visible');
$(el).css('max-height', Math.max(600, $(el).width()) + 'px'); $(el).css('max-height', Math.max(600, $(el).width()) + 'px');
return; return;
} }
$(el).parents().css('overflow', ''); //$(el).parents().css('overflow', '');
$(el).css('max-height', ''); $(el).css('max-height', '');
} }
} }

View File

@ -5,7 +5,8 @@ define([
var Thumb = { var Thumb = {
dimension: 100, dimension: 100,
padDimension: 200, padDimension: 200,
UPDATE_INTERVAL: 5000 UPDATE_INTERVAL: 60000,
UPDATE_FIRST: 5000
}; };
var supportedTypes = [ var supportedTypes = [

View File

@ -286,6 +286,7 @@ define([
}); });
}; };
window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL); window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL);
window.setTimeout(mkThumbnail, Thumb.UPDATE_FIRST);
} }
if (newPad) { if (newPad) {

View File

@ -557,6 +557,7 @@ define([
getContainer: function () { return $('iframe').contents().find('html')[0]; }, getContainer: function () { return $('iframe').contents().find('html')[0]; },
filter: function (el, before) { filter: function (el, before) {
if (before) { if (before) {
module.cursor.update();
$(el).parents().css('overflow', 'visible'); $(el).parents().css('overflow', 'visible');
$(el).css('max-width', '1200px'); $(el).css('max-width', '1200px');
$(el).css('max-height', Math.max(600, $(el).width()) + 'px'); $(el).css('max-height', Math.max(600, $(el).width()) + 'px');
@ -569,6 +570,9 @@ define([
$(el).css('max-height', ''); $(el).css('max-height', '');
$(el).css('overflow', ''); $(el).css('overflow', '');
$(el).find('body').css('background-color', '#fff'); $(el).find('body').css('background-color', '#fff');
var sel = module.cursor.makeSelection();
var range = module.cursor.makeRange();
module.cursor.fixSelection(sel, range);
} }
} }
}, waitFor(function (fw) { window.APP.framework = framework = fw; })); }, waitFor(function (fw) { window.APP.framework = framework = fw; }));

View File

@ -837,6 +837,7 @@ define([
}); });
}; };
window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL); window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL);
window.setTimeout(mkThumbnail, Thumb.UPDATE_FIRST);
}; };
var checkDeletedCells = function () { var checkDeletedCells = function () {

View File

@ -393,6 +393,7 @@ define([
}); });
}; };
window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL); window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL);
window.setTimeout(mkThumbnail, Thumb.UPDATE_FIRST);
}; };
config.onInit = function (info) { config.onInit = function (info) {