From 77bbbb2ba756fa485e193301187638552f189172 Mon Sep 17 00:00:00 2001 From: Zuzanna Date: Fri, 26 Dec 2025 23:48:42 +0100 Subject: [PATCH] cleaning --- .../src/less2/include/toolbar-history.less | 8 ++++- www/common/drive-ui.js | 7 +--- www/common/onlyoffice/history.js | 33 +++++-------------- www/common/onlyoffice/inner.js | 8 +++-- www/common/sframe-common-history.js | 3 +- www/common/toolbar.js | 3 -- 6 files changed, 23 insertions(+), 39 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar-history.less b/customize.dist/src/less2/include/toolbar-history.less index abab30fa2..1a2878c92 100644 --- a/customize.dist/src/less2/include/toolbar-history.less +++ b/customize.dist/src/less2/include/toolbar-history.less @@ -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; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 88b596074..646e3e251 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2273,7 +2273,6 @@ define([ var $state = $('', {'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); } diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index 479aa8711..2900ae181 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -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')) { diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index d1c9179cb..93636bbaa 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -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); }); diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index 73c4ce211..6a39df777 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -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); diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 45a7604b3..8a0accaa1 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -748,15 +748,12 @@ MessengerUI, Messages, Pages, PadTypes, Icons) { 'title': Messages.saveTitle }).hide(); if (config.readOnly === 1) { - console.log("hello!!") $hoverable.append($('', {'class': 'cp-toolbar-title-readonly'}) .text('('+Messages.readonly+')')); return $titleContainer; } $hoverable.append($('', {'class': 'cp-toolbar-title-readonly cp-toolbar-title-unsync'}) .text('('+Messages.readonly+')')); - console.log("hello5") - var $input = $('', { type: 'text', placeholder: placeholder,