@underpostnet/underpost 2.97.5 → 2.98.1
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/.vscode/settings.json +7 -8
- package/README.md +2 -2
- package/bin/build.js +21 -5
- package/bin/deploy.js +1 -0
- package/bin/file.js +2 -1
- package/bin/util.js +0 -17
- package/cli.md +2 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +2 -4
- package/scripts/rocky-pwa.sh +200 -0
- package/scripts/rocky-setup.sh +12 -39
- package/src/api/document/document.model.js +1 -1
- package/src/api/document/document.service.js +88 -98
- package/src/cli/cluster.js +5 -9
- package/src/cli/repository.js +9 -9
- package/src/cli/run.js +108 -106
- package/src/client/components/core/Auth.js +2 -0
- package/src/client/components/core/Content.js +52 -4
- package/src/client/components/core/Css.js +30 -0
- package/src/client/components/core/FileExplorer.js +699 -42
- package/src/client/components/core/Input.js +3 -1
- package/src/client/components/core/Panel.js +93 -23
- package/src/client/components/core/PanelForm.js +1 -0
- package/src/client/components/core/Responsive.js +15 -7
- package/src/client/components/core/SearchBox.js +0 -110
- package/src/client/components/core/Translate.js +58 -0
- package/src/client/services/default/default.management.js +327 -148
- package/src/client/sw/default.sw.js +107 -184
- package/src/index.js +58 -20
- package/src/client/components/core/ObjectLayerEngine.js +0 -1520
- package/src/client/components/core/ObjectLayerEngineModal.js +0 -1245
- package/src/client/components/core/ObjectLayerEngineViewer.js +0 -880
- package/src/server/object-layer.js +0 -335
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
2
|
import { FileService } from '../../services/file/file.service.js';
|
|
3
|
-
import { append, getBlobFromUint8ArrayFile, getRawContentFile, htmls, s } from './VanillaJs.js';
|
|
3
|
+
import { append, getBlobFromUint8ArrayFile, getRawContentFile, htmls, s, sa } from './VanillaJs.js';
|
|
4
4
|
import { s4 } from './CommonJs.js';
|
|
5
5
|
import { Translate } from './Translate.js';
|
|
6
6
|
import { Modal, renderViewTitle } from './Modal.js';
|
|
@@ -12,6 +12,49 @@ import { getQueryParams } from './Router.js';
|
|
|
12
12
|
|
|
13
13
|
const logger = loggerFactory(import.meta);
|
|
14
14
|
|
|
15
|
+
const attachMarkdownLinkHandlers = (containerSelector) => {
|
|
16
|
+
const links = sa(`${containerSelector} a[href]`);
|
|
17
|
+
links.forEach((link) => {
|
|
18
|
+
link.addEventListener('click', async (e) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
const href = link.getAttribute('href');
|
|
21
|
+
|
|
22
|
+
// Check if link is external
|
|
23
|
+
const isExternal = href.startsWith('http://') || href.startsWith('https://');
|
|
24
|
+
|
|
25
|
+
if (isExternal) {
|
|
26
|
+
// Show warning modal for external links
|
|
27
|
+
const result = await Modal.RenderConfirm({
|
|
28
|
+
id: `external-link-${s4()}`,
|
|
29
|
+
html: async () => html`
|
|
30
|
+
<div class="in section-mp" style="text-align: center; padding: 20px;">
|
|
31
|
+
<p>${Translate.Render('external-link-warning')}</p>
|
|
32
|
+
<p style="word-break: break-all; margin-top: 10px;"><strong>${href}</strong></p>
|
|
33
|
+
</div>
|
|
34
|
+
`,
|
|
35
|
+
icon: html`<i class="fas fa-external-link-alt"></i>`,
|
|
36
|
+
style: {
|
|
37
|
+
width: '350px',
|
|
38
|
+
height: '500px',
|
|
39
|
+
overflow: 'auto',
|
|
40
|
+
'z-index': '11',
|
|
41
|
+
resize: 'none',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Only open link if user confirmed (not cancelled or closed)
|
|
46
|
+
if (result && result.status === 'confirm') {
|
|
47
|
+
window.open(href, '_blank', 'noopener,noreferrer');
|
|
48
|
+
}
|
|
49
|
+
// If cancelled, do nothing - don't navigate
|
|
50
|
+
} else {
|
|
51
|
+
// Internal link - navigate normally
|
|
52
|
+
window.location.href = href;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
15
58
|
const Content = {
|
|
16
59
|
Render: async function (options = { idModal: '' }) {
|
|
17
60
|
const { idModal } = options;
|
|
@@ -32,7 +75,8 @@ const Content = {
|
|
|
32
75
|
if (!queryParams.cid) throw new Error(`no-result-found`);
|
|
33
76
|
|
|
34
77
|
{
|
|
35
|
-
const { data, status, message } = await DocumentService.get({ id: queryParams.cid });
|
|
78
|
+
const { data: responseData, status, message } = await DocumentService.get({ id: queryParams.cid });
|
|
79
|
+
const data = Array.isArray(responseData) ? responseData : responseData?.data || [];
|
|
36
80
|
if (status !== 'success' || !data || !data[0]) {
|
|
37
81
|
logger.error(message);
|
|
38
82
|
throw new Error(`no-result-found`);
|
|
@@ -81,7 +125,6 @@ const Content = {
|
|
|
81
125
|
if (file) await this.RenderFile({ idModal, file, id: file._id });
|
|
82
126
|
Modal.Data[idModal].onObserverListener[`main-content-observer`]();
|
|
83
127
|
} catch (error) {
|
|
84
|
-
logger.error(error);
|
|
85
128
|
htmls(`.content-render-${idModal}`, '');
|
|
86
129
|
htmls(`.error-${idModal}`, html`<i class="fas fa-exclamation-circle"></i> ${Translate.Render(error.message)}`);
|
|
87
130
|
s(`.error-${idModal}`).classList.remove('hide');
|
|
@@ -239,6 +282,11 @@ ${JSON.stringify(JSON.parse(content), null, 4)}</pre
|
|
|
239
282
|
|
|
240
283
|
if (options.raw) return render;
|
|
241
284
|
append(container, render);
|
|
285
|
+
|
|
286
|
+
// Scrape and handle markdown links after DOM insertion
|
|
287
|
+
if (ext === 'md') {
|
|
288
|
+
attachMarkdownLinkHandlers(container);
|
|
289
|
+
}
|
|
242
290
|
},
|
|
243
291
|
|
|
244
292
|
/**
|
|
@@ -274,4 +322,4 @@ ${JSON.stringify(JSON.parse(content), null, 4)}</pre
|
|
|
274
322
|
},
|
|
275
323
|
};
|
|
276
324
|
|
|
277
|
-
export { Content };
|
|
325
|
+
export { Content, attachMarkdownLinkHandlers };
|
|
@@ -340,6 +340,36 @@ const dynamicCol = (options = { containerSelector: '', id: '', type: '', limit:
|
|
|
340
340
|
);
|
|
341
341
|
break;
|
|
342
342
|
|
|
343
|
+
case 'search-inputs':
|
|
344
|
+
if (s(`.${containerSelector}`).offsetWidth < limitCol)
|
|
345
|
+
htmls(
|
|
346
|
+
`.style-${id}-col`,
|
|
347
|
+
css`
|
|
348
|
+
.${id}-col-a, .${id}-col-b, .${id}-col-c, .${id}-col-d {
|
|
349
|
+
width: 100%;
|
|
350
|
+
}
|
|
351
|
+
`,
|
|
352
|
+
);
|
|
353
|
+
else
|
|
354
|
+
htmls(
|
|
355
|
+
`.style-${id}-col`,
|
|
356
|
+
css`
|
|
357
|
+
.${id}-col-a {
|
|
358
|
+
width: 30%;
|
|
359
|
+
}
|
|
360
|
+
.${id}-col-b {
|
|
361
|
+
width: 30%;
|
|
362
|
+
}
|
|
363
|
+
.${id}-col-c {
|
|
364
|
+
width: 30%;
|
|
365
|
+
}
|
|
366
|
+
.${id}-col-d {
|
|
367
|
+
width: 10%;
|
|
368
|
+
}
|
|
369
|
+
`,
|
|
370
|
+
);
|
|
371
|
+
break;
|
|
372
|
+
|
|
343
373
|
default:
|
|
344
374
|
if (s(`.${containerSelector}`).offsetWidth < 900)
|
|
345
375
|
htmls(
|