File size: 833 Bytes
d2897cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export default class AssetService {

  /**
   * Get a list of all existing assets (e.g. images)
   * to display in the assets manager, and the config
   *
   * @returns object
   */
  static getAssetsConfig() {
    const textareaAssets = mQuery('#grapesjsbuilder_assets');
    const uploadPath = textareaAssets.data('upload');
    const deletePath = textareaAssets.data('delete');
    return {
      files: [],
      conf: {
        uploadPath,
        deletePath,
      },
    };
  }

  /**
   * Get a list of all existing assets (e.g. images)
   * to display in the assets manager, and the config
   *
   * @returns jqXHR
   */
  static getAssetsXhr(onSuccess) {
    const textareaAssets = mQuery('#grapesjsbuilder_assets');
    const assetsPath = textareaAssets.data('assets');
    return mQuery.get(assetsPath, onSuccess);
  }
}