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-app-framework.js',
'/common/common-util.js',
'/common/common-thumbnail.js',
'/common/modes.js',
'cm/lib/codemirror',
@ -46,7 +45,6 @@ define([
SFCommon,
Framework,
Util,
Thumb,
Modes,
CMeditor)
{
@ -350,11 +348,13 @@ define([
getContainer: getThumbnailContainer,
filter: function (el, 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');
return;
}
$(el).parents().css('overflow', '');
//$(el).parents().css('overflow', '');
$(el).css('max-height', '');
}
}

View file

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

View file

@ -280,12 +280,13 @@ define([
if (!cpNfInner.chainpad) { return; }
var content = cpNfInner.chainpad.getUserDoc();
if (content === oldThumbnailState) { return; }
Thumb.fromDOM(options.thumbnail, function (err, b64) {
oldThumbnailState = content;
SFUI.setPadThumbnail(href, b64);
});
Thumb.fromDOM(options.thumbnail, function (err, b64) {
oldThumbnailState = content;
SFUI.setPadThumbnail(href, b64);
});
};
window.setInterval(mkThumbnail, Thumb.UPDATE_INTERVAL);
window.setTimeout(mkThumbnail, Thumb.UPDATE_FIRST);
}
if (newPad) {

View file

@ -557,6 +557,7 @@ define([
getContainer: function () { return $('iframe').contents().find('html')[0]; },
filter: function (el, before) {
if (before) {
module.cursor.update();
$(el).parents().css('overflow', 'visible');
$(el).css('max-width', '1200px');
$(el).css('max-height', Math.max(600, $(el).width()) + 'px');
@ -569,6 +570,9 @@ define([
$(el).css('max-height', '');
$(el).css('overflow', '');
$(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; }));

View file

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

View file

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