This commit is contained in:
Zuzanna 2025-12-26 23:48:42 +01:00
parent ad59ca7b9c
commit 77bbbb2ba7
6 changed files with 23 additions and 39 deletions

View File

@ -56,6 +56,12 @@
font-size: 12px;
margin-right: 10px;
}
.cp-toolbar-history-previous, .cp-toolbar-history-next {
display: inline-flex;
align-items: center;
justify-content: center;
}
}
.cp-toolbar-history-actions {
display: flex;
@ -225,7 +231,7 @@
// // background-color: @history_lineBg
// }
.cp-history-snapshots {
// position: absolute;
position: absolute;
left: 1px;
right: 1px;
top: 1px;

View File

@ -2273,7 +2273,6 @@ define([
var $state = $('<span>', {'class': 'cp-app-drive-element-state'});
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
console.log("hello2")
var $ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
}
@ -2378,8 +2377,6 @@ define([
}
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
$ro = $readonlyIcon.clone().appendTo($state);
console.log("hello3")
$ro.attr('title', Messages.readonly);
}
@ -2387,13 +2384,11 @@ define([
var $restricted = $restrictedIcon.clone().appendTo($state);
$restricted.attr('title', Messages.fm_restricted);
}
var $shared = $sharedIcon.clone().appendTo($state);
$shared.attr('title', Messages.fm_canBeShared);
} else if ($content.data('readOnlyFolder') || APP.readOnly) {
$ro = $readonlyIcon.clone().appendTo($state);
console.log("hello4")
$ro.attr('title', Messages.readonly);
}

View File

@ -208,7 +208,7 @@ define([
var displayCheckpointTimeline = function(initial) {
var bar = $hist.find('.cp-history-timeline-container');
$(bar).addClass('cp-history-timeline-bar')
$(bar).addClass('cp-history-timeline-bar');
if (initial) {
var snapshotsEl = [];
loadMoreOOHistory();
@ -216,14 +216,11 @@ define([
var msgsRev = msgs;
} else {
msgs = ooMessages[id];
snapshotsEl = Array.from($hist.find('.cp-history-snapshots')[0].childNodes);
var patchColor = snapshotsEl[0]
console.log("hello!", $(patchColor).css('background-color'))
snapshotsEl = Array.from($hist.find('.cp-history-snapshots-oo')[0].childNodes);
msgsRev = msgs.slice().reverse();
}
var cpNfInner = common.startRealtime(config);
var md = Util.clone(cpNfInner.metadataMgr.getMetadata());
var snapshots = md.snapshots;
@ -234,7 +231,7 @@ define([
if (initial || id === -1) {
patchWidth = (1/msgs.length)*100;
} else {
patchWidth = (1/(msgs.length+Array.from($hist.find('.cp-history-snapshots')[0].childNodes).length))*100;
patchWidth = (1/(msgs.length+Array.from($hist.find('.cp-history-snapshots-oo')[0].childNodes).length))*100;
}
patchDiv = h(`div.cp-history-patch`, {
@ -249,12 +246,8 @@ define([
}
if (snapshots) {
var match = Object.values(snapshots).find(item => item.time === msg.time);
if (match) {
$(patchDiv).addClass('cp-history-snapshot').append(Icons.get('snapshot', {title: match.title}))
}
if (match) { $(patchDiv).addClass('cp-history-snapshot').append(Icons.get('snapshot', {title: match.title})); }
}
// if (msg.time)
}
var finalpatchDiv = h('div.cp-history-patch', {
@ -269,32 +262,24 @@ define([
var pos = Icons.get('chevron-down', {'class': 'cp-history-timeline-pos-oo'});
if (!initial) {
Array.from($hist.find('.cp-history-snapshots')[0].childNodes).forEach(function(patch) {
Array.from($hist.find('.cp-history-snapshots-oo')[0].childNodes).forEach(function(patch) {
$(patch).css('width', `${patchWidth}%`);
});
}
var snapshots = h('div.cp-history-snapshots', [
var patches = h('div.cp-history-snapshots-oo', [
snapshotsEl
]);
$(snapshots).css('height', '100%');
$(snapshots).css('display', 'flex');
$(patches).css('height', '100%');
$(patches).css('display', 'flex');
bar.html('').append([
snapshots
patches
]);
if (initial) {
$('.cp-history-patch').last().addClass('cp-history-oo-timeline-pos').append(pos);
}
var cpNfInner = common.startRealtime(config);
var md = Util.clone(cpNfInner.metadataMgr.getMetadata());
var snapshots = md.snapshots
// Object.keys(snapshots).forEach(function(snap) {
// if (snap.time ===
// })
console.log('snapshots', snapshots)
$('.cp-history-patch').on('click', function(e) {
if ($('.cp-history-timeline-pos-oo')) {

View File

@ -3075,7 +3075,6 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
readOnly = privateData.readOnly;
Title = common.createTitle({});
var configTb = {
displayed: ['pad'],
title: Title.getTitleConfig(),
@ -3172,8 +3171,12 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
if (bool) {
APP.history = true;
try { getEditor().asc_setRestriction(true); } catch (e) {}
$('.cp-toolbar-title-readonly').css('display', 'inline-flex');
$('.cp-toolbar-title-edit').hide();
return;
}
$('.cp-toolbar-title-readonly').hide();
$('.cp-toolbar-title-edit').show();
// Cancel button: redraw from lastCp
APP.history = false;
ooChannel.queue = [];
@ -3188,8 +3191,6 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
var deleteSnapshot = function (hash) {
var md = Util.clone(cpNfInner.metadataMgr.getMetadata());
var snapshots = md.snapshots = md.snapshots || {};
console.log("hello", snapshots)
delete snapshots[hash];
metadataMgr.updateMetadata(md);
APP.onLocal();
@ -3250,6 +3251,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
lastHash: ooChannel.lastHash
},
$toolbar: $('.cp-toolbar-container')
};
History.create(common, histConfig);
});

View File

@ -158,7 +158,6 @@ define([
var hash;
for (var i = 1; i < states.length; i++) {
console.log("snapshots", snapshots)
hash = states[i].serverHash;
if (snapshots.indexOf(hash) !== -1) {
snapshotsEl.push(h('div.cp-history-snapshot', {
@ -690,7 +689,7 @@ define([
// Load all the history messages into a new chainpad object
loadMoreHistory(config, common, function (err, newRt, isFull) {
History.readOnly = common.getMetadataMgr().getPrivateData().readOnly;
// History.readOnly = common.getMetadataMgr().getPrivateData().readOnly;
History.loading = false;
if (err) {
console.error(err);

View File

@ -748,15 +748,12 @@ MessengerUI, Messages, Pages, PadTypes, Icons) {
'title': Messages.saveTitle
}).hide();
if (config.readOnly === 1) {
console.log("hello!!")
$hoverable.append($('<span>', {'class': 'cp-toolbar-title-readonly'})
.text('('+Messages.readonly+')'));
return $titleContainer;
}
$hoverable.append($('<span>', {'class': 'cp-toolbar-title-readonly cp-toolbar-title-unsync'})
.text('('+Messages.readonly+')'));
console.log("hello5")
var $input = $('<input>', {
type: 'text',
placeholder: placeholder,