mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-09 17:45:02 +09:00
merge
This commit is contained in:
commit
529d0bc0d9
52 changed files with 255 additions and 249 deletions
2
dist/.gitignore
vendored
2
dist/.gitignore
vendored
|
@ -3,8 +3,6 @@ Anytype Setup*
|
|||
anytypeHelper*
|
||||
mac/*
|
||||
.icon-ico/*
|
||||
main.js
|
||||
main.js.map
|
||||
commands.js
|
||||
bundle-back.js
|
||||
anytypeHelper*
|
||||
|
|
2
dist/index.html
vendored
2
dist/index.html
vendored
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="./run.js" type="text/javascript"></script>
|
||||
<script src="./js/run.js" type="text/javascript"></script>
|
||||
|
||||
<!-- %REPLACE-JS% -->
|
||||
</body>
|
||||
|
|
4
dist/index.web.html
vendored
4
dist/index.web.html
vendored
|
@ -17,11 +17,11 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<script src="./polyfill.js" type="text/javascript"></script>
|
||||
<script src="./js/polyfill.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body onload="onload();">
|
||||
<div id="root"></div>
|
||||
<script src="./run.js" type="text/javascript"></script>
|
||||
<script src="./js/run.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
function onload () {
|
||||
RendererEvents.init(null, {
|
||||
|
|
2
dist/js/.gitignore
vendored
Normal file
2
dist/js/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
main.js
|
||||
main.js.map
|
0
dist/polyfill.js → dist/js/polyfill.js
vendored
0
dist/polyfill.js → dist/js/polyfill.js
vendored
2
dist/run.js → dist/js/run.js
vendored
2
dist/run.js → dist/js/run.js
vendored
|
@ -1,6 +1,6 @@
|
|||
const s = document.createElement('script');
|
||||
|
||||
s.src = './main.js?' + Math.random();
|
||||
s.src = './js/main.js?' + Math.random();
|
||||
s.type = 'text/javascript';
|
||||
|
||||
document.body.appendChild(s);
|
|
@ -16,6 +16,6 @@ exports.default = async function (context) {
|
|||
};
|
||||
|
||||
return await cli.releases.uploadSourceMaps(context.packager.appInfo.version, {
|
||||
include: [ '../../dist/main.js.map' ],
|
||||
include: [ '../../dist/js/main.js.map' ],
|
||||
});
|
||||
};
|
|
@ -176,8 +176,8 @@ class Util {
|
|||
fs.writeFileSync(exportName, content);
|
||||
|
||||
try {
|
||||
fs.unlinkSync(path.join(filesPath, 'main.js'));
|
||||
fs.unlinkSync(path.join(filesPath, 'run.js'));
|
||||
fs.unlinkSync(path.join(filesPath, 'js/main.js'));
|
||||
fs.unlinkSync(path.join(filesPath, 'js/run.js'));
|
||||
} catch (e) {
|
||||
this.log('info', e);
|
||||
};
|
||||
|
@ -223,10 +223,11 @@ class Util {
|
|||
"cs-CZ", "da-DK", "de-DE",
|
||||
"en-US", "es-ES", "fr-FR",
|
||||
"hi-IN", "id-ID", "it-IT",
|
||||
"ja-JP", "nl-NL", "no-NO",
|
||||
"pl-PL", "pt-BR", "ro-RO",
|
||||
"ru-RU", "tr-TR", "uk-UA",
|
||||
"vi-VN", "zh-CN", "zh-TW"
|
||||
"lt-LT", "ja-JP", "nl-NL",
|
||||
"no-NO", "pl-PL", "pt-BR",
|
||||
"ro-RO", "ru-RU", "tr-TR",
|
||||
"uk-UA", "vi-VN", "zh-CN",
|
||||
"zh-TW"
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ window.AnytypeGlobalConfig = {
|
|||
emojiUrl: Extension.clipper.emojiUrl,
|
||||
menuBorderTop: 16,
|
||||
menuBorderBottom: 16,
|
||||
debug: { mw: true },
|
||||
debug: {},
|
||||
};
|
||||
|
||||
let rootId = '';
|
||||
|
|
|
@ -42,6 +42,7 @@ const rootStore = {
|
|||
};
|
||||
|
||||
class RoutePage extends React.Component<RouteComponentProps> {
|
||||
|
||||
render () {
|
||||
const { match } = this.props;
|
||||
const params = match.params as any;
|
||||
|
@ -56,6 +57,7 @@ class RoutePage extends React.Component<RouteComponentProps> {
|
|||
</React.Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class Iframe extends React.Component {
|
||||
|
|
|
@ -3,8 +3,8 @@ import { observer } from 'mobx-react';
|
|||
import { observable } from 'mobx';
|
||||
import arrayMove from 'array-move';
|
||||
import { getRange, setRange } from 'selection-ranges';
|
||||
import { Label, Input, Button, Select, Loader, Error, DragBox, Tag, Textarea } from 'Component';
|
||||
import { I, C, UtilCommon, UtilData, Relation, keyboard, UtilObject, UtilRouter } from 'Lib';
|
||||
import { Label, Input, Button, Select, Loader, Error, DragBox, Tag } from 'Component';
|
||||
import { I, C, UtilCommon, UtilData, Relation, keyboard, UtilObject, UtilRouter, Storage } from 'Lib';
|
||||
import { dbStore, detailStore, commonStore, menuStore, extensionStore } from 'Store';
|
||||
import Constant from 'json/constant.json';
|
||||
import Util from '../lib/util';
|
||||
|
@ -47,7 +47,6 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
this.onKeyUp = this.onKeyUp.bind(this);
|
||||
this.onInput = this.onInput.bind(this);
|
||||
this.onFocus = this.onFocus.bind(this);
|
||||
this.onBlur = this.onBlur.bind(this);
|
||||
this.onDragEnd = this.onDragEnd.bind(this);
|
||||
this.focus = this.focus.bind(this);
|
||||
};
|
||||
|
@ -136,7 +135,6 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
contentEditable={true}
|
||||
suppressContentEditableWarning={true}
|
||||
onFocus={this.onFocus}
|
||||
onBlur={this.onBlur}
|
||||
onInput={this.onInput}
|
||||
onKeyDown={this.onKeyDown}
|
||||
onKeyUp={this.onKeyUp}
|
||||
|
@ -170,6 +168,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
|
||||
componentDidUpdate(): void {
|
||||
this.initType();
|
||||
this.placeholderCheck();
|
||||
};
|
||||
|
||||
initSpace () {
|
||||
|
@ -179,7 +178,20 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
return;
|
||||
};
|
||||
|
||||
const space = commonStore.space || spaces[0].targetSpaceId;
|
||||
let space = commonStore.space || Storage.get('lastSpaceId');
|
||||
|
||||
if (!space) {
|
||||
space = spaces.find(it => it.spaceAccessType == I.SpaceType.Personal)?.id;
|
||||
};
|
||||
|
||||
let check = null;
|
||||
if (space) {
|
||||
check = spaces.find(it => it.id == space);
|
||||
};
|
||||
|
||||
if (!space || !check) {
|
||||
space = spaces[0].id;
|
||||
};
|
||||
|
||||
this.refSpace.setOptions(spaces);
|
||||
this.refSpace.setValue(space);
|
||||
|
@ -193,7 +205,10 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
return;
|
||||
};
|
||||
|
||||
this.details.type = this.details.type || options[0].id;
|
||||
if (!this.details.type) {
|
||||
const bookmark = dbStore.getBookmarkType();
|
||||
this.details.type = bookmark?.id || options[0].id;
|
||||
};
|
||||
|
||||
this.refType.setOptions(options);
|
||||
this.refType.setValue(this.details.type);
|
||||
|
@ -245,6 +260,8 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
onSpaceChange (id: string): void {
|
||||
commonStore.spaceSet(id);
|
||||
UtilData.createSubscriptions(() => this.forceUpdate());
|
||||
|
||||
Storage.set('lastSpaceId', id);
|
||||
};
|
||||
|
||||
getTagsValue () {
|
||||
|
@ -297,9 +314,8 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
|
||||
e.preventDefault();
|
||||
|
||||
const value = this.getValue();
|
||||
value.existing.pop();
|
||||
this.setValue(value.existing);
|
||||
this.details.tag.pop();
|
||||
this.setValue(this.details.tag);
|
||||
});
|
||||
|
||||
this.placeholderCheck();
|
||||
|
@ -316,7 +332,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
};
|
||||
|
||||
onKeyUp (e: any) {
|
||||
menuStore.updateData('dataviewOptionList', { filter: this.getValue().new });
|
||||
menuStore.updateData('dataviewOptionList', { filter: this.getValue() });
|
||||
|
||||
this.placeholderCheck();
|
||||
this.resize();
|
||||
|
@ -354,44 +370,22 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
});
|
||||
};
|
||||
|
||||
onBlur () {
|
||||
};
|
||||
|
||||
placeholderCheck () {
|
||||
const node = $(this.node);
|
||||
const value = this.getValue();
|
||||
const list = node.find('#list');
|
||||
const placeholder = node.find('#placeholder');
|
||||
const length = this.details.tag.length;
|
||||
|
||||
if (value.existing.length) {
|
||||
list.show();
|
||||
} else {
|
||||
list.hide();
|
||||
};
|
||||
|
||||
if (value.new || value.existing.length) {
|
||||
placeholder.hide();
|
||||
} else {
|
||||
placeholder.show();
|
||||
};
|
||||
length ? list.show() : list.hide();
|
||||
value || length ? placeholder.hide() : placeholder.show();
|
||||
};
|
||||
|
||||
getValue () {
|
||||
getValue (): string {
|
||||
const node = $(this.node);
|
||||
const list = node.find('#list');
|
||||
const items = list.find('.itemWrap');
|
||||
const entry = node.find('#entry');
|
||||
const existing: any[] = [];
|
||||
|
||||
items.each((i: number, item: any) => {
|
||||
item = $(item);
|
||||
existing.push(item.data('id'));
|
||||
});
|
||||
|
||||
return {
|
||||
existing,
|
||||
new: (entry.length ? String(entry.text() || '').trim() : ''),
|
||||
};
|
||||
return entry.length ? String(entry.text() || '').trim() : '';
|
||||
};
|
||||
|
||||
setValue (value: string[]) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Button } from 'Component';
|
||||
import { I, C, UtilCommon, UtilObject } from 'Lib';
|
||||
import { I, C, UtilCommon } from 'Lib';
|
||||
import { extensionStore, detailStore } from 'Store';
|
||||
import Url from 'json/url.json';
|
||||
|
||||
interface State {
|
||||
error: string;
|
||||
|
@ -37,8 +36,9 @@ const Success = observer(class Success extends React.Component<I.PageComponent,
|
|||
};
|
||||
|
||||
onOpen () {
|
||||
C.BroadcastPayloadEvent({ type: 'openObject', object: extensionStore.createdObject });
|
||||
window.close();
|
||||
C.BroadcastPayloadEvent({ type: 'openObject', object: extensionStore.createdObject }, () => {
|
||||
window.close();
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ html.anytypeWebclipper-popup { width: 268px; }
|
|||
|
||||
.box { border: 1px solid var(--color-shape-secondary); border-radius: 1px; min-height: 32px; }
|
||||
.box {
|
||||
.value { padding: 6px 10px 0px 10px; }
|
||||
.value { padding: 5px 10px 0px 10px; }
|
||||
.value {
|
||||
.itemWrap { margin: 0px 6px 6px 0px; }
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
- This is the native messaging host for the AnyType browser extension.
|
||||
- It enables the web extension to find the open ports of the AnyType application and to start it if it is not running.
|
||||
- It is installed by the Electron script found in electron/js/lib/installNativeMessagingHost.js
|
||||
- for more docs, checkout the webclipper repository: https://github.com/anytypeio/webclipper
|
||||
*/
|
||||
|
||||
package main
|
||||
|
@ -48,10 +47,21 @@ func splitStdOutTokens(line string) []string {
|
|||
|
||||
// executes a command and returns the stdout as string
|
||||
func execCommand(command string) (string, error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
return execCommandWin(command)
|
||||
}
|
||||
stdout, err := exec.Command("bash", "-c", command).Output()
|
||||
return string(stdout), err
|
||||
}
|
||||
|
||||
func execCommandWin(command string) (string, error) {
|
||||
// Splitting the command into the executable and the arguments
|
||||
// For Windows, commands are executed through cmd /C
|
||||
cmd := exec.Command("cmd", "/C", command)
|
||||
stdout, err := cmd.Output()
|
||||
return string(stdout), err
|
||||
}
|
||||
|
||||
// checks if a string is contained in an array of strings
|
||||
func contains(s []string, e string) bool {
|
||||
for _, a := range s {
|
||||
|
@ -64,10 +74,11 @@ func contains(s []string, e string) bool {
|
|||
|
||||
// CORE LOGIC
|
||||
|
||||
// Windows: returns a list of open ports for all instances of anytypeHelper.exe found using cli utilities tasklist, netstat and findstr
|
||||
// Windows: returns a list of open ports for all instances of anytypeHelper.exe found using cli utilities tasklist, netstat and findstr
|
||||
func getOpenPortsWindows() (map[string][]string, error) {
|
||||
appName := "anytypeHelper.exe"
|
||||
stdout, err := execCommand(`tasklist | findstr "` + appName + `"`)
|
||||
stdout, err := execCommand(`tasklist`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -75,6 +86,9 @@ func getOpenPortsWindows() (map[string][]string, error) {
|
|||
lines := splitStdOutLines(stdout)
|
||||
pids := map[string]bool{}
|
||||
for _, line := range lines {
|
||||
if !strings.Contains(line, appName) {
|
||||
continue
|
||||
}
|
||||
tokens := splitStdOutTokens(line)
|
||||
pids[tokens[1]] = true
|
||||
}
|
||||
|
@ -85,7 +99,7 @@ func getOpenPortsWindows() (map[string][]string, error) {
|
|||
|
||||
result := map[string][]string{}
|
||||
for pid := range pids {
|
||||
stdout, err := execCommand(`netstat -ano | findstr ${pid} | findstr LISTENING`)
|
||||
stdout, err := execCommand(`netstat -ano`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -93,6 +107,9 @@ func getOpenPortsWindows() (map[string][]string, error) {
|
|||
lines := splitStdOutLines(stdout)
|
||||
ports := map[string]bool{}
|
||||
for _, line := range lines {
|
||||
if !strings.Contains(line, pid) || !strings.Contains(line, "LISTENING") {
|
||||
continue
|
||||
}
|
||||
tokens := splitStdOutTokens(line)
|
||||
port := strings.Split(tokens[1], ":")[1]
|
||||
ports[port] = true
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.32.0-rc6
|
||||
0.32.0-rc8
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "anytype",
|
||||
"version": "0.38.21-alpha",
|
||||
"version": "0.38.23-alpha",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "anytype",
|
||||
"version": "0.38.21-alpha",
|
||||
"version": "0.38.23-alpha",
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"dependencies": {
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
"build",
|
||||
"!dist/*",
|
||||
"dist/index.html",
|
||||
"dist/main.js",
|
||||
"dist/main.js.map",
|
||||
"dist/run.js",
|
||||
"dist/embed/**/*",
|
||||
"dist/challenge/**/*",
|
||||
"dist/lib/**/*",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "anytype",
|
||||
"version": "0.38.21-alpha",
|
||||
"version": "0.38.23-alpha",
|
||||
"description": "Anytype",
|
||||
"main": "electron.js",
|
||||
"scripts": {
|
||||
|
@ -167,10 +167,7 @@
|
|||
}
|
||||
],
|
||||
"asarUnpack": [
|
||||
"dist/main.js",
|
||||
"dist/main.js.map",
|
||||
"dist/index.html",
|
||||
"dist/run.js",
|
||||
"dist/lib",
|
||||
"dist/anytypeHelper",
|
||||
"dist/anytypeHelper.exe",
|
||||
|
@ -215,9 +212,6 @@
|
|||
"build",
|
||||
"!dist/*",
|
||||
"dist/index.html",
|
||||
"dist/main.js",
|
||||
"dist/main.js.map",
|
||||
"dist/run.js",
|
||||
"dist/embed/**/*",
|
||||
"dist/challenge/**/*",
|
||||
"dist/lib/**/*",
|
||||
|
|
|
@ -516,6 +516,7 @@
|
|||
"hi-IN",
|
||||
"id-ID",
|
||||
"it-IT",
|
||||
"lt-LT",
|
||||
"ja-JP",
|
||||
"nl-NL",
|
||||
"no-NO",
|
||||
|
|
|
@ -167,12 +167,12 @@
|
|||
"electronMenuLogs": "Show Logs",
|
||||
"electronMenuImport": "Import to Space",
|
||||
"electronMenuExport": "Export Space",
|
||||
"electronMenuSaveAs": "Save as file",
|
||||
"electronMenuSaveAs": "Export Object",
|
||||
"electronMenuDebugSpace": "Space",
|
||||
"electronMenuDebugObject": "Current Object",
|
||||
"electronMenuDebugProcess": "Process",
|
||||
"electronMenuDebugTree": "Tree diagnostics",
|
||||
"electronMenuClose": "Close window",
|
||||
"electronMenuClose": "Close Window",
|
||||
"electronMenuEdit": "Edit",
|
||||
"electronMenuUndo": "Undo",
|
||||
"electronMenuRedo": "Redo",
|
||||
|
@ -183,7 +183,7 @@
|
|||
"electronMenuSearch": "Search",
|
||||
"electronMenuPrint": "Print",
|
||||
"electronMenuWindow": "Window",
|
||||
"electronMenuNewWindow": "New window",
|
||||
"electronMenuNewWindow": "New Window",
|
||||
"electronMenuSearchObject": "Search Object",
|
||||
"electronMenuMinimise": "Minimise",
|
||||
"electronMenuZoomIn": "Zoom in",
|
||||
|
@ -675,10 +675,6 @@
|
|||
"popupSettingsSpacesListNetwork": "Network",
|
||||
"popupSettingsSpacesListDevice": "Device",
|
||||
|
||||
"popupSettingsSpacesMenuMoreOffload": "Offload from the device",
|
||||
"popupSettingsSpacesMenuMoreLeave": "Leave and unjoin space",
|
||||
"popupSettingsSpacesMenuMoreDeleteFromNetwork": "Delete from the network",
|
||||
|
||||
"popupSettingsDataManagementTitle": "Data management",
|
||||
"popupSettingsDataManagementLocalStorageTitle": "Local storage",
|
||||
"popupSettingsDataManagementLocalStorageText": "In order to save space on your local device, you can offload all your files to our encrypted backup node. The files will be loaded back when you open them.",
|
||||
|
|
|
@ -16,5 +16,6 @@
|
|||
"contact": "mailto:support@anytype.io?subject=Support%20request%2C%20account%20%25accountId%25&body=%0A%0ATechnical%20information%0A----------------------------------------------%0AOS%20version%3A%20%25os%25%0AApp%20version%3A%20%25version%25%0ABuild%20number%3A%20%25build%25%0ALibrary%20version%3A%20%25middleware%25%0AAccount%20ID%3A%20%25accountId%25%0AAnalytics%20ID%3A%20%25analyticsId%25%0ADevice%20ID%3A%20%25deviceId%25",
|
||||
"extendStorage": "mailto:storage@anytype.io?subject=Get%20more%20storage%2C%20account%20%25accountId%25&body=Hi%2C%20Anytype%20team.%20I%20am%20reaching%20out%20to%20request%20an%20increase%20in%20my%20file%20storage%20capacity%20as%20I%20have%20run%20out%20of%20storage.%20My%20current%20limit%20is%20%25storageLimit%25.%20My%20account%20id%20is%20%25accountId%25.%20Cheers%2C%20%25spaceName%25",
|
||||
"gallery": "https://gallery.any.coop",
|
||||
"cdn": "https://anytype-static.fra1.cdn.digitaloceanspaces.com"
|
||||
"cdn": "https://anytype-static.fra1.cdn.digitaloceanspaces.com",
|
||||
"webclipper": "https://chromewebstore.google.com/detail/anytype-web-clipper/jbnammhjiplhpjfncnlejjjejghimdkf?hl=en"
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
.element {
|
||||
.iconObject { margin: 0px !important; }
|
||||
.flex { align-items: center; gap: 0px 4px; }
|
||||
.name { line-height: 20px; width: 100%; @include text-overflow-nw; }
|
||||
.name { line-height: 18px; width: 100%; @include text-overflow-nw; }
|
||||
}
|
||||
}
|
||||
.cellContent.c-object.canEdit {
|
||||
|
|
|
@ -50,11 +50,6 @@
|
|||
.over { height: 18px; }
|
||||
}
|
||||
|
||||
.cellContent.c-object, .cellContent.c-file {
|
||||
.element { margin: 0px 6px 0px 0px; }
|
||||
.element:last-child { margin-right: 0px; }
|
||||
}
|
||||
|
||||
.cellContent.c-url,
|
||||
.cellContent.c-phone,
|
||||
.cellContent.c-email {
|
||||
|
|
|
@ -90,19 +90,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* Div */
|
||||
.block.blockLayout.layoutDiv {
|
||||
> .wrapContent { width: 100%; overflow: visible; }
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.block.blockLayout.layoutHeader { margin: 0px !important; }
|
||||
.block.blockLayout.layoutHeader {
|
||||
> .wrapContent { width: 100%; overflow: visible; }
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.block.blockLayout.layoutDiv,
|
||||
.block.blockLayout.layoutHeader,
|
||||
.block.blockLayout.layoutFooter { margin: 0px !important; }
|
||||
|
||||
.block.blockLayout.layoutDiv,
|
||||
.block.blockLayout.layoutHeader,
|
||||
.block.blockLayout.layoutFooter {
|
||||
> .wrapContent { width: 100%; overflow: visible; }
|
||||
}
|
||||
|
|
|
@ -1,34 +1,39 @@
|
|||
@import "~scss/_vars";
|
||||
|
||||
.menus {
|
||||
.menu.menuDataviewFileList { width: 288px; }
|
||||
.menu.menuDataviewFileList {
|
||||
.content { padding-top: 12px; padding-bottom: 0px; transition: none; }
|
||||
.menu.menuDataviewFileList, .menu.menuDataviewFileValues {
|
||||
.wrap { height: 100%; display: flex; flex-direction: column; padding: 0px 0px 8px 0px; }
|
||||
|
||||
.items { height: calc(100% - 28px); }
|
||||
.item {
|
||||
.name { @include text-overflow-nw; width: calc(100% - 26px); }
|
||||
}
|
||||
.label { color: var(--color-control-active); @include text-common; padding: 0px 16px; }
|
||||
|
||||
.bottom { flex-shrink: 0; }
|
||||
.bottom {
|
||||
.line { margin-top: 0px; }
|
||||
}
|
||||
}
|
||||
|
||||
.menu.menuDataviewFileList { width: 288px; }
|
||||
.menu.menuDataviewFileList {
|
||||
.content { padding-top: 12px; padding-bottom: 0px; transition: none; }
|
||||
|
||||
.items { height: calc(100% - 28px); }
|
||||
.item {
|
||||
.name { @include text-overflow-nw; width: calc(100% - 26px); }
|
||||
}
|
||||
.label { color: var(--color-control-active); @include text-common; padding: 0px 16px; }
|
||||
}
|
||||
|
||||
.menu.menuDataviewFileValues {
|
||||
.titleWrapper,
|
||||
.content { padding-bottom: 0px; }
|
||||
.content { overflow: visible; max-height: unset; }
|
||||
|
||||
.item { display: flex; }
|
||||
.items { height: calc(100% - 28px); overflow: auto; height: 100%; max-height: 360px; }
|
||||
.item { display: flex; align-items: center; }
|
||||
.item {
|
||||
img { display: block; max-width: 100%; max-height: 208px; object-fit: contain; }
|
||||
.name { line-height: 20px; width: calc(100% - 26px); @include text-overflow-nw; }
|
||||
.clickable { width: calc(100% - 20px); display: inline-block; vertical-align: top; }
|
||||
.clickable { width: calc(100% - 44px); display: inline-block; vertical-align: top; }
|
||||
.icon.more { background-color: var(--color-bg-primary); }
|
||||
.icon.dnd { height: auto; align-self: stretch; background-position: top center; background-size: 20px; }
|
||||
.icon.dnd { height: auto; align-self: stretch; background-position: center 2px; background-size: 20px; }
|
||||
}
|
||||
.item.isImage {
|
||||
.icon.more { top: 12px; right: 12px; margin: 0px; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
.pageMainMedia {
|
||||
|
||||
.blocks { margin: 0px auto; padding: 40px 0px 0px 0px; display: flex; }
|
||||
.blocks { margin: 0px auto; padding: 68px 0px 0px 0px; display: flex; }
|
||||
.blocks {
|
||||
.side.right { padding-top: 25px; }
|
||||
}
|
||||
|
|
|
@ -58,6 +58,10 @@
|
|||
.header { position: absolute; }
|
||||
}
|
||||
|
||||
.pageMainMedia {
|
||||
.blocks { padding-top: 16px; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1168,23 +1168,32 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
|
||||
isAllowedObject () {
|
||||
const { rootId, block, readonly } = this.props;
|
||||
const targetId = this.getObjectId();
|
||||
const types = Relation.getSetOfObjects(rootId, targetId, I.ObjectLayout.Type);
|
||||
const skipLayouts = [ I.ObjectLayout.Participant ].concat(UtilObject.getSystemLayouts());
|
||||
const sources = this.getSources();
|
||||
|
||||
let isAllowed = !readonly && blockStore.checkFlags(rootId, block.id, [ I.RestrictionDataview.Object ]);
|
||||
if (!isAllowed) {
|
||||
return false;
|
||||
};
|
||||
|
||||
if (isAllowed && this.isCollection()) {
|
||||
return true;
|
||||
};
|
||||
|
||||
isAllowed = isAllowed && !!sources.length;
|
||||
const sources = this.getSources();
|
||||
if (!sources.length) {
|
||||
return false;
|
||||
};
|
||||
|
||||
const targetId = this.getObjectId();
|
||||
const types = Relation.getSetOfObjects(rootId, targetId, I.ObjectLayout.Type);
|
||||
const skipLayouts = [ I.ObjectLayout.Participant ].concat(UtilObject.getFileAndSystemLayouts());
|
||||
|
||||
for (const type of types) {
|
||||
if (skipLayouts.includes(type.recommendedLayout)) {
|
||||
isAllowed = false;
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
return isAllowed;
|
||||
};
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ const BlockPdf = observer(class BlockPdf extends React.Component<I.BlockComponen
|
|||
total={pages}
|
||||
pageLimit={1}
|
||||
isShort={true}
|
||||
onChange={(page: number) => { this.setState({ page }); }}
|
||||
onChange={page => this.setState({ page })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -221,8 +221,7 @@ const BlockPdf = observer(class BlockPdf extends React.Component<I.BlockComponen
|
|||
};
|
||||
|
||||
onDocumentLoad (result: any) {
|
||||
const { numPages } = result;
|
||||
this.setState({ pages: numPages });
|
||||
this.setState({ pages: result.numPages });
|
||||
};
|
||||
|
||||
onPageRender () {
|
||||
|
|
|
@ -1184,7 +1184,7 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
|
|||
|
||||
this.text = value;
|
||||
|
||||
if (menuStore.isOpen('', '', [ 'onboarding', 'smile', 'select' ])) {
|
||||
if (menuStore.isOpen('', '', [ 'onboarding', 'smile', 'select', 'searchText' ])) {
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ class MenuBlockMore extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
case 'pageExport': {
|
||||
popupStore.open('export', { data: { objectIds: [ rootId ], allowHtml: true } });
|
||||
popupStore.open('export', { data: { objectIds: [ rootId ], allowHtml: true, route: ROUTE } });
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,19 +40,22 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
const isObject = this.format == I.RelationType.Object;
|
||||
const isReadonly = this.isReadonly();
|
||||
|
||||
let canDuplicate = false;
|
||||
let canDelete = false;
|
||||
let canDuplicate = true;
|
||||
let canDelete = true;
|
||||
let opts: any = null;
|
||||
let deleteText = translate('commonDelete');
|
||||
let deleteIcon = 'remove';
|
||||
|
||||
if (root) {
|
||||
canDuplicate = !root.isLocked() && blockStore.checkFlags(rootId, rootId, [ I.RestrictionObject.Relation ]);
|
||||
canDuplicate = canDelete = !root.isLocked() && blockStore.checkFlags(rootId, rootId, [ I.RestrictionObject.Relation ]);
|
||||
};
|
||||
if (readonly || (relation && Relation.isSystem(relation.relationKey))) {
|
||||
if (relation && Relation.isSystem(relation.relationKey)) {
|
||||
canDelete = false;
|
||||
};
|
||||
if (readonly) {
|
||||
canDuplicate = false;
|
||||
canDelete = false;
|
||||
};
|
||||
canDelete = canDuplicate;
|
||||
|
||||
switch (ref) {
|
||||
case 'type':
|
||||
|
|
|
@ -162,7 +162,7 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
|
||||
let items = relations.map(it => ({ ...it, scope: I.RelationScope.Object }));
|
||||
items = items.concat(typeRelations);
|
||||
items = items.sort(UtilData.sortByHidden).filter((it: any) => {
|
||||
items = items.sort(UtilData.sortByName).sort(UtilData.sortByHidden).filter((it: any) => {
|
||||
if (!it) {
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -362,7 +362,7 @@ class MenuContext extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
case 'export': {
|
||||
popupStore.open('export', { data: { objectIds } });
|
||||
popupStore.open('export', { data: { objectIds, route } });
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -11,10 +11,10 @@ interface State {
|
|||
isLoading: boolean;
|
||||
};
|
||||
|
||||
const HEIGHT = 28;
|
||||
const HEIGHT_ITEM = 28;
|
||||
const HEIGHT_DIV = 16;
|
||||
const MENU_ID = 'dataviewFileValues';
|
||||
const LIMIT_HEIGHT = 20;
|
||||
const LIMIT = 20;
|
||||
|
||||
const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.Component<I.Menu, State> {
|
||||
|
||||
|
@ -117,7 +117,7 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
rowCount={items.length + 1}
|
||||
loadMoreRows={this.loadMoreRows}
|
||||
isRowLoaded={({ index }) => !!this.items[index]}
|
||||
threshold={LIMIT_HEIGHT}
|
||||
threshold={LIMIT}
|
||||
>
|
||||
{({ onRowsRendered }) => (
|
||||
<AutoSizer className="scrollArea">
|
||||
|
@ -131,7 +131,7 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
rowHeight={({ index }) => this.getRowHeight(items[index])}
|
||||
rowRenderer={rowRenderer}
|
||||
onRowsRendered={onRowsRendered}
|
||||
overscanRowCount={LIMIT_HEIGHT}
|
||||
overscanRowCount={LIMIT}
|
||||
onScroll={this.onScroll}
|
||||
scrollToAlignment="center"
|
||||
/>
|
||||
|
@ -144,16 +144,14 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
|
||||
<div className="bottom">
|
||||
<div className="line" />
|
||||
<div
|
||||
id="item-upload"
|
||||
className="item upload"
|
||||
onClick={this.onUpload}
|
||||
onMouseEnter={() => setHover({ id: 'upload' })}
|
||||
<MenuItemVertical
|
||||
id="upload"
|
||||
icon="plus"
|
||||
name={translate('commonUpload')}
|
||||
onClick={this.onUpload}
|
||||
onMouseEnter={() => setHover({ id: 'upload' })}
|
||||
onMouseLeave={() => setHover()}
|
||||
>
|
||||
<Icon className="plus" />
|
||||
<div className="name">{translate('commonUpload')}</div>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -324,10 +322,7 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
const { data } = param;
|
||||
const { onChange, maxCount } = data;
|
||||
|
||||
let value = Relation.getArrayValue(data.value);
|
||||
value.push(id);
|
||||
value = UtilCommon.arrayUnique(value);
|
||||
|
||||
let value = UtilCommon.arrayUnique(Relation.getArrayValue(data.value).concat(id));
|
||||
if (maxCount) {
|
||||
value = value.slice(value.length - maxCount, value.length);
|
||||
};
|
||||
|
@ -340,21 +335,18 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
};
|
||||
|
||||
getRowHeight (item: any) {
|
||||
if (item.isDiv) {
|
||||
return HEIGHT_DIV;
|
||||
};
|
||||
return HEIGHT;
|
||||
return item.isDiv ? HEIGHT_DIV : HEIGHT_ITEM;
|
||||
};
|
||||
|
||||
resize () {
|
||||
const { getId, position } = this.props;
|
||||
const items = this.getItems();
|
||||
const obj = $(`#${getId()} .content`);
|
||||
const offset = 58;
|
||||
const itemsHeight = items.reduce((res: number, current: any) => { return res + this.getRowHeight(current); }, offset);
|
||||
const height = Math.max(HEIGHT + offset, Math.min(360, itemsHeight));
|
||||
const offset = 102;
|
||||
const itemsHeight = items.reduce((res: number, current: any) => res + this.getRowHeight(current), offset);
|
||||
const height = Math.max(HEIGHT_ITEM + offset, Math.min(360, itemsHeight));
|
||||
|
||||
obj.css({ height: height });
|
||||
obj.css({ height });
|
||||
position();
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import arrayMove from 'array-move';
|
||||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
import { Icon, IconObject, MenuItemVertical } from 'Component';
|
||||
import { Icon, IconObject, MenuItemVertical, EmptySearch } from 'Component';
|
||||
import { I, C, UtilCommon, UtilFile, UtilObject, Relation, Renderer, keyboard, Action, translate } from 'Lib';
|
||||
import { commonStore, detailStore, menuStore } from 'Store';
|
||||
import Constant from 'json/constant.json';
|
||||
|
@ -25,7 +25,7 @@ const MenuDataviewFileValues = observer(class MenuDataviewFileValues extends Rea
|
|||
};
|
||||
|
||||
render () {
|
||||
const { position, getId } = this.props;
|
||||
const { position, getId, setHover } = this.props;
|
||||
const items = this.getItems();
|
||||
|
||||
const Handle = SortableHandle(() => (
|
||||
|
@ -84,27 +84,33 @@ const MenuDataviewFileValues = observer(class MenuDataviewFileValues extends Rea
|
|||
return (
|
||||
<div
|
||||
ref={node => this.node = node}
|
||||
className="items"
|
||||
className="wrap"
|
||||
>
|
||||
{items.length ? (
|
||||
<div className="section">
|
||||
<List
|
||||
axis="y"
|
||||
lockAxis="y"
|
||||
lockToContainerEdges={true}
|
||||
transitionDuration={150}
|
||||
distance={10}
|
||||
onSortStart={this.onSortStart}
|
||||
onSortEnd={this.onSortEnd}
|
||||
useDragHandle={true}
|
||||
helperClass="isDragging"
|
||||
helperContainer={() => $(`#${getId()} .items`).get(0)}
|
||||
/>
|
||||
</div>
|
||||
) : ''}
|
||||
<List
|
||||
axis="y"
|
||||
lockAxis="y"
|
||||
lockToContainerEdges={true}
|
||||
transitionDuration={150}
|
||||
distance={10}
|
||||
onSortStart={this.onSortStart}
|
||||
onSortEnd={this.onSortEnd}
|
||||
useDragHandle={true}
|
||||
helperClass="isDragging"
|
||||
helperContainer={() => $(`#${getId()} .items`).get(0)}
|
||||
/>
|
||||
) : <EmptySearch text={translate('popupSearchEmpty')} />}
|
||||
|
||||
<div className="section">
|
||||
<MenuItemVertical id="add" icon="plus" name={translate('commonAdd')} onClick={this.onAdd} />
|
||||
<div className="bottom">
|
||||
<div className="line" />
|
||||
<MenuItemVertical
|
||||
id="add"
|
||||
icon="plus"
|
||||
name={translate('commonAdd')}
|
||||
onClick={this.onAdd}
|
||||
onMouseEnter={() => setHover({ id: 'add' })}
|
||||
onMouseLeave={() => setHover()}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -34,14 +34,14 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
const isObject = this.format == I.RelationType.Object;
|
||||
const isReadonly = this.isReadonly();
|
||||
const sections = this.getSections();
|
||||
|
||||
let opts = null;
|
||||
const ccn = [ 'item' ];
|
||||
|
||||
if (relation) {
|
||||
ccn.push('disabled');
|
||||
};
|
||||
|
||||
let opts = null;
|
||||
|
||||
if (isObject && !isReadonly && (!relation || !relation.isReadonlyValue)) {
|
||||
const length = this.objectTypes.length;
|
||||
const typeId = length ? this.objectTypes[0] : '';
|
||||
|
@ -218,14 +218,19 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
const canSort = !isFile;
|
||||
const canHide = relation && (relation.relationKey != 'name');
|
||||
|
||||
let canDuplicate = false;
|
||||
let canDuplicate = true;
|
||||
let canDelete = true;
|
||||
|
||||
if (relation) {
|
||||
canDuplicate = relation && blockStore.checkFlags(rootId, blockId, [ I.RestrictionObject.Relation ]);
|
||||
canDuplicate = canDelete = relation && blockStore.checkFlags(rootId, blockId, [ I.RestrictionObject.Relation ]);
|
||||
};
|
||||
if (relation && Relation.isSystem(relation.relationKey)) {
|
||||
canDuplicate = false;
|
||||
canDelete = false;
|
||||
};
|
||||
if (readonly) {
|
||||
canDuplicate = false;
|
||||
canDelete = false
|
||||
};
|
||||
const canDelete = canDuplicate;
|
||||
|
||||
let sections: any[] = [
|
||||
{
|
||||
|
|
|
@ -82,16 +82,19 @@ class MenuSearchText extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
onKeyDown (e: any) {
|
||||
keyboard.shortcut('arrowup, arrowdown, tab, enter', e, (pressed: string) => {
|
||||
keyboard.shortcut('arrowup, arrowdown, tab, enter', e, () => {
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
onKeyUp (e: any) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
const cmd = keyboard.cmdKey();
|
||||
|
||||
let ret = false;
|
||||
keyboard.shortcut('arrowup, arrowdown, tab, enter', e, (pressed: string) => {
|
||||
|
||||
keyboard.shortcut(`arrowup, arrowdown, tab, enter, ${cmd}+f`, e, (pressed: string) => {
|
||||
this.onArrow(pressed == 'arrowup' ? -1 : 1);
|
||||
ret = true;
|
||||
});
|
||||
|
@ -128,7 +131,7 @@ class MenuSearchText extends React.Component<I.Menu> {
|
|||
const { storageSet, param } = this.props;
|
||||
const { data } = param;
|
||||
const { route } = data;
|
||||
const value = UtilCommon.regexEscape(this.ref.getValue());
|
||||
const value = this.ref.getValue();
|
||||
const node = $(this.node);
|
||||
const cnt = node.find('#cnt');
|
||||
const switcher = node.find('#switcher').removeClass('active');
|
||||
|
@ -149,7 +152,7 @@ class MenuSearchText extends React.Component<I.Menu> {
|
|||
|
||||
findAndReplaceDOMText(this.container.get(0), {
|
||||
preset: 'prose',
|
||||
find: new RegExp(value, 'gi'),
|
||||
find: new RegExp(UtilCommon.regexEscape(value), 'gi'),
|
||||
wrap: 'search',
|
||||
portionMode: 'first',
|
||||
filterElements: (el: any) => {
|
||||
|
|
|
@ -175,7 +175,7 @@ const MenuSpace = observer(class MenuSpace extends React.Component<I.Menu> {
|
|||
},
|
||||
data: {
|
||||
options: [
|
||||
{ id: 'remove', icon: 'remove', name: translate('commonDelete') }
|
||||
{ id: 'remove', color: 'red', name: translate('commonDelete') }
|
||||
],
|
||||
onSelect: (e: any, element: any) => {
|
||||
switch (element.id) {
|
||||
|
|
|
@ -189,9 +189,8 @@ const PopupExport = observer(class PopupExport extends React.Component<I.Popup>
|
|||
onConfirm (e: any) {
|
||||
const { param, close } = this.props;
|
||||
const { data } = param;
|
||||
const { objectIds } = data;
|
||||
const { objectIds, route } = data;
|
||||
const { format } = this.data;
|
||||
const route = 'MenuObject';
|
||||
|
||||
analytics.event('ClickExport', { type: format, route });
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Title, IconObject, ObjectName, Icon } from 'Component';
|
||||
import { I, UtilObject, UtilRouter, translate } from 'Lib';
|
||||
import { I, UtilObject, UtilRouter, translate, Action } from 'Lib';
|
||||
import { authStore, dbStore, detailStore, menuStore } from 'Store';
|
||||
import Constant from 'json/constant.json';
|
||||
|
||||
|
@ -45,7 +45,7 @@ const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList e
|
|||
<td>{translate(`spaceStatus${space.spaceAccountStatus}`)}</td>
|
||||
<td>{translate(`spaceStatus${space.spaceLocalStatus}`)}</td>
|
||||
|
||||
<td className="columnMore dn">
|
||||
<td className="columnMore">
|
||||
<div id={`icon-more-${space.id}`} onClick={e => this.onSpaceMore(e, space)} className="iconWrap">
|
||||
<Icon className="more" />
|
||||
</div>
|
||||
|
@ -83,17 +83,9 @@ const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList e
|
|||
onSpaceMore (e: React.MouseEvent, space) {
|
||||
const element = $(`#icon-more-${space.id}`);
|
||||
const options: any[] = [
|
||||
{ id: 'offload', name: translate('popupSettingsSpacesMenuMoreOffload') },
|
||||
{ id: 'remove', color: 'red', name: translate('commonDelete') },
|
||||
];
|
||||
|
||||
if (UtilObject.isSpaceOwner(space.id)) {
|
||||
if (space.spaceAccessType == I.SpaceType.Shared) {
|
||||
options.push({ id: 'deleteFromNetwork', color: 'red', name: translate('popupSettingsSpacesMenuMoreDeleteFromNetwork') });
|
||||
};
|
||||
} else {
|
||||
options.push({ id: 'leave', color: 'red', name: translate('popupSettingsSpacesMenuMoreDeleteFromNetwork') });
|
||||
};
|
||||
|
||||
menuStore.open('select', {
|
||||
element,
|
||||
vertical: I.MenuDirection.Bottom,
|
||||
|
@ -105,16 +97,8 @@ const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList e
|
|||
options,
|
||||
onSelect: (e: any, item: any) => {
|
||||
switch (item.id) {
|
||||
case 'offload':
|
||||
console.log('OFFLOAD')
|
||||
break;
|
||||
|
||||
case 'leave':
|
||||
console.log('LEAVE')
|
||||
break;
|
||||
|
||||
case 'deleteFromNetwork':
|
||||
console.log('DELETE')
|
||||
case 'remove':
|
||||
Action.removeSpace(item.targetSpaceId, 'ScreenSettings');
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
|
|||
|
||||
scrollOnMove.onMouseUp(e);
|
||||
|
||||
const ids = this.ids.get(I.SelectType.Block);
|
||||
const ids = this.ids.get(I.SelectType.Block) || [];
|
||||
|
||||
if (ids.length) {
|
||||
focus.clear(true);
|
||||
|
|
|
@ -3,7 +3,6 @@ import $ from 'jquery';
|
|||
import raf from 'raf';
|
||||
import { Loader } from 'Component';
|
||||
import { Document, Page } from 'react-pdf';
|
||||
import { throttle } from 'lodash';
|
||||
|
||||
interface Props {
|
||||
id: string;
|
||||
|
@ -29,7 +28,7 @@ class MediaPdf extends React.Component<Props, State> {
|
|||
|
||||
render () {
|
||||
const { width } = this.state;
|
||||
const { src, page, onDocumentLoad, onPageRender, onClick } = this.props;
|
||||
const { src, page, onDocumentLoad, onClick } = this.props;
|
||||
|
||||
return (
|
||||
<div ref={ref => this.node = ref}>
|
||||
|
@ -44,7 +43,7 @@ class MediaPdf extends React.Component<Props, State> {
|
|||
pageNumber={page}
|
||||
loading={<Loader />}
|
||||
width={width}
|
||||
onRenderSuccess={onPageRender}
|
||||
onRenderSuccess={this.onPageRender}
|
||||
/>
|
||||
</Document>
|
||||
</div>
|
||||
|
@ -54,13 +53,14 @@ class MediaPdf extends React.Component<Props, State> {
|
|||
componentDidMount(): void {
|
||||
this._isMounted = true;
|
||||
this.rebind();
|
||||
|
||||
raf(() => this.resize());
|
||||
this.resize();
|
||||
};
|
||||
|
||||
componentWillUnmount(): void {
|
||||
this._isMounted = false;
|
||||
this.unbind();
|
||||
|
||||
raf.cancel(this.frame);
|
||||
};
|
||||
|
||||
unbind () {
|
||||
|
@ -68,7 +68,7 @@ class MediaPdf extends React.Component<Props, State> {
|
|||
};
|
||||
|
||||
rebind () {
|
||||
$(window).on(`resize.pdf-${this.props.id}`, throttle(() => this.resize(), 40));
|
||||
$(window).on(`resize.pdf-${this.props.id}`, () => this.resize());
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
@ -83,6 +83,11 @@ class MediaPdf extends React.Component<Props, State> {
|
|||
});
|
||||
};
|
||||
|
||||
onPageRender = () => {
|
||||
this.props.onPageRender();
|
||||
this.resize();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
export default MediaPdf;
|
|
@ -603,10 +603,10 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
};
|
||||
|
||||
const { targetBlockId } = child.content;
|
||||
const data: any = { view: 'Widget' };
|
||||
|
||||
let blockId = '';
|
||||
let event = 'ScreenHome';
|
||||
const data: any = { view: 'Widget' };
|
||||
|
||||
if (!isPreview) {
|
||||
blockId = block.id;
|
||||
|
|
|
@ -340,20 +340,18 @@ const WidgetList = observer(class WidgetList extends React.Component<Props, Stat
|
|||
if ((oldIndex == newIndex) || (targetBlockId != Constant.widgetId.favorite)) {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
const { root } = blockStore;
|
||||
const records = this.getRecords();
|
||||
const children = blockStore.getChildren(root, root, it => it.isLink());
|
||||
const current = children[oldIndex];
|
||||
const target = children[newIndex];
|
||||
|
||||
if (!current || !target) {
|
||||
return;
|
||||
};
|
||||
|
||||
const ro = records[oldIndex];
|
||||
const rn = records[newIndex];
|
||||
const oidx = children.findIndex(it => it.content.targetBlockId == ro);
|
||||
const nidx = children.findIndex(it => it.content.targetBlockId == rn);
|
||||
const current = children[oidx];
|
||||
const target = children[nidx];
|
||||
const childrenIds = blockStore.getChildrenIds(root, root);
|
||||
const position = newIndex < oldIndex ? I.BlockPosition.Top : I.BlockPosition.Bottom;
|
||||
const oidx = childrenIds.indexOf(current.id);
|
||||
const nidx = childrenIds.indexOf(target.id);
|
||||
|
||||
blockStore.updateStructure(root, root, arrayMove(childrenIds, oidx, nidx));
|
||||
Action.move(root, root, target.id, [ current.id ], position);
|
||||
|
|
|
@ -26,7 +26,7 @@ export default [
|
|||
|
||||
h3(`Webclipper`),
|
||||
video('39/1.mp4'),
|
||||
text(`The wait is over - we’re so relieved to bring you v1 of the Anytype webclipper. For those of you using Chrome browsers, you’ll be able to install the Anytype web clipper using ${link('', 'this link')}.`),
|
||||
text(`The wait is over - we’re so relieved to bring you v1 of the Anytype webclipper. For those of you using Chrome browsers, you’ll be able to install the Anytype web clipper using ${link(Url.webclipper, 'this link')}.`),
|
||||
text(`Once installed, you have two options to save content from the web:`),
|
||||
bullet(`Click the web clipper extension icon in your toolbar to save web pages as new objects in Anytype.`),
|
||||
bullet(`Select a text snippet, right click, and add the text to any previously-created object in your space.`),
|
||||
|
|
|
@ -989,7 +989,9 @@ class Dispatcher {
|
|||
switch (payload.type) {
|
||||
case 'openObject': {
|
||||
UtilObject.openAuto(payload.object);
|
||||
electron.focus();
|
||||
if (electron.focus) {
|
||||
electron.focus();
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -1055,7 +1057,7 @@ class Dispatcher {
|
|||
detailsUpdate (details: any, rootId: string, id: string, subIds: string[], clear: boolean) {
|
||||
this.getUniqueSubIds(subIds).forEach(subId => detailStore.update(subId, { id, details }, clear));
|
||||
|
||||
if (details.spaceAccountStatus == I.SpaceStatus.Deleted) {
|
||||
if ([ I.SpaceStatus.Deleted, I.SpaceStatus.Removing ].includes(details.spaceAccountStatus)) {
|
||||
if (id == blockStore.spaceview) {
|
||||
UtilRouter.switchSpace(authStore.accountSpaceId, '');
|
||||
};
|
||||
|
|
|
@ -541,13 +541,7 @@ class Keyboard {
|
|||
};
|
||||
|
||||
case 'save': {
|
||||
Action.export([ rootId ], I.ExportType.Protobuf, {
|
||||
zip: true,
|
||||
nested: true,
|
||||
files: true,
|
||||
archived: true,
|
||||
route: 'MenuSystem',
|
||||
});
|
||||
popupStore.open('export', { data: { objectIds: [ rootId ], route: 'MenuSystem', allowHtml: true } });
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -777,21 +771,21 @@ class Keyboard {
|
|||
return;
|
||||
};
|
||||
|
||||
menuStore.closeAll([ 'blockContext' ]);
|
||||
window.setTimeout(() => {
|
||||
menuStore.closeAll([ 'blockContext' ], () => {
|
||||
menuStore.open('searchText', {
|
||||
element: '#header',
|
||||
type: I.MenuType.Horizontal,
|
||||
horizontal: I.MenuDirection.Right,
|
||||
offsetX: 10,
|
||||
classNameWrap: 'fromHeader',
|
||||
passThrough: true,
|
||||
data: {
|
||||
isPopup,
|
||||
value,
|
||||
route,
|
||||
},
|
||||
});
|
||||
}, Constant.delay.menu);
|
||||
});
|
||||
};
|
||||
|
||||
onSearchPopup (route: string) {
|
||||
|
|
|
@ -430,7 +430,7 @@ class Mark {
|
|||
});
|
||||
|
||||
// Fix browser markup bug
|
||||
html.replace(/<\/?(i|b|font|search)>/g, (s: string, p: string) => {
|
||||
html.replace(/<\/?(i|b|font|search)[^>]*>/g, (s: string, p: string) => {
|
||||
let r = '';
|
||||
if (p == 'i') r = this.getTag(I.MarkType.Italic);
|
||||
if (p == 'b') r = this.getTag(I.MarkType.Bold);
|
||||
|
|
|
@ -649,7 +649,7 @@ class UtilCommon {
|
|||
};
|
||||
|
||||
matchUrl (s: string): string {
|
||||
const m = String(s || '').match(/^((?:[a-z]+:(?:\/\/)?)|\/\/)([^\s\/\?#]+)([^\s\?#]+)(?:\?([^#\s]*))?(?:#([^\s]*))?$/gi);
|
||||
const m = String(s || '').match(/^(?:[a-z]+:(?:\/\/)?)([^\s\/\?#]+)([^\s\?#]+)(?:\?([^#\s]*))?(?:#([^\s]*))?$/gi);
|
||||
return (m && m.length) ? m[0] : '';
|
||||
};
|
||||
|
||||
|
@ -829,14 +829,15 @@ class UtilCommon {
|
|||
};
|
||||
|
||||
fixAsarPath (path: string): string {
|
||||
const Electron = this.getElectron();
|
||||
const electron = this.getElectron();
|
||||
|
||||
let href = Electron.dirname(location.href);
|
||||
if (Electron.isPackaged) {
|
||||
href = href.replace('/app.asar/', '/app.asar.unpacked/');
|
||||
path = href + path.replace(/^\.\//, '/');
|
||||
if (!electron.dirname || !electron.isPackaged) {
|
||||
return path;
|
||||
};
|
||||
return path;
|
||||
|
||||
let href = electron.dirname(location.href);
|
||||
href = href.replace('/app.asar/', '/app.asar.unpacked/');
|
||||
return href + path.replace(/^\.\//, '/');
|
||||
};
|
||||
|
||||
injectCss (id: string, css: string) {
|
||||
|
|
|
@ -227,12 +227,18 @@ class UtilEmbed {
|
|||
};
|
||||
|
||||
getYoutubePath (url: string): string {
|
||||
const shortsReg = /\/shorts\//;
|
||||
|
||||
if (shortsReg.test(url)) {
|
||||
url = url.replace(shortsReg, '/watch?v=');
|
||||
};
|
||||
|
||||
const pm = url.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);
|
||||
const tm = url.match(/(\?t=|&t=)(\d+)/);
|
||||
|
||||
if (!pm || !pm[2].length) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
return pm[2] + ((tm && tm[2].length) ? `?start=${tm[2]}` : '');
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = (env, argv) => {
|
|||
entry: {
|
||||
app: {
|
||||
import: './src/ts/entry.tsx',
|
||||
filename: 'main.js',
|
||||
filename: 'js/main.js',
|
||||
},
|
||||
extension: {
|
||||
import: './extension/entry.tsx',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue