1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

JS-2306: Batch type change

This commit is contained in:
Andrew Simachev 2023-07-28 10:51:27 +02:00
parent bae8db64d1
commit 2684daca3d
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8
4 changed files with 32 additions and 2 deletions

View file

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.5 6.5L16.7929 5.20711C17.1834 4.81658 17.1834 4.18342 16.7929 3.79289L16.2071 3.20711C15.8166 2.81658 15.1834 2.81658 14.7929 3.20711L13.5 4.5L15.5 6.5ZM6 16L14.5 7.5L12.5 5.5L4 14L3 16.9999L6 16Z" fill="#B6B6B6"/>
</svg>

After

Width:  |  Height:  |  Size: 330 B

View file

@ -80,6 +80,7 @@
.icon.install { background-image: url('~img/icon/menu/action/install0.svg'); }
.icon.unlink { background-image: url('~img/icon/menu/action/unlink0.svg'); }
.icon.store { background-image: url('~img/icon/menu/action/store0.svg'); }
.icon.pencil { background-image: url('~img/icon/menu/action/pencil0.svg'); }
.icon.coverChange { background-image: url('~img/icon/cover/change.svg'); }
.icon.coverPosition { background-image: url('~img/icon/cover/position.svg'); }

View file

@ -88,6 +88,7 @@ class MenuContext extends React.Component<I.Menu> {
let pageCopy = { id: 'copy', icon: 'copy', name: 'Duplicate' };
let open = { id: 'open', icon: 'expand', name: translate('commonOpenObject') };
let linkTo = { id: 'linkTo', icon: 'linkTo', name: 'Link to', arrow: true };
let changeType = { id: 'changeType', icon: 'pencil', name: 'Change type', arrow: true };
let div = null;
let unlink = null;
let archive = null;
@ -156,7 +157,7 @@ class MenuContext extends React.Component<I.Menu> {
if (!allowedCopy) pageCopy = null;
let sections = [
{ children: [ open, fav, linkTo, div, pageCopy, unlink, archive ] },
{ children: [ open, fav, changeType, linkTo, div, pageCopy, unlink, archive ] },
];
sections = sections.filter((section: any) => {
@ -212,7 +213,21 @@ class MenuContext extends React.Component<I.Menu> {
};
switch (item.id) {
case 'linkTo':
case 'changeType':
menuId = 'typeSuggest';
menuParam.data = Object.assign(menuParam.data, {
filter: '',
filters: [
{ operator: I.FilterOperator.And, relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: UtilObject.getPageLayouts().concat([ I.ObjectLayout.Set ]) },
],
onClick: (item: any) => {
C.ObjectListSetObjectType(objectIds, item.id);
close();
}
});
break;
case 'linkTo': {
menuId = 'searchObject';
menuParam.data = Object.assign(menuParam.data, {
filters: [
@ -236,6 +251,7 @@ class MenuContext extends React.Component<I.Menu> {
}
});
break;
};
};
if (menuId && !menuStore.isOpen(menuId, item.id)) {

View file

@ -1622,6 +1622,15 @@ const ObjectListSetIsFavorite = (ids: string[], isFavorite: boolean, callBack?:
dispatcher.request(ObjectListSetIsFavorite.name, request, callBack);
};
const ObjectListSetObjectType = (ids: string[], typeId: string, callBack?: (message: any) => void) => {
const request = new Rpc.Object.ListSetObjectType.Request();
request.setObjectidsList(ids);
request.setObjecttypeid(typeId);
dispatcher.request(ObjectListSetObjectType.name, request, callBack);
};
const ObjectListExport = (path: string, objectIds: string[], format: I.ExportType, zip: boolean, includeNested: boolean, includeFiles: boolean, includeArchived: boolean, callBack?: (message: any) => void) => {
const request = new Rpc.Object.ListExport.Request();
@ -1910,6 +1919,7 @@ export {
ObjectListDelete,
ObjectListSetIsArchived,
ObjectListSetIsFavorite,
ObjectListSetObjectType,
ObjectListExport,
TemplateCreateFromObject,