From 4196c342a562316d0043b94033bcb5d273efbe8c Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 2 May 2025 11:39:28 +0200 Subject: [PATCH 01/45] JS-6664: Calendar dnd --- src/scss/block/dataview/view/calendar.scss | 2 + .../block/dataview/view/calendar/item.tsx | 65 +++++++++++++------ 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/scss/block/dataview/view/calendar.scss b/src/scss/block/dataview/view/calendar.scss index 4ae75ed3d5..d3026d3eeb 100644 --- a/src/scss/block/dataview/view/calendar.scss +++ b/src/scss/block/dataview/view/calendar.scss @@ -42,6 +42,8 @@ } .day { + .dropTarget { width: 100%; height: 100%; } + .head { display: flex; flex-direction: row; gap: 0px 8px; align-items: center; justify-content: space-between; } .head { .icon { flex-shrink: 0; width: 24px !important; height: 24px !important; opacity: 0; transition: opacity $transitionCommon; } diff --git a/src/ts/component/block/dataview/view/calendar/item.tsx b/src/ts/component/block/dataview/view/calendar/item.tsx index b056f30eca..1765cb08d7 100644 --- a/src/ts/component/block/dataview/view/calendar/item.tsx +++ b/src/ts/component/block/dataview/view/calendar/item.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { observer } from 'mobx-react'; -import { IconObject, ObjectName, Icon } from 'Component'; +import { IconObject, ObjectName, Icon, DropTarget } from 'Component'; import { I, S, U, translate, Preview } from 'Lib'; interface Props extends I.ViewComponent { @@ -27,16 +27,19 @@ const Item = observer(class Item extends React.Component { this.onContext = this.onContext.bind(this); this.canCreate = this.canCreate.bind(this); this.onCreate = this.onCreate.bind(this); + this.onDragStart = this.onDragStart.bind(this); }; render () { - const { items, className, d, m, y, getView, onContext } = this.props; + const { rootId, items, className, d, m, y, getView, onContext } = this.props; const view = getView(); const { hideIcon } = view; const slice = items.slice(0, LIMIT); const length = items.length; const cn = [ 'day' ]; const canCreate = this.canCreate(); + const relation = S.Record.getRelationByKey(view.groupRelationKey); + const canDrag = relation && !relation.isReadonlyValue; if (className) { cn.push(className); @@ -55,13 +58,31 @@ const Item = observer(class Item extends React.Component { const canEdit = !item.isReadonly && S.Block.isAllowed(item.restrictions, [ I.RestrictionObject.Details ]) && U.Object.isTaskLayout(item.layout); const icon = hideIcon ? null : ; + let content = ( + <> + {icon} + this.onOpen(item)} /> + + ); + + if (canDrag) { + content = ( + + {content} + + ); + }; + return ( +
onContext(e, item.id)} onMouseEnter={e => this.onMouseEnter(e, item)} onMouseLeave={this.onMouseLeave} + onDragStart={e => this.onDragStart(e, item)} > {icon} this.onOpen(item)} /> @@ -76,27 +97,29 @@ const Item = observer(class Item extends React.Component { onContextMenu={this.onContext} onDoubleClick={this.onCreate} > -
- {canCreate ? ( - - ) : ''} + +
+ {canCreate ? ( + + ) : ''} -
-
{d}
+
+
{d}
+
-
-
- {slice.map((item, i) => ( - - ))} +
+ {slice.map((item, i) => ( + + ))} - {more} -
+ {more} +
+
); }; @@ -207,6 +230,10 @@ const Item = observer(class Item extends React.Component { return groupRelation && (!groupRelation.isReadonlyValue || isToday) && isAllowedObject(); }; + onDragStart (e: any, item: any) { + console.log('onDragStart', item); + }; + }); export default Item; From a0a0fa8a1d8f88078ab9c39ead29094f090b20c0 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 12:26:57 +0200 Subject: [PATCH 02/45] updates --- src/scss/block/dataview/view/calendar.scss | 10 ++- .../block/dataview/view/calendar/item.tsx | 76 +++++++++++++------ src/ts/component/drag/provider.tsx | 3 +- src/ts/component/drag/target.tsx | 3 + 4 files changed, 64 insertions(+), 28 deletions(-) diff --git a/src/scss/block/dataview/view/calendar.scss b/src/scss/block/dataview/view/calendar.scss index d3026d3eeb..7cc96119b8 100644 --- a/src/scss/block/dataview/view/calendar.scss +++ b/src/scss/block/dataview/view/calendar.scss @@ -54,13 +54,17 @@ } } + .items { flex-grow: 1; } + .item { - display: flex; flex-direction: row; align-items: center; gap: 0px 4px; @include text-small; @include text-overflow-nw; - margin: 0px 0px 2px 0px; position: relative; padding: 0px 8px; border-radius: 4px; + display: flex; flex-direction: row; align-items: center; gap: 0px 4px; @include text-small; margin: 0px 0px 2px 0px; + position: relative; padding: 0px 4px; border-radius: 4px; } .item { + .dropTarget { display: flex; flex-direction: row; align-items: center; gap: 0px 4px; } + .iconObject { flex-shrink: 0; } - .name { @include text-overflow-nw; } + .name { @include text-overflow-nw; width: 100%; } } .item::before { content: ""; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background: rgba(79,79,79,0); z-index: 1; diff --git a/src/ts/component/block/dataview/view/calendar/item.tsx b/src/ts/component/block/dataview/view/calendar/item.tsx index 1765cb08d7..5046f03a49 100644 --- a/src/ts/component/block/dataview/view/calendar/item.tsx +++ b/src/ts/component/block/dataview/view/calendar/item.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { observer } from 'mobx-react'; import { IconObject, ObjectName, Icon, DropTarget } from 'Component'; -import { I, S, U, translate, Preview } from 'Lib'; +import { I, S, U, C, translate, Preview } from 'Lib'; interface Props extends I.ViewComponent { d: number; @@ -28,6 +28,7 @@ const Item = observer(class Item extends React.Component { this.canCreate = this.canCreate.bind(this); this.onCreate = this.onCreate.bind(this); this.onDragStart = this.onDragStart.bind(this); + this.onRecordDrop = this.onRecordDrop.bind(this); }; render () { @@ -67,7 +68,7 @@ const Item = observer(class Item extends React.Component { if (canDrag) { content = ( - + {content} ); @@ -84,8 +85,7 @@ const Item = observer(class Item extends React.Component { onMouseLeave={this.onMouseLeave} onDragStart={e => this.onDragStart(e, item)} > - {icon} - this.onOpen(item)} /> + {content}
); }; @@ -97,29 +97,29 @@ const Item = observer(class Item extends React.Component { onContextMenu={this.onContext} onDoubleClick={this.onCreate} > - -
- {canCreate ? ( - - ) : ''} +
+ {canCreate ? ( + + ) : ''} -
-
{d}
-
+
+
{d}
+
-
- {slice.map((item, i) => ( - - ))} +
+ {slice.map((item, i) => ( + + ))} - {more} -
- + {more} + + +
); }; @@ -231,7 +231,35 @@ const Item = observer(class Item extends React.Component { }; onDragStart (e: any, item: any) { - console.log('onDragStart', item); + const dragProvider = S.Common.getRef('dragProvider'); + + dragProvider?.onDragStart(e, I.DropType.Record, [ item.id ], this); + }; + + onRecordDrop (targetId: string, ids: [], position: I.BlockPosition) { + const { getSubId, getView } = this.props; + const subId = getSubId(); + const view = getView(); + + let value = 0; + + if (targetId.match(/^empty-/)) { + const [ , y, m, d ] = targetId.split('-').map(Number); + + value = U.Date.timestamp(y, m, d, 0, 0, 0); + } else { + const records = S.Record.getRecords(subId); + const target = records.find(r => r.id == targetId); + if (!target) { + return; + }; + + value = target[view.groupRelationKey] + (position == I.BlockPosition.Bottom ? 1 : 0); + }; + + if (value) { + C.ObjectListSetDetails(ids, [ { key: view.groupRelationKey, value } ]); + }; }; }); diff --git a/src/ts/component/drag/provider.tsx b/src/ts/component/drag/provider.tsx index d5584f458c..2a3193aeaf 100644 --- a/src/ts/component/drag/provider.tsx +++ b/src/ts/component/drag/provider.tsx @@ -54,6 +54,7 @@ const DragProvider = observer(forwardRef((props, re type: item.attr('data-type'), style: item.attr('data-style'), targetContextId: item.attr('data-target-context-id'), + viewType: item.attr('data-view-type'), }; const offset = item.offset(); const rect = el.getBoundingClientRect() as DOMRect; @@ -428,7 +429,7 @@ const DragProvider = observer(forwardRef((props, re const { onRecordDrop } = origin.current; if (onRecordDrop) { - onRecordDrop(targetId, ids); + onRecordDrop(targetId, ids, position); }; break; }; diff --git a/src/ts/component/drag/target.tsx b/src/ts/component/drag/target.tsx index d15e327800..c6809702a2 100644 --- a/src/ts/component/drag/target.tsx +++ b/src/ts/component/drag/target.tsx @@ -9,6 +9,7 @@ interface Props { style?: number; type?: I.BlockType; dropType: I.DropType; + viewType?: I.ViewType; className?: string; canDropMiddle?: boolean; isTargetTop?: boolean; @@ -26,6 +27,7 @@ const DropTarget: FC = ({ cacheKey = '', targetContextId = '', dropType = I.DropType.None, + viewType = null, type, style = 0, className = '', @@ -71,6 +73,7 @@ const DropTarget: FC = ({ 'drop-type': dropType, 'context-id': targetContextId, 'drop-middle': Number(canDropMiddle) || 0, + 'view-type': Number(viewType) || 0, })} > {children} From 1668468e2067b60cc2bb87868382aa691150c400 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 14:16:47 +0200 Subject: [PATCH 03/45] revert extension manifests --- dist/extension/manifest.firefox.json | 38 ------------------- .../{manifest.chrome.json => manifest.json} | 0 2 files changed, 38 deletions(-) delete mode 100644 dist/extension/manifest.firefox.json rename dist/extension/{manifest.chrome.json => manifest.json} (100%) diff --git a/dist/extension/manifest.firefox.json b/dist/extension/manifest.firefox.json deleted file mode 100644 index 9d1717c60d..0000000000 --- a/dist/extension/manifest.firefox.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "manifest_version": 3, - "name": "Anytype Web Clipper", - "description": "Save web content to the Anytype — open, encrypted, and local-first application that connects everything as objects.", - "version": "0.0.8", - "icons": { - "16": "img/icon16x16.png", - "128": "img/icon128x128.png" - }, - "options_page": "settings/index.html", - "action": { - "default_title": "Anytype Web Clipper", - "default_popup": "popup/index.html" - }, - "permissions": [ - "contextMenus", - "nativeMessaging", - "tabs", - "scripting", - "activeTab" - ], - "background": { - "scripts": [ "js/background.js" ] - }, - "content_scripts": [ - { - "js": [ "js/foreground.js" ], - "css": [ "css/foreground.css" ], - "matches": [ "" ] - } - ], - "web_accessible_resources": [ - { - "resources": [ "iframe/index.html" ], - "matches": [ "" ] - } - ] -} \ No newline at end of file diff --git a/dist/extension/manifest.chrome.json b/dist/extension/manifest.json similarity index 100% rename from dist/extension/manifest.chrome.json rename to dist/extension/manifest.json From 443dc88c06c95c0ccdf5e147439480be661c19ad Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 14:23:07 +0200 Subject: [PATCH 04/45] fix dragLayer for calendar --- src/scss/block/dataview/view/calendar.scss | 56 +++++++++---------- .../block/dataview/view/calendar/item.tsx | 6 +- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/scss/block/dataview/view/calendar.scss b/src/scss/block/dataview/view/calendar.scss index 7cc96119b8..02dca0f806 100644 --- a/src/scss/block/dataview/view/calendar.scss +++ b/src/scss/block/dataview/view/calendar.scss @@ -41,40 +41,38 @@ .number { color: var(--color-text-tertiary); } } - .day { - .dropTarget { width: 100%; height: 100%; } + .dropTarget { width: 100%; height: 100%; } - .head { display: flex; flex-direction: row; gap: 0px 8px; align-items: center; justify-content: space-between; } - .head { - .icon { flex-shrink: 0; width: 24px !important; height: 24px !important; opacity: 0; transition: opacity $transitionCommon; } + .head { display: flex; flex-direction: row; gap: 0px 8px; align-items: center; justify-content: space-between; } + .head { + .icon { flex-shrink: 0; width: 24px !important; height: 24px !important; opacity: 0; transition: opacity $transitionCommon; } - .number { @include text-paragraph; text-align: right; width: 100%; } - .number { - .inner { display: inline-block; } - } + .number { @include text-paragraph; text-align: right; width: 100%; } + .number { + .inner { display: inline-block; } } - - .items { flex-grow: 1; } - - .item { - display: flex; flex-direction: row; align-items: center; gap: 0px 4px; @include text-small; margin: 0px 0px 2px 0px; - position: relative; padding: 0px 4px; border-radius: 4px; - } - .item { - .dropTarget { display: flex; flex-direction: row; align-items: center; gap: 0px 4px; } - - .iconObject { flex-shrink: 0; } - .name { @include text-overflow-nw; width: 100%; } - } - .item::before { - content: ""; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background: rgba(79,79,79,0); z-index: 1; - pointer-events: none; - } - .item:hover::before { background: var(--color-shape-highlight-medium); } - - .item.more { display: block; color: var(--color-text-secondary); } } + .items { flex-grow: 1; } + + .record { + display: flex; flex-direction: row; align-items: center; gap: 0px 4px; @include text-small; margin: 0px 0px 2px 0px; + position: relative; padding: 0px 4px; border-radius: 4px; + } + .record { + .dropTarget { display: flex; flex-direction: row; align-items: center; gap: 0px 4px; } + + .iconObject { flex-shrink: 0; } + .name { @include text-overflow-nw; width: 100%; } + } + .record::before { + content: ""; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background: rgba(79,79,79,0); z-index: 1; + pointer-events: none; + } + .record:hover::before { background: var(--color-shape-highlight-medium); } + + .record.more { display: block; color: var(--color-text-secondary); } + .day:hover { .head { .icon { opacity: 1; } diff --git a/src/ts/component/block/dataview/view/calendar/item.tsx b/src/ts/component/block/dataview/view/calendar/item.tsx index 5046f03a49..22f5ef8a08 100644 --- a/src/ts/component/block/dataview/view/calendar/item.tsx +++ b/src/ts/component/block/dataview/view/calendar/item.tsx @@ -77,8 +77,8 @@ const Item = observer(class Item extends React.Component { return (
onContext(e, item.id)} onMouseEnter={e => this.onMouseEnter(e, item)} @@ -130,7 +130,7 @@ const Item = observer(class Item extends React.Component { onMouseEnter (e: any, item: any) { const node = $(this.node); - const element = node.find(`#item-${item.id}`); + const element = node.find(`#record-${item.id}`); const name = U.Common.shorten(item.name, 50); Preview.tooltipShow({ text: name, element }); From 1ce76114a43a6644a3b6cc8b1f210177567ee035 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 14:25:40 +0200 Subject: [PATCH 05/45] fix dragLayer for calendar --- src/scss/block/dataview/view/calendar.scss | 1 + src/ts/component/block/dataview/view/calendar/item.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scss/block/dataview/view/calendar.scss b/src/scss/block/dataview/view/calendar.scss index 02dca0f806..5b8d0c4720 100644 --- a/src/scss/block/dataview/view/calendar.scss +++ b/src/scss/block/dataview/view/calendar.scss @@ -42,6 +42,7 @@ } .dropTarget { width: 100%; height: 100%; } + .dropTarget.targetBot { width: calc(100% - 8px); margin: -2px auto 0px auto; } .head { display: flex; flex-direction: row; gap: 0px 8px; align-items: center; justify-content: space-between; } .head { diff --git a/src/ts/component/block/dataview/view/calendar/item.tsx b/src/ts/component/block/dataview/view/calendar/item.tsx index 22f5ef8a08..ac1daaec12 100644 --- a/src/ts/component/block/dataview/view/calendar/item.tsx +++ b/src/ts/component/block/dataview/view/calendar/item.tsx @@ -49,7 +49,7 @@ const Item = observer(class Item extends React.Component { let more = null; if (length > LIMIT) { more = ( -
+
+{length - LIMIT} {translate('commonMore')} {U.Common.plural(length, translate('pluralObject')).toLowerCase()}
); From b5cd357192a4af2524fd35e873175e5e1513652a Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 14:27:22 +0200 Subject: [PATCH 06/45] fix dragLayer for calendar --- src/scss/block/dataview/view/calendar.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scss/block/dataview/view/calendar.scss b/src/scss/block/dataview/view/calendar.scss index 5b8d0c4720..92cc664378 100644 --- a/src/scss/block/dataview/view/calendar.scss +++ b/src/scss/block/dataview/view/calendar.scss @@ -42,7 +42,7 @@ } .dropTarget { width: 100%; height: 100%; } - .dropTarget.targetBot { width: calc(100% - 8px); margin: -2px auto 0px auto; } + .dropTarget.targetBot { width: calc(100% - 8px); margin: 0px auto 0px auto; } .head { display: flex; flex-direction: row; gap: 0px 8px; align-items: center; justify-content: space-between; } .head { From 2ff6509d4639eb6b723d70f37fd53cf2153a6f36 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 16:42:32 +0200 Subject: [PATCH 07/45] bump middleware version --- middleware.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware.version b/middleware.version index d3924d2cb8..3a1a2c94c1 100644 --- a/middleware.version +++ b/middleware.version @@ -1 +1 @@ -0.41.0-rc14 \ No newline at end of file +0.41.0-rc16 \ No newline at end of file From 87df4ac074ef47b6eafdc607217897e62c73bdc4 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 16:43:11 +0200 Subject: [PATCH 08/45] 0.46.33-alpha --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ff6e5e6ee..657e388cdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "anytype", - "version": "0.46.32-beta", + "version": "0.46.33-alpha", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "anytype", - "version": "0.46.32-beta", + "version": "0.46.33-alpha", "hasInstallScript": true, "license": "SEE LICENSE IN LICENSE.md", "dependencies": { diff --git a/package.json b/package.json index 6c96596e81..225d9c35c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anytype", - "version": "0.46.32-beta", + "version": "0.46.33-alpha", "description": "Anytype", "main": "electron.js", "scripts": { From 4a14a0d75219c5afa41d308ef5dc9b4dc0910b54 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 16:46:09 +0200 Subject: [PATCH 09/45] https://community.anytype.io/t/cannot-open-settings-space-object-types-in-desktop-app-window-stucks-on-white-screen/27977: fix --- src/ts/component/sidebar/page/settings/library.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ts/component/sidebar/page/settings/library.tsx b/src/ts/component/sidebar/page/settings/library.tsx index df83bd6518..543d86e44a 100644 --- a/src/ts/component/sidebar/page/settings/library.tsx +++ b/src/ts/component/sidebar/page/settings/library.tsx @@ -178,14 +178,12 @@ const SidebarSettingsLibrary = observer(class SidebarSettingsLibrary extends Rea }; componentDidMount () { + const items = this.getItems(); + this.type = this.props.page == 'types' ? I.ObjectContainerType.Type : I.ObjectContainerType.Relation; this.refFilter.focus(); this.initSort(); this.load(true, this.openFirst); - }; - - componentDidUpdate () { - const items = this.getItems(); this.cache = new CellMeasurerCache({ fixedWidth: true, From cde78b51cd07dc57651c2e7d373b65e8bbfdab32 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 30 May 2025 18:51:28 +0200 Subject: [PATCH 10/45] remove column layout padding --- src/scss/block/featured.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scss/block/featured.scss b/src/scss/block/featured.scss index ba57893deb..1e06ef2eda 100644 --- a/src/scss/block/featured.scss +++ b/src/scss/block/featured.scss @@ -8,7 +8,6 @@ .icon.checkbox { width: 20px; height: 20px; vertical-align: middle; margin-top: -4px; background-image: url('~img/icon/dataview/checkbox0.svg'); } .icon.checkbox.active { background-image: url('~img/icon/dataview/checkbox1.svg'); } - .listColumn { padding-top: 36px; } .listColumn { .wrapMenu { display: none; } } From a9d89d6e00d327c7a4e069e8a230ecd7f73d9f1e Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Sat, 31 May 2025 09:39:40 +0200 Subject: [PATCH 11/45] JS-6232: fix --- src/ts/component/block/text.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ts/component/block/text.tsx b/src/ts/component/block/text.tsx index 04a9d6090f..bc04b6418a 100644 --- a/src/ts/component/block/text.tsx +++ b/src/ts/component/block/text.tsx @@ -960,13 +960,21 @@ const BlockText = observer(class BlockText extends React.Component { e.persist(); this.placeholderCheck(); - this.setValue(block.getText()); - keyboard.setFocus(true); if (onFocus) { onFocus(e); }; + + // Workaround for focus issue and Latex rendering + window.setTimeout(() => { + const range = this.getRange(); + + this.setValue(block.getText()); + + focus.set(block.id, range); + focus.apply(); + }, 0); }; onBlur (e: any) { From afd622b51127a26b559de70a56fdbc5249347811 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Sat, 31 May 2025 09:57:43 +0200 Subject: [PATCH 12/45] JS-5904: fix --- src/ts/component/menu/syncStatus.tsx | 9 ++------- src/ts/lib/action.ts | 17 ++++++++++++---- src/ts/lib/storage.ts | 30 +++++++++++++++------------- src/ts/lib/util/space.ts | 4 +++- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/ts/component/menu/syncStatus.tsx b/src/ts/component/menu/syncStatus.tsx index 8ef5ce6790..241fa0c1e1 100644 --- a/src/ts/component/menu/syncStatus.tsx +++ b/src/ts/component/menu/syncStatus.tsx @@ -339,13 +339,9 @@ const MenuSyncStatus = observer(class MenuSyncStatus extends React.Component { + Storage.deleteLastOpenedByObjectId(ids); C.ObjectListDelete(ids); - + + const isPopup = keyboard.isPopup(); + const match = keyboard.getMatch(); + + if (ids.includes(match.params.id)) { + if (isPopup) { + S.Popup.close('page'); + } else { + U.Space.openDashboard(); + }; + }; + if (callBack) { callBack(); }; - // Remove last opened objects in case any is deleted - Storage.deleteLastOpenedByObjectId(ids); - analytics.event('RemoveCompletely', { count, route }); }, onCancel: () => { diff --git a/src/ts/lib/storage.ts b/src/ts/lib/storage.ts index 7f7136eb64..fb62fdf1fa 100644 --- a/src/ts/lib/storage.ts +++ b/src/ts/lib/storage.ts @@ -247,21 +247,25 @@ class Storage { return this.get('pin'); }; + getLastOpened () { + return this.get('lastOpenedObject') || {}; + }; + setLastOpened (windowId: string, param: any) { - const obj = this.get('lastOpenedObject') || {}; + const obj = this.getLastOpened(); obj[windowId] = Object.assign(obj[windowId] || {}, param); this.set('lastOpenedObject', obj); }; - deleteLastOpenedByObjectId (objectIds: string[]) { - objectIds = objectIds || []; + deleteLastOpenedByObjectId (ids: string[]) { + ids = ids || []; - const obj = this.get('lastOpenedObject') || {}; + const obj = this.getLastOpened(); const windowIds = []; for (const windowId in obj) { - if (!obj[windowId] || objectIds.includes(obj[windowId].id)) { + if (!obj[windowId] || ids.includes(obj[windowId].id)) { windowIds.push(windowId); }; }; @@ -269,22 +273,20 @@ class Storage { this.deleteLastOpenedByWindowId(windowIds); }; - deleteLastOpenedByWindowId (windowIds: string[]) { - windowIds = windowIds.filter(id => id != '1'); - - if (!windowIds.length) { + deleteLastOpenedByWindowId (ids: string[]) { + if (!ids.length) { return; }; - const obj = this.get('lastOpenedObject') || {}; + const obj = this.getLastOpened(); - windowIds.forEach(windowId => delete(obj[windowId])); + ids.forEach(ids => delete(obj[ids])); this.set('lastOpenedObject', obj); }; - getLastOpened (windowId: string) { - const obj = this.get('lastOpenedObject') || {}; - return obj[windowId] || obj[1] || null; + getLastOpenedByWindowId (id: string) { + const obj = this.getLastOpened(); + return obj[id] || obj[1] || null; }; setToggle (rootId: string, id: string, value: boolean) { diff --git a/src/ts/lib/util/space.ts b/src/ts/lib/util/space.ts index af4a524ee7..652a9e807d 100644 --- a/src/ts/lib/util/space.ts +++ b/src/ts/lib/util/space.ts @@ -90,7 +90,9 @@ class UtilSpace { }; getLastObject () { - let home = Storage.getLastOpened(U.Common.getCurrentElectronWindowId()); + let home = Storage.getLastOpenedByWindowId(U.Common.getCurrentElectronWindowId()); + + console.log('getLastObject', home); // Invalid data protection if (!home || !home.id) { From b60d5487053fcdee1fdae56e2e90290e51e3aaaf Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Sat, 31 May 2025 10:16:02 +0200 Subject: [PATCH 13/45] JS-7117: fix --- src/scss/block/featured.scss | 9 +++++--- src/scss/block/relation.scss | 2 +- src/ts/component/block/featured.tsx | 33 +++++++++++++++++------------ src/ts/lib/util/space.ts | 2 -- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/scss/block/featured.scss b/src/scss/block/featured.scss index 1e06ef2eda..1ef1020633 100644 --- a/src/scss/block/featured.scss +++ b/src/scss/block/featured.scss @@ -44,12 +44,15 @@ } .cellContent.c-select { - .over { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0px 6px; } + .over { + display: inline-flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0px 6px; vertical-align: middle; + margin-top: -2px; + } .tagItem { margin: 0px; max-width: 400px; } } .cellContent.c-file { - .over { display: flex; flex-direction: row; align-items: center; gap: 0px 2px; height: 28px; } + .over { display: inline-flex; flex-direction: row; align-items: center; gap: 0px 2px; height: 28px; } .element { flex-shrink: 0; display: flex; } .iconObject { display: block; } .name { display: none; } @@ -60,7 +63,7 @@ .iconObject { flex-shrink: 0; margin: 0px 6px 0px 0px !important; } } - .cellContent.c-checkbox { display: flex; flex-direction: row; align-items: center; height: 28px; gap: 0px 4px; } + .cellContent.c-checkbox { display: inline-flex; flex-direction: row; align-items: center; height: 28px; gap: 0px 4px; } .cellContent.c-longText { .name { display: inline-block; vertical-align: top; max-width: 220px; @include text-overflow-nw; } diff --git a/src/scss/block/relation.scss b/src/scss/block/relation.scss index 797a40b907..18ede77a89 100644 --- a/src/scss/block/relation.scss +++ b/src/scss/block/relation.scss @@ -59,7 +59,7 @@ } .cell.isEditing.c-select { - .cellContent, .placeholder { padding: 6px 8px 4px 8px; } + .cellContent, .placeholder { padding: 6px 8px; } } .cell.isEditing.c-select.isSelect { .over { width: calc(100% - 26px); } diff --git a/src/ts/component/block/featured.tsx b/src/ts/component/block/featured.tsx index 445cd2ab43..e65eb00034 100644 --- a/src/ts/component/block/featured.tsx +++ b/src/ts/component/block/featured.tsx @@ -43,7 +43,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component {headerRelationsLayout == I.FeaturedRelationLayout.Column ? (
- {items.map((relation: any) => ( - - ))} + {items.map((relation: any) => { + const value = object[relation.relationKey]; + const canEdit = !readonly && allowedValue && !relation.isReadonlyValue; + + return ( + + ); + })}
) : (
{items.map((relation: any, i: any) => { const id = Relation.cellId(PREFIX, relation.relationKey, object.id); const value = object[relation.relationKey]; - const canEdit = allowedValue && !relation.isReadonlyValue; + const canEdit = !readonly && allowedValue && !relation.isReadonlyValue; const cn = [ 'cell', (canEdit ? 'canEdit' : '') ]; if (i == items.length - 1) { @@ -100,6 +105,8 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component Date: Sat, 31 May 2025 10:23:19 +0200 Subject: [PATCH 14/45] JS-6216: fix --- src/ts/component/block/featured.tsx | 2 -- src/ts/component/header/index.tsx | 30 ++++++++++++++++++++++++++++- src/ts/component/util/error.tsx | 3 --- src/ts/component/util/progress.tsx | 2 +- src/ts/lib/sidebar.ts | 1 - 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/ts/component/block/featured.tsx b/src/ts/component/block/featured.tsx index e65eb00034..821b2a5dd0 100644 --- a/src/ts/component/block/featured.tsx +++ b/src/ts/component/block/featured.tsx @@ -105,8 +105,6 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component((props, ref) => { onTab, } = props; + const nodeRef = useRef(null); const childRef = useRef(null); const Component = Components[component] || null; const cn = [ 'header', component, className ]; + const resizeObserver = new ResizeObserver(() => { + raf(() => resize()); + }); if (![ 'authIndex' ].includes(component)) { cn.push('isCommon'); @@ -159,6 +165,27 @@ const Header = forwardRef<{}, Props>((props, ref) => { return (isPopup ? '.popup' : '') + ' .header'; }; + const resize = () => { + const node = $(nodeRef.current); + const path = node.find('.path'); + + node.toggleClass('isSmall', path.outerWidth() < 180); + }; + + useEffect(() => { + if (nodeRef.current) { + resizeObserver.observe(nodeRef.current); + }; + + resize(); + + return () => { + if (nodeRef.current) { + resizeObserver.disconnect(); + }; + }; + }, []); + useEffect(() => { sidebar.resizePage(null, null, false); }); @@ -180,6 +207,7 @@ const Header = forwardRef<{}, Props>((props, ref) => { return (