Rename class name for collectionEditor & add method show
This commit is contained in:
parent
87ebe89196
commit
bdff9b14f1
4 changed files with 12 additions and 9 deletions
|
@ -206,8 +206,8 @@ import toast from '../toast/toast';
|
|||
});
|
||||
}
|
||||
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
class CollectionEditor {
|
||||
show(options) {
|
||||
const items = options.items || {};
|
||||
currentServerId = options.serverId;
|
||||
|
||||
|
@ -266,4 +266,4 @@ import toast from '../toast/toast';
|
|||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
export default CollectionEditor;
|
||||
|
|
|
@ -318,8 +318,9 @@ import toast from './toast/toast';
|
|||
return new Promise(function (resolve, reject) {
|
||||
switch (id) {
|
||||
case 'addtocollection':
|
||||
import('./collectionEditor/collectionEditor').then(({default: collectionEditor}) => {
|
||||
new collectionEditor({
|
||||
import('./collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
|
||||
const collectionEditor = new CollectionEditor();
|
||||
collectionEditor.show({
|
||||
items: [itemId],
|
||||
serverId: serverId
|
||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
|
|
|
@ -267,8 +267,9 @@ import datetime from '../../scripts/datetime';
|
|||
}
|
||||
break;
|
||||
case 'addtocollection':
|
||||
import('../collectionEditor/collectionEditor').then(({default: collectionEditor}) => {
|
||||
new collectionEditor({
|
||||
import('../collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
|
||||
const collectionEditor = new CollectionEditor();
|
||||
collectionEditor.show({
|
||||
items: items,
|
||||
serverId: serverId
|
||||
});
|
||||
|
|
|
@ -9,9 +9,10 @@ const NewCollection: FunctionComponent = () => {
|
|||
const btnNewCollection = element.current?.querySelector('.btnNewCollection') as HTMLButtonElement;
|
||||
if (btnNewCollection) {
|
||||
btnNewCollection.addEventListener('click', () => {
|
||||
import('../../components/collectionEditor/collectionEditor').then(({ default: collectionEditor }) => {
|
||||
import('../../components/collectionEditor/collectionEditor').then(({default: CollectionEditor}) => {
|
||||
const serverId = window.ApiClient.serverId();
|
||||
new collectionEditor({
|
||||
const collectionEditor = new CollectionEditor();
|
||||
collectionEditor.show({
|
||||
items: [],
|
||||
serverId: serverId
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue