@fiduswriter/image-manager 0.1.6 → 0.1.7

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.
@@ -1,44 +1,57 @@
1
- import {escapeText} from "fwtoolkit"
1
+ import { escapeText } from "fwtoolkit";
2
2
 
3
- import type {ImageCategory} from "../types.js"
3
+ import type { ImageCategory } from "../types.js";
4
+
5
+ /** HTML template for the standalone image overview layout
6
+ * (without the full page chrome from @fiduswriter/frontend).
7
+ * Provides the DOM elements required by OverviewMenuView, initTable(),
8
+ * activateWait/deactivateWait, and addAlert.
9
+ */
10
+ export function imageOverviewTemplate(): string {
11
+ return `<div id="fw-wait"><i class="fa fa-spinner fa-pulse"></i></div>
12
+ <div class="fw-contents-outer">
13
+ <div class="fw-overview-menu-wrapper"><ul id="fw-overview-menu"></ul></div>
14
+ <div class="fw-contents"></div>
15
+ </div>`;
16
+ }
4
17
 
5
18
  interface CategoryFormsTemplateData {
6
- categories: ImageCategory[]
19
+ categories: ImageCategory[];
7
20
  }
8
21
 
9
22
  interface EditcategoriesTemplateData {
10
- categories: ImageCategory[]
23
+ categories: ImageCategory[];
11
24
  }
12
25
 
13
26
  /** A template for the image category edit form. */
14
27
  const usermediaCategoryformsTemplate = ({
15
- categories
28
+ categories,
16
29
  }: CategoryFormsTemplateData) =>
17
- `${categories
18
- .map(
19
- cat =>
20
- `<tr id="categoryTr_${cat.id}" class="fw-list-input">
30
+ `${categories
31
+ .map(
32
+ (cat) =>
33
+ `<tr id="categoryTr_${cat.id}" class="fw-list-input">
21
34
  <td>
22
35
  <input type="text" class="category-form" id="categoryTitle_${cat.id}"
23
36
  value="${escapeText(cat.category_title)}" data-id="${cat.id}" />
24
37
  <span class="fw-add-input icon-addremove" tabindex="0"></span>
25
38
  </td>
26
- </tr>`
27
- )
28
- .join("")}
39
+ </tr>`,
40
+ )
41
+ .join("")}
29
42
  <tr class="fw-list-input">
30
43
  <td>
31
44
  <input type="text" class="category-form" />
32
45
  <span class="fw-add-input icon-addremove" tabindex="0"></span>
33
46
  </td>
34
- </tr>`
47
+ </tr>`;
35
48
 
36
49
  /** A template to edit image categories. */
37
50
  export const usermediaEditcategoriesTemplate = ({
38
- categories
51
+ categories,
39
52
  }: EditcategoriesTemplateData) =>
40
- `<table id="editCategoryList" class="fw-dialog-table">
53
+ `<table id="editCategoryList" class="fw-dialog-table">
41
54
  <tbody>
42
- ${usermediaCategoryformsTemplate({categories})}
55
+ ${usermediaCategoryformsTemplate({ categories })}
43
56
  </tbody>
44
- </table>`
57
+ </table>`;