mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-10 18:10:54 +09:00
Merge branch 'main' of github.com:anyproto/anytype-ts into feature/native-messaging-host
This commit is contained in:
commit
cbb012059c
37 changed files with 236 additions and 153 deletions
71
dist/workers/graph.js
vendored
71
dist/workers/graph.js
vendored
|
@ -75,6 +75,7 @@ let timeoutHover = 0;
|
|||
let rootId = '';
|
||||
let root = null;
|
||||
let paused = false;
|
||||
let isOver = '';
|
||||
|
||||
addEventListener('message', ({ data }) => {
|
||||
if (this[data.id]) {
|
||||
|
@ -195,23 +196,17 @@ updateForces = () => {
|
|||
|
||||
// Filter links
|
||||
if (!settings.link) {
|
||||
edges = edges.filter(d => d.type != EdgeType.Link);
|
||||
updateOrphans();
|
||||
|
||||
nodes = nodes.filter(d => !d.linkCnt);
|
||||
};
|
||||
|
||||
// Filter relations
|
||||
if (!settings.relation) {
|
||||
edges = edges.filter(d => d.type != EdgeType.Relation);
|
||||
updateOrphans();
|
||||
|
||||
nodes = nodes.filter(d => !d.relationCnt);
|
||||
};
|
||||
|
||||
// Filte local only edges
|
||||
if (settings.local) {
|
||||
edges = edges.filter(d => (d.source == rootId) || (d.target == rootId));
|
||||
edges = getEdgesByNodeId(rootId);
|
||||
|
||||
const nodeIds = util.arrayUnique([ rootId ].concat(edges.map(d => d.source)).concat(edges.map(d => d.target)));
|
||||
nodes = nodes.filter(d => nodeIds.includes(d.id));
|
||||
|
@ -220,8 +215,6 @@ updateForces = () => {
|
|||
let map = getNodeMap();
|
||||
edges = edges.filter(d => map.get(d.source) && map.get(d.target));
|
||||
|
||||
//updateOrphans();
|
||||
|
||||
// Filter orphans
|
||||
if (!settings.orphan) {
|
||||
nodes = nodes.filter(d => !d.isOrphan || d.forceShow);
|
||||
|
@ -292,11 +285,12 @@ updateTheme = ({ theme }) => {
|
|||
|
||||
updateOrphans = () => {
|
||||
nodes = nodes.map(d => {
|
||||
const edgeList = edges.filter(it => (it.source == d.id) || (it.target == d.id));
|
||||
const edges = getEdgesByNodeId(d.id);
|
||||
|
||||
d.isOrphan = !edgeList.length;
|
||||
d.linkCnt = edgeList.filter(it => it.type == EdgeType.Link).length;
|
||||
d.relationCnt = edgeList.filter(it => it.type == EdgeType.Relation).length;
|
||||
d.isOrphan = !edges.length;
|
||||
d.linkCnt = edges.filter(it => it.type == EdgeType.Link).length;
|
||||
d.relationCnt = edges.filter(it => it.type == EdgeType.Relation).length;
|
||||
|
||||
return d;
|
||||
});
|
||||
};
|
||||
|
@ -353,8 +347,8 @@ drawEdge = (d, arrowWidth, arrowHeight, arrowStart, arrowEnd) => {
|
|||
const sx2 = x2 + r2 * cos2;
|
||||
const sy2 = y2 + r2 * sin2;
|
||||
const k = 5 / transform.k;
|
||||
const isOver = d.source.isOver || d.target.isOver;
|
||||
const showName = isOver && d.name && settings.label;
|
||||
const io = (isOver == d.source.id) || (isOver == d.target.id);
|
||||
const showName = io && d.name && settings.label;
|
||||
const lineWidth = getLineWidth();
|
||||
|
||||
let colorLink = data.colors.link;
|
||||
|
@ -365,7 +359,7 @@ drawEdge = (d, arrowWidth, arrowHeight, arrowStart, arrowEnd) => {
|
|||
ctx.globalAlpha = hoverAlpha;
|
||||
};
|
||||
|
||||
if (isOver) {
|
||||
if (io) {
|
||||
colorLink = colorArrow = colorText = data.colors.highlight;
|
||||
ctx.globalAlpha = 1;
|
||||
};
|
||||
|
@ -437,6 +431,7 @@ drawNode = (d) => {
|
|||
const img = images[d.src];
|
||||
const diameter = radius * 2;
|
||||
const isSelected = selected.includes(d.id);
|
||||
const io = isOver == d.id;
|
||||
|
||||
let colorNode = data.colors.node;
|
||||
let colorText = data.colors.text;
|
||||
|
@ -449,9 +444,7 @@ drawNode = (d) => {
|
|||
const connections = edgeMap.get(d.id);
|
||||
if (connections && connections.length) {
|
||||
for (let i = 0; i < connections.length; i++) {
|
||||
const c = getNodeById(connections[i]);
|
||||
|
||||
if (c.isOver) {
|
||||
if (isOver == connections[i]) {
|
||||
ctx.globalAlpha = 1;
|
||||
break;
|
||||
};
|
||||
|
@ -459,7 +452,7 @@ drawNode = (d) => {
|
|||
};
|
||||
};
|
||||
|
||||
if (d.isOver || (root && (d.id == root.id))) {
|
||||
if (io || (root && (d.id == root.id))) {
|
||||
colorNode = colorText = colorLine = data.colors.highlight;
|
||||
lineWidth = getLineWidth() * 3;
|
||||
ctx.globalAlpha = 1;
|
||||
|
@ -469,7 +462,7 @@ drawNode = (d) => {
|
|||
colorNode = colorText = colorLine = data.colors.selected;
|
||||
};
|
||||
|
||||
if (d.isOver || isSelected) {
|
||||
if (io || isSelected) {
|
||||
lineWidth = getLineWidth() * 3;
|
||||
};
|
||||
|
||||
|
@ -619,24 +612,16 @@ onSetSelected = ({ ids }) => {
|
|||
};
|
||||
|
||||
onMouseMove = ({ x, y }) => {
|
||||
const active = nodes.find(d => d.isOver);
|
||||
const d = getNodeByCoords(x, y);
|
||||
|
||||
if (active) {
|
||||
active.isOver = false;
|
||||
};
|
||||
|
||||
if (d) {
|
||||
d.isOver = true;
|
||||
} else {
|
||||
isHovering = false;
|
||||
};
|
||||
isOver = d ? d.id : '';
|
||||
|
||||
send('onMouseMove', { node: (d ? d.id : ''), x, y, k: transform.k });
|
||||
redraw();
|
||||
clearTimeout(timeoutHover);
|
||||
|
||||
if (!d) {
|
||||
isHovering = false;
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -651,19 +636,17 @@ onMouseMove = ({ x, y }) => {
|
|||
};
|
||||
|
||||
onContextMenu = ({ x, y }) => {
|
||||
const active = nodes.find(d => d.isOver);
|
||||
if (active) {
|
||||
active.isOver = false;
|
||||
const d = getNodeByCoords(x, y);
|
||||
|
||||
isOver = d ? d.id : '';
|
||||
|
||||
if (d) {
|
||||
send('onContextMenu', { node: d, x, y });
|
||||
} else {
|
||||
send('onContextSpaceClick', { x, y });
|
||||
};
|
||||
|
||||
const d = getNodeByCoords(x, y);
|
||||
if (!d) {
|
||||
send('onContextSpaceClick', { x, y });
|
||||
} else {
|
||||
send('onContextMenu', { node: d, x, y });
|
||||
d.isOver = true;
|
||||
redraw();
|
||||
};
|
||||
redraw();
|
||||
};
|
||||
|
||||
onAddNode = ({ target, sourceId }) => {
|
||||
|
@ -783,6 +766,10 @@ const getNodeByCoords = (x, y) => {
|
|||
return simulation.find(transform.invertX(x), transform.invertY(y), 10 / transform.k);
|
||||
};
|
||||
|
||||
const getEdgesByNodeId = (id) => {
|
||||
return edges.filter(d => (d.source == id) || (d.target == id));
|
||||
};
|
||||
|
||||
const getRadius = (d) => {
|
||||
let k = 1;
|
||||
if (settings.icon && images[d.src] && (transform.k >= transformThresholdHalf)) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
BIN
electron/img/icons/256x256.ico
Normal file
BIN
electron/img/icons/256x256.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 KiB |
|
@ -51,6 +51,7 @@ class Server {
|
|||
|
||||
if (!this.isRunning && str && (str.indexOf(stdoutWebProxyPrefix) >= 0)) {
|
||||
const regex = new RegExp(stdoutWebProxyPrefix + '([^\n^\s]+)');
|
||||
|
||||
this.address = 'http://' + regex.exec(str)[1];
|
||||
this.isRunning = true;
|
||||
resolve(true);
|
||||
|
|
|
@ -98,7 +98,7 @@ class WindowManager {
|
|||
param.trafficLightPosition = { x: 20, y: 18 };
|
||||
} else
|
||||
if (is.windows) {
|
||||
param.icon = path.join(Util.imagePath(), 'icon32x32.png');
|
||||
param.icon = path.join(Util.imagePath(), 'icons', '256x256.ico');
|
||||
} else
|
||||
if (is.linux) {
|
||||
param.icon = image;
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.30.11
|
||||
0.30.12
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "anytype",
|
||||
"version": "0.37.16-beta",
|
||||
"version": "0.37.18-beta",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "anytype",
|
||||
"version": "0.37.16-beta",
|
||||
"version": "0.37.18-beta",
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "anytype",
|
||||
"version": "0.37.16-beta",
|
||||
"version": "0.37.18-beta",
|
||||
"description": "Anytype",
|
||||
"main": "electron.js",
|
||||
"scripts": {
|
||||
|
@ -535,7 +535,7 @@
|
|||
"win": {
|
||||
"sign": "./electron/hook/sign.js",
|
||||
"target": "nsis",
|
||||
"icon": "electron/img/icons/256x256.png",
|
||||
"icon": "electron/img/icons/256x256.ico",
|
||||
"publish": [
|
||||
{
|
||||
"provider": "spaces",
|
||||
|
|
|
@ -107,13 +107,13 @@
|
|||
|
||||
"coverRelationKeys": [ "coverId", "coverType", "coverX", "coverY", "coverScale" ],
|
||||
"optionRelationKeys": [ "id", "relationKey", "type", "layout", "name", "relationOptionColor" ],
|
||||
"typeRelationKeys": [ "recommendedRelations", "recommendedLayout", "sourceObject", "uniqueKey", "defaultTemplateId" ],
|
||||
"typeRelationKeys": [ "recommendedRelations", "recommendedLayout", "sourceObject", "uniqueKey", "defaultTemplateId", "lastUsedDate" ],
|
||||
"graphRelationKeys": [
|
||||
"id", "name", "snippet", "description", "iconEmoji", "iconImage", "iconOption", "relationFormat", "type", "layout", "done", "fileExt", "fileMimeType",
|
||||
"isDeleted", "isArchived", "isFavorite", "identityProfileLink"
|
||||
],
|
||||
"templateRelationKeys": [ "templateIsBundled", "type", "targetObjectType", "internalFlags", "sourceObject" ],
|
||||
"spaceRelationKeys": [ "spaceDashboardId", "spaceAccountStatus", "spaceLocalStatus", "spaceAccessibility", "targetSpaceId", "createdDate" ],
|
||||
"spaceRelationKeys": [ "spaceDashboardId", "spaceAccountStatus", "spaceLocalStatus", "spaceAccessibility", "targetSpaceId", "creator", "createdDate" ],
|
||||
|
||||
"pageCoverRelationKey": "pageCover",
|
||||
|
||||
|
|
|
@ -598,6 +598,7 @@
|
|||
"popupSettingsAppearancePersonalisation": "Personalisation",
|
||||
"popupSettingsAppearancePersonalisationSidebar": "Automatically show and hide sidebar",
|
||||
"popupSettingsAppearancePersonalisationRelativeDates": "Display relative dates",
|
||||
"popupSettingsAppearancePersonalisationFullscreen": "Open objects in fullscreen",
|
||||
|
||||
"popupSettingsWallpaperTitle": "Wallpaper",
|
||||
"popupSettingsWallpaperText": "Choose or upload the wallpaper. For best results upload high resolution images.",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
"qr": {
|
||||
"foreground": "#000",
|
||||
"bg": "#bfbfbf"
|
||||
"bg": "#fff"
|
||||
},
|
||||
|
||||
"icon": {
|
||||
|
@ -59,8 +59,8 @@
|
|||
},
|
||||
|
||||
"qr": {
|
||||
"foreground": "#d4d4d4",
|
||||
"bg": "#505050"
|
||||
"foreground": "#000",
|
||||
"bg": "#fff"
|
||||
},
|
||||
|
||||
"icon": {
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
}
|
||||
}
|
||||
.cell.isEditing.c-select {
|
||||
.cellContent { padding-bottom: 6px; height: auto !important; }
|
||||
.cellContent { padding-bottom: 10px; height: auto !important; }
|
||||
.wrap { overflow: visible; white-space: normal; }
|
||||
}
|
||||
.cell.isEditing.c-object {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
.wrap.withFilter {
|
||||
.items { height: calc(100% - 30px); }
|
||||
.emptySearch { height: calc(100% - 30px); }
|
||||
.loaderWrapper { top: 30px; height: calc(100% - 30px); }
|
||||
.loaderWrapper { position: relative; }
|
||||
}
|
||||
|
||||
.items { height: 100%; }
|
||||
|
|
|
@ -3,21 +3,23 @@
|
|||
html.bodyIndex, html.bodyAuth {
|
||||
--color-bg-primary: #060606 !important;
|
||||
|
||||
--color-text-primary: #d4d4d4;
|
||||
--color-text-primary: #d4d4d4 !important;
|
||||
--color-text-secondary: #8d8d8d !important;
|
||||
--color-text-tertiary: #505050;
|
||||
--color-text-tertiary: #505050 !important;
|
||||
|
||||
--color-shape-tertiary: #2b2b2b;
|
||||
--color-shape-tertiary: #2b2b2b !important;
|
||||
|
||||
--color-button-stroke: #252525;
|
||||
--color-button-stroke: #252525 !important;
|
||||
--color-button-black-hover: rgba(37, 37, 37, 0.8);
|
||||
--color-button-blank-hover: rgba(23, 23, 23, 0.8);
|
||||
|
||||
--color-input-opaque: #17171799;
|
||||
--color-popup: #141414;
|
||||
--color-input-opaque: #17171799 !important;
|
||||
--color-popup: #141414 !important;
|
||||
|
||||
--color-error: #8a351a;
|
||||
--color-error-background: #240e07;
|
||||
--color-error: #8a351a !important;
|
||||
--color-error-background: #240e07 !important;
|
||||
|
||||
--color-control-accent: #d4d4d4 !important;
|
||||
|
||||
--shadow: 0px 0px 0px 1px var(--color-button-stroke) !important;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
.items { display: flex; flex-direction: column; gap: 2px 0px; }
|
||||
|
||||
.item { display: flex; flex-direction: row; gap: 0px 10px; padding: 5px 8px; border-radius: 8px; transition: $transitionAllCommon; }
|
||||
.item:hover, .item.active { background: var(--color-shape-primary); }
|
||||
.item:hover, .item.active { background: var(--color-shape-highlight-medium); }
|
||||
.item {
|
||||
.icon { width: 22px; height: 22px; flex-shrink: 0; }
|
||||
.icon.logout { background-image: url('~img/icon/popup/settings/logout.svg'); }
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
.item { background: none; }
|
||||
.item::before { background: rgba(238, 238, 238, 0); }
|
||||
|
||||
.item {
|
||||
.icon.arrow { background-image: url('#{$themePath}/arrow/menu.svg'); }
|
||||
.icon.chk { background-image: url('#{$themePath}/icon/menu/checkbox.svg'); }
|
||||
|
@ -49,7 +50,7 @@
|
|||
.loaderWrapper { background: var(--color-bg-secondary); }
|
||||
}
|
||||
|
||||
/* MenuBlockAdd */
|
||||
/* BlockAdd */
|
||||
|
||||
.menu.menuBlockAdd {
|
||||
.item.isBig {
|
||||
|
@ -68,7 +69,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuSmile */
|
||||
/* Smile */
|
||||
|
||||
.menu.menuSmile {
|
||||
.body.gallery {
|
||||
|
@ -86,7 +87,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuBlockRelationView */
|
||||
/* BlockRelationEdit */
|
||||
|
||||
.menu.menuBlockRelationEdit {
|
||||
.item:hover { background: var(--color-shape-highlight-medium); }
|
||||
}
|
||||
|
||||
/* BlockRelationView */
|
||||
|
||||
.menu.menuBlockRelationView {
|
||||
.item {
|
||||
|
@ -98,7 +105,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuDataviewFilterValues */
|
||||
/* DataviewRelationEdit */
|
||||
|
||||
.menu.menuDataviewRelationEdit {
|
||||
.item:hover { background: var(--color-shape-highlight-medium); }
|
||||
}
|
||||
|
||||
/* DataviewFilterValues */
|
||||
|
||||
.menu.menuDataviewFilterValues {
|
||||
.select {
|
||||
|
@ -106,15 +119,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuThreadList */
|
||||
|
||||
.menu.menuThreadList {
|
||||
.item {
|
||||
.icon.cafe { background-image: url('#{$themePath}/icon/cafe.svg'); }
|
||||
}
|
||||
}
|
||||
|
||||
/* MenuDataviewCalendar */
|
||||
/* DataviewCalendar */
|
||||
|
||||
.menu.menuDataviewCalendar {
|
||||
.select {
|
||||
|
@ -124,7 +129,7 @@
|
|||
.day:not(.th):not(.active):hover { background: var(--color-system-drop-zone); }
|
||||
}
|
||||
|
||||
/* MenuBlockContext */
|
||||
/* BlockContext */
|
||||
|
||||
.menu.menuBlockContext {
|
||||
.icon.active.bold { background-image: url('#{$themePath}/icon/menu/action/mark/bold1.svg'); }
|
||||
|
@ -135,7 +140,7 @@
|
|||
.icon.active.underline { background-image: url('#{$themePath}/icon/menu/action/mark/underline1.svg'); }
|
||||
}
|
||||
|
||||
/* MenuBlockLinkSettings */
|
||||
/* BlockLinkSettings */
|
||||
|
||||
.menu.menuBlockLinkSettings {
|
||||
.section.card {
|
||||
|
@ -156,7 +161,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuOnboarding */
|
||||
/* Onboarding */
|
||||
|
||||
.menu.menuOnboarding { width: 288px; background: #373632; color: #fff; box-shadow: 0px 4px 16px rgb(0 0 0 / 20%); }
|
||||
.menu.menuOnboarding {
|
||||
|
@ -178,13 +183,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuDataviewCreateBookmark */
|
||||
/* DataviewCreateBookmark */
|
||||
|
||||
.menu.menuDataviewCreateBookmark {
|
||||
.loaderWrapper { background: rgba(39, 39, 35, 0.9); }
|
||||
}
|
||||
|
||||
/* MenuDataviewViewLayout */
|
||||
/* DataviewViewLayout */
|
||||
|
||||
.menu.menuDataviewViewLayout {
|
||||
.layouts {
|
||||
|
@ -207,7 +212,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuDataviewTemplateList */
|
||||
/* DataviewTemplateList */
|
||||
|
||||
.menu.menuDataviewTemplateList {
|
||||
.items {
|
||||
|
@ -224,7 +229,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuSpace */
|
||||
/* Space */
|
||||
|
||||
.menu.menuSpace { color: var(--color-text-primary); }
|
||||
.menu.menuSpace {
|
||||
|
@ -240,8 +245,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* MenuQuickCapture */
|
||||
/* QuickCapture */
|
||||
|
||||
.menuQuickCapture { background: none; box-shadow: none; }
|
||||
.menuQuickCapture.isExpanded { background: var(--color-bg-secondary); box-shadow: 0px 4px 16px rgb(0 0 0 / 20%), 0px 0px 0px 1px #393933 inset; }
|
||||
|
||||
/* ThreadList */
|
||||
|
||||
.menu.menuThreadList {
|
||||
.item {
|
||||
.icon.cafe { background-image: url('#{$themePath}/icon/cafe.svg'); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
.bg::before { box-shadow: 0px 0px; }
|
||||
}
|
||||
}
|
||||
|
||||
.side.right.tabImportIndex,
|
||||
.side.right.tabExportIndex {
|
||||
.item:hover { border-color: var(--color-shape-primary); }
|
||||
}
|
||||
}
|
||||
|
||||
/* PopupHelp */
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
.iconObject.isTask { background: none; }
|
||||
|
||||
.name { @include text-overflow-nw; }
|
||||
.descr { @include text-small; @include text-overflow-nw; }
|
||||
.descr { @include text-small; @include text-overflow-nw; color: var(--color-text-secondary); }
|
||||
|
||||
.buttons { flex-shrink: 0; display: flex; flex-direction: row; align-items: center; gap: 0px 6px; display: none; }
|
||||
.buttons {
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
.iconObject:not(.withOption) { background-color: var(--color-shape-tertiary); }
|
||||
.txt { width: calc(100% - 64px); }
|
||||
.name { @include text-common; @include text-overflow-nw; font-weight: 500; }
|
||||
.type { @include text-small; @include text-overflow-nw; }
|
||||
.type { @include text-small; @include text-overflow-nw; color: var(--color-text-secondary); }
|
||||
}
|
|
@ -837,6 +837,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
return;
|
||||
};
|
||||
|
||||
const { fullscreenObject } = commonStore;
|
||||
const { dataset } = this.props;
|
||||
const { selection } = dataset || {};
|
||||
const relation = dbStore.getRelationByKey(relationKey);
|
||||
|
@ -856,14 +857,13 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
|
||||
if ((relationKey == 'name') && (!ref.ref.state.isEditing)) {
|
||||
const ids = selection ? selection.get(I.SelectType.Record) : [];
|
||||
|
||||
if (keyboard.withCommand(e)) {
|
||||
if (ids.length) {
|
||||
return;
|
||||
} else {
|
||||
if (!ids.length) {
|
||||
UtilObject.openWindow(record);
|
||||
};
|
||||
} else {
|
||||
UtilObject.openPopup(record);
|
||||
fullscreenObject ? UtilObject.openAuto(record) : UtilObject.openPopup(record);
|
||||
};
|
||||
} else {
|
||||
ref.onClick(e);
|
||||
|
|
|
@ -32,6 +32,7 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
_isMounted = false;
|
||||
text = '';
|
||||
timeoutChange = 0;
|
||||
timeoutScroll = 0;
|
||||
node = null;
|
||||
refEditable = null;
|
||||
refType = null;
|
||||
|
@ -174,12 +175,10 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
this._isMounted = true;
|
||||
this.resize();
|
||||
this.init();
|
||||
this.onScroll();
|
||||
};
|
||||
|
||||
componentDidUpdate () {
|
||||
this.init();
|
||||
this.rebind();
|
||||
};
|
||||
|
||||
componentWillUnmount () {
|
||||
|
@ -189,6 +188,7 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
$(`#d${this.getContainerId()}`).remove();
|
||||
|
||||
window.clearTimeout(this.timeoutChange);
|
||||
window.clearTimeout(this.timeoutScroll);
|
||||
};
|
||||
|
||||
init () {
|
||||
|
@ -198,10 +198,11 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
this.setValue(this.text);
|
||||
this.setContent(this.text);
|
||||
this.rebind();
|
||||
this.onScroll();
|
||||
};
|
||||
|
||||
rebind () {
|
||||
const { block } = this.props;
|
||||
const { block, isPopup } = this.props;
|
||||
const { processor } = block.content;
|
||||
const { isEditing, isShowing } = this.state;
|
||||
const win = $(window);
|
||||
|
@ -239,7 +240,8 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
});
|
||||
|
||||
if (!UtilEmbed.allowAutoRender(processor)) {
|
||||
win.on(`scroll.${block.id}`, () => this.onScroll());
|
||||
const container = UtilCommon.getScrollContainer(isPopup);
|
||||
container.on(`scroll.${block.id}`, () => this.onScroll());
|
||||
};
|
||||
|
||||
win.on(`resize.${block.id}`, () => this.resize());
|
||||
|
@ -249,27 +251,39 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
};
|
||||
|
||||
unbind () {
|
||||
const { block } = this.props;
|
||||
const events = [ 'mousedown', 'mouseup', 'online', 'offline', 'scroll', 'resize' ];
|
||||
const { block, isPopup } = this.props;
|
||||
const container = UtilCommon.getScrollContainer(isPopup);
|
||||
const events = [ 'mousedown', 'mouseup', 'online', 'offline', 'resize' ];
|
||||
|
||||
$(window).off(events.map(it => `${it}.${block.id}`).join(' '));
|
||||
container.off(`scroll.${block.id}`);
|
||||
};
|
||||
|
||||
onScroll () {
|
||||
if (!this._isMounted) {
|
||||
const { block, isPopup } = this.props;
|
||||
const { processor } = block.content;
|
||||
|
||||
if (UtilEmbed.allowAutoRender(processor)) {
|
||||
return;
|
||||
};
|
||||
|
||||
const node = $(this.node);
|
||||
const win = $(window);
|
||||
const { wh } = UtilCommon.getWindowDimensions();
|
||||
const st = win.scrollTop();
|
||||
const { top } = node.offset();
|
||||
const bot = top + node.height();
|
||||
window.clearTimeout(this.timeoutScroll);
|
||||
this.timeoutScroll = window.setTimeout(() => {
|
||||
if (!this._isMounted) {
|
||||
return;
|
||||
};
|
||||
|
||||
if ((bot > st) && (top < st + wh)) {
|
||||
this.setShowing(true);
|
||||
};
|
||||
const container = UtilCommon.getScrollContainer(isPopup);
|
||||
const node = $(this.node);
|
||||
const ch = container.height();
|
||||
const st = container.scrollTop();
|
||||
const rect = node.get(0).getBoundingClientRect() as DOMRect;
|
||||
const top = rect.top - (isPopup ? container.offset().top : 0);
|
||||
|
||||
if (top <= st + ch) {
|
||||
this.setShowing(true);
|
||||
};
|
||||
}, 50);
|
||||
};
|
||||
|
||||
getContainerId () {
|
||||
|
@ -627,6 +641,17 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
blockId: block.id,
|
||||
};
|
||||
|
||||
// Fix Bilibili schemeless urls and autoplay
|
||||
if (block.isEmbedBilibili()) {
|
||||
if (text.match(/src="\/\/player[^"]+"/)) {
|
||||
text = text.replace(/src="(\/\/player[^"]+)"/, 'src="https:$1"');
|
||||
};
|
||||
|
||||
if (!/autoplay=/.test(text)) {
|
||||
text = text.replace(/(src="[^"]+)"/, `$1&autoplay=0"`);
|
||||
};
|
||||
};
|
||||
|
||||
// If content is Kroki code pack the code into SVG url
|
||||
if (block.isEmbedKroki() && !text.match(/^https:\/\/kroki.io/)) {
|
||||
const compressed = pako.deflate(new TextEncoder().encode(text), { level: 9 });
|
||||
|
@ -870,7 +895,7 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
keyboard.setResize(true);
|
||||
keyboard.disableSelection(true);
|
||||
|
||||
$(`#block-${block.id}`).addClass('isResizing');
|
||||
$(`.block.blockEmbed`).addClass('isResizing');
|
||||
win.on(`mousemove.${block.id}`, e => this.onResizeMove(e, checkMax));
|
||||
win.on(`mouseup.${block.id}`, e => this.onResizeEnd(e, checkMax));
|
||||
};
|
||||
|
@ -922,7 +947,7 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
keyboard.disableSelection(false);
|
||||
|
||||
win.off(`mousemove.${block.id} mouseup.${block.id}`);
|
||||
$(`#block-${block.id}`).removeClass('isResizing');
|
||||
$(`.block.blockEmbed`).removeClass('isResizing');
|
||||
|
||||
C.BlockListSetFields(rootId, [
|
||||
{ blockId: id, fields: { ...fields, width: w } },
|
||||
|
@ -973,10 +998,10 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
const node = $(this.node);
|
||||
const value = node.find('#value');
|
||||
|
||||
console.log(value.width());
|
||||
|
||||
this.setState({ width: value.width() });
|
||||
};
|
||||
|
||||
this.onScroll();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -722,7 +722,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
menuStore.closeAll();
|
||||
},
|
||||
data: {
|
||||
subId: rootId,
|
||||
rootId,
|
||||
value,
|
||||
filters,
|
||||
types: relation.objectTypes,
|
||||
|
|
|
@ -292,7 +292,6 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
vertical: I.MenuDirection.Center,
|
||||
data: {
|
||||
rootId,
|
||||
blockId,
|
||||
nameAdd: translate('menuBlockRelationEditAddObjectType'),
|
||||
placeholderFocus: translate('menuBlockRelationEditFilterObjectTypes'),
|
||||
value: this.objectTypes,
|
||||
|
|
|
@ -425,7 +425,7 @@ const MenuDataviewObjectList = observer(class MenuDataviewObjectList extends Rea
|
|||
resize () {
|
||||
const { getId, position, param } = this.props;
|
||||
const { data } = param;
|
||||
const { noFilter, canAdd, filter } = data;
|
||||
const { noFilter } = data;
|
||||
const items = this.getItems();
|
||||
const obj = $(`#${getId()} .content`);
|
||||
|
||||
|
@ -447,4 +447,4 @@ const MenuDataviewObjectList = observer(class MenuDataviewObjectList extends Rea
|
|||
|
||||
});
|
||||
|
||||
export default MenuDataviewObjectList;
|
||||
export default MenuDataviewObjectList;
|
|
@ -192,10 +192,10 @@ const MenuObjectValues = observer(class MenuObjectValues extends React.Component
|
|||
const { config } = commonStore;
|
||||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { subId, valueMapper, nameAdd } = data;
|
||||
const { rootId, valueMapper, nameAdd } = data;
|
||||
|
||||
let value: any[] = Relation.getArrayValue(data.value);
|
||||
value = value.map(it => detailStore.get(subId, it, []));
|
||||
value = value.map(it => detailStore.get(rootId, it, []));
|
||||
value = value.filter(it => it && !it._empty_ && !it.isArchived && !it.isDeleted);
|
||||
|
||||
if (!config.debug.ho) {
|
||||
|
|
|
@ -423,7 +423,7 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
|
||||
const { param, getSize } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
const { rootId } = data;
|
||||
|
||||
if (this.isReadonly()) {
|
||||
return;
|
||||
|
@ -442,7 +442,6 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
width: getSize().width,
|
||||
data: {
|
||||
rootId,
|
||||
blockId,
|
||||
nameAdd: translate('menuDataviewRelationEditAddObjectType'),
|
||||
placeholderFocus: translate('menuDataviewRelationEditFilterObjectTypes'),
|
||||
value: this.objectTypes,
|
||||
|
|
|
@ -897,13 +897,14 @@ const Menu = observer(class Menu extends React.Component<I.Menu, State> {
|
|||
return;
|
||||
};
|
||||
|
||||
|
||||
const refInput = this.ref.refFilter || this.ref.refName;
|
||||
if ((this.ref.n == -1) && refInput) {
|
||||
refInput.focus();
|
||||
};
|
||||
|
||||
const items = this.ref.getItems();
|
||||
if (item) {
|
||||
if (item && item.id) {
|
||||
this.ref.n = items.findIndex(it => it.id == item.id);
|
||||
};
|
||||
|
||||
|
@ -919,7 +920,9 @@ const Menu = observer(class Menu extends React.Component<I.Menu, State> {
|
|||
|
||||
if (next && (next.isDiv || next.isSection)) {
|
||||
this.ref.n++;
|
||||
this.setActive(items[this.ref.n], scroll);
|
||||
if (items[this.ref.n]) {
|
||||
this.setActive(items[this.ref.n], scroll);
|
||||
};
|
||||
} else {
|
||||
this.setHover(next, scroll);
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
cache: any = null;
|
||||
refList: any = null;
|
||||
refFilter: any = null;
|
||||
tab: I.StoreTab = I.StoreTab.Type;
|
||||
tab: I.StoreTab = null;
|
||||
view: View = View.Marketplace;
|
||||
frame = 0;
|
||||
limit = 0;
|
||||
|
@ -322,8 +322,12 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
onTab (id: any, isInner: boolean) {
|
||||
const { isPopup } = this.props;
|
||||
|
||||
if (this.tab == id) {
|
||||
return;
|
||||
};
|
||||
|
||||
this.tab = id;
|
||||
this.onView(Storage.get('viewStore') || View.Library, isInner);
|
||||
this.onView(Storage.get('viewStore') || View.Library, isInner, true);
|
||||
|
||||
Storage.set('tabStore', id);
|
||||
|
||||
|
@ -340,7 +344,11 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
};
|
||||
};
|
||||
|
||||
onView (id: View, isInner: boolean) {
|
||||
onView (id: View, isInner: boolean, isChangeTab: boolean = false) {
|
||||
if (!isChangeTab && (this.view == id)) {
|
||||
return;
|
||||
};
|
||||
|
||||
this.view = id;
|
||||
this.getData(true);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as React from 'react';
|
||||
import { Icon, Title, Label, Switch } from 'Component';
|
||||
import { Icon, Title, Label, Switch, Select } from 'Component';
|
||||
import { I, UtilCommon, translate, analytics, Renderer } from 'Lib';
|
||||
import { commonStore } from 'Store';
|
||||
import { observer } from 'mobx-react';
|
||||
|
@ -7,7 +7,7 @@ import { observer } from 'mobx-react';
|
|||
const PopupSettingsPageAppearance = observer(class PopupSettingsPageAppearance extends React.Component<I.PopupSettings> {
|
||||
|
||||
render () {
|
||||
const { autoSidebar, showRelativeDates, config, theme } = commonStore;
|
||||
const { autoSidebar, showRelativeDates, config, theme, fullscreenObject } = commonStore;
|
||||
const { hideTray, hideMenuBar } = config;
|
||||
const canHideMenu = UtilCommon.isPlatformWindows() || UtilCommon.isPlatformLinux();
|
||||
const themes: any[] = [
|
||||
|
@ -61,6 +61,11 @@ const PopupSettingsPageAppearance = observer(class PopupSettingsPageAppearance e
|
|||
<Switch className="big" value={!hideMenuBar} onChange={(e: any, v: boolean) => Renderer.send('setMenuBarVisibility', v)} />
|
||||
</div>
|
||||
) : ''}
|
||||
|
||||
<div className="item">
|
||||
<Label text={translate('popupSettingsAppearancePersonalisationFullscreen')} />
|
||||
<Switch className="big" value={fullscreenObject} onChange={(e: any, v: boolean) => commonStore.fullscreenObjectSet(v)} />
|
||||
</div>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
|
|
@ -266,7 +266,10 @@ const Graph = observer(class Graph extends React.Component<Props> {
|
|||
const body = $('body');
|
||||
const node = $(this.node);
|
||||
const { left, top } = node.offset();
|
||||
|
||||
const render = this.previewId != this.subject.id;
|
||||
|
||||
this.previewId = this.subject.id;
|
||||
|
||||
let el = $('#graphPreview');
|
||||
|
||||
const position = () => {
|
||||
|
@ -277,11 +280,13 @@ const Graph = observer(class Graph extends React.Component<Props> {
|
|||
el.css({ left: x, top: y });
|
||||
};
|
||||
|
||||
if (!el.length) {
|
||||
if (!el.length || render) {
|
||||
el = $('<div id="graphPreview" />');
|
||||
body.append(el);
|
||||
ReactDOM.render(<PreviewDefault object={this.subject} className="previewGraph" />, el.get(0), position);
|
||||
|
||||
body.find('#graphPreview').remove();
|
||||
body.append(el);
|
||||
|
||||
ReactDOM.render(<PreviewDefault object={this.subject} className="previewGraph" />, el.get(0), position);
|
||||
analytics.event('SelectGraphNode', { objectType: this.subject.type, layout: this.subject.layout });
|
||||
} else {
|
||||
position();
|
||||
|
|
|
@ -149,7 +149,7 @@ export default [
|
|||
div(),
|
||||
// --------------------------------------------//
|
||||
|
||||
h1(`A Winter Wonderland of Fresh Features ☃️`),
|
||||
h1(`Release 0.37.0 - A Winter Wonderland of Fresh Features ☃️`),
|
||||
text(`Happy festive season, Anytypers! We’re excited to be bidding 2023 farewell with another huge release that addresses some long standing community requests, gives you greater control over your data management, and unlocks the possibility to share your pre-created templates and use cases with other Anytypers. Let’s jump in!`),
|
||||
|
||||
h2(`💎 Highlights of this Release:`),
|
||||
|
|
|
@ -33,32 +33,32 @@ export enum BlockType {
|
|||
};
|
||||
|
||||
export enum BlockPosition {
|
||||
None = 0,
|
||||
Top = 1,
|
||||
Bottom = 2,
|
||||
Left = 3,
|
||||
Right = 4,
|
||||
Inner = 5,
|
||||
Replace = 6,
|
||||
InnerFirst = 7,
|
||||
None = 0,
|
||||
Top = 1,
|
||||
Bottom = 2,
|
||||
Left = 3,
|
||||
Right = 4,
|
||||
Inner = 5,
|
||||
Replace = 6,
|
||||
InnerFirst = 7,
|
||||
};
|
||||
|
||||
export enum BlockSplitMode {
|
||||
Bottom = 0,
|
||||
Top = 1,
|
||||
Inner = 2,
|
||||
Bottom = 0,
|
||||
Top = 1,
|
||||
Inner = 2,
|
||||
};
|
||||
|
||||
export enum BlockHAlign {
|
||||
Left = 0,
|
||||
Center = 1,
|
||||
Right = 2,
|
||||
Left = 0,
|
||||
Center = 1,
|
||||
Right = 2,
|
||||
};
|
||||
|
||||
export enum BlockVAlign {
|
||||
Top = 0,
|
||||
Middle = 1,
|
||||
Bottom = 2,
|
||||
Top = 0,
|
||||
Middle = 1,
|
||||
Bottom = 2,
|
||||
};
|
||||
|
||||
export interface BlockComponent {
|
||||
|
@ -196,6 +196,7 @@ export interface Block {
|
|||
isEmbedTelegram?(): boolean;
|
||||
isEmbedGithubGist?(): boolean;
|
||||
isEmbedSketchfab?(): boolean;
|
||||
isEmbedBilibili?(): boolean;
|
||||
|
||||
isText?(): boolean;
|
||||
isTextTitle?(): boolean;
|
|
@ -309,8 +309,10 @@ class Keyboard {
|
|||
return;
|
||||
};
|
||||
|
||||
const { fullscreenObject } = commonStore;
|
||||
|
||||
UtilObject.create('', '', details, I.BlockPosition.Bottom, '', {}, [ I.ObjectFlag.SelectTemplate, I.ObjectFlag.DeleteEmpty ], (message: any) => {
|
||||
UtilObject.openAuto({ id: message.targetId });
|
||||
fullscreenObject ? UtilObject.openAuto({ id: message.targetId }) : UtilObject.openPopup({ id: message.targetId });
|
||||
analytics.event('CreateObject', { route, objectType: commonStore.type });
|
||||
});
|
||||
};
|
||||
|
|
|
@ -22,6 +22,14 @@ type SearchSubscribeParams = Partial<{
|
|||
noDeps: boolean;
|
||||
}>;
|
||||
|
||||
const SYSTEM_DATE_RELATION_KEYS = [
|
||||
'lastModifiedDate',
|
||||
'lastOpenedDate',
|
||||
'createdDate',
|
||||
'addedDate',
|
||||
'lastUsedDate',
|
||||
];
|
||||
|
||||
class UtilData {
|
||||
|
||||
blockTextClass (v: I.TextStyle): string {
|
||||
|
@ -576,6 +584,12 @@ class UtilData {
|
|||
return 0;
|
||||
};
|
||||
|
||||
sortByNumericKey (key: string, c1: any, c2: any, dir: I.SortType) {
|
||||
if (c1[key] > c2[key]) return dir == I.SortType.Asc ? 1 : -1;
|
||||
if (c1[key] < c2[key]) return dir == I.SortType.Asc ? -1 : 1;
|
||||
return this.sortByName(c1, c2);
|
||||
};
|
||||
|
||||
checkObjectWithRelationCnt (relationKey: string, type: string, ids: string[], limit: number, callBack?: (message: any) => void) {
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.Equal, value: type },
|
||||
|
@ -809,9 +823,7 @@ class UtilData {
|
|||
};
|
||||
|
||||
sortMapper (it: any) {
|
||||
if ([ 'lastModifiedDate', 'lastOpenedDate', 'createdDate' ].includes(it.relationKey)) {
|
||||
it.includeTime = true;
|
||||
};
|
||||
it.includeTime = SYSTEM_DATE_RELATION_KEYS.includes(it.relationKey);
|
||||
return it;
|
||||
};
|
||||
|
||||
|
@ -837,7 +849,6 @@ class UtilData {
|
|||
|
||||
graphFilters () {
|
||||
const { space, techSpace } = commonStore;
|
||||
|
||||
const templateType = dbStore.getTemplateType();
|
||||
const filters = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isHidden', condition: I.FilterCondition.NotEqual, value: true },
|
||||
|
|
|
@ -113,6 +113,8 @@ class UtilMenu {
|
|||
{ type: I.BlockType.Page, id: 'existing', icon: 'existing', lang: 'Existing', arrow: true, aliases: [ 'link' ] },
|
||||
];
|
||||
|
||||
items.sort((c1, c2) => UtilData.sortByNumericKey('lastUsedDate', c1, c2, I.SortType.Desc));
|
||||
|
||||
let i = 0;
|
||||
for (const type of items) {
|
||||
ret.push({
|
||||
|
|
|
@ -390,6 +390,10 @@ class Block implements I.Block {
|
|||
isEmbedSketchfab (): boolean {
|
||||
return this.isEmbed() && (this.content.processor == I.EmbedProcessor.Sketchfab);
|
||||
};
|
||||
|
||||
isEmbedBilibili (): boolean {
|
||||
return this.isEmbed() && (this.content.processor == I.EmbedProcessor.Bilibili);
|
||||
};
|
||||
|
||||
isText (): boolean {
|
||||
return this.type == I.BlockType.Text;
|
||||
|
|
|
@ -50,6 +50,7 @@ class CommonStore {
|
|||
public autoSidebarValue = null;
|
||||
public isSidebarFixedValue = null;
|
||||
public showRelativeDatesValue = null;
|
||||
public fullscreenObjectValue = null;
|
||||
|
||||
public previewObj: I.Preview = {
|
||||
type: null,
|
||||
|
@ -91,6 +92,7 @@ class CommonStore {
|
|||
isFullScreen: observable,
|
||||
autoSidebarValue: observable,
|
||||
isSidebarFixedValue: observable,
|
||||
fullscreenObjectValue: observable,
|
||||
spaceId: observable,
|
||||
techSpaceId: observable,
|
||||
config: computed,
|
||||
|
@ -174,6 +176,10 @@ class CommonStore {
|
|||
return this.boolGet('isSidebarFixed');
|
||||
};
|
||||
|
||||
get fullscreenObject(): boolean {
|
||||
return this.boolGet('fullscreenObject');
|
||||
};
|
||||
|
||||
get theme(): string {
|
||||
return String(this.themeId || '');
|
||||
};
|
||||
|
@ -323,6 +329,10 @@ class CommonStore {
|
|||
this.boolSet('showRelativeDates', v);
|
||||
};
|
||||
|
||||
fullscreenObjectSet (v: boolean) {
|
||||
this.boolSet('fullscreenObject', v);
|
||||
};
|
||||
|
||||
fullscreenSet (v: boolean) {
|
||||
const body = $('body');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue