Rename class name for collectionEditor & add method show

This commit is contained in:
grafixeyehero 2022-08-06 02:50:41 +03:00
parent 87ebe89196
commit bdff9b14f1
4 changed files with 12 additions and 9 deletions

View file

@ -206,8 +206,8 @@ import toast from '../toast/toast';
}); });
} }
export class showEditor { class CollectionEditor {
constructor(options) { show(options) {
const items = options.items || {}; const items = options.items || {};
currentServerId = options.serverId; currentServerId = options.serverId;
@ -266,4 +266,4 @@ import toast from '../toast/toast';
} }
/* eslint-enable indent */ /* eslint-enable indent */
export default showEditor; export default CollectionEditor;

View file

@ -318,8 +318,9 @@ import toast from './toast/toast';
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
switch (id) { switch (id) {
case 'addtocollection': case 'addtocollection':
import('./collectionEditor/collectionEditor').then(({default: collectionEditor}) => { import('./collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
new collectionEditor({ const collectionEditor = new CollectionEditor();
collectionEditor.show({
items: [itemId], items: [itemId],
serverId: serverId serverId: serverId
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));

View file

@ -267,8 +267,9 @@ import datetime from '../../scripts/datetime';
} }
break; break;
case 'addtocollection': case 'addtocollection':
import('../collectionEditor/collectionEditor').then(({default: collectionEditor}) => { import('../collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
new collectionEditor({ const collectionEditor = new CollectionEditor();
collectionEditor.show({
items: items, items: items,
serverId: serverId serverId: serverId
}); });

View file

@ -9,9 +9,10 @@ const NewCollection: FunctionComponent = () => {
const btnNewCollection = element.current?.querySelector('.btnNewCollection') as HTMLButtonElement; const btnNewCollection = element.current?.querySelector('.btnNewCollection') as HTMLButtonElement;
if (btnNewCollection) { if (btnNewCollection) {
btnNewCollection.addEventListener('click', () => { btnNewCollection.addEventListener('click', () => {
import('../../components/collectionEditor/collectionEditor').then(({ default: collectionEditor }) => { import('../../components/collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
const serverId = window.ApiClient.serverId(); const serverId = window.ApiClient.serverId();
new collectionEditor({ const collectionEditor = new CollectionEditor();
collectionEditor.show({
items: [], items: [],
serverId: serverId serverId: serverId
}); });