mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
refactoring
This commit is contained in:
parent
b95786f9bb
commit
06fd1dbcfb
2 changed files with 8 additions and 20 deletions
|
@ -298,9 +298,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();
|
||||
|
@ -317,7 +316,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();
|
||||
|
@ -363,28 +362,17 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
const value = this.getValue();
|
||||
const list = node.find('#list');
|
||||
const placeholder = node.find('#placeholder');
|
||||
const length = value.existing.length;
|
||||
const length = this.details.tag.length;
|
||||
|
||||
length ? list.show() : list.hide();
|
||||
value.new || length ? placeholder.hide() : placeholder.show();
|
||||
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[]) {
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue