diff --git a/third_party/astroglobe/package-lock.json b/third_party/astroglobe/package-lock.json
index a83f78a..8359050 100644
--- a/third_party/astroglobe/package-lock.json
+++ b/third_party/astroglobe/package-lock.json
@@ -13,6 +13,7 @@
"@nextcloud/l10n": "^3.1.0",
"@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.29.2",
+ "markdown-it": "^14.1.0",
"pdfjs-dist": "^4.0.379",
"plotly.js-dist-min": "^2.35.3",
"vue": "^2.7.16",
@@ -4113,9 +4114,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true,
- "license": "Python-2.0",
- "peer": true
+ "license": "Python-2.0"
},
"node_modules/array-buffer-byte-length": {
"version": "1.0.2",
@@ -5722,7 +5721,6 @@
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
- "dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.12"
@@ -8622,6 +8620,15 @@
"license": "MIT",
"peer": true
},
+ "node_modules/linkify-it": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
+ "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
+ "license": "MIT",
+ "dependencies": {
+ "uc.micro": "^2.0.0"
+ }
+ },
"node_modules/linkify-string": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-4.3.2.tgz",
@@ -8737,6 +8744,23 @@
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
+ "node_modules/markdown-it": {
+ "version": "14.1.0",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
+ "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1",
+ "entities": "^4.4.0",
+ "linkify-it": "^5.0.0",
+ "mdurl": "^2.0.0",
+ "punycode.js": "^2.3.1",
+ "uc.micro": "^2.1.0"
+ },
+ "bin": {
+ "markdown-it": "bin/markdown-it.mjs"
+ }
+ },
"node_modules/material-colors": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
@@ -8909,6 +8933,12 @@
"license": "CC0-1.0",
"peer": true
},
+ "node_modules/mdurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
+ "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==",
+ "license": "MIT"
+ },
"node_modules/meow": {
"version": "13.2.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz",
@@ -10414,6 +10444,15 @@
"node": ">=6"
}
},
+ "node_modules/punycode.js": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
+ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/qified": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/qified/-/qified-0.5.3.tgz",
@@ -12669,6 +12708,12 @@
"license": "MIT",
"optional": true
},
+ "node_modules/uc.micro": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
+ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
+ "license": "MIT"
+ },
"node_modules/ufo": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz",
diff --git a/third_party/astroglobe/package.json b/third_party/astroglobe/package.json
index a54fba5..1f00975 100644
--- a/third_party/astroglobe/package.json
+++ b/third_party/astroglobe/package.json
@@ -22,6 +22,7 @@
"@nextcloud/l10n": "^3.1.0",
"@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.29.2",
+ "markdown-it": "^14.1.0",
"plotly.js-dist-min": "^2.35.3",
"pdfjs-dist": "^4.0.379",
"vue": "^2.7.16",
diff --git a/third_party/astroglobe/src/App.vue b/third_party/astroglobe/src/App.vue
index ce4aaf4..0e68238 100644
--- a/third_party/astroglobe/src/App.vue
+++ b/third_party/astroglobe/src/App.vue
@@ -199,10 +199,6 @@
ยท {{ t('astroglobe', 'Page {page}/{total}', { page: result.page_number, total: result.page_count }) }}
-
- {{ result.excerpt }}
-
@@ -296,6 +292,7 @@
+
+
+
@@ -311,27 +310,43 @@
{{ t('astroglobe', 'Loading content...') }}
-
+
-
-
-
- {{ viewerContext.before }}
-
-
- {{ viewerContext.chunk }}
-
-
- {{ viewerContext.after }}
-
-
+
+
+
+
+
+
@@ -356,12 +371,15 @@ import ChartBox from 'vue-material-design-icons/ChartBox.vue'
import Cog from 'vue-material-design-icons/Cog.vue'
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'
+import ChevronLeft from 'vue-material-design-icons/ChevronLeft.vue'
+import ChevronRight from 'vue-material-design-icons/ChevronRight.vue'
import Refresh from 'vue-material-design-icons/Refresh.vue'
import OpenInNew from 'vue-material-design-icons/OpenInNew.vue'
import Eye from 'vue-material-design-icons/Eye.vue'
import Close from 'vue-material-design-icons/Close.vue'
import PDFViewer from './components/PDFViewer.vue'
+import MarkdownViewer from './components/MarkdownViewer.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
@@ -394,11 +412,14 @@ export default {
NcEmptyContent,
NcCheckboxRadioSwitch,
PDFViewer,
+ MarkdownViewer,
Magnify,
ChartBox,
Cog,
ChevronDown,
ChevronUp,
+ ChevronLeft,
+ ChevronRight,
Refresh,
OpenInNew,
Eye,
@@ -434,6 +455,7 @@ export default {
viewerTitle: '',
viewerType: 'text',
viewerPage: 1,
+ pdfTotalPages: 0,
currentPdfPath: '',
viewerContext: {
chunk: '',
@@ -776,8 +798,35 @@ export default {
this.viewerType = 'text'
},
+ handlePdfLoaded(event) {
+ this.pdfTotalPages = event.totalPages || 0
+ },
+
+ getMarkdownContent() {
+ // Combine before/chunk/after context into single markdown string
+ let content = ''
+
+ if (this.viewerContext.before) {
+ content += this.viewerContext.before + '\n\n'
+ }
+
+ if (this.viewerContext.chunk) {
+ // Highlight the main chunk with a separator
+ content += '---\n\n'
+ content += this.viewerContext.chunk
+ content += '\n\n---'
+ }
+
+ if (this.viewerContext.after) {
+ content += '\n\n' + this.viewerContext.after
+ }
+
+ return content
+ },
+
closeViewer() {
this.showViewer = false
+ this.pdfTotalPages = 0
},
},
}
@@ -1031,25 +1080,6 @@ a.mcp-result-title {
line-height: 1.4;
}
-.mcp-result-excerpt {
- font-size: 13px;
- color: var(--color-text-maxcontrast);
- line-height: 1.5;
- white-space: pre-wrap;
- word-wrap: break-word;
-
- &--expanded {
- display: block;
- -webkit-line-clamp: unset;
- background: var(--color-background-dark);
- padding: 12px;
- border-radius: var(--border-radius);
- margin-top: 8px;
- white-space: pre-wrap;
- word-break: break-word;
- }
-}
-
.mcp-result-actions {
display: flex;
align-items: center;
@@ -1159,6 +1189,24 @@ a.mcp-result-title {
position: relative;
}
+.mcp-modal-footer {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 16px;
+ padding: 16px 20px;
+ border-top: 1px solid var(--color-border);
+ background: var(--color-main-background);
+ flex-shrink: 0;
+
+ .mcp-page-info {
+ font-size: 14px;
+ color: var(--color-text-maxcontrast);
+ min-width: 150px;
+ text-align: center;
+ }
+}
+
.mcp-viewer-loading {
display: flex;
flex-direction: column;
diff --git a/third_party/astroglobe/src/components/MarkdownViewer.vue b/third_party/astroglobe/src/components/MarkdownViewer.vue
new file mode 100644
index 0000000..f25761d
--- /dev/null
+++ b/third_party/astroglobe/src/components/MarkdownViewer.vue
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+
+
diff --git a/third_party/astroglobe/src/components/PDFViewer.vue b/third_party/astroglobe/src/components/PDFViewer.vue
index addf014..87fdbc3 100644
--- a/third_party/astroglobe/src/components/PDFViewer.vue
+++ b/third_party/astroglobe/src/components/PDFViewer.vue
@@ -11,27 +11,6 @@
-
-
-
-
-
- {{ t('astroglobe', 'Previous') }}
-
-
- {{ t('astroglobe', 'Page {current} of {total}', { current: pageNumber, total: totalPages }) }}
-
-
-
-
-
- {{ t('astroglobe', 'Next') }}
-
-
@@ -40,19 +19,13 @@ import * as pdfjsLib from 'pdfjs-dist'
import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
-import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import AlertCircle from 'vue-material-design-icons/AlertCircle.vue'
-import ChevronLeft from 'vue-material-design-icons/ChevronLeft.vue'
-import ChevronRight from 'vue-material-design-icons/ChevronRight.vue'
export default {
name: 'PDFViewer',
components: {
NcLoadingIcon,
- NcButton,
AlertCircle,
- ChevronLeft,
- ChevronRight,
},
props: {
filePath: {
@@ -247,34 +220,9 @@ export default {
}
}
-.pdf-controls {
- display: flex;
- align-items: center;
- gap: 16px;
- padding: 8px;
- background: var(--color-background-dark);
- border-radius: var(--border-radius-large);
-
- .page-info {
- font-size: 14px;
- color: var(--color-text-maxcontrast);
- min-width: 120px;
- text-align: center;
- }
-}
-
@media (max-width: 768px) {
.pdf-viewer {
padding: 8px;
}
-
- .pdf-controls {
- flex-direction: column;
- gap: 8px;
-
- .page-info {
- order: -1;
- }
- }
}