jodit 3.9.4 → 3.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +84 -82
- package/CHANGELOG.MD +109 -5
- package/build/jodit.css +450 -427
- package/build/jodit.es2018.css +298 -283
- package/build/jodit.es2018.en.css +298 -283
- package/build/jodit.es2018.en.js +539 -336
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +575 -372
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +1142 -876
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/package.json +1 -1
- package/src/config.ts +18 -19
- package/src/core/component/component.ts +16 -15
- package/src/core/storage/engines/local-storage-provider.ts +9 -3
- package/src/core/storage/engines/memory-storage-provider.ts +6 -3
- package/src/core/storage/storage.ts +7 -4
- package/src/core/ui/icon.ts +1 -0
- package/src/core/ui/index.ts +1 -3
- package/src/core/ui/list/group.less +8 -2
- package/src/{modules/file-browser/consts.ts → core/ui/list/index.ts} +4 -4
- package/src/core/ui/list/list.less +9 -1
- package/src/core/ui/list/list.ts +20 -3
- package/src/core/ui/{separator.ts → list/separator.ts} +2 -2
- package/src/core/ui/list/spacer.ts +15 -0
- package/src/core/view/view-with-toolbar.ts +2 -1
- package/src/modules/dialog/dialog.less +1 -15
- package/src/modules/dialog/dialog.ts +8 -1
- package/src/modules/file-browser/builders/context-menu.ts +29 -22
- package/src/modules/file-browser/config.ts +10 -2
- package/src/modules/file-browser/file-browser.ts +50 -29
- package/src/modules/file-browser/listeners/native-listeners.ts +37 -19
- package/src/modules/file-browser/listeners/state-listeners.ts +48 -22
- package/src/modules/file-browser/styles/file-browser.less +4 -291
- package/src/modules/file-browser/styles/preview.less +11 -8
- package/src/modules/file-browser/ui/files/files.less +174 -0
- package/src/modules/file-browser/ui/files/files.ts +14 -0
- package/{types/modules/file-browser/consts.d.ts → src/modules/file-browser/ui/index.ts} +3 -3
- package/src/modules/file-browser/ui/tree/tree.less +118 -0
- package/src/modules/file-browser/ui/tree/tree.ts +14 -0
- package/src/modules/toolbar/collection/collection.ts +17 -3
- package/src/modules/toolbar/collection/editor-collection.ts +22 -1
- package/src/plugins/clipboard/drag-and-drop.ts +4 -1
- package/src/plugins/inline-popup/config/config.ts +1 -0
- package/src/plugins/inline-popup/config/items/toolbar.ts +33 -0
- package/src/plugins/inline-popup/inline-popup.ts +17 -0
- package/src/plugins/size/resize-handler.ts +5 -2
- package/src/plugins/size/size.less +2 -17
- package/src/plugins/size/size.ts +6 -1
- package/src/plugins/sticky/sticky.ts +2 -0
- package/src/styles/icons/index.ts +2 -0
- package/src/{plugins/size/assests → styles/icons}/resize-handler.svg +0 -0
- package/src/styles/mixins.less +20 -0
- package/src/types/ajax.d.ts +0 -1
- package/src/types/file-browser.d.ts +13 -1
- package/src/types/jodit.d.ts +7 -1
- package/src/types/select.d.ts +2 -0
- package/src/types/storage.ts +3 -3
- package/src/types/style.d.ts +7 -1
- package/src/types/toolbar.d.ts +7 -1
- package/src/types/types.d.ts +1 -1
- package/src/types/view.d.ts +1 -1
- package/types/core/component/component.d.ts +4 -3
- package/types/core/storage/engines/local-storage-provider.d.ts +3 -3
- package/types/core/storage/engines/memory-storage-provider.d.ts +3 -3
- package/types/core/storage/storage.d.ts +3 -3
- package/types/core/ui/index.d.ts +1 -3
- package/types/core/ui/list/index.d.ts +9 -0
- package/types/core/ui/{separator.d.ts → list/separator.d.ts} +1 -1
- package/types/core/ui/list/spacer.d.ts +9 -0
- package/types/core/view/view-with-toolbar.d.ts +2 -1
- package/types/modules/file-browser/file-browser.d.ts +3 -2
- package/types/modules/file-browser/listeners/native-listeners.d.ts +5 -1
- package/types/modules/file-browser/ui/files/files.d.ts +10 -0
- package/types/modules/file-browser/ui/index.d.ts +7 -0
- package/types/modules/file-browser/ui/tree/tree.d.ts +10 -0
- package/types/modules/toolbar/collection/collection.d.ts +5 -2
- package/types/modules/toolbar/collection/editor-collection.d.ts +9 -1
- package/types/plugins/inline-popup/inline-popup.d.ts +4 -0
- package/types/styles/icons/index.d.ts +2 -1
- package/types/types/ajax.d.ts +0 -1
- package/types/types/file-browser.d.ts +13 -1
- package/types/types/jodit.d.ts +7 -1
- package/types/types/select.d.ts +2 -0
- package/types/types/storage.d.ts +3 -3
- package/types/types/storage.ts +3 -3
- package/types/types/style.d.ts +7 -1
- package/types/types/toolbar.d.ts +7 -1
- package/types/types/types.d.ts +1 -1
- package/types/types/view.d.ts +1 -1
|
@@ -36,26 +36,30 @@ import './config';
|
|
|
36
36
|
|
|
37
37
|
import { Dom } from '../../core/dom';
|
|
38
38
|
import { ObserveObject } from '../../core/events/';
|
|
39
|
-
import { F_CLASS, ICON_LOADER } from './consts';
|
|
40
39
|
import { makeDataProvider } from './factories';
|
|
41
40
|
import { stateListeners } from './listeners/state-listeners';
|
|
42
41
|
import { nativeListeners } from './listeners/native-listeners';
|
|
43
42
|
import { selfListeners } from './listeners/self-listeners';
|
|
44
43
|
import { DEFAULT_SOURCE_NAME } from './data-provider';
|
|
45
44
|
import { autobind } from '../../core/decorators';
|
|
45
|
+
import { FileBrowserFiles, FileBrowserTree } from './ui';
|
|
46
46
|
|
|
47
47
|
export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
48
48
|
/** @override */
|
|
49
49
|
className(): string {
|
|
50
|
-
return '
|
|
50
|
+
return 'Filebrowser';
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
private loader = this.c.div(
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
private loader = this.c.div(
|
|
54
|
+
this.getFullElName('loader'),
|
|
55
|
+
'<div class="jodit-icon_loader"></div>'
|
|
56
|
+
);
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
private browser = this.c.div(this.componentName);
|
|
59
|
+
private status_line = this.c.div(this.getFullElName('status'));
|
|
60
|
+
|
|
61
|
+
tree = new FileBrowserTree(this);
|
|
62
|
+
files = new FileBrowserFiles(this);
|
|
59
63
|
|
|
60
64
|
state = ObserveObject.create<IFileBrowserState>({
|
|
61
65
|
currentPath: '',
|
|
@@ -75,8 +79,8 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
75
79
|
dataProvider!: IFileBrowserDataProvider;
|
|
76
80
|
|
|
77
81
|
async loadItems(): Promise<any> {
|
|
78
|
-
this.files.
|
|
79
|
-
this.files.appendChild(this.loader.cloneNode(true));
|
|
82
|
+
this.files.setMod('active', true);
|
|
83
|
+
this.files.container.appendChild(this.loader.cloneNode(true));
|
|
80
84
|
|
|
81
85
|
return this.dataProvider
|
|
82
86
|
.items(this.state.currentPath, this.state.currentSource, {
|
|
@@ -101,11 +105,11 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
101
105
|
this.uploader.setSource(this.state.currentSource);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
this.tree.
|
|
108
|
+
this.tree.setMod('active', true);
|
|
105
109
|
|
|
106
|
-
Dom.detach(this.tree);
|
|
110
|
+
Dom.detach(this.tree.container);
|
|
107
111
|
|
|
108
|
-
this.tree.appendChild(this.loader.cloneNode(true));
|
|
112
|
+
this.tree.container.appendChild(this.loader.cloneNode(true));
|
|
109
113
|
|
|
110
114
|
const items = this.loadItems();
|
|
111
115
|
|
|
@@ -125,7 +129,7 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
125
129
|
|
|
126
130
|
return Promise.all([tree, items]).catch(error);
|
|
127
131
|
} else {
|
|
128
|
-
this.tree.
|
|
132
|
+
this.tree.setMod('active', false);
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
return items.catch(error);
|
|
@@ -217,21 +221,23 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
217
221
|
message = message.message;
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
this.
|
|
224
|
+
const successClass = this.getFullElName('status', 'success', true),
|
|
225
|
+
activeClass = this.getFullElName('status', 'active', true);
|
|
221
226
|
|
|
222
|
-
this.status_line.classList.
|
|
227
|
+
this.status_line.classList.remove(successClass);
|
|
228
|
+
this.status_line.classList.add(activeClass);
|
|
223
229
|
|
|
224
230
|
const messageBox = this.c.div();
|
|
225
231
|
messageBox.textContent = message;
|
|
226
232
|
this.status_line.appendChild(messageBox);
|
|
227
233
|
|
|
228
234
|
if (success) {
|
|
229
|
-
this.status_line.classList.add(
|
|
235
|
+
this.status_line.classList.add(successClass);
|
|
230
236
|
}
|
|
231
237
|
|
|
232
238
|
this.async.setTimeout(
|
|
233
239
|
() => {
|
|
234
|
-
this.status_line.classList.remove(
|
|
240
|
+
this.status_line.classList.remove(activeClass);
|
|
235
241
|
Dom.detach(this.status_line);
|
|
236
242
|
},
|
|
237
243
|
{
|
|
@@ -280,9 +286,9 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
280
286
|
let localTimeout: number = 0;
|
|
281
287
|
|
|
282
288
|
this.e
|
|
283
|
-
.off(this.files, 'dblclick')
|
|
284
|
-
.on(this.files, 'dblclick', this.onSelect(callback))
|
|
285
|
-
.on(this.files, 'touchstart', () => {
|
|
289
|
+
.off(this.files.container, 'dblclick')
|
|
290
|
+
.on(this.files.container, 'dblclick', this.onSelect(callback))
|
|
291
|
+
.on(this.files.container, 'touchstart', () => {
|
|
286
292
|
const now = new Date().getTime();
|
|
287
293
|
|
|
288
294
|
if (now - localTimeout < consts.EMULATE_DBLCLICK_TIMEOUT) {
|
|
@@ -345,7 +351,10 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
345
351
|
Config.defaultOptions.filebrowser
|
|
346
352
|
) as IFileBrowserOptions;
|
|
347
353
|
|
|
348
|
-
self.storage = Storage.makeStorage(
|
|
354
|
+
self.storage = Storage.makeStorage(
|
|
355
|
+
Boolean(this.o.saveStateInStorage),
|
|
356
|
+
this.componentName
|
|
357
|
+
);
|
|
349
358
|
|
|
350
359
|
self.dataProvider = makeDataProvider(self, self.options);
|
|
351
360
|
|
|
@@ -366,11 +375,13 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
366
375
|
});
|
|
367
376
|
});
|
|
368
377
|
|
|
378
|
+
self.browser.component = this;
|
|
379
|
+
|
|
369
380
|
if (self.o.showFoldersPanel) {
|
|
370
|
-
self.browser.appendChild(self.tree);
|
|
381
|
+
self.browser.appendChild(self.tree.container);
|
|
371
382
|
}
|
|
372
383
|
|
|
373
|
-
self.browser.appendChild(self.files);
|
|
384
|
+
self.browser.appendChild(self.files.container);
|
|
374
385
|
self.browser.appendChild(self.status_line);
|
|
375
386
|
|
|
376
387
|
selfListeners.call(self);
|
|
@@ -404,7 +415,14 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
404
415
|
}
|
|
405
416
|
});
|
|
406
417
|
|
|
407
|
-
const
|
|
418
|
+
const { storeView, storeSortBy, storeLastOpenedFolder } = this.o
|
|
419
|
+
.saveStateInStorage || {
|
|
420
|
+
storeLastOpenedFolder: false,
|
|
421
|
+
storeView: false,
|
|
422
|
+
storeSortBy: false
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const view = storeView && this.storage.get('view');
|
|
408
426
|
|
|
409
427
|
if (view && this.o.view == null) {
|
|
410
428
|
self.state.view = view === 'list' ? 'list' : 'tiles';
|
|
@@ -414,7 +432,7 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
414
432
|
|
|
415
433
|
this.state.fire('change.view');
|
|
416
434
|
|
|
417
|
-
const sortBy = self.storage.get<string>(
|
|
435
|
+
const sortBy = storeSortBy && self.storage.get<string>('sortBy');
|
|
418
436
|
|
|
419
437
|
if (sortBy) {
|
|
420
438
|
const parts = sortBy.split('-');
|
|
@@ -426,10 +444,13 @@ export class FileBrowser extends ViewWithToolbar implements IFileBrowser {
|
|
|
426
444
|
self.state.sortBy = self.o.sortBy || 'changed-desc';
|
|
427
445
|
}
|
|
428
446
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
447
|
+
if (storeLastOpenedFolder) {
|
|
448
|
+
const currentPath = self.storage.get<string>('currentPath'),
|
|
449
|
+
currentSource = self.storage.get<string>('currentSource');
|
|
450
|
+
|
|
451
|
+
self.state.currentPath = currentPath ?? '';
|
|
452
|
+
self.state.currentSource = currentSource ?? '';
|
|
453
|
+
}
|
|
433
454
|
|
|
434
455
|
self.initUploader(self);
|
|
435
456
|
}
|
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
HTMLTagNames,
|
|
9
|
+
IFileBrowserItem,
|
|
10
|
+
Nullable,
|
|
11
|
+
IDictionary
|
|
12
|
+
} from '../../../types';
|
|
8
13
|
import type { FileBrowser } from '../file-browser';
|
|
9
14
|
import { ctrlKey, attr } from '../../../core/helpers';
|
|
10
|
-
import { F_CLASS, ITEM_CLASS } from '../consts';
|
|
11
15
|
import contextMenu from '../builders/context-menu';
|
|
12
16
|
import { Dom } from '../../../core/dom';
|
|
13
17
|
|
|
@@ -18,20 +22,26 @@ export const getItem = (
|
|
|
18
22
|
): Nullable<HTMLElement> =>
|
|
19
23
|
Dom.closest(node as Node, elm => Dom.isTag(elm, tag), root);
|
|
20
24
|
|
|
25
|
+
export const elementToItem = (
|
|
26
|
+
elm: HTMLElement,
|
|
27
|
+
elementsMap: IDictionary<{
|
|
28
|
+
elm: HTMLElement;
|
|
29
|
+
item: IFileBrowserItem;
|
|
30
|
+
}>
|
|
31
|
+
): IFileBrowserItem | void => {
|
|
32
|
+
const { key } = elm.dataset,
|
|
33
|
+
{ item } = elementsMap[key || ''];
|
|
34
|
+
|
|
35
|
+
return item;
|
|
36
|
+
};
|
|
37
|
+
|
|
21
38
|
export function nativeListeners(this: FileBrowser): void {
|
|
22
39
|
let dragElement: false | HTMLElement = false;
|
|
23
40
|
|
|
24
41
|
const self = this;
|
|
25
42
|
|
|
26
|
-
const elementToItem = (elm: HTMLElement): IFileBrowserItem | void => {
|
|
27
|
-
const { key } = elm.dataset,
|
|
28
|
-
{ item } = self.elementsMap[key || ''];
|
|
29
|
-
|
|
30
|
-
return item;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
43
|
self.e
|
|
34
|
-
.on(self.tree, 'dragstart', (e: MouseEvent): void => {
|
|
44
|
+
.on(self.tree.container, 'dragstart', (e: MouseEvent): void => {
|
|
35
45
|
const a = getItem(e.target, self.dialog.container);
|
|
36
46
|
|
|
37
47
|
if (!a) {
|
|
@@ -42,20 +52,26 @@ export function nativeListeners(this: FileBrowser): void {
|
|
|
42
52
|
dragElement = a;
|
|
43
53
|
}
|
|
44
54
|
})
|
|
45
|
-
.on(self.tree, 'drop', (e: MouseEvent): boolean | void => {
|
|
55
|
+
.on(self.tree.container, 'drop', (e: MouseEvent): boolean | void => {
|
|
46
56
|
if ((self.o.moveFile || self.o.moveFolder) && dragElement) {
|
|
47
57
|
let path = attr(dragElement, '-path') || '';
|
|
48
58
|
|
|
49
59
|
// move folder
|
|
50
60
|
if (
|
|
51
61
|
!self.o.moveFolder &&
|
|
52
|
-
dragElement.classList.contains(
|
|
62
|
+
dragElement.classList.contains(
|
|
63
|
+
this.tree.getFullElName('item')
|
|
64
|
+
)
|
|
53
65
|
) {
|
|
54
66
|
return false;
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
// move file
|
|
58
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
dragElement.classList.contains(
|
|
72
|
+
this.files.getFullElName('item')
|
|
73
|
+
)
|
|
74
|
+
) {
|
|
59
75
|
path += attr(dragElement, '-name');
|
|
60
76
|
|
|
61
77
|
if (!self.o.moveFile) {
|
|
@@ -74,7 +90,9 @@ export function nativeListeners(this: FileBrowser): void {
|
|
|
74
90
|
path,
|
|
75
91
|
attr(a, '-path') || '',
|
|
76
92
|
attr(a, '-source') || '',
|
|
77
|
-
dragElement.classList.contains(
|
|
93
|
+
dragElement.classList.contains(
|
|
94
|
+
this.files.getFullElName('item')
|
|
95
|
+
)
|
|
78
96
|
)
|
|
79
97
|
.then(() => {
|
|
80
98
|
self.loadTree();
|
|
@@ -83,20 +101,20 @@ export function nativeListeners(this: FileBrowser): void {
|
|
|
83
101
|
dragElement = false;
|
|
84
102
|
}
|
|
85
103
|
})
|
|
86
|
-
.on(self.files, 'contextmenu', contextMenu(self))
|
|
87
|
-
.on(self.files, 'click', (e: MouseEvent): void => {
|
|
104
|
+
.on(self.files.container, 'contextmenu', contextMenu(self))
|
|
105
|
+
.on(self.files.container, 'click', (e: MouseEvent): void => {
|
|
88
106
|
if (!ctrlKey(e)) {
|
|
89
107
|
this.state.activeElements = [];
|
|
90
108
|
}
|
|
91
109
|
})
|
|
92
|
-
.on(self.files, 'click', (e: MouseEvent): false | void => {
|
|
110
|
+
.on(self.files.container, 'click', (e: MouseEvent): false | void => {
|
|
93
111
|
const a = getItem(e.target, self.dialog.container);
|
|
94
112
|
|
|
95
113
|
if (!a) {
|
|
96
114
|
return;
|
|
97
115
|
}
|
|
98
116
|
|
|
99
|
-
const item = elementToItem(a);
|
|
117
|
+
const item = elementToItem(a, self.elementsMap);
|
|
100
118
|
|
|
101
119
|
if (!item) {
|
|
102
120
|
return;
|
|
@@ -115,7 +133,7 @@ export function nativeListeners(this: FileBrowser): void {
|
|
|
115
133
|
|
|
116
134
|
return false;
|
|
117
135
|
})
|
|
118
|
-
.on(self.files, 'dragstart', (e: MouseEvent) => {
|
|
136
|
+
.on(self.files.container, 'dragstart', (e: MouseEvent) => {
|
|
119
137
|
if (self.o.moveFile) {
|
|
120
138
|
const a = getItem(e.target, self.dialog.container);
|
|
121
139
|
|
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import type { IFileBrowserItem } from '../../../types';
|
|
8
8
|
import type { FileBrowser } from '../file-browser';
|
|
9
|
-
import { F_CLASS, ITEM_CLASS } from '../consts';
|
|
10
9
|
import { Dom } from '../../../core/dom';
|
|
11
10
|
import { normalizePath } from '../../../core/helpers/normalize';
|
|
12
11
|
import { Button } from '../../../core/ui';
|
|
13
12
|
|
|
14
|
-
const DEFAULT_SOURCE_NAME = 'default'
|
|
15
|
-
ITEM_ACTIVE_CLASS = ITEM_CLASS + '_active_true';
|
|
13
|
+
const DEFAULT_SOURCE_NAME = 'default';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* Convert state to view
|
|
@@ -49,6 +47,15 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
49
47
|
.on(
|
|
50
48
|
['change.currentPath', 'change.currentSource'],
|
|
51
49
|
this.async.debounce(() => {
|
|
50
|
+
if (
|
|
51
|
+
this.o.saveStateInStorage &&
|
|
52
|
+
this.o.saveStateInStorage.storeLastOpenedFolder
|
|
53
|
+
) {
|
|
54
|
+
this.storage
|
|
55
|
+
.set('currentPath', this.state.currentPath)
|
|
56
|
+
.set('currentSource', this.state.currentSource);
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
this.loadTree();
|
|
53
60
|
}, this.defaultTimeout)
|
|
54
61
|
)
|
|
@@ -57,7 +64,10 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
57
64
|
const key = item.uniqueHashKey,
|
|
58
65
|
{ elm } = elementsMap[key];
|
|
59
66
|
|
|
60
|
-
elm &&
|
|
67
|
+
elm &&
|
|
68
|
+
elm.classList.remove(
|
|
69
|
+
files.getFullElName('item', 'active', true)
|
|
70
|
+
);
|
|
61
71
|
});
|
|
62
72
|
})
|
|
63
73
|
|
|
@@ -68,35 +78,45 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
68
78
|
const key = item.uniqueHashKey,
|
|
69
79
|
{ elm } = elementsMap[key];
|
|
70
80
|
|
|
71
|
-
elm &&
|
|
81
|
+
elm &&
|
|
82
|
+
elm.classList.add(
|
|
83
|
+
files.getFullElName('item', 'active', true)
|
|
84
|
+
);
|
|
72
85
|
});
|
|
73
86
|
})
|
|
74
87
|
|
|
75
88
|
.on('change.view', () => {
|
|
76
|
-
files.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
files.setMod('view', state.view);
|
|
90
|
+
if (
|
|
91
|
+
this.o.saveStateInStorage &&
|
|
92
|
+
this.o.saveStateInStorage.storeView
|
|
93
|
+
) {
|
|
94
|
+
this.storage.set('view', state.view);
|
|
95
|
+
}
|
|
81
96
|
})
|
|
82
97
|
|
|
83
98
|
.on('change.sortBy', () => {
|
|
84
|
-
|
|
99
|
+
if (
|
|
100
|
+
this.o.saveStateInStorage &&
|
|
101
|
+
this.o.saveStateInStorage.storeSortBy
|
|
102
|
+
) {
|
|
103
|
+
this.storage.set('sortBy', state.sortBy);
|
|
104
|
+
}
|
|
85
105
|
})
|
|
86
106
|
|
|
87
107
|
.on(
|
|
88
108
|
'change.elements',
|
|
89
109
|
this.async.debounce(() => {
|
|
90
|
-
Dom.detach(files);
|
|
110
|
+
Dom.detach(files.container);
|
|
91
111
|
|
|
92
112
|
if (state.elements.length) {
|
|
93
113
|
state.elements.forEach(item => {
|
|
94
|
-
this.files.appendChild(getDomElement(item));
|
|
114
|
+
this.files.container.appendChild(getDomElement(item));
|
|
95
115
|
});
|
|
96
116
|
} else {
|
|
97
|
-
files.appendChild(
|
|
117
|
+
files.container.appendChild(
|
|
98
118
|
create.div(
|
|
99
|
-
|
|
119
|
+
this.componentName + '_no-files_true',
|
|
100
120
|
this.i18n('There are no files')
|
|
101
121
|
)
|
|
102
122
|
);
|
|
@@ -107,20 +127,23 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
107
127
|
.on(
|
|
108
128
|
'change.sources',
|
|
109
129
|
this.async.debounce(() => {
|
|
110
|
-
Dom.detach(this.tree);
|
|
130
|
+
Dom.detach(this.tree.container);
|
|
111
131
|
|
|
112
132
|
state.sources.forEach(source => {
|
|
113
133
|
const sourceName = source.name;
|
|
114
134
|
|
|
115
135
|
if (sourceName && sourceName !== DEFAULT_SOURCE_NAME) {
|
|
116
|
-
this.tree.appendChild(
|
|
117
|
-
create.div(
|
|
136
|
+
this.tree.container.appendChild(
|
|
137
|
+
create.div(
|
|
138
|
+
this.tree.getFullElName('source-title'),
|
|
139
|
+
sourceName
|
|
140
|
+
)
|
|
118
141
|
);
|
|
119
142
|
}
|
|
120
143
|
|
|
121
144
|
source.folders.forEach((name: string) => {
|
|
122
145
|
const folderElm = create.a(
|
|
123
|
-
|
|
146
|
+
this.tree.getFullElName('item'),
|
|
124
147
|
{
|
|
125
148
|
draggable: 'draggable',
|
|
126
149
|
href: '#',
|
|
@@ -132,7 +155,10 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
132
155
|
'data-source': sourceName,
|
|
133
156
|
'data-source-path': source.path
|
|
134
157
|
},
|
|
135
|
-
create.span(
|
|
158
|
+
create.span(
|
|
159
|
+
this.tree.getFullElName('item-title'),
|
|
160
|
+
name
|
|
161
|
+
)
|
|
136
162
|
);
|
|
137
163
|
|
|
138
164
|
const action =
|
|
@@ -149,7 +175,7 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
149
175
|
|
|
150
176
|
this.e.on(folderElm, 'click', action('openFolder'));
|
|
151
177
|
|
|
152
|
-
this.tree.appendChild(folderElm);
|
|
178
|
+
this.tree.container.appendChild(folderElm);
|
|
153
179
|
|
|
154
180
|
if (name === '..' || name === '.') {
|
|
155
181
|
return;
|
|
@@ -206,7 +232,7 @@ export function stateListeners(this: FileBrowser): void {
|
|
|
206
232
|
});
|
|
207
233
|
});
|
|
208
234
|
|
|
209
|
-
this.tree.
|
|
235
|
+
this.tree.append(button);
|
|
210
236
|
}
|
|
211
237
|
});
|
|
212
238
|
}, this.defaultTimeout)
|