mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
wip
This commit is contained in:
parent
cc675f400d
commit
dc30486d8f
@ -127,6 +127,46 @@ define([
|
||||
|
||||
return cancelBlock;
|
||||
};
|
||||
|
||||
var nativePrint = window.print.bind(window);
|
||||
|
||||
var printFullContent = function () {
|
||||
var target = document.querySelector('.cp-form-creator-container');
|
||||
if (!target) { nativePrint(); return; }
|
||||
|
||||
var prevHeight = target.style.height;
|
||||
var prevOverflow = target.style.overflow;
|
||||
var prevOverflowY = target.style.overflowY;
|
||||
var prevMaxHeight = target.style.maxHeight;
|
||||
|
||||
target.style.setProperty('height', 'auto', 'important');
|
||||
target.style.setProperty('max-height', 'none', 'important');
|
||||
target.style.setProperty('overflow', 'visible', 'important');
|
||||
target.style.setProperty('overflow-y', 'visible', 'important');
|
||||
|
||||
var restore = function () {
|
||||
target.style.height = prevHeight;
|
||||
target.style.overflow = prevOverflow;
|
||||
target.style.overflowY = prevOverflowY;
|
||||
target.style.maxHeight = prevMaxHeight;
|
||||
window.onafterprint = null;
|
||||
};
|
||||
|
||||
window.onafterprint = restore;
|
||||
setTimeout(restore, 60000);
|
||||
|
||||
setTimeout(function () { nativePrint(); }, 50);
|
||||
};
|
||||
|
||||
window.print = printFullContent;
|
||||
|
||||
window.addEventListener('keydown', function (e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'p') {
|
||||
e.preventDefault();
|
||||
printFullContent();
|
||||
}
|
||||
});
|
||||
|
||||
var editTextOptions = function (opts, setCursorGetter, cb) {
|
||||
var evOnSave = Util.mkEvent();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user