mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
JS-6884: fix
This commit is contained in:
parent
447da6eaf5
commit
d1cfb4d038
13 changed files with 20 additions and 4 deletions
|
@ -194,6 +194,7 @@ const BlockType = observer(class BlockType extends React.Component<I.BlockCompon
|
|||
focus.apply();
|
||||
},
|
||||
data: {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getLayoutsForTypeSelection() },
|
||||
|
|
|
@ -415,6 +415,7 @@ class MenuBlockAction extends React.Component<I.Menu, State> {
|
|||
case 'turnObject': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = Object.assign(menuParam.data, {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -480,6 +480,7 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
case 'turnObject': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = Object.assign(menuParam.data, {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -422,6 +422,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
case 'turnObject': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = Object.assign(menuParam.data, {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -118,6 +118,7 @@ const MenuNew = observer(forwardRef<I.MenuRef, I.Menu>((props, ref) => {
|
|||
case 'type': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = Object.assign(menuParam.data, {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getLayoutsForTypeSelection() },
|
||||
|
|
|
@ -120,6 +120,7 @@ const MenuSource = observer(class MenuSource extends React.Component<I.Menu> {
|
|||
case 'type': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = {
|
||||
canAdd: true,
|
||||
onClick: (item: any) => {
|
||||
this.save([ item.id ]);
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ class MenuContext extends React.Component<I.Menu> {
|
|||
case 'changeType': {
|
||||
menuId = 'typeSuggest';
|
||||
menuParam.data = Object.assign(menuParam.data, {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -351,6 +351,7 @@ const MenuOnboarding = observer(class MenuSelect extends React.Component<I.Menu,
|
|||
offsetX: getSize().width,
|
||||
vertical: I.MenuDirection.Center,
|
||||
data: {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -19,7 +19,7 @@ const MenuTypeSuggest = observer(forwardRef<I.MenuRef, I.Menu>((props, ref) => {
|
|||
const [ dummy, setDummy ] = useState(0);
|
||||
const { param, getId, position, close, setHover, setActive, onKeyDown } = props;
|
||||
const { data } = param;
|
||||
const { noFilter, skipIds, onMore, onClick, noInstall } = data;
|
||||
const { noFilter, skipIds, onMore, onClick, noInstall, canAdd } = data;
|
||||
const itemList = useRef([]);
|
||||
const filter = String(data.filter || '');
|
||||
const currentFilter = useRef('');
|
||||
|
@ -52,7 +52,7 @@ const MenuTypeSuggest = observer(forwardRef<I.MenuRef, I.Menu>((props, ref) => {
|
|||
{ id: 'library', name: translate('commonMyTypes'), children: library },
|
||||
];
|
||||
|
||||
if (canWrite && filter && !add) {
|
||||
if (canWrite && filter && !add && canAdd) {
|
||||
sections.push({
|
||||
children: [
|
||||
{ id: 'add', name: U.Common.sprintf(translate('menuTypeSuggestCreateTypeFilter'), filter) },
|
||||
|
|
|
@ -313,6 +313,7 @@ const PageMainSettingsSpaceIndex = observer(class PageMainSettingsSpaceIndex ext
|
|||
element: `#${getId()} #defaultType`,
|
||||
horizontal: I.MenuDirection.Right,
|
||||
data: {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -90,6 +90,7 @@ const SidebarSectionTypeLayoutFormatList = observer(class SidebarSectionTypeLayo
|
|||
classNameWrap: 'fromSidebar',
|
||||
horizontal: I.MenuDirection.Right,
|
||||
data: {
|
||||
canAdd: true,
|
||||
filter: '',
|
||||
filters: [
|
||||
{ relationKey: 'recommendedLayout', condition: I.FilterCondition.In, value: U.Object.getPageLayouts() },
|
||||
|
|
|
@ -453,6 +453,8 @@ class Dataview {
|
|||
const view = this.getView(rootId, blockId, viewId);
|
||||
const types = Relation.getSetOfObjects(rootId, objectId, I.ObjectLayout.Type);
|
||||
const relations = Relation.getSetOfObjects(rootId, objectId, I.ObjectLayout.Relation);
|
||||
const object = S.Detail.get(rootId, rootId, [ 'type' ], true);
|
||||
const type = S.Record.getTypeById(object.type);
|
||||
const isAllowedDefaultType = this.isCollection(rootId, blockId) || !!relations.length;
|
||||
|
||||
let typeId = '';
|
||||
|
@ -479,9 +481,12 @@ class Dataview {
|
|||
};
|
||||
};
|
||||
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
if (!typeId && type && type.defaultTypeId) {
|
||||
typeId = type.defaultTypeId;
|
||||
};
|
||||
|
||||
if (!type) {
|
||||
const check = S.Record.getTypeById(typeId);
|
||||
if (!check) {
|
||||
typeId = S.Common.type;
|
||||
};
|
||||
|
||||
|
|
|
@ -1283,6 +1283,7 @@ class UtilMenu {
|
|||
onOpen: context => menuContext = context,
|
||||
data: {
|
||||
noStore: true,
|
||||
canAdd: true,
|
||||
onMore,
|
||||
buttons,
|
||||
filters: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue