mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
301814bcdd |
2
.github/workflows/release-beta.yml
vendored
2
.github/workflows/release-beta.yml
vendored
@@ -2,7 +2,7 @@ name: BETA Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- beta
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
|
||||
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -10,9 +10,7 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}", "--disable-extension=eliostruyf.vscode-front-matter"
|
||||
],
|
||||
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
||||
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
|
||||
"preLaunchTask": "npm: build:ext"
|
||||
},
|
||||
@@ -21,9 +19,7 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}", "--disable-extension=eliostruyf.vscode-front-matter"
|
||||
],
|
||||
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
||||
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
|
||||
}
|
||||
]
|
||||
|
||||
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@@ -1,15 +1,5 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"commitHelper.messages": [
|
||||
{
|
||||
"type": "👨💻 apps",
|
||||
"values": ["#search", "#profile"]
|
||||
},
|
||||
{
|
||||
"type": "⚙️ tasks",
|
||||
"values": ["#build", "#deploy", "#skip"]
|
||||
}
|
||||
],
|
||||
"workbench.colorCustomizations": {
|
||||
"titleBar.activeBackground": "#15c2cb",
|
||||
"titleBar.inactiveBackground": "#44ffd299",
|
||||
|
||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,33 +1,6 @@
|
||||
# Change Log
|
||||
|
||||
## [10.3.0] - 2024-08-13 - [Release notes](https://beta.frontmatter.codes/updates/v10.3.0)
|
||||
|
||||
### ✨ New features
|
||||
|
||||
- [#823](https://github.com/estruyf/vscode-front-matter/issues/823): Integrated GitHub Copilot support for titles, descriptions, and taxonomy field suggestions
|
||||
- [#824](https://github.com/estruyf/vscode-front-matter/issues/824): Added the ability to link custom actions to fields
|
||||
|
||||
### 🎨 Enhancements
|
||||
|
||||
- [#467](https://github.com/estruyf/vscode-front-matter/issues/467): New `fmContentType` metadata field to link content type (fallback to the `type` field)
|
||||
- [#819](https://github.com/estruyf/vscode-front-matter/issues/819): Added new extensibility support for media scripts
|
||||
- [#820](https://github.com/estruyf/vscode-front-matter/issues/820): Moving the website and API to different hosts
|
||||
- [#821](https://github.com/estruyf/vscode-front-matter/issues/821): Added URI handler to support command links from the documentation
|
||||
- [#822](https://github.com/estruyf/vscode-front-matter/issues/822): Added docs to the panel & dashboard views
|
||||
- [#829](https://github.com/estruyf/vscode-front-matter/issues/829): UI extensibility is now generally available
|
||||
- [#831](https://github.com/estruyf/vscode-front-matter/issues/831): Added "select all" action bar button to the content and media dashboards
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#827](https://github.com/estruyf/vscode-front-matter/issues/827): Fix for `frontmatter.json` file which gets created when already present in a sub-folder
|
||||
- [#830](https://github.com/estruyf/vscode-front-matter/issues/830): Fix for using the SEO title field setting to change the title field reference
|
||||
- [#832](https://github.com/estruyf/vscode-front-matter/issues/832): Fix for finding folders with wildcards in the path
|
||||
|
||||
## [10.2.1] - 2024-08-08
|
||||
|
||||
- [#820](https://github.com/estruyf/vscode-front-matter/issues/820): Update API links to the new API URL
|
||||
|
||||
## [10.2.0] - 2024-06-12 - [Release notes](https://beta.frontmatter.codes/updates/v10.2.0)
|
||||
## [10.2.0] - 2024-xx-xx
|
||||
|
||||
### ✨ New features
|
||||
|
||||
@@ -36,15 +9,15 @@
|
||||
### 🎨 Enhancements
|
||||
|
||||
- [#441](https://github.com/estruyf/vscode-front-matter/issues/441): Show input descriptions for snippet and data forms
|
||||
- [#442](https://github.com/estruyf/vscode-front-matter/issues/442): Hide sidebar on data view when data file is selected + show dropdown of data files
|
||||
- [#442](https://github.com/estruyf/vscode-front-matter/issues/442): Hide sidebar on data view when data file is selecte + show dropdown of data files
|
||||
- [#788](https://github.com/estruyf/vscode-front-matter/issues/788): Show a warning on setting update when it exists in an extended configuration
|
||||
- [#798](https://github.com/estruyf/vscode-front-matter/issues/798): Changed dialog to slide-over for the snippet forms
|
||||
- [#799](https://github.com/estruyf/vscode-front-matter/issues/799): Added `frontMatter.logging` setting to define the logging output. Options are `info`, `warn`, `error`, and `verbose`. The default is `info`.
|
||||
- [#799](https://github.com/estruyf/vscode-front-matter/issues/799): Added `frontMatter.logging` setting to define the logging output. Options are `info`, `warn`, `error`, and `verbose`. Default is `info`.
|
||||
- [#800](https://github.com/estruyf/vscode-front-matter/issues/800): Add colors for the Front Matter CMS output
|
||||
- [#808](https://github.com/estruyf/vscode-front-matter/issues/808): Add support to generate field groups and `block` fields in content type generation
|
||||
- [#810](https://github.com/estruyf/vscode-front-matter/issues/810): Update the tab title based on the view
|
||||
- [#811](https://github.com/estruyf/vscode-front-matter/issues/811): Added `panel.gitActions` view mode option to hide the Git actions in the panel
|
||||
- [#812](https://github.com/estruyf/vscode-front-matter/issues/812): Added the `{{locale}}` placeholder, which can be used in the `previewPath` property
|
||||
- [#812](https://github.com/estruyf/vscode-front-matter/issues/812): Added the `{{locale}}` placeholder which can be used in the `previewPath` property
|
||||
|
||||
### ⚡️ Optimizations
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ You can open showcase issues for the following things:
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 💚 Backers & Sponsors 👇 🤘
|
||||
## 🖤 Backers & Sponsors 👇 🤘
|
||||
|
||||
<p align="center">
|
||||
<img src="https://frontmatter.codes/api/img-sponsors" alt="Front Matter sponsors" />
|
||||
@@ -187,9 +187,17 @@ You can open showcase issues for the following things:
|
||||
|
||||
<br />
|
||||
|
||||
<p align="center" title="Powered by Netlify">
|
||||
<a href="https://www.netlify.com?utm_source=vscode-frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/netlify-dark.png" alt="Deploys by Netlify" height="51px" />
|
||||
<p align="center" title="Powered by Vercel">
|
||||
<a href="https://run.events/?utm_source=frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/runevents-purple.webp" alt="run.events - Event Management Platform" height="50px" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
<p align="center" title="Powered by Vercel">
|
||||
<a href="https://vercel.com/?utm_source=vscode-frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/powered-by-vercel.png" alt="Powered by Vercel" height="44px" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -203,7 +211,18 @@ You can open showcase issues for the following things:
|
||||
|
||||
## 📊 Telemetry
|
||||
|
||||
The Front Matter CMS extension only uses telemetry on application crashes. The extension respects the `telemetry.enableTelemetry` setting which you can learn more about in the [Visual Studio Code FAQ](https://aka.ms/vscode-remote/telemetry).
|
||||
The Front Matter CMS extension collects telemetry data to help us build a better understand which features from the CMS are used. The extension respects the `telemetry.enableTelemetry` setting which you can learn more about in the [Visual Studio Code FAQ](https://aka.ms/vscode-remote/telemetry), or you can only disable it for the extension by configuring the `frontMatter.telemetry.disable` setting.
|
||||
|
||||
We only collect the following data:
|
||||
|
||||
- Type of event
|
||||
- Extension title (main or beta)
|
||||
- Extension version
|
||||
|
||||
No user-specific data is collected, you can check the telemetry implementation in the following files:
|
||||
|
||||
- [Telemetry class](https://github.com/estruyf/vscode-front-matter/blob/59528a3db01be8d34dc40638e6cf827090e31986/src/helpers/Telemetry.ts)
|
||||
- [Metrics API](https://github.com/FrontMatter/web-documentation-nextjs/blob/main/pages/api/metrics.ts)
|
||||
|
||||
For crash reports in the webviews, we make use of Sentry to help us understand what went wrong. This data is only used to fix issues and improve the extension. You can find more information about the Sentry implementation in the following files:
|
||||
|
||||
|
||||
23
README.md
23
README.md
@@ -177,7 +177,7 @@ You can open showcase issues for the following things:
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 💚 Backers & Sponsors 👇 🤘
|
||||
## 🖤 Backers & Sponsors 👇 🤘
|
||||
|
||||
<p align="center">
|
||||
<img src="https://frontmatter.codes/api/img-sponsors" alt="Front Matter sponsors" />
|
||||
@@ -185,7 +185,7 @@ You can open showcase issues for the following things:
|
||||
|
||||
<br />
|
||||
|
||||
<p align="center" title="Support by run.events">
|
||||
<p align="center" title="Powered by Vercel">
|
||||
<a href="https://run.events/?utm_source=frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/runevents-purple.webp" alt="run.events - Event Management Platform" height="50px" />
|
||||
</a>
|
||||
@@ -193,9 +193,9 @@ You can open showcase issues for the following things:
|
||||
|
||||
<br />
|
||||
|
||||
<p align="center" title="Powered by Netlify">
|
||||
<a href="https://www.netlify.com?utm_source=vscode-frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/netlify-dark.png" alt="Deploys by Netlify" height="51px" />
|
||||
<p align="center" title="Powered by Vercel">
|
||||
<a href="https://vercel.com/?utm_source=vscode-frontmatter&utm_campaign=oss">
|
||||
<img src="https://frontmatter.codes/assets/sponsors/powered-by-vercel.png" alt="Powered by Vercel" height="44px" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -209,7 +209,18 @@ You can open showcase issues for the following things:
|
||||
|
||||
## 📊 Telemetry
|
||||
|
||||
The Front Matter CMS extension only uses telemetry on application crashes. The extension respects the `telemetry.enableTelemetry` setting which you can learn more about in the [Visual Studio Code FAQ](https://aka.ms/vscode-remote/telemetry).
|
||||
The Front Matter CMS extension collects telemetry data to help us build a better understand which features from the CMS are used. The extension respects the `telemetry.enableTelemetry` setting which you can learn more about in the [Visual Studio Code FAQ](https://aka.ms/vscode-remote/telemetry), or you can only disable it for the extension by configuring the `frontMatter.telemetry.disable` setting.
|
||||
|
||||
We only collect the following data:
|
||||
|
||||
- Type of event
|
||||
- Extension title (main or beta)
|
||||
- Extension version
|
||||
|
||||
No user-specific data is collected, you can check the telemetry implementation in the following files:
|
||||
|
||||
- [Telemetry class](https://github.com/estruyf/vscode-front-matter/blob/59528a3db01be8d34dc40638e6cf827090e31986/src/helpers/Telemetry.ts)
|
||||
- [Metrics API](https://github.com/FrontMatter/web-documentation-nextjs/blob/main/pages/api/metrics.ts)
|
||||
|
||||
For crash reports in the webviews, we make use of Sentry to help us understand what went wrong. This data is only used to fix issues and improve the extension. You can find more information about the Sentry implementation in the following files:
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -1,54 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 28 28">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
stroke-width: 0px;
|
||||
}
|
||||
|
||||
.cls-1, .cls-2, .cls-3, .cls-4 {
|
||||
fill: #c91980;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
font-family: Futura-MediumItalic, Futura;
|
||||
font-size: 8px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.cls-2, .cls-3, .cls-4, .cls-5 {
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
.cls-2, .cls-4 {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
font-family: Futura-CondensedExtraBold, Futura;
|
||||
font-size: 10.6px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
font-family: Futura-CondensedMedium, Futura;
|
||||
font-size: 10.1px;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g class="cls-5">
|
||||
<text class="cls-4" transform="translate(2.1 18.9) scale(1 1)"><tspan x="0" y="0">MATTER</tspan></text>
|
||||
</g>
|
||||
<g class="cls-5">
|
||||
<text class="cls-2" transform="translate(1.9 26)"><tspan x="0" y="0">BETA</tspan></text>
|
||||
</g>
|
||||
<rect class="cls-1" x="2.4" width="3" height="1"/>
|
||||
<rect class="cls-1" x="6.9" width="3" height="1"/>
|
||||
<rect class="cls-1" x="11.4" width="3" height="1"/>
|
||||
<rect class="cls-1" x="2.4" y="27" width="3" height="1"/>
|
||||
<rect class="cls-1" x="6.9" y="27" width="3" height="1"/>
|
||||
<rect class="cls-1" x="11.4" y="27" width="3" height="1"/>
|
||||
<g class="cls-5">
|
||||
<text class="cls-3" transform="translate(2.1 10.1) scale(.8 1)"><tspan x="0" y="0">FRONT</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 28 28" style="enable-background:new 0 0 28 28;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFE45E;}
|
||||
.st1{fill:none;stroke:#FFE45E;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st2{font-family:'MyriadPro-Bold';}
|
||||
.st3{font-size:8px;}
|
||||
</style>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st0" d="M4.1,10.2H2.4V2.1h3.1V4H4.1v1.2h1.2V7H4.1V10.2z"/>
|
||||
<path class="st0" d="M10.7,10.2H8.9L8,7.3c0-0.1,0-0.1,0-0.2C7.9,7.1,7.9,7,7.8,6.8v0.6v2.9H6.1V2.1h1.8c0.8,0,1.3,0.2,1.8,0.6
|
||||
c0.5,0.5,0.8,1.2,0.8,2.1c0,1-0.4,1.6-1.1,2L10.7,10.2z M7.9,5.8L7.9,5.8c0.3,0,0.5-0.1,0.6-0.3S8.7,5,8.7,4.8c0-0.6-0.3-1-0.8-1
|
||||
l0,0V5.8z"/>
|
||||
<path class="st0" d="M16.1,6.2c0,1.2-0.2,2.3-0.7,3.1s-1.1,1.2-1.7,1.2s-1.2-0.3-1.6-0.9c-0.6-0.8-0.9-1.9-0.9-3.4
|
||||
s0.3-2.6,0.9-3.4C12.6,2.3,13,2,13.7,2c0.8,0,1.3,0.4,1.8,1.2C15.8,3.8,16.1,4.8,16.1,6.2z M14.3,6.2c0-1.4-0.2-2.2-0.7-2.2
|
||||
c-0.2,0-0.4,0.2-0.5,0.6c-0.1,0.4-0.2,0.9-0.2,1.6c0,0.7,0.1,1.2,0.2,1.6c0.1,0.4,0.3,0.6,0.5,0.6c0.2,0,0.4-0.2,0.5-0.6
|
||||
C14.2,7.3,14.3,6.9,14.3,6.2z"/>
|
||||
<path class="st0" d="M16.8,10.2V2.1h1.7l0.9,2.9c0.1,0.1,0.1,0.3,0.2,0.6c0.1,0.2,0.1,0.5,0.2,0.8L20,7c-0.1-0.7-0.1-1.3-0.2-1.8
|
||||
s-0.1-1-0.1-1.2V2.1h1.7v8.2h-1.6l-0.9-3c-0.1-0.3-0.2-0.6-0.3-0.9c-0.1-0.3-0.1-0.6-0.2-0.8c0,0.6,0.1,1.1,0.1,1.5
|
||||
c0,0.4,0,0.8,0,1.2v2.1h-1.7V10.2z"/>
|
||||
<path class="st0" d="M24.6,10.2h-1.7V4h-1V2.1h3.7V4h-1.1V10.2z"/>
|
||||
</g>
|
||||
</g>
|
||||
<rect class="st1" width="28" height="28"/>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st0" d="M3.1,11.6H4l0.6,3c0.1,0.4,0.2,0.8,0.2,1.2C4.9,16.2,4.9,16.6,5,17c0-0.1,0-0.1,0-0.1v-0.1l0.2-0.9l0.1-0.8
|
||||
l0.1-0.5l0.6-3h0.9l0.7,7.5h-1l-0.2-2.6c0-0.1,0-0.2,0-0.3c0-0.1,0-0.2,0-0.2v-1v-0.9l0,0c0,0,0,0,0-0.1v0.2c0,0.2,0,0.3-0.1,0.5
|
||||
c-0.1,0.2,0,0.2-0.1,0.3L6,15.7V16l-0.6,3.3H4.7l-0.6-2.8c-0.1-0.4-0.2-0.8-0.2-1.1c-0.1-0.4-0.1-0.8-0.2-1.2l-0.3,5.2h-1
|
||||
L3.1,11.6z"/>
|
||||
<path class="st0" d="M9.4,11.6h0.8l1.6,7.5h-1l-0.3-1.5H9l-0.3,1.5h-1L9.4,11.6z M10.4,16.8l-0.3-1.2C10,14.8,9.8,13.9,9.7,13
|
||||
c0,0.5-0.1,0.9-0.2,1.4c-0.1,0.5-0.2,1-0.3,1.5l-0.2,1L10.4,16.8L10.4,16.8z"/>
|
||||
<path class="st0" d="M11.6,11.6h3.3v0.9h-1.1v6.7h-1v-6.7h-1.2V11.6z"/>
|
||||
<path class="st0" d="M14.9,11.6h3.3v0.9h-1.1v6.7h-1v-6.7h-1.2V11.6z"/>
|
||||
<path class="st0" d="M18.8,11.6h2.7v0.9h-1.7v2.4h1.5v0.9h-1.5v2.6h1.7v0.9h-2.7V11.6z"/>
|
||||
<path class="st0" d="M22.3,11.6h1.3c0.6,0,1,0.1,1.2,0.4c0.3,0.3,0.5,0.9,0.5,1.6c0,0.5-0.1,1-0.3,1.3c-0.2,0.3-0.4,0.5-0.8,0.6
|
||||
l1.4,3.7h-1l-1.4-3.7v3.7h-1L22.3,11.6L22.3,11.6z M23.3,14.9c0.4,0,0.7-0.1,0.8-0.3c0.2-0.2,0.2-0.5,0.2-0.9c0-0.2,0-0.4-0.1-0.6
|
||||
c-0.1-0.2-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.3-0.2s-0.3-0.1-0.4-0.1h-0.2v2.5H23.3z"/>
|
||||
</g>
|
||||
</g>
|
||||
<text transform="matrix(1 0 0 1 5.4457 25.9479)" class="st0 st2 st3">BETA</text>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.9 KiB |
17
assets/icons/frontmatter-short-teal.svg
Normal file
17
assets/icons/frontmatter-short-teal.svg
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1250 1250" style="enable-background:new 0 0 1250 1250;" xml:space="preserve">
|
||||
<path fill="#02aeb7" d="M316,1082.3H119.4V151.2h347.5v218.9H316v135.7h140.5v210.5H316V1082.3z"/>
|
||||
<path fill="#02aeb7" d="M602.2,151.2H704l77.7,379.9c9.5,47.4,18.1,95,26,142.6s15,97.6,21.4,149.8c0.7-6.8,1.3-12.1,1.7-16
|
||||
c0.2-2.7,0.6-5.5,1.1-8.2l16.6-106.7l14.9-101.3l13.2-66.9l69.2-373.3h102.9l81.2,931.1h-113.6l-19.9-316c-0.8-16.1-1.4-29.9-2-41.6
|
||||
c-0.6-11.7-0.9-21.3-0.9-29L988.3,571l-2.8-114.6c0-0.8,0-2.5-0.3-5.1s-0.5-6.1-0.9-10.6l-2.8,18.7c-3,22.1-5.8,41.4-8.3,57.9
|
||||
s-4.7,30.3-6.6,41.6l-15.1,84.9l-5.7,32l-74.3,406.4h-80.1l-69.7-351c-9.5-46.2-17.9-93.1-25.4-140.8s-14.2-97.6-20.3-149.9
|
||||
l-34.3,641.6H529.6L602.2,151.2z"/>
|
||||
<rect x="119.4" y="0.1" fill="#02aeb7" width="184" height="64.7"/>
|
||||
<rect x="395.7" y="0.1" fill="#02aeb7" width="184" height="64.7"/>
|
||||
<rect x="675.3" y="0.1" fill="#02aeb7" width="184" height="64.7"/>
|
||||
<rect x="119.4" y="1184.7" fill="#02aeb7" width="184" height="64.7"/>
|
||||
<rect x="395.7" y="1184.7" fill="#02aeb7" width="184" height="64.7"/>
|
||||
<rect x="675.3" y="1184.7" fill="#02aeb7" width="184" height="64.7"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -274,8 +274,6 @@
|
||||
"dashboard.preview.button.refresh.title": "更新",
|
||||
"dashboard.preview.button.open.title": "開く",
|
||||
|
||||
"dashboard.snippetsView.item.type.content": "コンテンツ用スニペット",
|
||||
"dashboard.snippetsView.item.type.media": "メディア用スニペット",
|
||||
"dashboard.snippetsView.item.quickAction.editSnippet": "スニペットを編集",
|
||||
"dashboard.snippetsView.item.quickAction.deleteSnippet": "スニペットを削除",
|
||||
"dashboard.snippetsView.item.quickAction.viewSnippet": "スニペットファイルの表示",
|
||||
@@ -727,7 +725,6 @@
|
||||
"helpers.settingsHelper.readConfig.progress.title": "{0}: 動的な設定ファイルを読み込んでいます...",
|
||||
"helpers.settingsHelper.readConfig.error": "設定の読み込みでエラーが発生しました。",
|
||||
"helpers.settingsHelper.refreshConfig.success": "設定を再読み込みしました。",
|
||||
"helpers.settingsHelper.safeUpdate.warning": "Front Matter CMSの構成が拡張または分割されているため、\"{0}\"の設定を更新できませんでした。手動で更新を加えてください。更新情報についての出力を確認してください。",
|
||||
|
||||
"helpers.taxonomyHelper.rename.input.title": "タクソノミー名を変更 {0}",
|
||||
"helpers.taxonomyHelper.rename.validate.equalValue": "現在のファイル名とは別のファイル名を入力してください。",
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
"common.languages": "Languages",
|
||||
"common.scripts": "Scripts",
|
||||
"common.rename": "Rename",
|
||||
"common.docs": "Documentation",
|
||||
|
||||
"loading.initPages": "Loading content",
|
||||
|
||||
@@ -154,7 +153,6 @@
|
||||
"dashboard.filters.languageFilter.all": "All",
|
||||
|
||||
"dashboard.header.actionsBar.itemsSelected": "{0} selected",
|
||||
"dashboard.header.actionsBar.selectAll": "Select all",
|
||||
"dashboard.header.actionsBar.alertDelete.title": "Delete selected files",
|
||||
"dashboard.header.actionsBar.alertDelete.description": "Are you sure you want to delete the selected files?",
|
||||
|
||||
@@ -432,16 +430,12 @@
|
||||
"panel.fields.slugField.generate": "Generate slug",
|
||||
|
||||
"panel.fields.textField.ai.message": "Use Front Matter AI to suggest {0}",
|
||||
"panel.fields.textField.copilot.message": "Use Copilot to suggest {0}",
|
||||
"panel.fields.textField.ai.generate": "Generating suggestion...",
|
||||
"panel.fields.textField.loading": "Loading field",
|
||||
"panel.fields.textField.limit": "Field limit reached {0}",
|
||||
|
||||
"panel.fields.wrapperField.unknown": "Unkown field type: {0}",
|
||||
|
||||
"panel.fields.fieldCustomAction.button.title": "Custom action",
|
||||
"panel.fields.fieldCustomAction.executing": "Executing field action...",
|
||||
|
||||
"panel.actions.title": "Actions",
|
||||
|
||||
"panel.articleDetails.title": "More details",
|
||||
@@ -526,7 +520,6 @@
|
||||
"panel.tagPicker.inputPlaceholder.empty": "Pick your {0}",
|
||||
"panel.tagPicker.inputPlaceholder.disabled": "You have reached the limit of {0}",
|
||||
"panel.tagPicker.ai.suggest": "Use Front Matter AI to suggest {0}",
|
||||
"panel.tagPicker.copilot.suggest": "Use GitHub Copilot to suggest {0}",
|
||||
"panel.tagPicker.ai.generating": "Generating suggestions...",
|
||||
"panel.tagPicker.limit": "Max.: {0}",
|
||||
"panel.tagPicker.unkown": "Add the unknown tag",
|
||||
@@ -710,11 +703,9 @@
|
||||
"helpers.questions.contentTitle.aiInput.placeholder": "What would you like to write about?",
|
||||
"helpers.questions.contentTitle.aiInput.quickPick.title.separator": "your title/description",
|
||||
"helpers.questions.contentTitle.aiInput.quickPick.ai.separator": "AI generated title",
|
||||
"helpers.questions.contentTitle.aiInput.quickPick.copilot.separator": "GitHub Copilot suggestions",
|
||||
"helpers.questions.contentTitle.aiInput.select.title": "Select a title",
|
||||
"helpers.questions.contentTitle.aiInput.select.placeholder": "Select a title for your content",
|
||||
"helpers.questions.contentTitle.aiInput.failed": "Failed fetching the AI title. Please try to use your own title or try again later.",
|
||||
"helpers.questions.contentTitle.copilotInput.failed": "Failed fetching the GitHub Copilot title suggestions. Please try to use your own title or try again later.",
|
||||
"helpers.questions.contentTitle.aiInput.warning": "You did not specify a title for your content.",
|
||||
"helpers.questions.contentTitle.titleInput.title": "Content title",
|
||||
"helpers.questions.contentTitle.titleInput.prompt": "What would you like to use as a title for the content to create?",
|
||||
@@ -788,8 +779,6 @@
|
||||
"listeners.panel.taxonomyListener.aiSuggestTaxonomy.noEditor.error": "No active editor",
|
||||
"listeners.panel.taxonomyListener.aiSuggestTaxonomy.noData.error": "No article data",
|
||||
|
||||
"services.copilot.getChatResponse.error": "Failed to get a response from the GitHub Copilot.",
|
||||
|
||||
"services.modeSwitch.switchMode.quickPick.placeholder": "Select the mode you want to use",
|
||||
"services.modeSwitch.switchMode.quickPick.title": "{0}: Mode selection",
|
||||
"services.modeSwitch.setText.mode": "Mode: {0}",
|
||||
|
||||
168
package-lock.json
generated
168
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "vscode-front-matter-beta",
|
||||
"version": "10.3.0",
|
||||
"version": "10.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "vscode-front-matter-beta",
|
||||
"version": "10.3.0",
|
||||
"version": "10.2.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6"
|
||||
@@ -2935,7 +2935,8 @@
|
||||
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.17.tgz",
|
||||
"integrity": "sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
@@ -3099,12 +3100,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fill-range": "^7.1.1"
|
||||
"fill-range": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -3115,7 +3116,8 @@
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz",
|
||||
"integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
@@ -3209,7 +3211,8 @@
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001583.tgz",
|
||||
"integrity": "sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
@@ -3322,10 +3325,12 @@
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}],
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
@@ -3983,10 +3988,12 @@
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
||||
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}]
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/domhandler": {
|
||||
"version": "5.0.3",
|
||||
@@ -4753,9 +4760,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
@@ -4847,10 +4854,12 @@
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}],
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
@@ -5453,7 +5462,8 @@
|
||||
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz",
|
||||
"integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/mdevils"
|
||||
},
|
||||
@@ -6028,7 +6038,8 @@
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
||||
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
@@ -7075,7 +7086,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz",
|
||||
"integrity": "sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7109,7 +7121,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz",
|
||||
"integrity": "sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7263,7 +7276,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.1.0.tgz",
|
||||
"integrity": "sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7283,7 +7297,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz",
|
||||
"integrity": "sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7304,7 +7319,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.1.0.tgz",
|
||||
"integrity": "sha512-cRzEj7c0OL4Mw2v6nwzttyOZe8XY/Z8G0rzmWQZTBi/jjwyw/U4uqKtUORXQrR5bAZZnbTI/feRV/R7hc4jQYQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7323,7 +7339,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz",
|
||||
"integrity": "sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7344,7 +7361,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz",
|
||||
"integrity": "sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7365,7 +7383,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.2.0.tgz",
|
||||
"integrity": "sha512-lXraTwcX3yH/vMDaFWCQJP1uIszLVebzUa3ZHdrgxr7KEU/9mL4mVgCpGbyhvNLNlauROiNUq7WN5u7ndbY6xg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7384,7 +7403,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.1.0.tgz",
|
||||
"integrity": "sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7402,7 +7422,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz",
|
||||
"integrity": "sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7422,7 +7443,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz",
|
||||
"integrity": "sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7441,7 +7463,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz",
|
||||
"integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7459,7 +7482,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz",
|
||||
"integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7480,7 +7504,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz",
|
||||
"integrity": "sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7495,7 +7520,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz",
|
||||
"integrity": "sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7510,7 +7536,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz",
|
||||
"integrity": "sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7528,7 +7555,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz",
|
||||
"integrity": "sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7546,7 +7574,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz",
|
||||
"integrity": "sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7566,7 +7595,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.1.0.tgz",
|
||||
"integrity": "sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7587,7 +7617,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.1.0.tgz",
|
||||
"integrity": "sha512-uEjpEYY6KMs1g7QfJ2eX1SQEV+ZT4rUD3UcF6l57acZvLNK7PBZL+ty82Z1qhK1/yXIY4bdx04FKMgR0g4IAag==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7602,7 +7633,8 @@
|
||||
"resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.1.0.tgz",
|
||||
"integrity": "sha512-ukRBgie8TIAcacscVHSiddHjO4k/q3pnedmzMQ4iwDcK0FtFCohKOlFbaOL/mPgfnPsL3C1ZyxJa4sbWrBl3jg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
@@ -7784,10 +7816,12 @@
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}],
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
@@ -8665,7 +8699,8 @@
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
|
||||
"integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
@@ -8728,7 +8763,8 @@
|
||||
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz",
|
||||
"integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
@@ -9085,7 +9121,8 @@
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
@@ -10548,7 +10585,8 @@
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||
"integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
@@ -10606,7 +10644,8 @@
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
@@ -12145,7 +12184,8 @@
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
|
||||
"integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==",
|
||||
"dev": true,
|
||||
"funding": [{
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
@@ -12658,9 +12698,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-dev-server/node_modules/ws": {
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||
"version": "8.16.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
|
||||
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
@@ -12906,9 +12946,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "7.5.10",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
||||
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
||||
"version": "7.5.9",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
@@ -13012,4 +13052,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
76
package.json
76
package.json
@@ -3,7 +3,7 @@
|
||||
"displayName": "Front Matter CMS",
|
||||
"description": "Front Matter is a CMS that runs within Visual Studio Code. It gives you the power and control of a full-blown CMS while also providing you the flexibility and speed of the static site generator of your choice like: Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and many more...",
|
||||
"icon": "assets/frontmatter-teal-128x128.png",
|
||||
"version": "10.3.0",
|
||||
"version": "10.2.0",
|
||||
"preview": false,
|
||||
"publisher": "eliostruyf",
|
||||
"galleryBanner": {
|
||||
@@ -31,6 +31,8 @@
|
||||
"l10n": "./l10n",
|
||||
"categories": [
|
||||
"AI",
|
||||
"Chat",
|
||||
"Visualization",
|
||||
"Other"
|
||||
],
|
||||
"keywords": [
|
||||
@@ -70,6 +72,21 @@
|
||||
"**/.frontmatter/config/*.json": "jsonc"
|
||||
}
|
||||
},
|
||||
"chatParticipants": [{
|
||||
"id": "frontMatter.chat",
|
||||
"name": "fm",
|
||||
"fullName": "Front Matter",
|
||||
"description": "Front Matter CMS chat",
|
||||
"isSticky": true,
|
||||
"commands": [{
|
||||
"name": "docs",
|
||||
"description": "Ask a question about Front Matter CMS and we will try to help you out."
|
||||
}, {
|
||||
"name": "create",
|
||||
"description": "Create a new Front Matter CMS project.",
|
||||
"isSticky": true
|
||||
}]
|
||||
}],
|
||||
"keybindings": [{
|
||||
"command": "frontMatter.dashboard",
|
||||
"key": "alt+d"
|
||||
@@ -568,7 +585,6 @@
|
||||
"default": [],
|
||||
"markdownDescription": "%setting.frontMatter.custom.scripts.markdownDescription%",
|
||||
"items": {
|
||||
"$id": "#customscript",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
@@ -1178,7 +1194,7 @@
|
||||
"scope": "Site preview"
|
||||
},
|
||||
"frontMatter.preview.trailingSlash": {
|
||||
"type": "boolean",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"markdownDescription": "%setting.frontMatter.preview.trailingSlash.markdownDescription%",
|
||||
"scope": "Site preview"
|
||||
@@ -1229,15 +1245,9 @@
|
||||
"fileType": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"oneOf": [{
|
||||
"enum": [
|
||||
"md",
|
||||
"mdx"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
"enum": [
|
||||
"md",
|
||||
"mdx"
|
||||
],
|
||||
"description": "%setting.frontMatter.taxonomy.contentTypes.items.properties.fileType.description%"
|
||||
},
|
||||
@@ -1555,13 +1565,6 @@
|
||||
"description": "%setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.caseSensitive.description%"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
"type": "array",
|
||||
"description": "%setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.actions.description%",
|
||||
"items": {
|
||||
"$ref": "#customscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
@@ -1991,6 +1994,11 @@
|
||||
},
|
||||
"scope": "Taxonomy"
|
||||
},
|
||||
"frontMatter.telemetry.disable": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"markdownDescription": "%setting.frontMatter.telemetry.disable.markdownDescription%"
|
||||
},
|
||||
"frontMatter.templates.enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
@@ -2022,11 +2030,6 @@
|
||||
"info",
|
||||
"verbose"
|
||||
]
|
||||
},
|
||||
"frontMatter.copilot.family": {
|
||||
"type": "string",
|
||||
"default": "gpt-3.5-turbo",
|
||||
"markdownDescription": "%setting.frontMatter.copilot.family.markdownDescription%"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2283,12 +2286,6 @@
|
||||
"title": "%command.frontMatter.preview%",
|
||||
"category": "Front Matter"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.docs",
|
||||
"title": "%command.frontMatter.docs%",
|
||||
"category": "Front Matter",
|
||||
"icon": "$(book)"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.chatbot",
|
||||
"title": "%command.frontMatter.chatbot%",
|
||||
@@ -2655,32 +2652,27 @@
|
||||
}
|
||||
],
|
||||
"view/title": [{
|
||||
"command": "frontMatter.docs",
|
||||
"group": "navigation@-1",
|
||||
"when": "view == frontMatter.explorer"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.chatbot",
|
||||
"group": "navigation@0",
|
||||
"when": "view == frontMatter.explorer"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.mode.switch",
|
||||
"command": "frontMatter.collapseSections",
|
||||
"group": "navigation@1",
|
||||
"when": "view == frontMatter.explorer"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.mode.switch",
|
||||
"group": "navigation@2",
|
||||
"when": "view == frontMatter.explorer && frontMatter:has:modes == true"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.project.switch",
|
||||
"group": "navigation@2",
|
||||
"group": "navigation@3",
|
||||
"when": "view == frontMatter.explorer && frontMatter:project:switch:enabled"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.settings.refresh",
|
||||
"group": "navigation@3",
|
||||
"when": "view == frontMatter.explorer"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.collapseSections",
|
||||
"group": "navigation@4",
|
||||
"when": "view == frontMatter.explorer"
|
||||
},
|
||||
|
||||
@@ -73,13 +73,11 @@
|
||||
"setting.frontMatter.content.pageFolders.items.properties.path.description": "フォルダーのパス",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.excludeSubdir.description": "サブディレクトリを除外する",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.previewPath.description": "フォルダーのカスタム プレビュー パスを定義します。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.trailingSlash.description": "プレビュー用URLに末尾のスラッシュを加えるかどうかを設定します。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.filePrefix.description": "ファイル名の接頭辞を定義します。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.contentTypes.description": "現在の場所に使用できる記事タイプを定義します。定義しない場合は、全ての記事タイプを使用できます。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.disableCreation.description": "フォルダー内の新しい記事の作成を無効にします。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.defaultLocale.description": "ページフォルダー用デフォルトのロケールIDを設定します。このフォルダー内の全ての記事が`frontMatter.content.i18n`で設定された言語へ翻訳可能になります。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.locales.description": "ページフォルダーで利用するロケールを設定します。この設定は記事の翻訳に使用されます。",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.slugTemplate.description": "カスタムスラッグのテンプレートを定義します。",
|
||||
"setting.frontMatter.content.i18n.markdownDescription": "ウェブサイトで利用するロケールを設定します。この設定はページフォルダーレベルの設定より優先されます。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.content.i18n)",
|
||||
"setting.frontMatter.content.i18n.items.properties.title.description": "言語名",
|
||||
"setting.frontMatter.content.i18n.items.properties.locale.description": "言語コード",
|
||||
@@ -177,7 +175,6 @@
|
||||
"setting.frontMatter.panel.freeform.markdownDescription": "未登録のタグ/カテゴリーをタグピッカーに入力可能にするかどうかを設定します(有効にすると、後で保存するオプションが使えます)。規定値はtrue。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.freeform)",
|
||||
"setting.frontMatter.panel.actions.disabled.markdownDescription": "パネル内で非表示にしたいコマンドを設定します。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.actions.disabled)",
|
||||
"setting.frontMatter.preview.host.markdownDescription": "プレビュー表示に使用するホストのURLを設定します(例:`http://localhost:1313`)。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.host)",
|
||||
"setting.frontMatter.preview.trailingSlash.markdownDescription": "プレビュー用URLに末尾のスラッシュを加えるかどうかを設定します。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.trailingslash)",
|
||||
"setting.frontMatter.preview.pathName.markdownDescription": "ホストパスとスラッグの間に追加したいパスを設定します。例えば、パスに`yyyy/MM`などの日付を含めたい場合等に使えます。日付は記事の日付フィールドの値に基づいて生成されます。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.pathname)",
|
||||
"setting.frontMatter.site.baseURL.markdownDescription": "ベースURLを設定します。これはSEOチェックに利用されます。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.site.baseurl)",
|
||||
"setting.frontMatter.taxonomy.alignFilename.markdownDescription": "ファイル生成時にファイル名をスラッグに合わせます。[ドキュメントを確認](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.alignfilename)",
|
||||
@@ -232,7 +229,6 @@
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.caseSensitive.description": "比較で大文字と小文字を区別するかどうかを指定します。デフォルト: true",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.pageBundle.description": "新しい記事を作成するときにフォルダーを作成するかどうかを指定します。",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.previewPath.description": "記事タイプのカスタム プレビュー パスを定義します。",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.trailingSlash.description": "プレビュー用URLに末尾のスラッシュを加えるかどうかを設定します。",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.slugTemplate.description": "記事タイプのカスタムスラッグのテンプレートを設定します。",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.template.description": "新しい記事の作成に使用できるオプションのテンプレート。",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.postScript.description": "新しい記事の作成後に使用できるオプションのポストスクリプト。",
|
||||
|
||||
177
package.nls.json
177
package.nls.json
@@ -38,7 +38,6 @@
|
||||
"command.frontMatter.markup.orderedlist": "Ordered list",
|
||||
"command.frontMatter.markup.options": "Other markup options",
|
||||
"command.frontMatter.preview": "Preview content",
|
||||
"command.frontMatter.docs": "Documentation",
|
||||
"command.frontMatter.chatbot": "Ask the Front Matter AI for help",
|
||||
"command.frontMatter.promoteSettings": "Promote settings from local to team level",
|
||||
"command.frontMatter.remap": "Remap or remove tag/category in all articles",
|
||||
@@ -51,25 +50,25 @@
|
||||
"command.frontMatter.cache.clear": "Clear cache",
|
||||
"command.frontMatter.i18n.create": "Create new translation",
|
||||
"settings.configuration.title": "Front Matter: use frontmatter.json for shared team settings",
|
||||
"setting.frontMatter.projects.markdownDescription": "Specify the list of projects to load in the Front Matter CMS. [Local](https://file%2B.vscode-resource.vscode-cdn.net/Users/eliostruyf/nodejs/frontmatter-test-projects/astro-blog/test.html) - [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.projects) - [View in VS Code](vscode://simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.projects%22%5D)",
|
||||
"setting.frontMatter.projects.markdownDescription": "Specify the list of projects to load in the Front Matter CMS. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.projects)",
|
||||
"setting.frontMatter.projects.items.properties.name.markdownDescription": "Specify the name of the project.",
|
||||
"setting.frontMatter.projects.items.properties.default.markdownDescription": "Specify if this project is the default project to load.",
|
||||
"setting.frontMatter.sponsors.ai.enabled.markdownDescription": "Specify if you want to enable AI suggestions. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.sponsors.ai.enabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.sponsors.ai.enabled%22%5D)",
|
||||
"setting.frontMatter.extensibility.scripts.markdownDescription": "Specify the list of scripts to load in the Front Matter CMS. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.extensibility.scripts) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.extensibility.scripts%22%5D)",
|
||||
"setting.frontMatter.experimental.markdownDescription": "Specify if you want to enable the experimental features. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.experimental) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.experimental%22%5D)",
|
||||
"setting.frontMatter.extends.markdownDescription": "Specify the list of paths/URLs to extend the Front Matter CMS config. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.extends) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.extends%22%5D)",
|
||||
"setting.frontMatter.content.autoUpdateDate.markdownDescription": "Specify if you want to automatically update the modified date of your article/page (only content located in your content folder). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.autoupdatedate) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.autoupdatedate%22%5D)",
|
||||
"setting.frontMatter.content.defaultFileType.markdownDescription": "Specify the default file type for the content to create. [Docs](https://frontmatter.codes/docs/settings/overview%23frontmatter.content.defaultfiletype) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.defaultfiletype%22%5D)",
|
||||
"setting.frontMatter.content.defaultSorting.markdownDescription": "Specify the default sorting option for the content dashboard. You can use one of the values from the enum or define your own ID. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.defaultsorting) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.defaultsorting%22%5D)",
|
||||
"setting.frontMatter.content.draftField.markdownDescription": "Define the draft field you want to use to manage your content. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.draftfield) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.draftfield%22%5D)",
|
||||
"setting.frontMatter.sponsors.ai.enabled.markdownDescription": "Specify if you want to enable AI suggestions. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.sponsors.ai.enabled)",
|
||||
"setting.frontMatter.extensibility.scripts.markdownDescription": "Specify the list of scripts to load in the Front Matter CMS. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.extensibility.scripts)",
|
||||
"setting.frontMatter.experimental.markdownDescription": "Specify if you want to enable the experimental features. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.experimental)",
|
||||
"setting.frontMatter.extends.markdownDescription": "Specify the list of paths/URLs to extend the Front Matter CMS config. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.extends)",
|
||||
"setting.frontMatter.content.autoUpdateDate.markdownDescription": "Specify if you want to automatically update the modified date of your article/page (only content located in your content folder). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.autoupdatedate)",
|
||||
"setting.frontMatter.content.defaultFileType.markdownDescription": "Specify the default file type for the content to create. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.defaultfiletype)",
|
||||
"setting.frontMatter.content.defaultSorting.markdownDescription": "Specify the default sorting option for the content dashboard. You can use one of the values from the enum or define your own ID. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.defaultsorting)",
|
||||
"setting.frontMatter.content.draftField.markdownDescription": "Define the draft field you want to use to manage your content. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.draftfield)",
|
||||
"setting.frontMatter.content.draftField.properties.type.description": "Type of the draft field you want to use",
|
||||
"setting.frontMatter.content.draftField.properties.name.description": "Name of the field to use",
|
||||
"setting.frontMatter.content.draftField.properties.invert.description": "By default the draft field is set to true when the content is a draft. Set this to true to set it to false.",
|
||||
"setting.frontMatter.content.draftField.properties.choices.description": "List of choices for the field",
|
||||
"setting.frontMatter.content.fmHighlight.markdownDescription": "Specify if you want to highlight the Front Matter in the Markdown file. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.fmhighlight) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.fmhighlight%22%5D)",
|
||||
"setting.frontMatter.content.hideFm.markdownDescription": "Specify if you want to hide the Front Matter in the Markdown file. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.hidefm) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.hidefm%22%5D)",
|
||||
"setting.frontMatter.content.hideFmMessage.markdownDescription": "Specify the message to display when the Front Matter is hidden. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.hidefmMessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.hidefmMessage%22%5D)",
|
||||
"setting.frontMatter.content.pageFolders.markdownDescription": "This array of folders defines where the extension can retrieve or create new pages. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.pagefolders) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.pagefolders%22%5D)",
|
||||
"setting.frontMatter.content.fmHighlight.markdownDescription": "Specify if you want to highlight the Front Matter in the Markdown file. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.fmhighlight)",
|
||||
"setting.frontMatter.content.hideFm.markdownDescription": "Specify if you want to hide the Front Matter in the Markdown file. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.hidefm)",
|
||||
"setting.frontMatter.content.hideFmMessage.markdownDescription": "Specify the message to display when the Front Matter is hidden. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.hidefmMessage)",
|
||||
"setting.frontMatter.content.pageFolders.markdownDescription": "This array of folders defines where the extension can retrieve or create new pages. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.pagefolders)",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.title.description": "Name of the folder",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.path.description": "Path of the folder",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.excludeSubdir.description": "Exclude sub-directories",
|
||||
@@ -81,29 +80,29 @@
|
||||
"setting.frontMatter.content.pageFolders.items.properties.defaultLocale.description": "Set the default locale ID for the page folder. All content from this folder is translatable to the languages defined in the `frontMatter.content.i18n` setting.",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.locales.description": "Define the locales for the page folder. This will be used for the translation of the content.",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.slugTemplate.description": "Defines a custom slug template.",
|
||||
"setting.frontMatter.content.i18n.markdownDescription": "Specify the locales you want to use for your website. This setting can be overwritten on page folder level. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.i18n) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.i18n%22%5D)",
|
||||
"setting.frontMatter.content.i18n.markdownDescription": "Specify the locales you want to use for your website. This setting can be overwritten on page folder level. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.i18n)",
|
||||
"setting.frontMatter.content.i18n.items.properties.title.description": "Title of the locale",
|
||||
"setting.frontMatter.content.i18n.items.properties.locale.description": "Locale code",
|
||||
"setting.frontMatter.content.i18n.items.properties.path.description": "Relative path of the locale folder",
|
||||
"setting.frontMatter.content.placeholders.markdownDescription": "This array of placeholders defines the placeholders that you can use in your content types and templates for automatically populating your content its front matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.placeholders) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.placeholders%22%5D)",
|
||||
"setting.frontMatter.content.placeholders.markdownDescription": "This array of placeholders defines the placeholders that you can use in your content types and templates for automatically populating your content its front matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.placeholders)",
|
||||
"setting.frontMatter.content.placeholders.items.properties.id.description": "ID of the placeholder, in your content type or template, use it as follows: {{placeholder}}",
|
||||
"setting.frontMatter.content.placeholders.items.properties.value.description": "The placeholder its value",
|
||||
"setting.frontMatter.content.placeholders.items.properties.script.description": "The script to execute to get the value of the placeholder",
|
||||
"setting.frontMatter.content.publicFolder.markdownDescription": "Specify the folder name where all your assets are located. For instance in Hugo this is the `static` folder. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.publicfolder) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.publicfolder%22%5D)",
|
||||
"setting.frontMatter.content.publicFolder.markdownDescription": "Specify the folder name where all your assets are located. For instance in Hugo this is the `static` folder. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.publicfolder)",
|
||||
"setting.frontMatter.content.publicFolder.properties.path.description": "Specify the path of the assets folder",
|
||||
"setting.frontMatter.content.publicFolder.properties.relative.description": "Defines if the path to your media files be relative to the content file?",
|
||||
"setting.frontMatter.snippets.wrapper.enabled.markdownDescription": "Specify if you want to wrap the snippets. [Docs](https://frontmatter.codes/docs/settings/overview#frontMatter.snippets.wrapper.enabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontMatter.snippets.wrapper.enabled%22%5D)",
|
||||
"setting.frontMatter.content.snippets.markdownDescription": "Define the snippets you want to use in your content. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.snippets) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.snippets%22%5D)",
|
||||
"setting.frontMatter.content.sorting.markdownDescription": "Define the sorting options for your dashboard content. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.sorting) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.sorting%22%5D)",
|
||||
"setting.frontMatter.snippets.wrapper.enabled.markdownDescription": "Specify if you want to wrap the snippets. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontMatter.snippets.wrapper.enabled)",
|
||||
"setting.frontMatter.content.snippets.markdownDescription": "Define the snippets you want to use in your content. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.snippets)",
|
||||
"setting.frontMatter.content.sorting.markdownDescription": "Define the sorting options for your dashboard content. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.sorting)",
|
||||
"setting.frontMatter.content.sorting.items.properties.id.description": "The ID of the sorting option. This will be used for the storing the last used sorting option or the default option.",
|
||||
"setting.frontMatter.content.sorting.items.properties.title.description": "Name of the sorting label",
|
||||
"setting.frontMatter.content.sorting.items.properties.name.description": "Name of the metadata field to sort by",
|
||||
"setting.frontMatter.content.sorting.items.properties.order.description": "Order of the sorting",
|
||||
"setting.frontMatter.content.sorting.items.properties.type.description": "Type of the field value",
|
||||
"setting.frontMatter.content.supportedFileTypes.markdownDescription": "Specify the file types that you want to use in Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.supportedfiletypes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.supportedfiletypes%22%5D)",
|
||||
"setting.frontMatter.content.wysiwyg.markdownDescription": "Specifies if you want to enable/disable the What You See, Is What You Get (WYSIWYG) markdown controls. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.wysiwyg) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.wysiwyg%22%5D)",
|
||||
"setting.frontMatter.content.filters.markdownDescription": "Specify the filters you want to use for your content dashboard. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.filters) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.content.filters%22%5D)",
|
||||
"setting.frontMatter.custom.scripts.markdownDescription": "Specify the path to a Node.js script to execute. The current file path will be provided as an argument. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.custom.scripts) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.custom.scripts%22%5D)",
|
||||
"setting.frontMatter.content.supportedFileTypes.markdownDescription": "Specify the file types that you want to use in Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.supportedfiletypes)",
|
||||
"setting.frontMatter.content.wysiwyg.markdownDescription": "Specifies if you want to enable/disable the What You See, Is What You Get (WYSIWYG) markdown controls. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.wysiwyg)",
|
||||
"setting.frontMatter.content.filters.markdownDescription": "Specify the filters you want to use for your content dashboard. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.filters)",
|
||||
"setting.frontMatter.custom.scripts.markdownDescription": "Specify the path to a Node.js script to execute. The current file path will be provided as an argument. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.custom.scripts)",
|
||||
"setting.frontMatter.custom.scripts.items.properties.id.description": "ID of the script.",
|
||||
"setting.frontMatter.custom.scripts.items.properties.title.description": "Title you want to give to your script. Will be shown as the title of the button.",
|
||||
"setting.frontMatter.custom.scripts.items.properties.script.description": "Path to the script to execute",
|
||||
@@ -117,16 +116,16 @@
|
||||
"setting.frontMatter.custom.scripts.items.properties.environments.items.properties.type.description": "The environment type for which the script needs to be used",
|
||||
"setting.frontMatter.custom.scripts.items.properties.environments.items.properties.script.description": "Path to the script to execute",
|
||||
"setting.frontMatter.custom.scripts.items.properties.contentTypes.description": "Define the content types for which the script will be used. If none are defined, it will be available to all types.",
|
||||
"setting.frontMatter.dashboard.content.pagination.markdownDescription": "Specify if you want to enable/disable pagination for your content. You can define your page number up to 52. Default items per page is `16`. Disabling the pagination can be done by setting it to `false`. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.content.pagination) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.dashboard.content.pagination%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.cardTags.markdownDescription": "Specify the name of the metadata field that will be used to show the tags on the content card. When empty or null, it will hide the tags from the card. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.content.cardtags) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.dashboard.content.cardtags%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.state.markdownDescription": "Specify if you want to show the state/draft status on the content card view. [Docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.state) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontMatter.dashboard.content.card.fields.state%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.date.markdownDescription": "Specify if you want to show the date on the content card view. [Docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.date) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontMatter.dashboard.content.card.fields.date%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.description.markdownDescription": "Specify the name of the metadata field that will be used to show the description on the content card. [Docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.description) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontMatter.dashboard.content.card.fields.description%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.title.markdownDescription": "Specify the name of the metadata field that will be used to show the title on the content card. [Docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.title) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontMatter.dashboard.content.card.fields.title%22%5D)",
|
||||
"setting.frontMatter.dashboard.mediaSnippet.markdownDescription": "Specify the a snippet for your custom media insert markup. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.mediasnippet) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.dashboard.mediasnippet%22%5D)",
|
||||
"setting.frontMatter.dashboard.content.pagination.markdownDescription": "Specify if you want to enable/disable pagination for your content. You can define your page number up to 52. Default items per page is `16`. Disabling the pagination can be done by setting it to `false`. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.content.pagination)",
|
||||
"setting.frontMatter.dashboard.content.cardTags.markdownDescription": "Specify the name of the metadata field that will be used to show the tags on the content card. When empty or null, it will hide the tags from the card. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.content.cardtags)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.state.markdownDescription": "Specify if you want to show the state/draft status on the content card view. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.state)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.date.markdownDescription": "Specify if you want to show the date on the content card view. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.date)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.description.markdownDescription": "Specify the name of the metadata field that will be used to show the description on the content card. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.description)",
|
||||
"setting.frontMatter.dashboard.content.card.fields.title.markdownDescription": "Specify the name of the metadata field that will be used to show the title on the content card. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontMatter.dashboard.content.card.fields.title)",
|
||||
"setting.frontMatter.dashboard.mediaSnippet.markdownDescription": "Specify the a snippet for your custom media insert markup. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.mediasnippet)",
|
||||
"setting.frontMatter.dashboard.mediaSnippet.items.description": "Use the `{mediaUrl}`, `{caption}`, `{alt}`, `{filename}`, `{mediaHeight}`, and `{mediaWidth}` placeholders in your snippet to automatically insert the media information.",
|
||||
"setting.frontMatter.dashboard.openOnStart.markdownDescription": "Specify if you want to open the dashboard when you start VS Code. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.openonstart) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.dashboard.openonstart%22%5D)",
|
||||
"setting.frontMatter.data.files.markdownDescription": "Specify the data files you want to use for your website. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.files) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.data.files%22%5D)",
|
||||
"setting.frontMatter.dashboard.openOnStart.markdownDescription": "Specify if you want to open the dashboard when you start VS Code. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.dashboard.openonstart)",
|
||||
"setting.frontMatter.data.files.markdownDescription": "Specify the data files you want to use for your website. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.files)",
|
||||
"setting.frontMatter.data.files.items.properties.id.description": "Your unique ID you want to use for your data file.",
|
||||
"setting.frontMatter.data.files.items.properties.title.description": "Title you want to give to your data file.",
|
||||
"setting.frontMatter.data.files.items.properties.labelField.description": "The field you want to use as label for your data entries.",
|
||||
@@ -139,33 +138,33 @@
|
||||
"setting.frontMatter.data.files.items.properties.schema.properties.properties.description": "Defines the fields of the form.",
|
||||
"setting.frontMatter.data.files.items.properties.type.description": "If you are using data types, you can specify your type ID.",
|
||||
"setting.frontMatter.data.files.items.properties.singleEntry.description": "If you want to use a single entry for your data file.",
|
||||
"setting.frontMatter.data.folders.markdownDescription": "Specify the data folders you want to use for your website. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.folders) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.data.folders%22%5D)",
|
||||
"setting.frontMatter.data.folders.markdownDescription": "Specify the data folders you want to use for your website. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.folders)",
|
||||
"setting.frontMatter.data.folders.items.properties.id.description": "Your unique ID you want to use for your data folder.",
|
||||
"setting.frontMatter.data.folders.items.properties.labelField.description": "The field you want to use as label for your data entries.",
|
||||
"setting.frontMatter.data.folders.items.properties.path.description": "Path to the folder to load files.",
|
||||
"setting.frontMatter.data.folders.items.properties.type.description": "If you are using data types, you can specify your type ID.",
|
||||
"setting.frontMatter.data.folders.items.properties.singleEntry.description": "If you want to use a single entry for your data files in the folder.",
|
||||
"setting.frontMatter.data.types.markdownDescription": "Specify the data types. These types can be used in for your data files. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.types) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.data.types%22%5D)",
|
||||
"setting.frontMatter.data.types.markdownDescription": "Specify the data types. These types can be used in for your data files. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.data.types)",
|
||||
"setting.frontMatter.data.types.items.properties.id.description": "Your unique ID you want to use for your data type.",
|
||||
"setting.frontMatter.file.preserveCasing.markdownDescription": "Specify if you want to preserve the casing of your file names from the title. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.file.preservecasing) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.file.preservecasing%22%5D)",
|
||||
"setting.frontMatter.framework.id.markdownDescription": "Specify the ID of your static site generator or framework you are using for your website. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.framework.id) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.framework.id%22%5D)",
|
||||
"setting.frontMatter.framework.startCommand.markdownDescription": "Specify the command you want to use to start your static site generator or framework. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.framework.startcommand) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.framework.startcommand%22%5D)",
|
||||
"setting.frontMatter.git.enabled.markdownDescription": "Specify if you want to use the Git actions for your website. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.enabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.enabled%22%5D)",
|
||||
"setting.frontMatter.git.commitMessage.markdownDescription": "Specify the commit message you want to use for the sync. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.commitmessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.commitmessage%22%5D)",
|
||||
"setting.frontMatter.git.submodule.pull.markdownDescription": "Specify if you want to pull submodules when syncing. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.pull) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.submodule.pull%22%5D)",
|
||||
"setting.frontMatter.git.submodule.push.markdownDescription": "Specify if you want to push submodules when syncing. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.push) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.submodule.push%22%5D)",
|
||||
"setting.frontMatter.git.submodule.branch.markdownDescription": "Specify the submodule branch to checkout. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.branch) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.submodule.branch%22%5D)",
|
||||
"setting.frontMatter.git.submodule.folder.markdownDescription": "Specify the submodule folder of your content, this can be handy when you are using multiple submodules. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.folder) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.submodule.folder%22%5D)",
|
||||
"setting.frontMatter.global.activeMode.markdownDescription": "Specify the activated mode of Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.activemode) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.global.activemode%22%5D)",
|
||||
"setting.frontMatter.global.modes.markdownDescription": "Specify the modes you want to use for Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.modes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.global.modes%22%5D)",
|
||||
"setting.frontMatter.file.preserveCasing.markdownDescription": "Specify if you want to preserve the casing of your file names from the title. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.file.preservecasing)",
|
||||
"setting.frontMatter.framework.id.markdownDescription": "Specify the ID of your static site generator or framework you are using for your website. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.framework.id)",
|
||||
"setting.frontMatter.framework.startCommand.markdownDescription": "Specify the command you want to use to start your static site generator or framework. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.framework.startcommand)",
|
||||
"setting.frontMatter.git.enabled.markdownDescription": "Specify if you want to use the Git actions for your website. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.enabled)",
|
||||
"setting.frontMatter.git.commitMessage.markdownDescription": "Specify the commit message you want to use for the sync. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.commitmessage)",
|
||||
"setting.frontMatter.git.submodule.pull.markdownDescription": "Specify if you want to pull submodules when syncing. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.pull)",
|
||||
"setting.frontMatter.git.submodule.push.markdownDescription": "Specify if you want to push submodules when syncing. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.push)",
|
||||
"setting.frontMatter.git.submodule.branch.markdownDescription": "Specify the submodule branch to checkout. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.branch)",
|
||||
"setting.frontMatter.git.submodule.folder.markdownDescription": "Specify the submodule folder of your content, this can be handy when you are using multiple submodules. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.submodule.folder)",
|
||||
"setting.frontMatter.global.activeMode.markdownDescription": "Specify the activated mode of Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.activemode)",
|
||||
"setting.frontMatter.global.modes.markdownDescription": "Specify the modes you want to use for Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.modes)",
|
||||
"setting.frontMatter.global.modes.items.properties.id.description": "The ID of your mode.",
|
||||
"setting.frontMatter.global.modes.items.properties.features.description": "The features you want to use for your mode.",
|
||||
"setting.frontMatter.global.notifications.markdownDescription": "Specifies the notifications you want to see. By default, all notifications types will be shown. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.notifications) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.global.notifications%22%5D)",
|
||||
"setting.frontMatter.global.disabledNotifications.markdownDescription": "This is an array with the notifications types that can be disabled for Front Matter CMS. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.disablednotifications) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.global.disablednotifications%22%5D)",
|
||||
"setting.frontMatter.media.defaultSorting.markdownDescription": "Specify the default sorting option for the media dashboard. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.defaultsorting) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.media.defaultsorting%22%5D)",
|
||||
"setting.frontMatter.media.supportedMimeTypes.markdownDescription": "Specify the mime types to support for the media files. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.supportedmimetypes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.media.supportedmimetypes%22%5D)",
|
||||
"setting.frontMatter.global.notifications.markdownDescription": "Specifies the notifications you want to see. By default, all notifications types will be shown. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.notifications)",
|
||||
"setting.frontMatter.global.disabledNotifications.markdownDescription": "This is an array with the notifications types that can be disabled for Front Matter CMS. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.global.disablednotifications)",
|
||||
"setting.frontMatter.media.defaultSorting.markdownDescription": "Specify the default sorting option for the media dashboard. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.defaultsorting)",
|
||||
"setting.frontMatter.media.supportedMimeTypes.markdownDescription": "Specify the mime types to support for the media files. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.supportedmimetypes)",
|
||||
|
||||
"setting.frontMatter.media.contentTypes.markdownDescription": "Specify the media content types you want to use in Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.contenttypes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.media.contenttypes%22%5D)",
|
||||
"setting.frontMatter.media.contentTypes.markdownDescription": "Specify the media content types you want to use in Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.media.contenttypes)",
|
||||
"setting.frontMatter.media.contentTypes.items.description": "Define the media content types you want to use in Front Matter.",
|
||||
"setting.frontMatter.media.contentTypes.items.properties.name.description": "Name of the media content type",
|
||||
"setting.frontMatter.media.contentTypes.items.properties.fileTypes.description": "Specify the file types to allow for the media content type",
|
||||
@@ -175,17 +174,17 @@
|
||||
"setting.frontMatter.media.contentTypes.items.properties.fields.properties.type.description": "Define the type of field",
|
||||
"setting.frontMatter.media.contentTypes.items.properties.fields.properties.single.description": "Is a single line field",
|
||||
|
||||
"setting.frontMatter.panel.freeform.markdownDescription": "Specifies if you want to allow yourself from entering unknown tags/categories in the tag picker (when enabled, you will have the option to store them afterwards). Default: true. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.freeform) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.panel.freeform%22%5D)",
|
||||
"setting.frontMatter.panel.actions.disabled.markdownDescription": "Specify the actions you want to disable in the panel. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.actions.disabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.panel.actions.disabled%22%5D)",
|
||||
"setting.frontMatter.preview.host.markdownDescription": "Specify the host URL (example: http://localhost:1313) to be used when opening the preview. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.host) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.preview.host%22%5D)",
|
||||
"setting.frontMatter.preview.trailingSlash.markdownDescription": "Specify if you want to add a trailing slash to the preview URL. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.trailingslash) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.preview.trailingslash%22%5D)",
|
||||
"setting.frontMatter.preview.pathName.markdownDescription": "Specify the path you want to add after the host and before your slug. This can be used for instance to include the year/month like: `yyyy/MM`. The date will be generated based on the article its date field value. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.pathname) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.preview.pathname%22%5D)",
|
||||
"setting.frontMatter.site.baseURL.markdownDescription": "Specify the base URL of your site, this will be used for SEO checks. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.site.baseurl) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.site.baseurl%22%5D)",
|
||||
"setting.frontMatter.taxonomy.alignFilename.markdownDescription": "Align the filename with the new slug when it gets generated. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.alignfilename) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.alignfilename%22%5D)",
|
||||
"setting.frontMatter.taxonomy.categories.markdownDescription": "Specifies the categories which can be used in the Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.categories) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.categories%22%5D)",
|
||||
"setting.frontMatter.taxonomy.commaSeparatedFields.markdownDescription": "Specify the fields names that Front Matter should treat as a comma-separated array. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.commaseparatedfields) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.commaseparatedfields%22%5D)",
|
||||
"setting.frontMatter.panel.freeform.markdownDescription": "Specifies if you want to allow yourself from entering unknown tags/categories in the tag picker (when enabled, you will have the option to store them afterwards). Default: true. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.freeform)",
|
||||
"setting.frontMatter.panel.actions.disabled.markdownDescription": "Specify the actions you want to disable in the panel. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.panel.actions.disabled)",
|
||||
"setting.frontMatter.preview.host.markdownDescription": "Specify the host URL (example: http://localhost:1313) to be used when opening the preview. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.host)",
|
||||
"setting.frontMatter.preview.trailingSlash.markdownDescription": "Specify if you want to add a trailing slash to the preview URL. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.trailingslash)",
|
||||
"setting.frontMatter.preview.pathName.markdownDescription": "Specify the path you want to add after the host and before your slug. This can be used for instance to include the year/month like: `yyyy/MM`. The date will be generated based on the article its date field value. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.preview.pathname)",
|
||||
"setting.frontMatter.site.baseURL.markdownDescription": "Specify the base URL of your site, this will be used for SEO checks. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.site.baseurl)",
|
||||
"setting.frontMatter.taxonomy.alignFilename.markdownDescription": "Align the filename with the new slug when it gets generated. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.alignfilename)",
|
||||
"setting.frontMatter.taxonomy.categories.markdownDescription": "Specifies the categories which can be used in the Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.categories)",
|
||||
"setting.frontMatter.taxonomy.commaSeparatedFields.markdownDescription": "Specify the fields names that Front Matter should treat as a comma-separated array. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.commaseparatedfields)",
|
||||
"setting.frontMatter.taxonomy.commaSeparatedFields.items.description": "Name of the fields you want to use as comma-separated arrays.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.markdownDescription": "Specify the type of contents you want to use for your articles/pages/etc. Make sure the `type` is correctly set in your front matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.contenttypes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.contenttypes%22%5D)",
|
||||
"setting.frontMatter.taxonomy.contentTypes.markdownDescription": "Specify the type of contents you want to use for your articles/pages/etc. Make sure the `type` is correctly set in your front matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.contenttypes)",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.description": "Define the content types you want to use in Front Matter.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.name.description": "Define the type of field",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fileType.description": "Specifies the type of content you want to create.",
|
||||
@@ -231,7 +230,6 @@
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.operator.description": "The operator to use",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.value.description": "The value to compare",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.caseSensitive.description": "Specify if the comparison is case sensitive. Default: true",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.actions.description": "Specify the field custom actions",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.pageBundle.description": "Specify if you want to create a folder when creating new content.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.previewPath.description": "Defines a custom preview path for the content type.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.trailingSlash.description": "Specify if you want to add a trailing slash to the preview URL.",
|
||||
@@ -240,46 +238,45 @@
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.postScript.description": "An optional post script that can be used after new content creation.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.filePrefix.description": "Defines a prefix for the file name.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.defaultFileName.description": "Default file name to use when creating new content.",
|
||||
"setting.frontMatter.taxonomy.customTaxonomy.markdownDescription": "Specify the custom taxonomy field data. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.tags) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.tags%22%5D)",
|
||||
"setting.frontMatter.taxonomy.customTaxonomy.markdownDescription": "Specify the custom taxonomy field data. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.tags)",
|
||||
"setting.frontMatter.taxonomy.customTaxonomy.items.properties.id.description": "ID for your taxonomy field. It cannot contain the \"tags\" or \"categories\" value.",
|
||||
"setting.frontMatter.taxonomy.customTaxonomy.items.properties.options.description": "Options from which you can pick.",
|
||||
"setting.frontMatter.taxonomy.dateField.markdownDescription": "This setting is used to define the publishing date field of your articles. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.datefield) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.datefield%22%5D)",
|
||||
"setting.frontMatter.taxonomy.dateFormat.markdownDescription": "Specify the date format for your articles. Check [date-fns formating](https://date-fns.org/v2.0.1/docs/format) for more information. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.dateformat) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.dateformat%22%5D)",
|
||||
"setting.frontMatter.taxonomy.fieldGroups.markdownDescription": "Define the field groups you want to use for your block fields or collection fields. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.fieldgroups) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.fieldgroups%22%5D)",
|
||||
"setting.frontMatter.taxonomy.dateField.markdownDescription": "This setting is used to define the publishing date field of your articles. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.datefield)",
|
||||
"setting.frontMatter.taxonomy.dateFormat.markdownDescription": "Specify the date format for your articles. Check [date-fns formating](https://date-fns.org/v2.0.1/docs/format) for more information. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.dateformat)",
|
||||
"setting.frontMatter.taxonomy.fieldGroups.markdownDescription": "Define the field groups you want to use for your block fields or collection fields. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.fieldgroups)",
|
||||
"setting.frontMatter.taxonomy.fieldGroups.items.properties.id.description": "The name of the field group",
|
||||
"setting.frontMatter.taxonomy.fieldGroups.items.properties.labelField.description": "The name of the field to be used as display value",
|
||||
"setting.frontMatter.taxonomy.frontMatterType.markdownDescription": "Specify the type of Front Matter to use. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.frontmattertype) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.frontmattertype%22%5D)",
|
||||
"setting.frontMatter.taxonomy.indentArrays.markdownDescription": "Specify if arrays in front matter are indented. Default: true. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.indentarrays) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.indentarrays%22%5D)",
|
||||
"setting.frontMatter.taxonomy.modifiedField.markdownDescription": "This setting is used to define the modified date field of your articles. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.modifiedfield) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.modifiedfield%22%5D)",
|
||||
"setting.frontMatter.taxonomy.quoteStringValues.markdownDescription": "Specify if you want to quote string values in the front matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.quotestringvalues) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.quotestringvalues%22%5D)",
|
||||
"setting.frontMatter.taxonomy.noPropertyValueQuotes.markdownDescription": "Specify the properties from which quotes need to be removed. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.nopropertyvaluequotes) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.nopropertyvaluequotes%22%5D)",
|
||||
"setting.frontMatter.taxonomy.frontMatterType.markdownDescription": "Specify the type of Front Matter to use. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.frontmattertype)",
|
||||
"setting.frontMatter.taxonomy.indentArrays.markdownDescription": "Specify if arrays in front matter are indented. Default: true. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.indentarrays)",
|
||||
"setting.frontMatter.taxonomy.modifiedField.markdownDescription": "This setting is used to define the modified date field of your articles. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.modifiedfield)",
|
||||
"setting.frontMatter.taxonomy.quoteStringValues.markdownDescription": "Specify if you want to quote string values in the front matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.quotestringvalues)",
|
||||
"setting.frontMatter.taxonomy.noPropertyValueQuotes.markdownDescription": "Specify the properties from which quotes need to be removed. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.nopropertyvaluequotes)",
|
||||
"setting.frontMatter.taxonomy.noPropertyValueQuotes.items.description": "Name of the properties you want to remove quotes from.",
|
||||
"setting.frontMatter.taxonomy.seoContentLengh.markdownDescription": "Specifies the optimal minimum length for your articles. Between 1,760 words – 2,400 is the absolute ideal article length for SEO in 2021. (set to `-1` to turn it off). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seocontentlengh) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seocontentlengh%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoDescriptionField.markdownDescription": "Specifies the name of the SEO description field for your page. Default is 'description'. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seodescriptionfield) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seodescriptionfield%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoDescriptionLength.markdownDescription": "Specifies the optimal description length for SEO (set to `-1` to turn it off). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seodescriptionlength) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seodescriptionlength%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoSlugLength.markdownDescription": "Specifies the optimal slug length for SEO (set to `-1` to turn it off). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seosluglength) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seosluglength%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoTitleField.markdownDescription": "Specifies the name of the SEO title field for your page. Default is 'title'. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seotitlefield) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seotitlefield%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoTitleLength.markdownDescription": "Specifies the optimal title length for SEO (set to `-1` to turn it off). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seotitlelength) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.seotitlelength%22%5D)",
|
||||
"setting.frontMatter.taxonomy.slugPrefix.markdownDescription": "Specify a prefix for the slug. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugprefix) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.slugprefix%22%5D)",
|
||||
"setting.frontMatter.taxonomy.slugSuffix.markdownDescription": "Specify a suffix for the slug. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugsuffix) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.slugsuffix%22%5D)",
|
||||
"setting.frontMatter.taxonomy.slugTemplate.markdownDescription": "Defines a custom slug template for the content you will create. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugtemplate) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.slugtemplate%22%5D)",
|
||||
"setting.frontMatter.taxonomy.tags.markdownDescription": "Specifies the tags which can be used in the Front Matter. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.tags) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.taxonomy.tags%22%5D)",
|
||||
"setting.frontMatter.telemetry.disable.markdownDescription": "Specify if you want to disable the telemetry. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.telemetry.disable) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.telemetry.disable%22%5D)",
|
||||
"setting.frontMatter.templates.enabled.markdownDescription": "Specify if you want to use templates. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.enabled) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.templates.enabled%22%5D)",
|
||||
"setting.frontMatter.templates.folder.markdownDescription": "Specify the folder to use for your article templates. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.folder) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.templates.folder%22%5D)",
|
||||
"setting.frontMatter.templates.prefix.markdownDescription": "Specify the prefix you want to add for your new article filenames. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.prefix) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.templates.prefix%22%5D)",
|
||||
"setting.frontMatter.taxonomy.seoContentLengh.markdownDescription": "Specifies the optimal minimum length for your articles. Between 1,760 words – 2,400 is the absolute ideal article length for SEO in 2021. (set to `-1` to turn it off). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seocontentlengh)",
|
||||
"setting.frontMatter.taxonomy.seoDescriptionField.markdownDescription": "Specifies the name of the SEO description field for your page. Default is 'description'. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seodescriptionfield)",
|
||||
"setting.frontMatter.taxonomy.seoDescriptionLength.markdownDescription": "Specifies the optimal description length for SEO (set to `-1` to turn it off). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seodescriptionlength)",
|
||||
"setting.frontMatter.taxonomy.seoSlugLength.markdownDescription": "Specifies the optimal slug length for SEO (set to `-1` to turn it off). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seosluglength)",
|
||||
"setting.frontMatter.taxonomy.seoTitleField.markdownDescription": "Specifies the name of the SEO title field for your page. Default is 'title'. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seotitlefield)",
|
||||
"setting.frontMatter.taxonomy.seoTitleLength.markdownDescription": "Specifies the optimal title length for SEO (set to `-1` to turn it off). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seotitlelength)",
|
||||
"setting.frontMatter.taxonomy.slugPrefix.markdownDescription": "Specify a prefix for the slug. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugprefix)",
|
||||
"setting.frontMatter.taxonomy.slugSuffix.markdownDescription": "Specify a suffix for the slug. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugsuffix)",
|
||||
"setting.frontMatter.taxonomy.slugTemplate.markdownDescription": "Defines a custom slug template for the content you will create. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugtemplate)",
|
||||
"setting.frontMatter.taxonomy.tags.markdownDescription": "Specifies the tags which can be used in the Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.tags)",
|
||||
"setting.frontMatter.telemetry.disable.markdownDescription": "Specify if you want to disable the telemetry. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.telemetry.disable)",
|
||||
"setting.frontMatter.templates.enabled.markdownDescription": "Specify if you want to use templates. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.enabled)",
|
||||
"setting.frontMatter.templates.folder.markdownDescription": "Specify the folder to use for your article templates. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.folder)",
|
||||
"setting.frontMatter.templates.prefix.markdownDescription": "Specify the prefix you want to add for your new article filenames. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.prefix)",
|
||||
"setting.frontMatter.dashboard.mediaSnippet.deprecationMessage": "This setting is deprecated and will be removed in the next major version. Please define your media snippet in the `frontMatter.content.snippet` setting.",
|
||||
"setting.frontMatter.taxonomy.dateField.deprecationMessage": "This setting is deprecated and will be removed in the next major version. Please use the new `isPublishDate` settings instead in your content types date fields.",
|
||||
"setting.frontMatter.taxonomy.modifiedField.deprecationMessage": "This setting is deprecated and will be removed in the next major version. Please use the new `isModifiedDate` settings instead in your content types date fields.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.customType.description": "Specify the name of the custom field type to use.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.clearEmpty.description": "Specify if the empty values should be cleared.",
|
||||
"setting.frontMatter.website.host.markdownDescription": "Specify the host URL of your website. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.website.url) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.website.url%22%5D)",
|
||||
"setting.frontMatter.website.host.markdownDescription": "Specify the host URL of your website. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.website.url)",
|
||||
"command.frontMatter.settings.refresh": "Refresh Front Matter Settings",
|
||||
"setting.frontMatter.config.dynamicFilePath.markdownDescription": "Specify the path to the dynamic config file (ex: [[workspace]]/config.js). [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.config.dynamicfilepath) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.config.dynamicfilepath%22%5D)",
|
||||
"setting.frontMatter.config.dynamicFilePath.markdownDescription": "Specify the path to the dynamic config file (ex: [[workspace]]/config.js). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.config.dynamicfilepath)",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.allowAsSubContent.description": "Specify if the content type can be used as sub content.",
|
||||
"setting.frontMatter.taxonomy.contentTypes.items.properties.isSubContent.description": "Specify if the content type is sub content.",
|
||||
|
||||
"setting.frontMatter.git.disableOnBranches.markdownDescription": "Specify the branches on which you want to disable the Git actions. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.disableonbranches) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.disableonbranches%22%5D)",
|
||||
"setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.requirescommitmessage%22%5D)",
|
||||
"setting.frontMatter.copilot.family.markdownDescription": "Specify the LLM family of the Copilot you want to use. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.copilot.family) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.copilot.family%22%5D)"
|
||||
"setting.frontMatter.git.disableOnBranches.markdownDescription": "Specify the branches on which you want to disable the Git actions. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.disableonbranches)",
|
||||
"setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage)"
|
||||
}
|
||||
@@ -5,15 +5,13 @@ const core = require('@actions/core');
|
||||
const packageJson = require('../package.json');
|
||||
const version = packageJson.version.split('.');
|
||||
|
||||
packageJson.version = `${version[0]}.${version[1]}.${process.argv[
|
||||
process.argv.length - 1
|
||||
].substring(0, 9)}`;
|
||||
packageJson.version = `${version[0]}.${version[1]}.${process.argv[process.argv.length-1].substr(0, 7)}`;
|
||||
packageJson.preview = true;
|
||||
packageJson.name = 'vscode-front-matter-beta';
|
||||
packageJson.name = "vscode-front-matter-beta";
|
||||
packageJson.displayName = `${packageJson.displayName} (BETA)`;
|
||||
packageJson.description = `BETA Version of Front Matter. ${packageJson.description}`;
|
||||
packageJson.icon = 'assets/frontmatter-beta.png';
|
||||
packageJson.homepage = 'https://beta.frontmatter.codes';
|
||||
packageJson.icon = "assets/frontmatter-beta.png";
|
||||
packageJson.homepage = "https://beta.frontmatter.codes";
|
||||
|
||||
console.log(packageJson.version);
|
||||
|
||||
@@ -22,16 +20,13 @@ core.summary.addHeading(`Version info`).addRaw(`Version: ${packageJson.version}`
|
||||
const scripts = packageJson.scripts;
|
||||
for (const key in scripts) {
|
||||
if (key.startsWith(`prod:`)) {
|
||||
scripts[key] = scripts[key].replace('production', 'development');
|
||||
scripts[key] = scripts[key].replace("production", "development");
|
||||
}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(packageJson.scripts, null, 2));
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(path.resolve('.'), 'package.json'),
|
||||
JSON.stringify(packageJson, null, 2)
|
||||
);
|
||||
fs.writeFileSync(path.join(path.resolve('.'), 'package.json'), JSON.stringify(packageJson, null, 2));
|
||||
|
||||
let readme = fs.readFileSync(path.join(__dirname, '../README.beta.md'), 'utf8');
|
||||
fs.writeFileSync(path.join(__dirname, '../README.md'), readme);
|
||||
@@ -40,4 +35,4 @@ fs.writeFileSync(path.join(__dirname, '../README.md'), readme);
|
||||
const ignoreFilePath = path.join(path.resolve('.'), '.vscodeignore');
|
||||
let vscodeignore = fs.readFileSync(ignoreFilePath, 'utf8');
|
||||
vscodeignore = vscodeignore.replace(`**/*.map`, '');
|
||||
fs.writeFileSync(ignoreFilePath, vscodeignore);
|
||||
fs.writeFileSync(ignoreFilePath, vscodeignore);
|
||||
@@ -20,13 +20,13 @@ import {
|
||||
SETTING_SLUG_PREFIX,
|
||||
SETTING_SLUG_SUFFIX,
|
||||
SETTING_CONTENT_PLACEHOLDERS,
|
||||
TelemetryEvent,
|
||||
SETTING_SLUG_TEMPLATE
|
||||
} from './../constants';
|
||||
import { CustomPlaceholder, Field } from '../models';
|
||||
import { format } from 'date-fns';
|
||||
import {
|
||||
ArticleHelper,
|
||||
Logger,
|
||||
Settings,
|
||||
SlugHelper,
|
||||
processArticlePlaceholdersFromData,
|
||||
@@ -38,13 +38,13 @@ import { COMMAND_NAME, DefaultFields } from '../constants';
|
||||
import { DashboardData, SnippetInfo, SnippetRange } from '../models/DashboardData';
|
||||
import { DateHelper } from '../helpers/DateHelper';
|
||||
import { parseWinPath } from '../helpers/parseWinPath';
|
||||
import { Telemetry } from '../helpers/Telemetry';
|
||||
import { ParsedFrontMatter } from '../parsers';
|
||||
import { MediaListener } from '../listeners/panel';
|
||||
import { NavigationType } from '../dashboardWebView/models';
|
||||
import { SNIPPET } from '../constants/Snippet';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { getTitleField } from '../utils';
|
||||
|
||||
export class Article {
|
||||
/**
|
||||
@@ -133,7 +133,6 @@ export class Article {
|
||||
private static async setLastModifiedDateInner(
|
||||
document: TextDocument
|
||||
): Promise<ParsedFrontMatter | undefined> {
|
||||
Logger.verbose(`Article:setLastModifiedDateInner:Start`);
|
||||
const article = ArticleHelper.getFrontMatterFromDocument(document);
|
||||
|
||||
// Only set the date, if there is already front matter set
|
||||
@@ -143,16 +142,9 @@ export class Article {
|
||||
|
||||
const cloneArticle = Object.assign({}, article);
|
||||
const dateField = await ArticleHelper.getModifiedDateField(article);
|
||||
Logger.verbose(`Article:setLastModifiedDateInner:DateField - ${JSON.stringify(dateField)}`);
|
||||
|
||||
try {
|
||||
const fieldName = dateField?.name || DefaultFields.LastModified;
|
||||
const fieldValue = Article.formatDate(new Date(), dateField?.dateFormat);
|
||||
cloneArticle.data[fieldName] = fieldValue;
|
||||
Logger.verbose(
|
||||
`Article:setLastModifiedDateInner:DateField name - ${fieldName} - value - ${fieldValue}`
|
||||
);
|
||||
Logger.verbose(`Article:setLastModifiedDateInner:End`);
|
||||
cloneArticle.data[fieldName] = Article.formatDate(new Date(), dateField?.dateFormat);
|
||||
return cloneArticle;
|
||||
} catch (e: unknown) {
|
||||
Notifications.error(
|
||||
@@ -190,6 +182,8 @@ export class Article {
|
||||
* Generate the slug based on the article title
|
||||
*/
|
||||
public static async updateSlug() {
|
||||
Telemetry.send(TelemetryEvent.generateSlug);
|
||||
|
||||
const updateFileName = Settings.get(SETTING_SLUG_UPDATE_FILE_NAME) as string;
|
||||
const editor = window.activeTextEditor;
|
||||
|
||||
@@ -210,7 +204,7 @@ export class Article {
|
||||
contentType
|
||||
);
|
||||
|
||||
const titleField = getTitleField();
|
||||
const titleField = 'title';
|
||||
const articleTitle: string = article.data[titleField];
|
||||
const slugInfo = Article.generateSlug(articleTitle, article, contentType.slugTemplate);
|
||||
|
||||
@@ -291,7 +285,7 @@ export class Article {
|
||||
/**
|
||||
* Retrieve the slug from the front matter
|
||||
*/
|
||||
public static getSlug(pathname?: string) {
|
||||
public static getSlug() {
|
||||
const editor = window.activeTextEditor;
|
||||
if (!editor) {
|
||||
return;
|
||||
@@ -304,18 +298,17 @@ export class Article {
|
||||
|
||||
const parsedFile = parse(file);
|
||||
|
||||
const titleField = getTitleField();
|
||||
const slugTemplate = Settings.get<string>(SETTING_SLUG_TEMPLATE);
|
||||
if (slugTemplate) {
|
||||
if (slugTemplate === '{{title}}') {
|
||||
const article = ArticleHelper.getFrontMatter(editor);
|
||||
if (article?.data && article.data[titleField]) {
|
||||
return article.data[titleField].toLowerCase().replace(/\s/g, '-');
|
||||
if (article?.data?.title) {
|
||||
return article.data.title.toLowerCase().replace(/\s/g, '-');
|
||||
}
|
||||
} else {
|
||||
const article = ArticleHelper.getFrontMatter(editor);
|
||||
if (article?.data) {
|
||||
return SlugHelper.createSlug(article.data[titleField], article.data, slugTemplate);
|
||||
return SlugHelper.createSlug(article.data.title, article.data, slugTemplate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,10 +320,6 @@ export class Article {
|
||||
return `${prefix}${parsedFile.name}${suffix}`;
|
||||
}
|
||||
|
||||
if (parsedFile.name.toLowerCase() === 'index' && pathname) {
|
||||
return ``;
|
||||
}
|
||||
|
||||
const folderName = basename(dirname(file));
|
||||
return folderName;
|
||||
}
|
||||
@@ -382,16 +371,11 @@ export class Article {
|
||||
public static formatDate(dateValue: Date, fieldDateFormat?: string): string {
|
||||
const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string;
|
||||
|
||||
Logger.verbose(`Article:formatDate:Start`);
|
||||
|
||||
if (fieldDateFormat) {
|
||||
Logger.verbose(`Article:formatDate:FieldDateFormat - ${fieldDateFormat}`);
|
||||
return format(dateValue, DateHelper.formatUpdate(fieldDateFormat) as string);
|
||||
} else if (dateFormat && typeof dateFormat === 'string') {
|
||||
Logger.verbose(`Article:formatDate:DateFormat - ${dateFormat}`);
|
||||
return format(dateValue, DateHelper.formatUpdate(dateFormat) as string);
|
||||
} else {
|
||||
Logger.verbose(`Article:formatDate:toISOString - ${dateValue}`);
|
||||
return typeof dateValue.toISOString === 'function'
|
||||
? dateValue.toISOString()
|
||||
: dateValue?.toString();
|
||||
@@ -488,12 +472,11 @@ export class Article {
|
||||
|
||||
const article = ArticleHelper.getFrontMatter(editor);
|
||||
const contentType = article ? await ArticleHelper.getContentType(article) : undefined;
|
||||
const tileField = getTitleField();
|
||||
|
||||
await commands.executeCommand(COMMAND_NAME.dashboard, {
|
||||
type: NavigationType.Snippets,
|
||||
data: {
|
||||
fileTitle: article?.data[tileField] || '',
|
||||
fileTitle: article?.data.title || '',
|
||||
filePath: editor.document.uri.fsPath,
|
||||
fieldName: basename(editor.document.uri.fsPath),
|
||||
contentType,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { authentication, commands, ExtensionContext } from 'vscode';
|
||||
import { COMMAND_NAME, CONTEXT, WEBSITE_LINKS } from '../constants';
|
||||
import { COMMAND_NAME, CONTEXT } from '../constants';
|
||||
import { Extension, Logger } from '../helpers';
|
||||
import { Dashboard } from './Dashboard';
|
||||
import { SettingsListener } from '../listeners/panel';
|
||||
@@ -22,8 +22,9 @@ export class Backers {
|
||||
const githubAuth = await authentication.getSession('github', ['read:user'], { silent: true });
|
||||
if (githubAuth && githubAuth.accessToken) {
|
||||
try {
|
||||
const isBeta = ext.isBetaVersion();
|
||||
const response = await fetch(
|
||||
`${WEBSITE_LINKS.api.baseUrl}${WEBSITE_LINKS.api.endpoints.backers}`,
|
||||
`https://${isBeta ? `beta.` : ``}frontmatter.codes/api/v2/backers`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -1,13 +1,99 @@
|
||||
import { PreviewCommands, GeneralCommands } from './../constants';
|
||||
import { Telemetry } from './../helpers/Telemetry';
|
||||
import { TelemetryEvent, PreviewCommands, GeneralCommands, WEBSITE_LINKS, COMMAND_NAME } from './../constants';
|
||||
import { join } from 'path';
|
||||
import { commands, Uri, ViewColumn, window } from 'vscode';
|
||||
import {
|
||||
CancellationToken,
|
||||
chat,
|
||||
ChatContext,
|
||||
ChatRequest,
|
||||
ChatResponseStream,
|
||||
commands,
|
||||
LanguageModelChatMessage,
|
||||
lm,
|
||||
Uri,
|
||||
ViewColumn,
|
||||
window
|
||||
} from 'vscode';
|
||||
import { Extension } from '../helpers';
|
||||
import { WebviewHelper } from '@estruyf/vscode';
|
||||
import { getLocalizationFile } from '../utils/getLocalizationFile';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { Folders } from '.';
|
||||
|
||||
export class Chatbot {
|
||||
private static company: string;
|
||||
private static chatId: number;
|
||||
|
||||
public static async register() {
|
||||
const fmChat = chat.createChatParticipant('frontMatter.chat', this.handler);
|
||||
fmChat.iconPath = Uri.joinPath(
|
||||
Extension.getInstance().extensionPath,
|
||||
'/assets/icons/frontmatter-short-teal.svg'
|
||||
);
|
||||
}
|
||||
|
||||
private static async handler(
|
||||
request: ChatRequest,
|
||||
context: ChatContext,
|
||||
stream: ChatResponseStream,
|
||||
token: CancellationToken
|
||||
) {
|
||||
const { command, prompt } = request;
|
||||
|
||||
if (command === 'docs' && prompt) {
|
||||
if (!this.chatId || !this.company) {
|
||||
stream.progress('Initializing the Front Matter AI...');
|
||||
|
||||
await this.initChat();
|
||||
}
|
||||
|
||||
if (!this.company || !this.chatId) {
|
||||
this.showAiError(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
stream.progress('Fetching information from the docs...');
|
||||
|
||||
const data: {
|
||||
answer: string;
|
||||
answerId: number;
|
||||
sources: string[];
|
||||
} = await this.retrieveDocs(prompt);
|
||||
|
||||
if (!data.answer) {
|
||||
this.showAiError(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
stream.markdown(data.answer);
|
||||
} else if (command === 'create') {
|
||||
stream.progress(`Checking your configuration...`);
|
||||
|
||||
const messages = [LanguageModelChatMessage.User(`You are a kind and helpful assistant named Front Matter AI. You aim to provide support in managing Front Matter CMS and its content. If you don't know the answer to a question, you will guide the user to the documentation (https://frontmatter.codes/docs). You can use the "https://frontmatter.codes/docs" link as a reference. When returning code you will surround it in a MD code block, not HTML.`)];
|
||||
|
||||
messages.push(LanguageModelChatMessage.User(request.prompt));
|
||||
|
||||
const [model] = await lm.selectChatModels({ vendor: 'copilot', family: 'gpt-4' });
|
||||
|
||||
try {
|
||||
const chatResponse = await model.sendRequest(messages, {}, token);
|
||||
for await (const fragment of chatResponse.text) {
|
||||
stream.markdown(fragment);
|
||||
}
|
||||
stream.button({
|
||||
command: COMMAND_NAME.createByContentType,
|
||||
title: 'Create new content',
|
||||
});
|
||||
} catch (err) {
|
||||
this.showAiError(stream);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
stream.markdown('Sorry, I do not understand that command. Check out the [Front Matter CMS](https://frontmatter.codes/docs) documentation for more information.')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the Chatbot in the editor
|
||||
*/
|
||||
@@ -115,5 +201,53 @@ export class Chatbot {
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
Telemetry.send(TelemetryEvent.openChatbot);
|
||||
}
|
||||
|
||||
private static async initChat() {
|
||||
const response = await fetch(`${WEBSITE_LINKS.root}/api/ai-init`);
|
||||
|
||||
if (!response.ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.company || !data.chatId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.company = data.company;
|
||||
this.chatId = data.chatId;
|
||||
}
|
||||
|
||||
private static async retrieveDocs(prompt: string) {
|
||||
if (!this.company || !this.chatId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(`${WEBSITE_LINKS.root}/api/ai-chat`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'accept': '*',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
company: this.company,
|
||||
chatId: this.chatId,
|
||||
question: prompt,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
private static showAiError(stream: ChatResponseStream) {
|
||||
stream.markdown(`Sorry, I am not able to connect to the Front Matter AI service. Please try again later or check out the [Front Matter CMS](https://frontmatter.codes/docs) documentation.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ import {
|
||||
CONTEXT,
|
||||
ExtensionState,
|
||||
SETTING_EXPERIMENTAL,
|
||||
COMMAND_NAME
|
||||
SETTING_EXTENSIBILITY_SCRIPTS,
|
||||
COMMAND_NAME,
|
||||
TelemetryEvent
|
||||
} from '../constants';
|
||||
import { join } from 'path';
|
||||
import { commands, Uri, ViewColumn, Webview, WebviewPanel, window } from 'vscode';
|
||||
@@ -16,6 +18,7 @@ import {
|
||||
DashboardListener,
|
||||
MediaListener,
|
||||
SettingsListener,
|
||||
TelemetryListener,
|
||||
DataListener,
|
||||
PagesListener,
|
||||
ExtensionListener,
|
||||
@@ -26,11 +29,12 @@ import {
|
||||
} from '../listeners/dashboard';
|
||||
import { MediaListener as PanelMediaListener } from '../listeners/panel';
|
||||
import { GitListener, ModeListener } from '../listeners/general';
|
||||
import { Folders } from './Folders';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { DashboardMessage } from '../dashboardWebView/DashboardMessage';
|
||||
import { NavigationType } from '../dashboardWebView/models';
|
||||
import { getExtensibilityScripts, ignoreMsgCommand } from '../utils';
|
||||
import { ignoreMsgCommand } from '../utils';
|
||||
|
||||
export class Dashboard {
|
||||
private static webview: WebviewPanel | null = null;
|
||||
@@ -63,6 +67,7 @@ export class Dashboard {
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboard, (data?: DashboardData) => {
|
||||
Telemetry.send(TelemetryEvent.openContentDashboard);
|
||||
if (!data) {
|
||||
Dashboard.open({ type: NavigationType.Contents });
|
||||
} else {
|
||||
@@ -73,30 +78,35 @@ export class Dashboard {
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboardMedia, () => {
|
||||
Telemetry.send(TelemetryEvent.openMediaDashboard);
|
||||
Dashboard.open({ type: NavigationType.Media });
|
||||
})
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboardSnippets, () => {
|
||||
Telemetry.send(TelemetryEvent.openSnippetsDashboard);
|
||||
Dashboard.open({ type: NavigationType.Snippets });
|
||||
})
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboardData, () => {
|
||||
Telemetry.send(TelemetryEvent.openDataDashboard);
|
||||
Dashboard.open({ type: NavigationType.Data });
|
||||
})
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboardTaxonomy, () => {
|
||||
Telemetry.send(TelemetryEvent.openTaxonomyDashboard);
|
||||
Dashboard.open({ type: NavigationType.Taxonomy });
|
||||
})
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.dashboardClose, () => {
|
||||
Telemetry.send(TelemetryEvent.closeDashboard);
|
||||
Dashboard.close();
|
||||
})
|
||||
);
|
||||
@@ -231,6 +241,7 @@ export class Dashboard {
|
||||
PagesListener.process(msg);
|
||||
SettingsListener.process(msg);
|
||||
DataListener.process(msg);
|
||||
TelemetryListener.process(msg);
|
||||
SnippetListener.process(msg);
|
||||
ModeListener.process(msg);
|
||||
GitListener.process(msg);
|
||||
@@ -296,8 +307,20 @@ export class Dashboard {
|
||||
|
||||
// Get experimental setting
|
||||
const experimental = SettingsHelper.get(SETTING_EXPERIMENTAL);
|
||||
const extensibilityScripts = SettingsHelper.get<string[]>(SETTING_EXTENSIBILITY_SCRIPTS) || [];
|
||||
|
||||
const scriptsToLoad: string[] = getExtensibilityScripts(webView);
|
||||
const scriptsToLoad: string[] = [];
|
||||
if (experimental) {
|
||||
for (const script of extensibilityScripts) {
|
||||
if (script.startsWith('https://')) {
|
||||
scriptsToLoad.push(script);
|
||||
} else {
|
||||
const absScriptPath = Folders.getAbsFilePath(script);
|
||||
const scriptUri = webView.asWebviewUri(Uri.file(absScriptPath));
|
||||
scriptsToLoad.push(scriptUri.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const csp = [
|
||||
`default-src 'none';`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Folders } from './Folders';
|
||||
import { ViewColumn, commands, version, workspace } from 'vscode';
|
||||
import { ViewColumn, commands, workspace } from 'vscode';
|
||||
import ContentProvider from '../providers/ContentProvider';
|
||||
import { join } from 'path';
|
||||
import { ContentFolder } from '../models';
|
||||
@@ -37,8 +37,6 @@ export class Diagnostics {
|
||||
|
||||
Beta: \`${Extension.getInstance().isBetaVersion()}\`
|
||||
Version: \`${Extension.getInstance().version}\`
|
||||
OS: \`${process.platform}\`
|
||||
VSCode version: \`${version}\`
|
||||
|
||||
## Project name
|
||||
|
||||
|
||||
@@ -6,18 +6,12 @@ import {
|
||||
SETTING_CONTENT_PAGE_FOLDERS,
|
||||
SETTING_CONTENT_STATIC_FOLDER,
|
||||
SETTING_CONTENT_SUPPORTED_FILETYPES,
|
||||
SETTING_DATE_FORMAT
|
||||
SETTING_DATE_FORMAT,
|
||||
TelemetryEvent
|
||||
} from './../constants';
|
||||
import { commands, Uri, workspace, window } from 'vscode';
|
||||
import { basename, dirname, join, relative, sep } from 'path';
|
||||
import {
|
||||
ContentFolder,
|
||||
ContentType,
|
||||
FileInfo,
|
||||
FolderInfo,
|
||||
I18nConfig,
|
||||
StaticFolder
|
||||
} from '../models';
|
||||
import { ContentFolder, FileInfo, FolderInfo, I18nConfig, StaticFolder } from '../models';
|
||||
import uniqBy = require('lodash.uniqby');
|
||||
import { Template } from './Template';
|
||||
import { Notifications } from '../helpers/Notifications';
|
||||
@@ -29,12 +23,12 @@ import { parseWinPath } from '../helpers/parseWinPath';
|
||||
import { MediaHelpers } from '../helpers/MediaHelpers';
|
||||
import { MediaListener, PagesListener, SettingsListener } from '../listeners/dashboard';
|
||||
import { DEFAULT_FILE_TYPES } from '../constants/DefaultFileTypes';
|
||||
import { Telemetry } from '../helpers/Telemetry';
|
||||
import { glob } from 'glob';
|
||||
import { mkdirAsync } from '../utils/mkdirAsync';
|
||||
import { existsAsync, isWindows, lstatAsync } from '../utils';
|
||||
import { existsAsync, isWindows } from '../utils';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { Preview } from './Preview';
|
||||
|
||||
export const WORKSPACE_PLACEHOLDER = `[[workspace]]`;
|
||||
|
||||
@@ -105,6 +99,8 @@ export class Folders {
|
||||
MediaHelpers.resetMedia();
|
||||
MediaListener.sendMediaFiles(0, folderPath);
|
||||
}
|
||||
|
||||
Telemetry.send(TelemetryEvent.addMediaFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,6 +175,8 @@ export class Folders {
|
||||
|
||||
Notifications.info(l10n.t(LocalizationKey.commandsFoldersCreateSuccess));
|
||||
|
||||
Telemetry.send(TelemetryEvent.registerFolder);
|
||||
|
||||
SettingsListener.getSettings(true);
|
||||
}
|
||||
}
|
||||
@@ -192,6 +190,8 @@ export class Folders {
|
||||
let folders = await Folders.get();
|
||||
folders = folders.filter((f) => f.path !== folder.fsPath);
|
||||
await Folders.update(folders);
|
||||
|
||||
Telemetry.send(TelemetryEvent.unregisterFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ export class Folders {
|
||||
* @param filePath
|
||||
* @returns
|
||||
*/
|
||||
public static async getFilePrefixBeFilePath(filePath: string): Promise<string | undefined> {
|
||||
public static async getFilePrefixBeFilePath(filePath: string) {
|
||||
const folders = await Folders.get();
|
||||
if (folders.length > 0) {
|
||||
filePath = parseWinPath(filePath);
|
||||
@@ -672,7 +672,7 @@ export class Folders {
|
||||
public static async getPageFolderByFilePath(
|
||||
filePath: string
|
||||
): Promise<ContentFolder | undefined> {
|
||||
const folders = Folders.getCached();
|
||||
const folders = await Folders.get();
|
||||
const parsedPath = parseWinPath(filePath);
|
||||
const pageFolderMatches = folders
|
||||
.filter((folder) => parsedPath && folder.path && parsedPath.includes(folder.path))
|
||||
@@ -685,49 +685,6 @@ export class Folders {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the folder associated with the specified content type and file path.
|
||||
* If a single matching folder is found, it is returned. If multiple matching folders are found,
|
||||
* the user is prompted to select one. If no matching folders are found, the user is prompted to
|
||||
* select a folder with a preview path.
|
||||
*
|
||||
* @param contentType - The content type to match.
|
||||
* @param filePath - The file path to match.
|
||||
* @returns A Promise that resolves to the selected ContentFolder, or undefined if no matching folder is found.
|
||||
*/
|
||||
public static async getFolderByContentType(
|
||||
contentType: ContentType,
|
||||
filePath: string
|
||||
): Promise<ContentFolder | undefined> {
|
||||
if (!contentType) {
|
||||
return;
|
||||
}
|
||||
|
||||
const folders = Folders.getCached();
|
||||
let selectedFolder: ContentFolder | undefined;
|
||||
|
||||
// Try to find the folder by content type
|
||||
let crntFolders = folders.filter(
|
||||
(folder) =>
|
||||
folder.contentTypes?.includes((contentType as ContentType).name) && folder.previewPath
|
||||
);
|
||||
|
||||
// Use file path to find the folder
|
||||
if (crntFolders.length > 0) {
|
||||
crntFolders = crntFolders.filter((folder) => filePath?.startsWith(folder.path));
|
||||
}
|
||||
|
||||
if (crntFolders && crntFolders.length === 1) {
|
||||
selectedFolder = crntFolders[0];
|
||||
} else if (crntFolders && crntFolders.length > 1) {
|
||||
selectedFolder = await Preview.askUserToPickFolder(crntFolders);
|
||||
} else {
|
||||
selectedFolder = await Preview.askUserToPickFolder(folders.filter((f) => f.previewPath));
|
||||
}
|
||||
|
||||
return selectedFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the file stats for a given file.
|
||||
* @param file - The URI of the file.
|
||||
@@ -827,26 +784,9 @@ export class Folders {
|
||||
|
||||
try {
|
||||
pattern = isWindows() ? parseWinPath(pattern) : pattern;
|
||||
const folders = await glob(pattern, {
|
||||
ignore: 'node_modules/**',
|
||||
dot: true
|
||||
});
|
||||
|
||||
const onlyFolders = [];
|
||||
for (const folder of folders) {
|
||||
try {
|
||||
const stats = await lstatAsync(folder);
|
||||
if (stats.isDirectory()) {
|
||||
onlyFolders.push(folder);
|
||||
} else {
|
||||
onlyFolders.push(dirname(folder));
|
||||
}
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const uniqueFolders = [...new Set(onlyFolders)];
|
||||
const files = await glob(pattern, { ignore: '**/node_modules/**', dot: true });
|
||||
const allFolders = (files || []).map((file) => dirname(file));
|
||||
const uniqueFolders = [...new Set(allFolders)];
|
||||
Logger.verbose(`Folders:findFolders:end - ${uniqueFolders.length}`);
|
||||
return uniqueFolders;
|
||||
} catch (e) {
|
||||
@@ -865,7 +805,7 @@ export class Folders {
|
||||
|
||||
try {
|
||||
pattern = isWindows() ? parseWinPath(pattern) : pattern;
|
||||
const files = await glob(pattern, { ignore: 'node_modules/**', dot: true });
|
||||
const files = await glob(pattern, { ignore: '**/node_modules/**', dot: true });
|
||||
const allFiles = (files || []).map((file) => Uri.file(file));
|
||||
Logger.verbose(`Folders:findFiles:end - ${allFiles.length}`);
|
||||
return allFiles;
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
SETTING_PREVIEW_HOST,
|
||||
SETTING_PREVIEW_PATHNAME,
|
||||
CONTEXT,
|
||||
TelemetryEvent,
|
||||
PreviewCommands,
|
||||
SETTING_EXPERIMENTAL,
|
||||
SETTING_DATE_FORMAT,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
processFmPlaceholders,
|
||||
processPathPlaceholders,
|
||||
Settings,
|
||||
Telemetry,
|
||||
processDateTimePlaceholders
|
||||
} from '../helpers';
|
||||
import { ContentFolder, ContentType, PreviewSettings } from '../models';
|
||||
@@ -29,7 +31,7 @@ import { ParsedFrontMatter } from '../parsers';
|
||||
import { getLocalizationFile } from '../utils/getLocalizationFile';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { getTitleField, joinUrl } from '../utils';
|
||||
import { joinUrl } from '../utils';
|
||||
import { i18n } from './i18n';
|
||||
|
||||
export class Preview {
|
||||
@@ -75,13 +77,11 @@ export class Preview {
|
||||
return;
|
||||
}
|
||||
|
||||
const titleField = getTitleField();
|
||||
|
||||
// Create the preview webview
|
||||
const webView = window.createWebviewPanel(
|
||||
'frontMatterPreview',
|
||||
article?.data && article?.data[titleField]
|
||||
? l10n.t(LocalizationKey.commandsPreviewPanelTitle, article?.data[titleField])
|
||||
article?.data?.title
|
||||
? l10n.t(LocalizationKey.commandsPreviewPanelTitle, article?.data.title)
|
||||
: 'Front Matter Preview',
|
||||
{
|
||||
viewColumn: ViewColumn.Beside,
|
||||
@@ -197,6 +197,8 @@ export class Preview {
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
Telemetry.send(TelemetryEvent.openPreview);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,15 +247,44 @@ export class Preview {
|
||||
contentType = await ArticleHelper.getContentType(article);
|
||||
}
|
||||
|
||||
// Get the folder of the article by the file path
|
||||
selectedFolder = await Folders.getPageFolderByFilePath(filePath);
|
||||
// Check if there is a pathname defined on content folder level
|
||||
const folders = await Folders.get();
|
||||
if (folders.length > 0) {
|
||||
const foldersWithPath = folders.filter((folder) => folder.previewPath);
|
||||
|
||||
if (!selectedFolder && contentType) {
|
||||
selectedFolder = await Folders.getFolderByContentType(contentType, filePath);
|
||||
}
|
||||
for (const folder of foldersWithPath) {
|
||||
const folderPath = parseWinPath(folder.path);
|
||||
if (filePath.startsWith(folderPath)) {
|
||||
if (!selectedFolder || selectedFolder.path.length < folderPath.length) {
|
||||
selectedFolder = folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedFolder && selectedFolder.previewPath) {
|
||||
pathname = selectedFolder.previewPath;
|
||||
if (!selectedFolder && article?.data && contentType && !contentType.previewPath) {
|
||||
// Try to find the folder by content type
|
||||
let crntFolders = folders.filter(
|
||||
(folder) =>
|
||||
folder.contentTypes?.includes((contentType as ContentType).name) && folder.previewPath
|
||||
);
|
||||
|
||||
// Use file path to find the folder
|
||||
if (crntFolders.length > 0) {
|
||||
crntFolders = crntFolders.filter((folder) => filePath?.startsWith(folder.path));
|
||||
}
|
||||
|
||||
if (crntFolders && crntFolders.length === 1) {
|
||||
selectedFolder = crntFolders[0];
|
||||
} else if (crntFolders && crntFolders.length > 1) {
|
||||
selectedFolder = await Preview.askUserToPickFolder(crntFolders);
|
||||
} else {
|
||||
selectedFolder = await Preview.askUserToPickFolder(folders.filter((f) => f.previewPath));
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedFolder && selectedFolder.previewPath) {
|
||||
pathname = selectedFolder.previewPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is a pathname defined on content type level
|
||||
@@ -264,7 +295,7 @@ export class Preview {
|
||||
}
|
||||
|
||||
if (!slug) {
|
||||
slug = Article.getSlug(pathname);
|
||||
slug = Article.getSlug();
|
||||
}
|
||||
|
||||
const locale = await i18n.getLocale(filePath);
|
||||
@@ -343,7 +374,7 @@ export class Preview {
|
||||
slug = `${slug}/`;
|
||||
}
|
||||
|
||||
return join(slug);
|
||||
return slug;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,7 +424,7 @@ export class Preview {
|
||||
* @param crntFolders
|
||||
* @returns
|
||||
*/
|
||||
public static async askUserToPickFolder(
|
||||
private static async askUserToPickFolder(
|
||||
crntFolders: ContentFolder[]
|
||||
): Promise<ContentFolder | undefined> {
|
||||
let selectedFolder: ContentFolder | undefined = undefined;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DEFAULT_CONTENT_TYPE } from './../constants/ContentType';
|
||||
import { Telemetry } from './../helpers/Telemetry';
|
||||
import { workspace, Uri, commands, window } from 'vscode';
|
||||
import { join } from 'path';
|
||||
import { Notifications } from '../helpers/Notifications';
|
||||
@@ -15,7 +16,8 @@ import {
|
||||
import {
|
||||
COMMAND_NAME,
|
||||
SETTING_CONTENT_DEFAULT_FILETYPE,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES
|
||||
SETTING_TAXONOMY_CONTENT_TYPES,
|
||||
TelemetryEvent
|
||||
} from '../constants';
|
||||
import { SettingsListener } from '../listeners/dashboard';
|
||||
import { existsAsync, writeFileAsync } from '../utils';
|
||||
@@ -94,6 +96,8 @@ categories: []
|
||||
// Initialize the taxonomy database
|
||||
TaxonomyHelper.initDb();
|
||||
|
||||
Telemetry.send(TelemetryEvent.initialization);
|
||||
|
||||
// Check if you can find the framework
|
||||
const wsFolder = Folders.getWorkspaceFolder();
|
||||
const framework = await FrameworkDetector.get(wsFolder?.fsPath || '');
|
||||
|
||||
@@ -3,12 +3,15 @@ import {
|
||||
CONTEXT,
|
||||
EXTENSION_NAME,
|
||||
NOTIFICATION_TYPE,
|
||||
SETTING_SEO_DESCRIPTION_FIELD,
|
||||
SETTING_SEO_DESCRIPTION_LENGTH,
|
||||
SETTING_SEO_TITLE_FIELD,
|
||||
SETTING_SEO_TITLE_LENGTH
|
||||
} from './../constants';
|
||||
import * as vscode from 'vscode';
|
||||
import { ArticleHelper, Notifications, SeoHelper, Settings } from '../helpers';
|
||||
import { PanelProvider } from '../panelWebView/PanelProvider';
|
||||
import { DefaultFields } from '../constants';
|
||||
import { ContentType } from '../helpers/ContentType';
|
||||
import { DataListener } from '../listeners/panel';
|
||||
import { commands } from 'vscode';
|
||||
@@ -17,7 +20,6 @@ import { Preview } from './Preview';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { i18n } from './i18n';
|
||||
import { getDescriptionField, getTitleField } from '../utils';
|
||||
|
||||
export class StatusListener {
|
||||
/**
|
||||
@@ -54,10 +56,12 @@ export class StatusListener {
|
||||
collection.clear();
|
||||
|
||||
// Retrieve the SEO config properties
|
||||
const titleLength = Settings.get<number>(SETTING_SEO_TITLE_LENGTH) || -1;
|
||||
const descLength = Settings.get<number>(SETTING_SEO_DESCRIPTION_LENGTH) || -1;
|
||||
const titleField = getTitleField();
|
||||
const descriptionField = getDescriptionField();
|
||||
const titleLength = (Settings.get(SETTING_SEO_TITLE_LENGTH) as number) || -1;
|
||||
const descLength = (Settings.get(SETTING_SEO_DESCRIPTION_LENGTH) as number) || -1;
|
||||
const titleField =
|
||||
(Settings.get(SETTING_SEO_TITLE_FIELD) as string) || DefaultFields.Title;
|
||||
const descriptionField =
|
||||
(Settings.get(SETTING_SEO_DESCRIPTION_FIELD) as string) || DefaultFields.Description;
|
||||
|
||||
if (editor && article.data[titleField] && titleLength > -1) {
|
||||
SeoHelper.checkLength(editor, collection, article, titleField, titleLength);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { commands } from 'vscode';
|
||||
import { COMMAND_NAME } from '../constants';
|
||||
import { TagType } from '../panelWebView/TagType';
|
||||
import { PanelProvider } from '../panelWebView/PanelProvider';
|
||||
|
||||
export class Taxonomy {
|
||||
/**
|
||||
* Registers the commands for the Article class.
|
||||
*
|
||||
* @param subscriptions - The array of subscriptions to register the commands with.
|
||||
*/
|
||||
public static async registerCommands(subscriptions: unknown[]) {
|
||||
const explorerSidebar = PanelProvider.getInstance();
|
||||
|
||||
if (explorerSidebar) {
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.insertTags, async () => {
|
||||
await commands.executeCommand('workbench.view.extension.frontmatter-explorer');
|
||||
await commands.executeCommand('workbench.action.focusSideBar');
|
||||
explorerSidebar.triggerInputFocus(TagType.tags);
|
||||
})
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
commands.registerCommand(COMMAND_NAME.insertCategories, async () => {
|
||||
await commands.executeCommand('workbench.view.extension.frontmatter-explorer');
|
||||
await commands.executeCommand('workbench.action.focusSideBar');
|
||||
explorerSidebar.triggerInputFocus(TagType.categories);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import {
|
||||
COMMAND_NAME,
|
||||
DefaultFields,
|
||||
SETTING_CONTENT_DEFAULT_FILETYPE,
|
||||
SETTING_TEMPLATES_FOLDER
|
||||
SETTING_TEMPLATES_FOLDER,
|
||||
TelemetryEvent
|
||||
} from '../constants';
|
||||
import { ArticleHelper, Extension, Settings } from '../helpers';
|
||||
import { Article, Folders } from '.';
|
||||
@@ -15,6 +15,7 @@ import { ContentType } from '../helpers/ContentType';
|
||||
import { ContentType as IContentType } from '../models';
|
||||
import { PagesListener } from '../listeners/dashboard';
|
||||
import { extname } from 'path';
|
||||
import { Telemetry } from '../helpers/Telemetry';
|
||||
import { writeFileAsync, copyFileAsync } from '../utils';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
@@ -162,14 +163,8 @@ export class Template {
|
||||
|
||||
const templateData = await ArticleHelper.getFrontMatterByPath(template.fsPath);
|
||||
let contentType: IContentType | undefined;
|
||||
if (templateData && templateData.data) {
|
||||
if (templateData.data[DefaultFields.ContentType]) {
|
||||
contentType = contentTypes?.find(
|
||||
(t) => t.name === templateData.data[DefaultFields.ContentType]
|
||||
);
|
||||
} else if (templateData.data[DefaultFields.Type]) {
|
||||
contentType = contentTypes?.find((t) => t.name === templateData.data[DefaultFields.Type]);
|
||||
}
|
||||
if (templateData && templateData.data && templateData.data.type) {
|
||||
contentType = contentTypes?.find((t) => t.name === templateData.data.type);
|
||||
}
|
||||
|
||||
const fileExtension = extname(template.fsPath).replace('.', '');
|
||||
@@ -222,6 +217,8 @@ export class Template {
|
||||
|
||||
Notifications.info(l10n.t(LocalizationKey.commandsTemplateCreateSuccess));
|
||||
|
||||
Telemetry.send(TelemetryEvent.createContentFromTemplate);
|
||||
|
||||
// Trigger a refresh for the dashboard
|
||||
PagesListener.refresh();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { COMMAND_NAME, SETTING_CONTENT_I18N } from '../constants';
|
||||
import { ContentFolder, Field, I18nConfig, ContentType as IContentType } from '../models';
|
||||
import { join, parse } from 'path';
|
||||
import { existsAsync, getDescriptionField, getTitleField } from '../utils';
|
||||
import { existsAsync } from '../utils';
|
||||
import { Folders } from '.';
|
||||
import { ParsedFrontMatter } from '../parsers';
|
||||
import { PagesListener } from '../listeners/dashboard';
|
||||
@@ -412,11 +412,8 @@ export class i18n {
|
||||
},
|
||||
async () => {
|
||||
try {
|
||||
const titleField = getTitleField();
|
||||
const descriptionField = getDescriptionField();
|
||||
|
||||
const title = article.data[titleField] || '';
|
||||
const description = article.data[descriptionField] || '';
|
||||
const title = article.data.title || '';
|
||||
const description = article.data.description || '';
|
||||
const content = article.content || '';
|
||||
|
||||
const text = [title, description, content];
|
||||
@@ -431,8 +428,8 @@ export class i18n {
|
||||
return;
|
||||
}
|
||||
|
||||
article.data[titleField] = article.data[titleField] ? translations[0] : '';
|
||||
article.data[descriptionField] = article.data[descriptionField] ? translations[1] : '';
|
||||
article.data.title = article.data.title ? translations[0] : '';
|
||||
article.data.description = article.data.description ? translations[1] : '';
|
||||
article.content = article.content ? translations[2] : '';
|
||||
} catch (error) {
|
||||
Notifications.error(`${(error as Error).message}`);
|
||||
|
||||
@@ -10,7 +10,5 @@ export * from './Preview';
|
||||
export * from './Project';
|
||||
export * from './Settings';
|
||||
export * from './StatusListener';
|
||||
export * from './Taxonomy';
|
||||
export * from './Template';
|
||||
export * from './Wysiwyg';
|
||||
export * from './i18n';
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { FEATURE_FLAG } from './Features';
|
||||
|
||||
export const DEFAULT_PANEL_FEATURE_FLAGS = Object.values(FEATURE_FLAG.panel).filter(
|
||||
(v) => v !== FEATURE_FLAG.panel.globalSettings
|
||||
);
|
||||
|
||||
export const DEFAULT_DASHBOARD_FEATURE_FLAGS = [
|
||||
FEATURE_FLAG.dashboard.data.view,
|
||||
FEATURE_FLAG.dashboard.taxonomy.view,
|
||||
FEATURE_FLAG.dashboard.snippets.view,
|
||||
FEATURE_FLAG.dashboard.snippets.manage
|
||||
];
|
||||
@@ -3,8 +3,5 @@ export const DefaultFields = {
|
||||
LastModified: `lastmod`,
|
||||
Description: `description`,
|
||||
Title: `title`,
|
||||
Slug: `slug`,
|
||||
Type: `type`,
|
||||
ContentType: `fmContentType`,
|
||||
Keywords: `keywords`
|
||||
Slug: `slug`
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export const EXTENSION_COMMAND_PREFIX = 'frontMatter';
|
||||
const extensionName = 'frontMatter';
|
||||
|
||||
export const EXTENSION_ID = 'eliostruyf.vscode-front-matter';
|
||||
export const EXTENSION_BETA_ID = 'eliostruyf.vscode-front-matter-beta';
|
||||
|
||||
export const getCommandName = (command: string) => {
|
||||
return `${EXTENSION_COMMAND_PREFIX}.${command}`;
|
||||
return `${extensionName}.${command}`;
|
||||
};
|
||||
|
||||
export const COMMAND_NAME = {
|
||||
@@ -27,7 +27,6 @@ export const COMMAND_NAME = {
|
||||
initTemplate: getCommandName('initTemplate'),
|
||||
collapseSections: getCommandName('collapseSections'),
|
||||
preview: getCommandName('preview'),
|
||||
docs: getCommandName('docs'),
|
||||
chatbot: getCommandName('chatbot'),
|
||||
dashboard: getCommandName('dashboard'),
|
||||
dashboardMedia: getCommandName('dashboard.media'),
|
||||
|
||||
@@ -14,20 +14,8 @@ export const DOCS_SUBMODULES = 'https://frontmatter.codes/docs/git-integration#g
|
||||
export const WEBSITE_LINKS = {
|
||||
root: 'https://frontmatter.codes',
|
||||
api: {
|
||||
baseUrl: 'https://api.frontmatter.codes',
|
||||
endpoints: {
|
||||
ai: {
|
||||
description: '/ai/description',
|
||||
taxonomy: '/ai/taxonomy',
|
||||
title: '/ai/title'
|
||||
},
|
||||
chat: {
|
||||
init: '/ai-init',
|
||||
message: '/ai-chat',
|
||||
feedback: '/ai-feedback'
|
||||
},
|
||||
backers: '/v2/backers'
|
||||
}
|
||||
metrics: 'https://frontmatter.codes/api/metrics',
|
||||
ai: 'https://frontmatter.codes/api/ai'
|
||||
},
|
||||
docs: {
|
||||
dataDashboard: 'https://frontmatter.codes/docs/dashboard/datafiles-view',
|
||||
|
||||
56
src/constants/TelemetryEvent.ts
Normal file
56
src/constants/TelemetryEvent.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
export const TelemetryEvent = {
|
||||
activate: 'activate',
|
||||
initialization: 'initialization',
|
||||
registerFolder: 'registerFolder',
|
||||
unregisterFolder: 'unregisterFolder',
|
||||
promoteSettings: 'promoteSettings',
|
||||
|
||||
// Commands
|
||||
openContentDashboard: 'openContentDashboard',
|
||||
openMediaDashboard: 'openMediaDashboard',
|
||||
openDataDashboard: 'openDataDashboard',
|
||||
openSnippetsDashboard: 'openSnippetsDashboard',
|
||||
openTaxonomyDashboard: 'openTaxonomyDashboard',
|
||||
closeDashboard: 'closeDashboard',
|
||||
|
||||
// Other actions
|
||||
generateSlug: 'generateSlug',
|
||||
createContentFromTemplate: 'createContentFromTemplate',
|
||||
createContentFromContentType: 'createContentFromContentType',
|
||||
addMediaFolder: 'addMediaFolder',
|
||||
openPreview: 'openPreview',
|
||||
uploadMedia: 'uploadMedia',
|
||||
refreshMedia: 'refreshMedia',
|
||||
deleteMedia: 'deleteMedia',
|
||||
insertContentSnippet: 'insertContentSnippet',
|
||||
insertMediaToContent: 'insertMediaToContent',
|
||||
insertFileToContent: 'insertFileToContent',
|
||||
updateMediaMetadata: 'updateMediaMetadata',
|
||||
openPanelWebview: 'openPanelWebview',
|
||||
|
||||
// Chatbot
|
||||
openChatbot: 'openChatbot',
|
||||
|
||||
// Content types
|
||||
generateContentType: 'generateContentType',
|
||||
addMissingFields: 'addMissingFields',
|
||||
setContentType: 'setContentType',
|
||||
|
||||
// Custom scripts
|
||||
runCustomScript: 'runCustomScript',
|
||||
runMediaScript: 'runMediaScript',
|
||||
|
||||
// Webviews
|
||||
webviewWelcomeScreen: 'webviewWelcomeScreen',
|
||||
webviewMediaView: 'webviewMediaView',
|
||||
webviewDataView: 'webviewDataView',
|
||||
webviewContentsView: 'webviewContentsView',
|
||||
webviewSnippetsView: 'webviewSnippetsView',
|
||||
webviewTaxonomyDashboard: 'webviewTaxonomyDashboard',
|
||||
webviewSettings: 'webviewSettings',
|
||||
webviewUnknown: 'webviewUnknown',
|
||||
|
||||
// Git
|
||||
gitSync: 'gitSync',
|
||||
gitFetch: 'gitFetch'
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './ContentType';
|
||||
export * from './DefaultFeatureFlags';
|
||||
export * from './DefaultFieldValues';
|
||||
export * from './DefaultFields';
|
||||
export * from './DefaultFileTypes';
|
||||
@@ -18,6 +17,7 @@ export * from './SentryIgnore';
|
||||
export * from './Snippet';
|
||||
export * from './SsgScripts';
|
||||
export * from './StaticFolderPlaceholder';
|
||||
export * from './TelemetryEvent';
|
||||
export * from './Templates';
|
||||
export * from './charCode';
|
||||
export * from './charMap';
|
||||
|
||||
@@ -45,6 +45,8 @@ export const SETTING_TEMPLATES_FOLDER = 'templates.folder';
|
||||
export const SETTING_TEMPLATES_PREFIX = 'templates.prefix';
|
||||
export const SETTING_TEMPLATES_ENABLED = 'templates.enabled';
|
||||
|
||||
export const SETTING_TELEMETRY_DISABLE = 'telemetry.disable';
|
||||
|
||||
export const SETTING_PANEL_FREEFORM = 'panel.freeform';
|
||||
export const SETTING_PANEL_ACTIONS_DISABLED = 'panel.actions.disabled';
|
||||
|
||||
@@ -113,8 +115,6 @@ export const SETTING_SNIPPETS_WRAPPER = 'snippets.wrapper.enabled';
|
||||
|
||||
export const SETTING_WEBSITE_URL = 'website.host';
|
||||
|
||||
export const SETTING_COPILOT_FAMILY = 'copilot.family';
|
||||
|
||||
export const SETTING_LOGGING = 'logging';
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,6 +74,7 @@ export enum DashboardMessage {
|
||||
setState = 'setState',
|
||||
getState = 'getState',
|
||||
runCustomScript = 'runCustomScript',
|
||||
sendTelemetry = 'sendTelemetry',
|
||||
showNotification = 'showNotification',
|
||||
setTitle = 'setTitle',
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { AiInitResponse } from './models/AiInitResponse';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { messageHandler } from '@estruyf/vscode/dist/client';
|
||||
import { GeneralCommands, WEBSITE_LINKS } from '../../../constants';
|
||||
import { GeneralCommands } from '../../../constants';
|
||||
|
||||
export interface IChatbotProps { }
|
||||
|
||||
@@ -36,7 +36,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
|
||||
setLocaleReady(true);
|
||||
});
|
||||
|
||||
const initResponse = await fetch(`${aiUrl}${WEBSITE_LINKS.api.endpoints.chat.init}`);
|
||||
const initResponse = await fetch(`${aiUrl}/api/ai-init`);
|
||||
|
||||
if (!initResponse.ok) {
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(`${aiUrl}${WEBSITE_LINKS.api.endpoints.chat.message}`, {
|
||||
const response = await fetch(`${aiUrl}/api/ai-chat`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -3,7 +3,6 @@ import { HandThumbDownIcon, HandThumbUpIcon } from '@heroicons/react/24/outline'
|
||||
import { HandThumbDownIcon as ThumbDownSolidIcon, HandThumbUpIcon as ThumbUpSolidIcon } from '@heroicons/react/24/solid';
|
||||
import { useCallback } from 'react';
|
||||
import { useSettingsContext } from '../../providers/SettingsProvider';
|
||||
import { WEBSITE_LINKS } from '../../../constants';
|
||||
|
||||
export interface IFeedbackProps {
|
||||
answerId: number;
|
||||
@@ -29,7 +28,7 @@ export const Feedback: React.FunctionComponent<IFeedbackProps> = ({
|
||||
}, []);
|
||||
|
||||
const callVote = useCallback(async (vote: boolean) => {
|
||||
await fetch(`${aiUrl}${WEBSITE_LINKS.api.endpoints.chat.feedback}`, {
|
||||
await fetch(`${aiUrl}/api/ai-feedback`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -10,7 +10,7 @@ import usePages from '../../hooks/usePages';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Messenger, messageHandler } from '@estruyf/vscode/dist/client';
|
||||
import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { GeneralCommands } from '../../../constants';
|
||||
import { GeneralCommands, TelemetryEvent } from '../../../constants';
|
||||
import { PageLayout } from '../Layout/PageLayout';
|
||||
import { FilesProvider } from '../../providers/FilesProvider';
|
||||
import { Alert } from '../Modals/Alert';
|
||||
@@ -67,6 +67,10 @@ export const Contents: React.FunctionComponent<IContentsProps> = ({
|
||||
}, [JSON.stringify(pageItems)]);
|
||||
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewContentsView
|
||||
});
|
||||
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.dashboardHeaderTabsContents));
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
date: pageData.date,
|
||||
title: pageData.title,
|
||||
description: pageData.description,
|
||||
type: pageData.fmContentType,
|
||||
type: pageData.type,
|
||||
pageData
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { groupBy } from '../../../helpers/GroupBy';
|
||||
import { FrontMatterIcon } from '../../../panelWebView/components/Icons/FrontMatterIcon';
|
||||
import { GroupOption } from '../../constants/GroupOption';
|
||||
import { GroupingSelector, PageAtom, PagedItems, ViewSelector } from '../../state';
|
||||
import { GroupingSelector, PageAtom, ViewSelector } from '../../state';
|
||||
import { Item } from './Item';
|
||||
import { List } from './List';
|
||||
import usePagination from '../../hooks/usePagination';
|
||||
@@ -34,7 +34,6 @@ export const Overview: React.FunctionComponent<IOverviewProps> = ({
|
||||
const page = useRecoilValue(PageAtom);
|
||||
const { pageSetNr } = usePagination(settings?.dashboardState.contents.pagination);
|
||||
const view = useRecoilValue(ViewSelector);
|
||||
const [, setPagedItems] = useRecoilState(PagedItems);
|
||||
|
||||
const pagedPages = useMemo(() => {
|
||||
if (pageSetNr) {
|
||||
@@ -101,10 +100,6 @@ export const Overview: React.FunctionComponent<IOverviewProps> = ({
|
||||
return { groupKeys, groupedPages };
|
||||
}, [pages, grouping, settings?.draftField]);
|
||||
|
||||
React.useEffect(() => {
|
||||
setPagedItems(pagedPages.map((page) => page.fmFilePath));
|
||||
}, [pagedPages]);
|
||||
|
||||
React.useEffect(() => {
|
||||
messageHandler.request<string[]>(DashboardMessage.getPinnedItems).then((items) => {
|
||||
setIsReady(true);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Container } from './SortableContainer';
|
||||
import { SortableItem } from './SortableItem';
|
||||
import { ChevronRightIcon, CircleStackIcon } from '@heroicons/react/24/outline';
|
||||
import { DataType } from '../../../models/DataType';
|
||||
import { GeneralCommands, WEBSITE_LINKS } from '../../../constants';
|
||||
import { GeneralCommands, TelemetryEvent, WEBSITE_LINKS } from '../../../constants';
|
||||
import { NavigationItem } from '../Layout';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
@@ -130,6 +130,10 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.dashboardHeaderTabsData));
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewDataView
|
||||
});
|
||||
|
||||
Messenger.send(GeneralCommands.toVSCode.logging.info, {
|
||||
message: 'Data view loaded',
|
||||
location: 'DASHBOARD'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import { NavigationType, Page } from '../../models';
|
||||
import { CommandLineIcon, PencilIcon, TrashIcon, ChevronDownIcon, XMarkIcon, EyeIcon, LanguageIcon, CheckIcon } from '@heroicons/react/24/outline';
|
||||
import { CommandLineIcon, PencilIcon, TrashIcon, ChevronDownIcon, XMarkIcon, EyeIcon, LanguageIcon } from '@heroicons/react/24/outline';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { MultiSelectedItemsAtom, PagedItems, SelectedItemActionAtom, SelectedMediaFolderSelector, SettingsSelector } from '../../state';
|
||||
import { MultiSelectedItemsAtom, SelectedItemActionAtom, SelectedMediaFolderSelector, SettingsSelector } from '../../state';
|
||||
import { ActionsBarItem } from './ActionsBarItem';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
@@ -29,7 +29,6 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
const selectedFolder = useRecoilValue(SelectedMediaFolderSelector);
|
||||
const settings = useRecoilValue(SettingsSelector);
|
||||
const { files } = useFilesContext();
|
||||
const pagedItems = useRecoilValue(PagedItems);
|
||||
|
||||
const viewFile = React.useCallback(() => {
|
||||
if (selectedFiles.length === 1) {
|
||||
@@ -67,10 +66,6 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
}
|
||||
}, [selectedFiles]);
|
||||
|
||||
const selectAllItems = React.useCallback(() => {
|
||||
setSelectedFiles([...pagedItems]);
|
||||
}, [pagedItems]);
|
||||
|
||||
const languageActions = React.useMemo(() => {
|
||||
const actions: React.ReactNode[] = [];
|
||||
|
||||
@@ -197,7 +192,6 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
<ActionsBarItem
|
||||
disabled={selectedFiles.length === 0 || selectedFiles.length > 1}
|
||||
onClick={viewFile}
|
||||
title={l10n.t(LocalizationKey.commonView)}
|
||||
>
|
||||
<EyeIcon className="w-4 h-4 mr-2" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.commonView)}</span>
|
||||
@@ -211,7 +205,6 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
messageHandler.send(DashboardMessage.rename, selectedFiles[0]);
|
||||
setSelectedFiles([]);
|
||||
}}
|
||||
title={l10n.t(LocalizationKey.commonRename)}
|
||||
>
|
||||
<RenameIcon className="w-4 h-4 mr-2" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.commonRename)}</span>
|
||||
@@ -228,7 +221,6 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
path: selectedFiles[0],
|
||||
action: 'edit'
|
||||
})}
|
||||
title={l10n.t(LocalizationKey.commonEdit)}
|
||||
>
|
||||
<PencilIcon className="w-4 h-4 mr-2" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.commonEdit)}</span>
|
||||
@@ -245,39 +237,25 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
className='hover:text-[var(--vscode-statusBarItem-errorBackground)]'
|
||||
disabled={selectedFiles.length === 0}
|
||||
onClick={() => setShowAlert(true)}
|
||||
title={l10n.t(LocalizationKey.commonDelete)}
|
||||
>
|
||||
<TrashIcon className="w-4 h-4 mr-2" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.commonDelete)}</span>
|
||||
</ActionsBarItem>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-4'>
|
||||
{
|
||||
selectedFiles.length > 0 && (
|
||||
<ActionsBarItem
|
||||
className='flex items-center hover:text-[var(--vscode-statusBarItem-warningBackground)]'
|
||||
onClick={() => setSelectedFiles([])}
|
||||
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}
|
||||
>
|
||||
<XMarkIcon className="w-4 h-4 mr-1" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
|
||||
</ActionsBarItem>
|
||||
)
|
||||
}
|
||||
|
||||
<ActionsBarItem
|
||||
disabled={selectedFiles.length === pagedItems.length}
|
||||
onClick={selectAllItems}
|
||||
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}
|
||||
>
|
||||
<div className='w-4 h-4 inline-flex items-center justify-center border border-[var(--vscode-sideBar-foreground)] group-hover:border-[var(--vscode-statusBarItem-warningBackground)] rounded mr-1'>
|
||||
<CheckIcon className="w-3 h-3" aria-hidden="true" />
|
||||
</div>
|
||||
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}</span>
|
||||
</ActionsBarItem>
|
||||
</div>
|
||||
</div >
|
||||
{
|
||||
selectedFiles.length > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
className='flex items-center hover:text-[var(--vscode-statusBarItem-warningBackground)]'
|
||||
onClick={() => setSelectedFiles([])}
|
||||
>
|
||||
<XMarkIcon className="w-4 h-4 mr-1" aria-hidden="true" />
|
||||
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
||||
{showAlert && (
|
||||
<Alert
|
||||
@@ -288,8 +266,7 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
|
||||
dismiss={() => setShowAlert(false)}
|
||||
trigger={onDeleteConfirm}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -2,7 +2,6 @@ import * as React from 'react';
|
||||
import { cn } from '../../../utils/cn';
|
||||
|
||||
export interface IActionsBarItemProps {
|
||||
title?: string;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
@@ -12,13 +11,11 @@ export const ActionsBarItem: React.FunctionComponent<IActionsBarItemProps> = ({
|
||||
children,
|
||||
className,
|
||||
disabled,
|
||||
onClick,
|
||||
title
|
||||
onClick
|
||||
}: React.PropsWithChildren<IActionsBarItemProps>) => {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
title={title || ''}
|
||||
className={cn(`flex items-center text-[var(--vscode-tab-inactiveForeground)] hover:text-[var(--vscode-tab-activeForeground)] disabled:opacity-50 disabled:hover:text-[var(--vscode-tab-inactiveForeground)]`, className)}
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ChoiceButton } from '../Common/ChoiceButton';
|
||||
import { MediaHeaderBottom } from '../Media/MediaHeaderBottom';
|
||||
import { Tabs } from './Tabs';
|
||||
import { CustomScript } from '../../../models';
|
||||
import { ArrowTopRightOnSquareIcon, BoltIcon, BookOpenIcon, PlusIcon } from '@heroicons/react/24/outline';
|
||||
import { ArrowTopRightOnSquareIcon, BoltIcon, PlusIcon } from '@heroicons/react/24/outline';
|
||||
import { HeartIcon } from '@heroicons/react/24/solid';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { routePaths } from '../..';
|
||||
@@ -29,7 +29,7 @@ import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { SettingsLink } from '../SettingsView/SettingsLink';
|
||||
import { Link } from '../Common/Link';
|
||||
import { COMMAND_NAME, GeneralCommands, SPONSOR_LINK } from '../../../constants';
|
||||
import { SPONSOR_LINK } from '../../../constants';
|
||||
import { Filters } from './Filters';
|
||||
import { ActionsBar } from './ActionsBar';
|
||||
import { RefreshDashboardData } from './RefreshDashboardData';
|
||||
@@ -157,16 +157,6 @@ export const Header: React.FunctionComponent<IHeaderProps> = ({
|
||||
)
|
||||
}
|
||||
|
||||
<button
|
||||
className="inline-flex items-center hover:text-[var(--vscode-textLink-activeForeground)]"
|
||||
title={l10n.t(LocalizationKey.commonDocs)}
|
||||
onClick={() => Messenger.send(GeneralCommands.toVSCode.runCommand, {
|
||||
command: COMMAND_NAME.docs
|
||||
})}>
|
||||
<span className='sr-only'>{l10n.t(LocalizationKey.commonDocs)}</span>
|
||||
<BookOpenIcon className='w-4 h-4' aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
<SettingsLink onNavigate={updateView} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,6 @@ import { Tab } from './Tab';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { PageIcon } from '../../../panelWebView/components/Icons';
|
||||
import { DEFAULT_DASHBOARD_FEATURE_FLAGS } from '../../../constants/DefaultFeatureFlags';
|
||||
|
||||
export interface ITabsProps {
|
||||
onNavigate: (navigationType: NavigationType) => void;
|
||||
@@ -20,6 +19,12 @@ export const Tabs: React.FunctionComponent<ITabsProps> = ({
|
||||
}: React.PropsWithChildren<ITabsProps>) => {
|
||||
const mode = useRecoilValue(ModeAtom);
|
||||
|
||||
const allDashboardVIews = [
|
||||
FEATURE_FLAG.dashboard.snippets.view,
|
||||
FEATURE_FLAG.dashboard.data.view,
|
||||
FEATURE_FLAG.dashboard.taxonomy.view
|
||||
];
|
||||
|
||||
return (
|
||||
<ul
|
||||
className="flex items-center justify-start h-full space-x-4"
|
||||
@@ -38,7 +43,7 @@ export const Tabs: React.FunctionComponent<ITabsProps> = ({
|
||||
<span>{l10n.t(LocalizationKey.dashboardHeaderTabsMedia)}</span>
|
||||
</Tab>
|
||||
</li>
|
||||
<FeatureFlag features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS} flag={FEATURE_FLAG.dashboard.snippets.view}>
|
||||
<FeatureFlag features={mode?.features || [...allDashboardVIews]} flag={FEATURE_FLAG.dashboard.snippets.view}>
|
||||
<li role="presentation">
|
||||
<Tab navigationType={NavigationType.Snippets} onNavigate={onNavigate}>
|
||||
<ScissorsIcon className={`h-4 w-auto mr-2`} />
|
||||
@@ -46,7 +51,7 @@ export const Tabs: React.FunctionComponent<ITabsProps> = ({
|
||||
</Tab>
|
||||
</li>
|
||||
</FeatureFlag>
|
||||
<FeatureFlag features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS} flag={FEATURE_FLAG.dashboard.data.view}>
|
||||
<FeatureFlag features={mode?.features || [...allDashboardVIews]} flag={FEATURE_FLAG.dashboard.data.view}>
|
||||
<li role="presentation">
|
||||
<Tab navigationType={NavigationType.Data} onNavigate={onNavigate}>
|
||||
<CircleStackIcon className={`h-4 w-auto mr-2`} />
|
||||
@@ -54,7 +59,7 @@ export const Tabs: React.FunctionComponent<ITabsProps> = ({
|
||||
</Tab>
|
||||
</li>
|
||||
</FeatureFlag>
|
||||
<FeatureFlag features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS} flag={FEATURE_FLAG.dashboard.taxonomy.view}>
|
||||
<FeatureFlag features={mode?.features || [...allDashboardVIews]} flag={FEATURE_FLAG.dashboard.taxonomy.view}>
|
||||
<li role="presentation">
|
||||
<Tab navigationType={NavigationType.Taxonomy} onNavigate={onNavigate}>
|
||||
<TagIcon className={`h-4 w-auto mr-2`} />
|
||||
|
||||
@@ -33,9 +33,6 @@ export const CustomActions: React.FunctionComponent<ICustomActionsProps> = ({
|
||||
));
|
||||
}, [scripts]);
|
||||
|
||||
if (!customActions.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (showTrigger) {
|
||||
return (
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Messenger } from '@estruyf/vscode/dist/client';
|
||||
import { ArrowUpTrayIcon } from '@heroicons/react/24/outline';
|
||||
import * as React from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import {
|
||||
LoadingAtom,
|
||||
MediaFoldersAtom,
|
||||
PagedItems,
|
||||
SelectedMediaFolderAtom,
|
||||
SettingsSelector,
|
||||
ViewDataSelector
|
||||
@@ -21,7 +20,7 @@ import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { FrontMatterIcon } from '../../../panelWebView/components/Icons/FrontMatterIcon';
|
||||
import { FolderItem } from './FolderItem';
|
||||
import useMedia from '../../hooks/useMedia';
|
||||
import { STATIC_FOLDER_PLACEHOLDER, } from '../../../constants';
|
||||
import { GeneralCommands, STATIC_FOLDER_PLACEHOLDER, TelemetryEvent } from '../../../constants';
|
||||
import { PageLayout } from '../Layout/PageLayout';
|
||||
import { parseWinPath } from '../../../helpers/parseWinPath';
|
||||
import { basename, extname, join } from 'path';
|
||||
@@ -42,7 +41,6 @@ export const Media: React.FunctionComponent<IMediaProps> = (
|
||||
const selectedFolder = useRecoilValue(SelectedMediaFolderAtom);
|
||||
const folders = useRecoilValue(MediaFoldersAtom);
|
||||
const loading = useRecoilValue(LoadingAtom);
|
||||
const [, setPagedItems] = useRecoilState(PagedItems);
|
||||
|
||||
const currentStaticFolder = useMemo(() => {
|
||||
if (settings?.staticFolder) {
|
||||
@@ -128,7 +126,6 @@ export const Media: React.FunctionComponent<IMediaProps> = (
|
||||
});
|
||||
}
|
||||
|
||||
setPagedItems(mediaFiles.map((m) => m.fsPath));
|
||||
return mediaFiles;
|
||||
}, [media, viewData, currentStaticFolder, settings?.staticFolder]);
|
||||
|
||||
@@ -154,6 +151,15 @@ export const Media: React.FunctionComponent<IMediaProps> = (
|
||||
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.dashboardHeaderTabsMedia));
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewMediaView
|
||||
});
|
||||
|
||||
Messenger.send(GeneralCommands.toVSCode.logging.info, {
|
||||
message: `Media view loaded`,
|
||||
location: 'DASHBOARD'
|
||||
});
|
||||
}, []);
|
||||
|
||||
const { getRootProps, isDragActive } = useDropzone({
|
||||
|
||||
@@ -8,7 +8,7 @@ import { AstroContentTypes } from '../Configuration/Astro/AstroContentTypes';
|
||||
import { ContentFolders } from '../Configuration/Common/ContentFolders';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { COMMAND_NAME } from '../../../constants';
|
||||
import { COMMAND_NAME, TelemetryEvent } from '../../../constants';
|
||||
import { ArrowPathIcon } from '@heroicons/react/24/outline';
|
||||
import { VSCodePanelTab, VSCodePanelView, VSCodePanels } from '@vscode/webview-ui-toolkit/react';
|
||||
import { CommonSettings } from './CommonSettings';
|
||||
@@ -25,6 +25,10 @@ export const SettingsView: React.FunctionComponent<ISettingsViewProps> = (_: Rea
|
||||
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.commonSettings));
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewSettings
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@@ -19,7 +19,6 @@ import { LocalizationKey } from '../../../localization';
|
||||
import { FooterActions } from './FooterActions';
|
||||
import { ItemMenu } from './ItemMenu';
|
||||
import { SlideOver } from '../Modals/SlideOver';
|
||||
import { DEFAULT_DASHBOARD_FEATURE_FLAGS } from '../../../constants/DefaultFeatureFlags';
|
||||
|
||||
export interface IItemProps {
|
||||
snippetKey: string;
|
||||
@@ -164,7 +163,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
</h2>
|
||||
|
||||
<FeatureFlag
|
||||
features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS}
|
||||
features={mode?.features || []}
|
||||
flag={FEATURE_FLAG.dashboard.snippets.manage}
|
||||
alternative={
|
||||
<ItemMenu
|
||||
@@ -191,7 +190,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
</div>
|
||||
|
||||
<FeatureFlag
|
||||
features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS}
|
||||
features={mode?.features || []}
|
||||
flag={FEATURE_FLAG.dashboard.snippets.manage}
|
||||
alternative={
|
||||
<FooterActions
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { FeatureFlag } from '../../../components/features/FeatureFlag';
|
||||
import { FEATURE_FLAG, GeneralCommands, WEBSITE_LINKS } from '../../../constants';
|
||||
import { TelemetryEvent } from '../../../constants/TelemetryEvent';
|
||||
import { SnippetParser } from '../../../helpers/SnippetParser';
|
||||
import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { ModeAtom, SettingsSelector, ViewDataSelector } from '../../state';
|
||||
@@ -17,7 +18,6 @@ import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { List } from '../Media/List';
|
||||
import { SlideOver } from '../Modals/SlideOver';
|
||||
import { DEFAULT_DASHBOARD_FEATURE_FLAGS } from '../../../constants/DefaultFeatureFlags';
|
||||
|
||||
export interface ISnippetsProps { }
|
||||
|
||||
@@ -83,6 +83,10 @@ export const Snippets: React.FunctionComponent<ISnippetsProps> = (
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.dashboardHeaderTabsSnippets));
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewSnippetsView
|
||||
});
|
||||
|
||||
Messenger.send(GeneralCommands.toVSCode.logging.info, {
|
||||
message: `Snippets view loaded`,
|
||||
location: 'DASHBOARD'
|
||||
@@ -92,9 +96,7 @@ export const Snippets: React.FunctionComponent<ISnippetsProps> = (
|
||||
return (
|
||||
<PageLayout
|
||||
header={
|
||||
<FeatureFlag
|
||||
features={mode?.features || DEFAULT_DASHBOARD_FEATURE_FLAGS}
|
||||
flag={FEATURE_FLAG.dashboard.snippets.manage}>
|
||||
<FeatureFlag features={mode?.features || []} flag={FEATURE_FLAG.dashboard.snippets.manage}>
|
||||
<div
|
||||
className={`py-3 px-4 flex items-center justify-between border-b border-[var(--frontmatter-border)]`}
|
||||
aria-label={l10n.t(LocalizationKey.dashboardSnippetsViewSnippetsAriaLabel)}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ChevronRightIcon, ArrowDownTrayIcon } from '@heroicons/react/24/outline
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { GeneralCommands } from '../../../constants';
|
||||
import { GeneralCommands, TelemetryEvent } from '../../../constants';
|
||||
import { TaxonomyData } from '../../../models';
|
||||
import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { Page, PageMappings } from '../../models';
|
||||
@@ -55,6 +55,10 @@ export const TaxonomyView: React.FunctionComponent<ITaxonomyViewProps> = ({
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.setTitle, l10n.t(LocalizationKey.dashboardHeaderTabsTaxonomies));
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewTaxonomyDashboard
|
||||
});
|
||||
|
||||
Messenger.send(GeneralCommands.toVSCode.logging.info, {
|
||||
message: 'Taxonomy view loaded',
|
||||
location: 'DASHBOARD'
|
||||
|
||||
@@ -5,6 +5,7 @@ import { LocalizationKey } from '../../../localization';
|
||||
import { useEffect } from 'react';
|
||||
import { Messenger } from '@estruyf/vscode/dist/client';
|
||||
import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { TelemetryEvent } from '../../../constants';
|
||||
|
||||
export interface IUnknownViewProps { }
|
||||
|
||||
@@ -13,6 +14,10 @@ export const UnknownView: React.FunctionComponent<IUnknownViewProps> = (
|
||||
) => {
|
||||
useEffect(() => {
|
||||
Messenger.send(DashboardMessage.setTitle, "Unknown View");
|
||||
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewUnknown
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BookOpenIcon, HeartIcon, StarIcon } from '@heroicons/react/24/outline';
|
||||
import * as React from 'react';
|
||||
import { DOCUMENTATION_LINK, GITHUB_LINK, GeneralCommands, REVIEW_LINK, SPONSOR_LINK } from '../../../constants';
|
||||
import { DOCUMENTATION_LINK, GITHUB_LINK, GeneralCommands, REVIEW_LINK, SPONSOR_LINK, TelemetryEvent } from '../../../constants';
|
||||
import { Messenger } from '@estruyf/vscode/dist/client';
|
||||
import { FrontMatterIcon } from '../../../panelWebView/components/Icons/FrontMatterIcon';
|
||||
import { GitHubIcon } from '../../../panelWebView/components/Icons/GitHubIcon';
|
||||
@@ -25,6 +25,9 @@ export const WelcomeScreen: React.FunctionComponent<IWelcomeScreenProps> = ({
|
||||
|
||||
React.useEffect(() => {
|
||||
setView(NavigationType.Welcome);
|
||||
Messenger.send(DashboardMessage.sendTelemetry, {
|
||||
event: TelemetryEvent.webviewWelcomeScreen
|
||||
});
|
||||
|
||||
Messenger.send(GeneralCommands.toVSCode.logging.info, {
|
||||
message: 'Welcome screen loaded',
|
||||
|
||||
@@ -93,7 +93,7 @@ if (elm) {
|
||||
render(
|
||||
<I10nProvider>
|
||||
<SettingsProvider
|
||||
aiUrl={WEBSITE_LINKS.api.baseUrl}
|
||||
aiUrl={WEBSITE_LINKS.root}
|
||||
experimental={experimental === 'true'}
|
||||
version={version || ""}>
|
||||
<Chatbot />
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const PagedItems = atom<string[]>({
|
||||
key: 'PagedItems',
|
||||
default: []
|
||||
});
|
||||
@@ -16,7 +16,6 @@ export * from './MediaTotalAtom';
|
||||
export * from './ModeAtom';
|
||||
export * from './MultiSelectedItemsAtom';
|
||||
export * from './PageAtom';
|
||||
export * from './PagedItems';
|
||||
export * from './PinnedItems';
|
||||
export * from './SearchAtom';
|
||||
export * from './SearchReadyAtom';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { GitListener } from './listeners/general/GitListener';
|
||||
import * as vscode from 'vscode';
|
||||
import { COMMAND_NAME, CONTEXT, EXTENSION_NAME } from './constants';
|
||||
import { COMMAND_NAME, CONTEXT, EXTENSION_NAME, TelemetryEvent } from './constants';
|
||||
import { MarkdownFoldingProvider } from './providers/MarkdownFoldingProvider';
|
||||
import { TagType } from './panelWebView/TagType';
|
||||
import { PanelProvider } from './panelWebView/PanelProvider';
|
||||
import {
|
||||
DashboardSettings,
|
||||
@@ -30,13 +31,11 @@ import {
|
||||
Article,
|
||||
Settings,
|
||||
StatusListener,
|
||||
Chatbot,
|
||||
Taxonomy
|
||||
Chatbot
|
||||
} from './commands';
|
||||
import { join } from 'path';
|
||||
import { Terminal } from './services';
|
||||
import { i18n } from './commands/i18n';
|
||||
import { UriHandler } from './providers/UriHandler';
|
||||
|
||||
let pageUpdateDebouncer: { (fnc: any, time: number): void };
|
||||
let editDebounce: { (fnc: any, time: number): void };
|
||||
@@ -55,7 +54,6 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
vscode.commands.executeCommand('setContext', CONTEXT.isDevelopment, true);
|
||||
}
|
||||
|
||||
// Sponsor check
|
||||
Backers.init(context).then(() => {});
|
||||
|
||||
// Make sure the EN language file is loaded
|
||||
@@ -81,6 +79,9 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
SettingsHelper.checkToPromote();
|
||||
|
||||
// Sends the activation event
|
||||
Telemetry.send(TelemetryEvent.activate);
|
||||
|
||||
// Start listening to the folders for content changes.
|
||||
// This will make sure the dashboard is up to date
|
||||
PagesListener.startWatchers();
|
||||
@@ -117,16 +118,32 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
// Folding the front matter of markdown files
|
||||
MarkdownFoldingProvider.register();
|
||||
|
||||
// Register the taxonomy commands
|
||||
Taxonomy.registerCommands(subscriptions);
|
||||
const insertTags = vscode.commands.registerCommand(COMMAND_NAME.insertTags, async () => {
|
||||
await vscode.commands.executeCommand('workbench.view.extension.frontmatter-explorer');
|
||||
await vscode.commands.executeCommand('workbench.action.focusSideBar');
|
||||
explorerSidebar.triggerInputFocus(TagType.tags);
|
||||
});
|
||||
|
||||
const insertCategories = vscode.commands.registerCommand(
|
||||
COMMAND_NAME.insertCategories,
|
||||
async () => {
|
||||
await vscode.commands.executeCommand('workbench.view.extension.frontmatter-explorer');
|
||||
await vscode.commands.executeCommand('workbench.action.focusSideBar');
|
||||
explorerSidebar.triggerInputFocus(TagType.categories);
|
||||
}
|
||||
);
|
||||
|
||||
// Register all the article commands
|
||||
Article.registerCommands(subscriptions);
|
||||
|
||||
// Template creation
|
||||
/**
|
||||
* Template creation
|
||||
*/
|
||||
Template.registerCommands();
|
||||
|
||||
// Content creation
|
||||
/**
|
||||
* Content creation
|
||||
*/
|
||||
ContentType.registerCommands();
|
||||
Content.registerCommands();
|
||||
Folders.registerCommands();
|
||||
@@ -192,16 +209,6 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand(COMMAND_NAME.preview, () => Preview.open(extensionPath))
|
||||
);
|
||||
|
||||
// Open docs
|
||||
subscriptions.push(
|
||||
vscode.commands.registerCommand(COMMAND_NAME.docs, () => {
|
||||
vscode.commands.executeCommand(
|
||||
`simpleBrowser.show`,
|
||||
`https://${extension.isBetaVersion() ? `beta.` : ``}frontmatter.codes/docs`
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
// Chat to the bot
|
||||
subscriptions.push(
|
||||
vscode.commands.registerCommand(COMMAND_NAME.chatbot, () => Chatbot.open(extensionPath))
|
||||
@@ -234,11 +241,11 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
// Cache commands
|
||||
Cache.registerCommands();
|
||||
|
||||
// Register the URI handler
|
||||
UriHandler.register();
|
||||
// GitHub Copilot integration
|
||||
Chatbot.register();
|
||||
|
||||
// Subscribe all commands
|
||||
subscriptions.push(PanelView, collapseAll, fmStatusBarItem);
|
||||
subscriptions.push(insertTags, PanelView, insertCategories, collapseAll, fmStatusBarItem);
|
||||
|
||||
console.log(`𝖥𝗋𝗈𝗇𝗍 𝖬𝖺𝗍𝗍𝖾𝗋 𝖢𝖬𝖲 𝖺𝖼𝗍𝗂𝗏𝖺𝗍𝖾𝖽! 𝖱𝖾𝖺𝖽𝗒 𝗍𝗈 𝗌𝗍𝖺𝗋𝗍 𝗐𝗋𝗂𝗍𝗂𝗇𝗀... 👩💻🧑💻👨💻`);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ import { Link, Parent } from 'mdast-util-from-markdown/lib';
|
||||
import { Content } from 'mdast';
|
||||
import { CustomScript } from './CustomScript';
|
||||
import { Folders } from '../commands/Folders';
|
||||
import { existsAsync, getTitleField } from '../utils';
|
||||
import { existsAsync } from '../utils';
|
||||
import { mkdirAsync } from '../utils/mkdirAsync';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
@@ -460,10 +460,8 @@ export class ArticleHelper {
|
||||
let contentType: IContentType | undefined = undefined;
|
||||
|
||||
// Get content type by type name in the front matter
|
||||
if (article.data[DefaultFields.ContentType]) {
|
||||
contentType = contentTypes.find((ct) => ct.name === article.data[DefaultFields.ContentType]);
|
||||
} else if (article.data[DefaultFields.Type]) {
|
||||
contentType = contentTypes.find((ct) => ct.name === article.data[DefaultFields.Type]);
|
||||
if (article.data.type) {
|
||||
contentType = contentTypes.find((ct) => ct.name === article.data.type);
|
||||
} else if (!contentType && article.path) {
|
||||
const pageFolder = await Folders.getPageFolderByFilePath(article.path);
|
||||
if (pageFolder && pageFolder.contentTypes?.length === 1) {
|
||||
@@ -637,12 +635,11 @@ export class ArticleHelper {
|
||||
) {
|
||||
const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string;
|
||||
const fmData = Object.assign({}, data);
|
||||
const titleField = getTitleField();
|
||||
|
||||
for (const fieldName of Object.keys(fmData)) {
|
||||
const fieldValue = fmData[fieldName];
|
||||
|
||||
if (fieldName === titleField && (fieldValue === null || fieldValue === '')) {
|
||||
if (fieldName === 'title' && (fieldValue === null || fieldValue === '')) {
|
||||
fmData[fieldName] = title;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ import {
|
||||
import {
|
||||
COMMAND_NAME,
|
||||
DefaultFieldValues,
|
||||
DefaultFields,
|
||||
EXTENSION_NAME,
|
||||
FEATURE_FLAG,
|
||||
SETTING_CONTENT_DRAFT_FIELD,
|
||||
SETTING_DATE_FORMAT,
|
||||
SETTING_FRAMEWORK_ID,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES,
|
||||
SETTING_TAXONOMY_FIELD_GROUPS
|
||||
SETTING_TAXONOMY_FIELD_GROUPS,
|
||||
TelemetryEvent
|
||||
} from '../constants';
|
||||
import {
|
||||
ContentType as IContentType,
|
||||
@@ -37,7 +37,7 @@ import { DEFAULT_CONTENT_TYPE_NAME } from '../constants/ContentType';
|
||||
import { Telemetry } from './Telemetry';
|
||||
import { basename } from 'path';
|
||||
import { ParsedFrontMatter } from '../parsers';
|
||||
import { encodeEmoji, existsAsync, fieldWhenClause, getTitleField, writeFileAsync } from '../utils';
|
||||
import { encodeEmoji, existsAsync, fieldWhenClause, writeFileAsync } from '../utils';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
|
||||
@@ -185,7 +185,7 @@ export class ContentType {
|
||||
fields.splice(fieldIdx, 1, ...fieldGroup.fields);
|
||||
}
|
||||
} else if (field && field.type === 'fields') {
|
||||
field.fields = field.fields || [];
|
||||
fields = field.fields || [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,6 +203,8 @@ export class ContentType {
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry.send(TelemetryEvent.generateContentType);
|
||||
|
||||
const content = ArticleHelper.getCurrent();
|
||||
|
||||
const editor = window.activeTextEditor;
|
||||
@@ -282,7 +284,7 @@ export class ContentType {
|
||||
|
||||
// Update the type field in the page
|
||||
if (!overrideBool && editor) {
|
||||
content.data[DefaultFields.ContentType] = contentTypeName;
|
||||
content.data['type'] = contentTypeName;
|
||||
ArticleHelper.update(editor, content);
|
||||
}
|
||||
|
||||
@@ -330,6 +332,8 @@ export class ContentType {
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry.send(TelemetryEvent.addMissingFields);
|
||||
|
||||
const article = ArticleHelper.getCurrent();
|
||||
|
||||
if (!article || !article.data) {
|
||||
@@ -373,6 +377,8 @@ export class ContentType {
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry.send(TelemetryEvent.setContentType);
|
||||
|
||||
const content = ArticleHelper.getCurrent();
|
||||
const contentTypes = ContentType.getAll() || [];
|
||||
|
||||
@@ -396,7 +402,7 @@ export class ContentType {
|
||||
return;
|
||||
}
|
||||
|
||||
content.data[DefaultFields.ContentType] = ctAnswer;
|
||||
content.data.type = ctAnswer;
|
||||
|
||||
const editor = window.activeTextEditor;
|
||||
ArticleHelper.update(editor!, content);
|
||||
@@ -944,11 +950,8 @@ export class ContentType {
|
||||
}
|
||||
|
||||
titleValue = titleValue.trim();
|
||||
|
||||
const titleFieldName = getTitleField();
|
||||
|
||||
// Check if the title needs to encode the emoji's used in it
|
||||
const titleField = contentType.fields.find((f) => f.name === titleFieldName);
|
||||
const titleField = contentType.fields.find((f) => f.name === 'title');
|
||||
if (titleField && titleField.encodeEmoji) {
|
||||
titleValue = encodeEmoji(titleValue);
|
||||
}
|
||||
@@ -988,8 +991,12 @@ export class ContentType {
|
||||
contentType
|
||||
);
|
||||
|
||||
// Set the content type
|
||||
data[DefaultFields.ContentType] = contentType.name;
|
||||
let isTypeSet = false;
|
||||
if (data.type) {
|
||||
isTypeSet = true;
|
||||
} else {
|
||||
data.type = contentType.name;
|
||||
}
|
||||
|
||||
const article: ParsedFrontMatter = {
|
||||
content: '',
|
||||
@@ -999,11 +1006,12 @@ export class ContentType {
|
||||
|
||||
data = await ArticleHelper.updateDates(article);
|
||||
|
||||
if (isTypeSet) {
|
||||
delete data.type;
|
||||
}
|
||||
|
||||
if (contentType.name !== DEFAULT_CONTENT_TYPE_NAME) {
|
||||
data[DefaultFields.ContentType] = contentType.name;
|
||||
} else {
|
||||
// Default content type, remove the content type field
|
||||
delete data[DefaultFields.ContentType];
|
||||
data['type'] = contentType.name;
|
||||
}
|
||||
|
||||
const content = ArticleHelper.stringifyFrontMatter(templateData?.content || ``, data);
|
||||
@@ -1027,6 +1035,8 @@ export class ContentType {
|
||||
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersContentTypeCreateSuccess));
|
||||
|
||||
Telemetry.send(TelemetryEvent.createContentFromContentType);
|
||||
|
||||
// Trigger a refresh for the dashboard
|
||||
PagesListener.refresh();
|
||||
}
|
||||
@@ -1048,7 +1058,6 @@ export class ContentType {
|
||||
isRoot: boolean = true
|
||||
): Promise<any> {
|
||||
if (obj.fields) {
|
||||
const titleField = getTitleField();
|
||||
const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string;
|
||||
|
||||
for (const field of obj.fields) {
|
||||
@@ -1057,7 +1066,7 @@ export class ContentType {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (field.name === titleField) {
|
||||
if (field.name === 'title') {
|
||||
if (field.default) {
|
||||
data[field.name] = processArticlePlaceholdersFromData(
|
||||
field.default as string,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Settings } from './SettingsHelper';
|
||||
import { CommandType, EnvironmentType } from './../models/PanelSettings';
|
||||
import { CustomScript as ICustomScript, ScriptType } from '../models/PanelSettings';
|
||||
import { window, env as vscodeEnv, ProgressLocation, Uri, commands } from 'vscode';
|
||||
import { ArticleHelper, Logger, MediaHelpers } from '.';
|
||||
import { ArticleHelper, Logger, Telemetry } from '.';
|
||||
import { Folders, WORKSPACE_PLACEHOLDER } from '../commands/Folders';
|
||||
import { exec, execSync } from 'child_process';
|
||||
import * as os from 'os';
|
||||
@@ -12,6 +12,7 @@ import ContentProvider from '../providers/ContentProvider';
|
||||
import { Dashboard } from '../commands/Dashboard';
|
||||
import { DashboardCommand } from '../dashboardWebView/DashboardCommand';
|
||||
import { ParsedFrontMatter } from '../parsers';
|
||||
import { TelemetryEvent } from '../constants/TelemetryEvent';
|
||||
import { SETTING_CUSTOM_SCRIPTS } from '../constants';
|
||||
import { existsAsync } from '../utils';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
@@ -39,8 +40,12 @@ export class CustomScript {
|
||||
const wsPath = wsFolder.fsPath;
|
||||
|
||||
if (script.type === ScriptType.MediaFile || script.type === ScriptType.MediaFolder) {
|
||||
Telemetry.send(TelemetryEvent.runMediaScript);
|
||||
|
||||
await CustomScript.runMediaScript(wsPath, path, script);
|
||||
} else {
|
||||
Telemetry.send(TelemetryEvent.runCustomScript);
|
||||
|
||||
if (script.bulk) {
|
||||
// Run script on all files
|
||||
await CustomScript.bulkRun(wsPath, script);
|
||||
@@ -62,11 +67,11 @@ export class CustomScript {
|
||||
* @param path
|
||||
* @returns
|
||||
*/
|
||||
public static async singleRun(
|
||||
private static async singleRun(
|
||||
wsPath: string,
|
||||
script: ICustomScript,
|
||||
path: string | null = null
|
||||
): Promise<any> {
|
||||
): Promise<void> {
|
||||
let articlePath: string | null = path;
|
||||
let article: ParsedFrontMatter | null | undefined = null;
|
||||
|
||||
@@ -94,7 +99,7 @@ export class CustomScript {
|
||||
articlePath as string,
|
||||
script
|
||||
);
|
||||
return await CustomScript.showOutput(output, script, articlePath);
|
||||
await CustomScript.showOutput(output, script, articlePath);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
@@ -128,7 +133,7 @@ export class CustomScript {
|
||||
title: l10n.t(LocalizationKey.helpersCustomScriptExecuting, script.title),
|
||||
cancellable: false
|
||||
},
|
||||
async (_, __) => {
|
||||
async (progress, token) => {
|
||||
for await (const folder of folders) {
|
||||
if (folder.lastModified.length > 0) {
|
||||
for await (const file of folder.lastModified) {
|
||||
@@ -261,22 +266,10 @@ export class CustomScript {
|
||||
output: string | null,
|
||||
script: ICustomScript,
|
||||
articlePath?: string | null
|
||||
): Promise<any> {
|
||||
): Promise<void> {
|
||||
if (output) {
|
||||
try {
|
||||
const data: {
|
||||
frontmatter?: { [key: string]: any };
|
||||
fmAction?:
|
||||
| 'open'
|
||||
| 'copyMediaMetadata'
|
||||
| 'copyMediaMetadataAndDelete'
|
||||
| 'deleteMedia'
|
||||
| 'fieldAction';
|
||||
fmPath?: string;
|
||||
fmSourcePath?: string;
|
||||
fmDestinationPath?: string;
|
||||
fmFieldValue?: any;
|
||||
} = JSON.parse(output);
|
||||
const data = JSON.parse(output);
|
||||
|
||||
if (data.frontmatter) {
|
||||
let article = null;
|
||||
@@ -312,23 +305,6 @@ export class CustomScript {
|
||||
if (data.fmAction === 'open' && data.fmPath) {
|
||||
const uri = data.fmPath.startsWith(`http`) ? data.fmPath : Uri.file(data.fmPath);
|
||||
commands.executeCommand('vscode.open', uri);
|
||||
} else if (
|
||||
data.fmAction === 'copyMediaMetadata' &&
|
||||
data.fmSourcePath &&
|
||||
data.fmDestinationPath
|
||||
) {
|
||||
await MediaHelpers.copyMetadata(data.fmSourcePath, data.fmDestinationPath);
|
||||
} else if (
|
||||
data.fmAction === 'copyMediaMetadataAndDelete' &&
|
||||
data.fmSourcePath &&
|
||||
data.fmDestinationPath
|
||||
) {
|
||||
await MediaHelpers.copyMetadata(data.fmSourcePath, data.fmDestinationPath);
|
||||
await MediaHelpers.deleteFile(data.fmSourcePath);
|
||||
} else if (data.fmAction === 'deleteMedia' && data.fmPath) {
|
||||
await MediaHelpers.deleteFile(data.fmPath);
|
||||
} else if (data.fmAction === 'fieldAction') {
|
||||
return data.fmFieldValue || undefined;
|
||||
}
|
||||
} else {
|
||||
Logger.error(`No frontmatter found.`);
|
||||
|
||||
@@ -348,7 +348,15 @@ export class MediaHelpers {
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
public static async deleteFile(file: string) {
|
||||
public static async deleteFile({
|
||||
file,
|
||||
page,
|
||||
folder
|
||||
}: {
|
||||
file: string;
|
||||
page: number;
|
||||
folder: string | null;
|
||||
}) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
@@ -488,18 +496,6 @@ export class MediaHelpers {
|
||||
await mediaLib.updateFilename(file, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the metadata from the source media to the target media.
|
||||
*
|
||||
* @param source - The path of the source media.
|
||||
* @param target - The path of the target media.
|
||||
*/
|
||||
public static async copyMetadata(source: string, target: string) {
|
||||
const mediaLib = MediaLibrary.getInstance();
|
||||
const metadata = await mediaLib.get(source);
|
||||
mediaLib.set(target, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the media files
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Preview } from '../commands/Preview';
|
||||
import { Project } from '../commands/Project';
|
||||
import {
|
||||
CONTEXT,
|
||||
DefaultFields,
|
||||
SETTING_CONTENT_DRAFT_FIELD,
|
||||
SETTING_CONTENT_FRONTMATTER_HIGHLIGHT,
|
||||
SETTING_DATA_TYPES,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
SETTING_DATE_FORMAT,
|
||||
SETTING_PANEL_FREEFORM,
|
||||
SETTING_SEO_CONTENT_MIN_LENGTH,
|
||||
SETTING_SEO_DESCRIPTION_FIELD,
|
||||
SETTING_SEO_DESCRIPTION_LENGTH,
|
||||
SETTING_SEO_SLUG_LENGTH,
|
||||
SETTING_SEO_TITLE_LENGTH,
|
||||
@@ -28,7 +30,8 @@ import {
|
||||
SETTING_SLUG_SUFFIX,
|
||||
SETTING_SLUG_UPDATE_FILE_NAME,
|
||||
SETTING_TAXONOMY_CUSTOM,
|
||||
SETTING_TAXONOMY_FIELD_GROUPS
|
||||
SETTING_TAXONOMY_FIELD_GROUPS,
|
||||
SETTING_SEO_TITLE_FIELD
|
||||
} from '../constants';
|
||||
import { GitListener } from '../listeners/general';
|
||||
import {
|
||||
@@ -42,8 +45,6 @@ import {
|
||||
TaxonomyType
|
||||
} from '../models';
|
||||
import { Folders } from '../commands';
|
||||
import { Copilot } from '../services/Copilot';
|
||||
import { getDescriptionField, getTitleField } from '../utils';
|
||||
|
||||
export class PanelSettings {
|
||||
public static async get(): Promise<IPanelSettings> {
|
||||
@@ -52,15 +53,15 @@ export class PanelSettings {
|
||||
try {
|
||||
return {
|
||||
aiEnabled: Settings.get<boolean>(SETTING_SPONSORS_AI_ENABLED) || false,
|
||||
copilotEnabled: await Copilot.isInstalled(),
|
||||
git: await GitListener.getSettings(),
|
||||
seo: {
|
||||
title: (Settings.get(SETTING_SEO_TITLE_LENGTH) as number) || -1,
|
||||
slug: (Settings.get(SETTING_SEO_SLUG_LENGTH) as number) || -1,
|
||||
description: (Settings.get(SETTING_SEO_DESCRIPTION_LENGTH) as number) || -1,
|
||||
content: (Settings.get(SETTING_SEO_CONTENT_MIN_LENGTH) as number) || -1,
|
||||
titleField: getTitleField(),
|
||||
descriptionField: getDescriptionField()
|
||||
titleField: (Settings.get(SETTING_SEO_TITLE_FIELD) as string) || DefaultFields.Title,
|
||||
descriptionField:
|
||||
(Settings.get(SETTING_SEO_DESCRIPTION_FIELD) as string) || DefaultFields.Description
|
||||
},
|
||||
slug: {
|
||||
prefix: Settings.get(SETTING_SLUG_PREFIX) || '',
|
||||
|
||||
@@ -9,7 +9,6 @@ import { SponsorAi } from '../services/SponsorAI';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { ContentFolder } from '../models';
|
||||
import { Copilot } from '../services/Copilot';
|
||||
|
||||
interface FolderQuickPickItem extends QuickPickItem {
|
||||
path: string;
|
||||
@@ -42,12 +41,11 @@ export class Questions {
|
||||
public static async ContentTitle(showWarning: boolean = true): Promise<string | undefined> {
|
||||
const aiEnabled = Settings.get<boolean>(SETTING_SPONSORS_AI_ENABLED);
|
||||
let title: string | undefined = '';
|
||||
const isCopilotInstalled = await Copilot.isInstalled();
|
||||
|
||||
let aiTitles: string[] | undefined;
|
||||
if (aiEnabled) {
|
||||
const githubAuth = await authentication.getSession('github', ['read:user'], { silent: true });
|
||||
|
||||
if (aiEnabled || isCopilotInstalled) {
|
||||
if (isCopilotInstalled) {
|
||||
if (githubAuth && githubAuth.account.label) {
|
||||
title = await window.showInputBox({
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputTitle),
|
||||
prompt: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPrompt),
|
||||
@@ -57,81 +55,54 @@ export class Questions {
|
||||
|
||||
if (title) {
|
||||
try {
|
||||
aiTitles = await Copilot.suggestTitles(title);
|
||||
const aiTitles = await SponsorAi.getTitles(githubAuth.accessToken, title);
|
||||
|
||||
if (aiTitles && aiTitles.length > 0) {
|
||||
const options: QuickPickItem[] = [
|
||||
{
|
||||
label: `✏️ ${l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickTitleSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
{
|
||||
label: title
|
||||
},
|
||||
{
|
||||
label: `🤖 ${l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickAiSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
...aiTitles.map((d: string) => ({
|
||||
label: d
|
||||
}))
|
||||
];
|
||||
|
||||
const selectedTitle = await window.showQuickPick(options, {
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputSelectTitle),
|
||||
placeHolder: l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputSelectPlaceholder
|
||||
),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
if (selectedTitle) {
|
||||
title = selectedTitle.label;
|
||||
} else if (!selectedTitle) {
|
||||
// Reset the title, so the user can enter their own title
|
||||
title = undefined;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.error((e as Error).message);
|
||||
Notifications.error(
|
||||
l10n.t(LocalizationKey.helpersQuestionsContentTitleCopilotInputFailed)
|
||||
);
|
||||
Notifications.error(l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputFailed));
|
||||
title = undefined;
|
||||
}
|
||||
} else if (!title && showWarning) {
|
||||
Notifications.warning(l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputWarning));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const githubAuth = await authentication.getSession('github', ['read:user'], {
|
||||
silent: true
|
||||
});
|
||||
|
||||
if (githubAuth && githubAuth.account.label) {
|
||||
title = await window.showInputBox({
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputTitle),
|
||||
prompt: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPrompt),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
if (title) {
|
||||
try {
|
||||
aiTitles = await SponsorAi.getTitles(githubAuth.accessToken, title);
|
||||
} catch (e) {
|
||||
Logger.error((e as Error).message);
|
||||
Notifications.error(
|
||||
l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputFailed)
|
||||
);
|
||||
title = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (title && aiTitles && aiTitles.length > 0) {
|
||||
const options: QuickPickItem[] = [
|
||||
{
|
||||
label: `✏️ ${l10n.t(
|
||||
LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickTitleSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
{
|
||||
label: title
|
||||
},
|
||||
{
|
||||
label: `🤖 ${l10n.t(
|
||||
isCopilotInstalled
|
||||
? LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickCopilotSeparator
|
||||
: LocalizationKey.helpersQuestionsContentTitleAiInputQuickPickAiSeparator
|
||||
)}`,
|
||||
kind: QuickPickItemKind.Separator
|
||||
},
|
||||
...aiTitles.map((d: string) => ({
|
||||
label: d
|
||||
}))
|
||||
];
|
||||
|
||||
const selectedTitle = await window.showQuickPick(options, {
|
||||
title: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputSelectTitle),
|
||||
placeHolder: l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputSelectPlaceholder),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
|
||||
if (selectedTitle) {
|
||||
title = selectedTitle.label;
|
||||
} else if (!selectedTitle) {
|
||||
// Reset the title, so the user can enter their own title
|
||||
title = undefined;
|
||||
}
|
||||
} else if (!title && showWarning) {
|
||||
Notifications.warning(l10n.t(LocalizationKey.helpersQuestionsContentTitleAiInputWarning));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +212,7 @@ export class Questions {
|
||||
|
||||
if (options.length === 0) {
|
||||
Notifications.error(
|
||||
l10n.t(LocalizationKey.helpersQuestionsSelectContentTypeQuickPickErrorNoContentTypes)
|
||||
LocalizationKey.helpersQuestionsSelectContentTypeQuickPickErrorNoContentTypes
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { parseWinPath } from './parseWinPath';
|
||||
import { Telemetry } from './Telemetry';
|
||||
import { Notifications } from './Notifications';
|
||||
import {
|
||||
commands,
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
CONTEXT,
|
||||
ExtensionState,
|
||||
SETTING_TAXONOMY_CUSTOM,
|
||||
TelemetryEvent,
|
||||
COMMAND_NAME,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES,
|
||||
SETTING_CONTENT_PAGE_FOLDERS,
|
||||
@@ -514,9 +516,7 @@ ${JSON.stringify(value, null, 2)}`,
|
||||
}frontmatter.codes/frontmatter.schema.json`
|
||||
};
|
||||
|
||||
const projectFile = await Settings.projectConfigPath();
|
||||
|
||||
if (wsFolder && !projectFile) {
|
||||
if (wsFolder) {
|
||||
const configPath = join(wsFolder.fsPath, Settings.globalFile);
|
||||
if (!(await existsAsync(configPath))) {
|
||||
await writeFileAsync(configPath, JSON.stringify(initialConfig, null, 2), 'utf8');
|
||||
@@ -600,6 +600,8 @@ ${JSON.stringify(value, null, 2)}`,
|
||||
}
|
||||
|
||||
Notifications.info(l10n.t(LocalizationKey.helpersSettingsHelperPromoteSuccess));
|
||||
|
||||
Telemetry.send(TelemetryEvent.promoteSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
import { workspace } from 'vscode';
|
||||
import { Extension, Settings } from '.';
|
||||
import {
|
||||
EXTENSION_BETA_ID,
|
||||
EXTENSION_ID,
|
||||
SETTING_TELEMETRY_DISABLE,
|
||||
WEBSITE_LINKS
|
||||
} from '../constants';
|
||||
|
||||
export class Telemetry {
|
||||
private static instance: Telemetry;
|
||||
private extTitle: string;
|
||||
private extVersion: string;
|
||||
private events: any[] = [];
|
||||
private timeout: NodeJS.Timeout | undefined;
|
||||
|
||||
private constructor() {
|
||||
const extension = Extension.getInstance();
|
||||
this.extTitle = extension.isBetaVersion() ? EXTENSION_BETA_ID : EXTENSION_ID;
|
||||
this.extVersion = extension.version;
|
||||
}
|
||||
|
||||
public static getInstance(): Telemetry {
|
||||
if (!Telemetry.instance) {
|
||||
Telemetry.instance = new Telemetry();
|
||||
}
|
||||
return Telemetry.instance;
|
||||
}
|
||||
|
||||
public static isVscodeEnabled(): boolean {
|
||||
const config = workspace.getConfiguration('telemetry');
|
||||
const isVscodeEnable = config.get<'off' | undefined>('enableTelemetry');
|
||||
@@ -13,6 +39,56 @@ export class Telemetry {
|
||||
*/
|
||||
public static isEnabled(): boolean {
|
||||
const isVscodeEnable = Telemetry.isVscodeEnabled();
|
||||
return isVscodeEnable ? false : true;
|
||||
|
||||
const isDisabled = Settings.get<boolean>(SETTING_TELEMETRY_DISABLE);
|
||||
|
||||
return isDisabled || isVscodeEnable ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send metrics to our own database
|
||||
* @param eventName
|
||||
* @param properties
|
||||
* @returns
|
||||
*/
|
||||
public static send(eventName: string, properties?: any) {
|
||||
if (!Telemetry.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const instance = Telemetry.getInstance();
|
||||
instance.events.push({
|
||||
name: eventName,
|
||||
extName: instance.extTitle,
|
||||
version: instance.extVersion,
|
||||
properties
|
||||
});
|
||||
|
||||
instance.debounceMetrics();
|
||||
}
|
||||
|
||||
/**
|
||||
* Debounce the metrics by 1 second
|
||||
*/
|
||||
private async debounceMetrics() {
|
||||
const instance = Telemetry.getInstance();
|
||||
|
||||
// Check if timeout was defined
|
||||
if (instance.timeout) {
|
||||
clearTimeout(instance.timeout);
|
||||
}
|
||||
|
||||
// Set a new timeout
|
||||
instance.timeout = setTimeout(async () => {
|
||||
await fetch(WEBSITE_LINKS.api.metrics, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(this.events)
|
||||
});
|
||||
// Reset the events
|
||||
this.events = [];
|
||||
}, 1000) as any as NodeJS.Timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ContentType } from '../models';
|
||||
import { getTitleField } from '../utils';
|
||||
import { ArticleHelper } from './ArticleHelper';
|
||||
import { SlugHelper } from './SlugHelper';
|
||||
|
||||
@@ -8,17 +7,16 @@ export const processArticlePlaceholdersFromData = (
|
||||
data: { [key: string]: any },
|
||||
contentType: ContentType
|
||||
): string => {
|
||||
const titleField = getTitleField();
|
||||
if (value.includes('{{title}}') && data[titleField]) {
|
||||
if (value.includes('{{title}}') && data.title) {
|
||||
const regex = new RegExp('{{title}}', 'g');
|
||||
value = value.replace(regex, data[titleField] || '');
|
||||
value = value.replace(regex, data.title || '');
|
||||
}
|
||||
|
||||
if (value.includes('{{slug}}')) {
|
||||
const regex = new RegExp('{{slug}}', 'g');
|
||||
value = value.replace(
|
||||
regex,
|
||||
SlugHelper.createSlug(data[titleField] || '', data, contentType.slugTemplate) || ''
|
||||
SlugHelper.createSlug(data.title || '', data, contentType.slugTemplate) || ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,11 +32,9 @@ export const processArticlePlaceholdersFromPath = async (
|
||||
return value;
|
||||
}
|
||||
|
||||
const titleField = getTitleField();
|
||||
|
||||
if (value.includes('{{title}}')) {
|
||||
const regex = new RegExp('{{title}}', 'g');
|
||||
value = value.replace(regex, article.data[titleField] || '');
|
||||
value = value.replace(regex, article.data.title || '');
|
||||
}
|
||||
|
||||
if (value.includes('{{slug}}') && filePath) {
|
||||
@@ -47,11 +43,8 @@ export const processArticlePlaceholdersFromPath = async (
|
||||
const regex = new RegExp('{{slug}}', 'g');
|
||||
value = value.replace(
|
||||
regex,
|
||||
SlugHelper.createSlug(
|
||||
article.data[titleField] || '',
|
||||
article.data,
|
||||
contentType.slugTemplate
|
||||
) || ''
|
||||
SlugHelper.createSlug(article.data.title || '', article.data, contentType.slugTemplate) ||
|
||||
''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useState, useEffect } from 'react';
|
||||
import { DEFAULT_CONTENT_TYPE, DEFAULT_CONTENT_TYPE_NAME } from '../constants/ContentType';
|
||||
import { Settings } from '../dashboardWebView/models';
|
||||
import { ContentType, PanelSettings } from '../models';
|
||||
import { DefaultFields } from '../constants';
|
||||
|
||||
export default function useContentType(
|
||||
settings: PanelSettings | Settings | undefined | null,
|
||||
@@ -14,12 +13,8 @@ export default function useContentType(
|
||||
if (settings && metadata) {
|
||||
let contentTypeName = DEFAULT_CONTENT_TYPE_NAME;
|
||||
|
||||
if (metadata) {
|
||||
if (metadata[DefaultFields.ContentType]) {
|
||||
contentTypeName = metadata[DefaultFields.ContentType];
|
||||
} else if (metadata[DefaultFields.Type]) {
|
||||
contentTypeName = metadata[DefaultFields.Type];
|
||||
}
|
||||
if (metadata?.type) {
|
||||
contentTypeName = metadata.type;
|
||||
}
|
||||
|
||||
// Get the content type by the folder name
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Telemetry } from '../../helpers/Telemetry';
|
||||
import { MediaHelpers } from '../../helpers/MediaHelpers';
|
||||
import { DashboardMessage } from '../../dashboardWebView/DashboardMessage';
|
||||
import { BaseListener } from './BaseListener';
|
||||
import { DashboardCommand } from '../../dashboardWebView/DashboardCommand';
|
||||
import { SortingOption } from '../../dashboardWebView/models';
|
||||
import { commands, env, Uri } from 'vscode';
|
||||
import { COMMAND_NAME } from '../../constants';
|
||||
import { COMMAND_NAME, TelemetryEvent } from '../../constants';
|
||||
import * as os from 'os';
|
||||
import { Folders } from '../../commands';
|
||||
import { PostMessageData, UnmappedMedia } from '../../models';
|
||||
@@ -23,25 +24,31 @@ export class MediaListener extends BaseListener {
|
||||
this.sendMediaFiles(page, folder, sorting);
|
||||
break;
|
||||
case DashboardMessage.refreshMedia:
|
||||
Telemetry.send(TelemetryEvent.refreshMedia);
|
||||
MediaHelpers.resetMedia();
|
||||
this.sendMediaFiles(0, msg?.payload?.folder);
|
||||
break;
|
||||
case DashboardMessage.uploadMedia:
|
||||
Telemetry.send(TelemetryEvent.uploadMedia);
|
||||
this.store(msg?.payload);
|
||||
break;
|
||||
case DashboardMessage.deleteMedia:
|
||||
Telemetry.send(TelemetryEvent.deleteMedia);
|
||||
this.delete(msg?.payload);
|
||||
break;
|
||||
case DashboardMessage.revealMedia:
|
||||
this.openFileInFinder(msg?.payload?.file);
|
||||
break;
|
||||
case DashboardMessage.insertMedia:
|
||||
Telemetry.send(TelemetryEvent.insertMediaToContent);
|
||||
MediaHelpers.insertMediaToMarkdown(msg?.payload);
|
||||
break;
|
||||
case DashboardMessage.insertFile:
|
||||
Telemetry.send(TelemetryEvent.insertFileToContent);
|
||||
MediaHelpers.insertMediaToMarkdown(msg?.payload);
|
||||
break;
|
||||
case DashboardMessage.updateMediaMetadata:
|
||||
Telemetry.send(TelemetryEvent.updateMediaMetadata);
|
||||
this.update(msg.payload);
|
||||
break;
|
||||
case DashboardMessage.getUnmappedMedia:
|
||||
@@ -176,7 +183,7 @@ export class MediaListener extends BaseListener {
|
||||
*/
|
||||
private static delete(data: { file: string; page: number; folder: string | null }) {
|
||||
try {
|
||||
MediaHelpers.deleteFile(data.file);
|
||||
MediaHelpers.deleteFile(data);
|
||||
this.sendMediaFiles(data.page || 0, data.folder || '');
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class PagesListener extends BaseListener {
|
||||
// Optimize the list of recently changed files
|
||||
DataListener.getFoldersAndFiles(doc.uri);
|
||||
// Trigger the metadata update
|
||||
this.watcherExec(doc.uri, 'save');
|
||||
this.watcherExec(doc.uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -103,9 +103,9 @@ export class PagesListener extends BaseListener {
|
||||
false,
|
||||
false
|
||||
);
|
||||
watcher.onDidCreate(async (uri: Uri) => this.watcherExec(uri, 'create'));
|
||||
watcher.onDidChange(async (uri: Uri) => this.watcherExec(uri, 'change'));
|
||||
watcher.onDidDelete(async (uri: Uri) => this.watcherExec(uri, 'delete'));
|
||||
watcher.onDidCreate(async (uri: Uri) => this.watcherExec(uri));
|
||||
watcher.onDidChange(async (uri: Uri) => this.watcherExec(uri));
|
||||
watcher.onDidDelete(async (uri: Uri) => this.watcherExec(uri));
|
||||
this.watchers[folderUri.fsPath] = watcher;
|
||||
}
|
||||
}
|
||||
@@ -162,10 +162,10 @@ export class PagesListener extends BaseListener {
|
||||
* Watcher for processing page updates
|
||||
* @param file
|
||||
*/
|
||||
private static async watcherExec(file: Uri, type?: 'create' | 'change' | 'delete' | 'save') {
|
||||
private static async watcherExec(file: Uri) {
|
||||
const progressFile = async (file: Uri) => {
|
||||
const ext = Extension.getInstance();
|
||||
Logger.info(`File watcher execution for (${type}): ${file.fsPath}`);
|
||||
Logger.info(`File watcher execution for: ${file.fsPath}`);
|
||||
|
||||
const pageIdx = this.lastPages.findIndex((p) => p.fmFilePath === file.fsPath);
|
||||
if (pageIdx !== -1) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { EditorHelper } from '@estruyf/vscode';
|
||||
import { window, Range, Position } from 'vscode';
|
||||
import { Dashboard } from '../../commands/Dashboard';
|
||||
import { SETTING_CONTENT_SNIPPETS, SETTING_DATE_FORMAT } from '../../constants';
|
||||
import { SETTING_CONTENT_SNIPPETS, SETTING_DATE_FORMAT, TelemetryEvent } from '../../constants';
|
||||
import { DashboardMessage } from '../../dashboardWebView/DashboardMessage';
|
||||
import {
|
||||
ArticleHelper,
|
||||
Notifications,
|
||||
Settings,
|
||||
Telemetry,
|
||||
processArticlePlaceholdersFromPath,
|
||||
processTimePlaceholders
|
||||
} from '../../helpers';
|
||||
@@ -27,6 +29,7 @@ export class SnippetListener extends BaseListener {
|
||||
this.updateSnippet(msg.payload);
|
||||
break;
|
||||
case DashboardMessage.insertSnippet:
|
||||
Telemetry.send(TelemetryEvent.insertContentSnippet);
|
||||
this.insertSnippet(msg.payload);
|
||||
break;
|
||||
case DashboardMessage.updateSnippetPlaceholders:
|
||||
|
||||
20
src/listeners/dashboard/TelemetryListener.ts
Normal file
20
src/listeners/dashboard/TelemetryListener.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { DashboardMessage } from '../../dashboardWebView/DashboardMessage';
|
||||
import { Telemetry } from '../../helpers/Telemetry';
|
||||
import { PostMessageData } from '../../models';
|
||||
import { BaseListener } from './BaseListener';
|
||||
|
||||
export class TelemetryListener extends BaseListener {
|
||||
/**
|
||||
* Process the messages for the dashboard views
|
||||
* @param msg
|
||||
*/
|
||||
public static process(msg: PostMessageData) {
|
||||
super.process(msg);
|
||||
|
||||
switch (msg.command) {
|
||||
case DashboardMessage.sendTelemetry:
|
||||
Telemetry.send(msg.payload.event, msg.payload.properties);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ export * from './MediaListener';
|
||||
export * from './PagesListener';
|
||||
export * from './SettingsListener';
|
||||
export * from './SnippetListener';
|
||||
export * from './TelemetryListener';
|
||||
export * from './TaxonomyListener';
|
||||
export * from './LocalizationListener';
|
||||
export * from './SsgListener';
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
SETTING_GIT_SUBMODULE_BRANCH,
|
||||
SETTING_GIT_SUBMODULE_FOLDER,
|
||||
SETTING_GIT_SUBMODULE_PULL,
|
||||
SETTING_GIT_SUBMODULE_PUSH
|
||||
SETTING_GIT_SUBMODULE_PUSH,
|
||||
TelemetryEvent
|
||||
} from './../../constants';
|
||||
import { Settings } from './../../helpers/SettingsHelper';
|
||||
import { Dashboard } from '../../commands/Dashboard';
|
||||
@@ -21,7 +22,8 @@ import {
|
||||
Logger,
|
||||
Notifications,
|
||||
parseWinPath,
|
||||
processTimePlaceholders
|
||||
processTimePlaceholders,
|
||||
Telemetry
|
||||
} from '../../helpers';
|
||||
import { GeneralCommands } from './../../constants/GeneralCommands';
|
||||
import simpleGit, { SimpleGit } from 'simple-git';
|
||||
@@ -156,6 +158,8 @@ export class GitListener {
|
||||
try {
|
||||
this.sendMsg(GeneralCommands.toWebview.git.syncingStart, isSync ? 'syncing' : 'fetching');
|
||||
|
||||
Telemetry.send(isSync ? TelemetryEvent.gitSync : TelemetryEvent.gitFetch);
|
||||
|
||||
await this.pull();
|
||||
|
||||
if (isSync) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
SETTING_DATE_FORMAT,
|
||||
SETTING_GLOBAL_ACTIVE_MODE,
|
||||
SETTING_GLOBAL_MODES,
|
||||
SETTING_SEO_TITLE_FIELD,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES
|
||||
} from '../../constants';
|
||||
import { Article, Preview } from '../../commands';
|
||||
@@ -36,7 +37,7 @@ import {
|
||||
ContentType as IContentType,
|
||||
FolderInfo
|
||||
} from '../../models';
|
||||
import { encodeEmoji, fieldWhenClause, getTitleField } from '../../utils';
|
||||
import { encodeEmoji, fieldWhenClause } from '../../utils';
|
||||
import { PanelProvider } from '../../panelWebView/PanelProvider';
|
||||
import { MessageHandlerData } from '@estruyf/vscode';
|
||||
import { SponsorAi } from '../../services/SponsorAI';
|
||||
@@ -44,7 +45,6 @@ import { Terminal } from '../../services';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
import { parse } from 'path';
|
||||
import { Copilot } from '../../services/Copilot';
|
||||
|
||||
const FILE_LIMIT = 10;
|
||||
|
||||
@@ -104,62 +104,9 @@ export class DataListener extends BaseListener {
|
||||
case CommandToCode.aiSuggestDescription:
|
||||
this.aiSuggestTaxonomy(msg.command, msg.requestId);
|
||||
break;
|
||||
case CommandToCode.copilotSuggestDescription:
|
||||
this.copilotSuggestDescription(msg.command, msg.requestId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a Copilot suggestion command.
|
||||
* @param command - The command to execute.
|
||||
* @param requestId - The optional request ID.
|
||||
* @returns A Promise that resolves when the suggestion command is executed.
|
||||
*/
|
||||
private static async copilotSuggestDescription(command: string, requestId?: string) {
|
||||
if (!command || !requestId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const article = ArticleHelper.getActiveFile();
|
||||
if (!article) {
|
||||
return;
|
||||
}
|
||||
|
||||
const articleDetails = await ArticleHelper.getFrontMatterByPath(article);
|
||||
if (!articleDetails) {
|
||||
return;
|
||||
}
|
||||
|
||||
const extPath = Extension.getInstance().extensionPath;
|
||||
const panel = PanelProvider.getInstance(extPath);
|
||||
|
||||
const titleField = getTitleField();
|
||||
const description = await Copilot.suggestDescription(
|
||||
articleDetails.data[titleField],
|
||||
articleDetails.content
|
||||
);
|
||||
|
||||
if (description) {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
payload: description
|
||||
} as MessageHandlerData<string>);
|
||||
} else {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: l10n.t(LocalizationKey.servicesCopilotGetChatResponseError)
|
||||
} as MessageHandlerData<string>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggests taxonomy using AI.
|
||||
* @param command - The command string.
|
||||
* @param requestId - The optional request ID.
|
||||
*/
|
||||
private static async aiSuggestTaxonomy(command: string, requestId?: string) {
|
||||
if (!command || !requestId) {
|
||||
return;
|
||||
@@ -193,7 +140,7 @@ export class DataListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
const titleField = getTitleField();
|
||||
const titleField = (Settings.get(SETTING_SEO_TITLE_FIELD) as string) || DefaultFields.Title;
|
||||
|
||||
const suggestion = await SponsorAi.getDescription(
|
||||
githubAuth.accessToken,
|
||||
@@ -360,21 +307,9 @@ export class DataListener extends BaseListener {
|
||||
|
||||
// Check slug
|
||||
if (!slugField && !updatedMetadata[DefaultFields.Slug]) {
|
||||
let pathname = contentType.previewPath || '';
|
||||
if (!pathname) {
|
||||
const selectedFolder = await Folders.getPageFolderByFilePath(filePath);
|
||||
if (selectedFolder && selectedFolder.previewPath) {
|
||||
pathname = selectedFolder.previewPath;
|
||||
}
|
||||
}
|
||||
const slug = Article.getSlug();
|
||||
|
||||
if (!pathname) {
|
||||
pathname = Preview.getSettings().pathname || '';
|
||||
}
|
||||
|
||||
const slug = Article.getSlug(pathname);
|
||||
|
||||
if (typeof slug !== 'undefined') {
|
||||
if (slug) {
|
||||
updatedMetadata[DefaultFields.Slug] = slug;
|
||||
}
|
||||
}
|
||||
@@ -411,7 +346,7 @@ export class DataListener extends BaseListener {
|
||||
}
|
||||
|
||||
let beforeValue: any;
|
||||
const titleField = getTitleField();
|
||||
const titleField = (Settings.get(SETTING_SEO_TITLE_FIELD) as string) || DefaultFields.Title;
|
||||
|
||||
const editor = window.activeTextEditor;
|
||||
|
||||
@@ -768,11 +703,9 @@ export class DataListener extends BaseListener {
|
||||
data && contentType ? processArticlePlaceholdersFromData(value, data, contentType) : value;
|
||||
value = processTimePlaceholders(value, dateFormat);
|
||||
value = processFmPlaceholders(value, data);
|
||||
|
||||
const titleField = getTitleField();
|
||||
value = await ArticleHelper.processCustomPlaceholders(
|
||||
value,
|
||||
data[titleField] || '',
|
||||
data.title || '',
|
||||
crntFile?.uri.fsPath || ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Folders } from '../../commands';
|
||||
import { SETTING_CUSTOM_SCRIPTS } from '../../constants';
|
||||
import { CustomScript, Notifications, Settings } from '../../helpers';
|
||||
import { CustomScript, Settings } from '../../helpers';
|
||||
import { CustomScript as ICustomScript, PostMessageData } from '../../models';
|
||||
import { CommandToCode } from '../../panelWebView/CommandToCode';
|
||||
import { BaseListener } from './BaseListener';
|
||||
@@ -17,32 +16,6 @@ export class ScriptListener extends BaseListener {
|
||||
case CommandToCode.runCustomScript:
|
||||
this.runCustomScript(msg);
|
||||
break;
|
||||
case CommandToCode.runFieldAction:
|
||||
this.runFieldAction(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static async runFieldAction({ command, payload, requestId }: PostMessageData) {
|
||||
if (!payload || !requestId || !command) {
|
||||
return;
|
||||
}
|
||||
|
||||
const script = payload as ICustomScript;
|
||||
if (script.script) {
|
||||
const wsFolder = Folders.getWorkspaceFolder();
|
||||
if (!wsFolder) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fieldValue = await CustomScript.singleRun(wsFolder.fsPath, script);
|
||||
|
||||
if (fieldValue) {
|
||||
this.sendRequest(command, requestId, fieldValue);
|
||||
} else {
|
||||
Notifications.error('The script did not return a field value');
|
||||
this.sendRequestError(command, requestId, 'The script did not return a field value');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,16 @@ import { authentication, window } from 'vscode';
|
||||
import { ArticleHelper, Extension, Settings, TaxonomyHelper } from '../../helpers';
|
||||
import { BlockFieldData, CustomTaxonomyData, PostMessageData, TaxonomyType } from '../../models';
|
||||
import { DataListener } from '.';
|
||||
import {
|
||||
DefaultFields,
|
||||
SETTING_SEO_DESCRIPTION_FIELD,
|
||||
SETTING_SEO_TITLE_FIELD
|
||||
} from '../../constants';
|
||||
import { SponsorAi } from '../../services/SponsorAI';
|
||||
import { PanelProvider } from '../../panelWebView/PanelProvider';
|
||||
import { MessageHandlerData } from '@estruyf/vscode';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
import { Copilot } from '../../services/Copilot';
|
||||
import { getDescriptionField, getTitleField } from '../../utils';
|
||||
|
||||
export class TaxonomyListener extends BaseListener {
|
||||
/**
|
||||
@@ -63,71 +66,9 @@ export class TaxonomyListener extends BaseListener {
|
||||
case CommandToCode.aiSuggestTaxonomy:
|
||||
this.aiSuggestTaxonomy(msg.command, msg.requestId, msg.payload);
|
||||
break;
|
||||
case CommandToCode.copilotSuggestTaxonomy:
|
||||
this.copilotSuggestTaxonomy(msg.command, msg.requestId, msg.payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggests a taxonomy for a given command, request ID, and tag type.
|
||||
*
|
||||
* @param command - The command to execute.
|
||||
* @param requestId - The ID of the request.
|
||||
* @param type - The type of the tag.
|
||||
* @returns A Promise that resolves to void.
|
||||
*/
|
||||
private static async copilotSuggestTaxonomy(command: string, requestId?: string, type?: TagType) {
|
||||
if (!command || !requestId || !type) {
|
||||
return;
|
||||
}
|
||||
|
||||
const article = ArticleHelper.getActiveFile();
|
||||
if (!article) {
|
||||
return;
|
||||
}
|
||||
|
||||
const articleDetails = await ArticleHelper.getFrontMatterByPath(article);
|
||||
if (!articleDetails) {
|
||||
return;
|
||||
}
|
||||
|
||||
const extPath = Extension.getInstance().extensionPath;
|
||||
const panel = PanelProvider.getInstance(extPath);
|
||||
|
||||
const titleField = getTitleField();
|
||||
const descriptionField = getDescriptionField();
|
||||
|
||||
const tags = await Copilot.suggestTaxonomy(
|
||||
articleDetails.data[titleField],
|
||||
type,
|
||||
articleDetails.data[descriptionField],
|
||||
articleDetails.content
|
||||
);
|
||||
|
||||
if (tags) {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
payload: tags
|
||||
} as MessageHandlerData<string[]>);
|
||||
} else {
|
||||
panel.getWebview()?.postMessage({
|
||||
command,
|
||||
requestId,
|
||||
error: l10n.t(LocalizationKey.servicesCopilotGetChatResponseError)
|
||||
} as MessageHandlerData<string>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggests taxonomy based on the provided command, request ID, and tag type.
|
||||
*
|
||||
* @param command - The command to execute.
|
||||
* @param requestId - The ID of the request.
|
||||
* @param type - The type of tag.
|
||||
* @returns A Promise that resolves to void.
|
||||
*/
|
||||
private static async aiSuggestTaxonomy(command: string, requestId?: string, type?: TagType) {
|
||||
if (!command || !requestId || !type) {
|
||||
return;
|
||||
@@ -161,8 +102,9 @@ export class TaxonomyListener extends BaseListener {
|
||||
return;
|
||||
}
|
||||
|
||||
const titleField = getTitleField();
|
||||
const descriptionField = getDescriptionField();
|
||||
const titleField = (Settings.get(SETTING_SEO_TITLE_FIELD) as string) || DefaultFields.Title;
|
||||
const descriptionField =
|
||||
(Settings.get(SETTING_SEO_DESCRIPTION_FIELD) as string) || DefaultFields.Description;
|
||||
|
||||
const suggestions = await SponsorAi.getTaxonomySuggestions(
|
||||
githubAuth.accessToken,
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export * from './localization.enum';
|
||||
export * from './localize';
|
||||
|
||||
@@ -175,10 +175,6 @@ export enum LocalizationKey {
|
||||
* Rename
|
||||
*/
|
||||
commonRename = 'common.rename',
|
||||
/**
|
||||
* Documentation
|
||||
*/
|
||||
commonDocs = 'common.docs',
|
||||
/**
|
||||
* Loading content
|
||||
*/
|
||||
@@ -515,10 +511,6 @@ export enum LocalizationKey {
|
||||
* {0} selected
|
||||
*/
|
||||
dashboardHeaderActionsBarItemsSelected = 'dashboard.header.actionsBar.itemsSelected',
|
||||
/**
|
||||
* Select all
|
||||
*/
|
||||
dashboardHeaderActionsBarSelectAll = 'dashboard.header.actionsBar.selectAll',
|
||||
/**
|
||||
* Delete selected files
|
||||
*/
|
||||
@@ -1400,10 +1392,6 @@ export enum LocalizationKey {
|
||||
* Use Front Matter AI to suggest {0}
|
||||
*/
|
||||
panelFieldsTextFieldAiMessage = 'panel.fields.textField.ai.message',
|
||||
/**
|
||||
* Use Copilot to suggest {0}
|
||||
*/
|
||||
panelFieldsTextFieldCopilotMessage = 'panel.fields.textField.copilot.message',
|
||||
/**
|
||||
* Generating suggestion...
|
||||
*/
|
||||
@@ -1420,14 +1408,6 @@ export enum LocalizationKey {
|
||||
* Unkown field type: {0}
|
||||
*/
|
||||
panelFieldsWrapperFieldUnknown = 'panel.fields.wrapperField.unknown',
|
||||
/**
|
||||
* Custom action
|
||||
*/
|
||||
panelFieldsFieldCustomActionButtonTitle = 'panel.fields.fieldCustomAction.button.title',
|
||||
/**
|
||||
* Executing field action...
|
||||
*/
|
||||
panelFieldsFieldCustomActionExecuting = 'panel.fields.fieldCustomAction.executing',
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
@@ -1692,10 +1672,6 @@ export enum LocalizationKey {
|
||||
* Use Front Matter AI to suggest {0}
|
||||
*/
|
||||
panelTagPickerAiSuggest = 'panel.tagPicker.ai.suggest',
|
||||
/**
|
||||
* Use GitHub Copilot to suggest {0}
|
||||
*/
|
||||
panelTagPickerCopilotSuggest = 'panel.tagPicker.copilot.suggest',
|
||||
/**
|
||||
* Generating suggestions...
|
||||
*/
|
||||
@@ -2332,10 +2308,6 @@ export enum LocalizationKey {
|
||||
* AI generated title
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputQuickPickAiSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.ai.separator',
|
||||
/**
|
||||
* GitHub Copilot suggestions
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputQuickPickCopilotSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.copilot.separator',
|
||||
/**
|
||||
* Select a title
|
||||
*/
|
||||
@@ -2348,10 +2320,6 @@ export enum LocalizationKey {
|
||||
* Failed fetching the AI title. Please try to use your own title or try again later.
|
||||
*/
|
||||
helpersQuestionsContentTitleAiInputFailed = 'helpers.questions.contentTitle.aiInput.failed',
|
||||
/**
|
||||
* Failed fetching the GitHub Copilot title suggestions. Please try to use your own title or try again later.
|
||||
*/
|
||||
helpersQuestionsContentTitleCopilotInputFailed = 'helpers.questions.contentTitle.copilotInput.failed',
|
||||
/**
|
||||
* You did not specify a title for your content.
|
||||
*/
|
||||
@@ -2600,10 +2568,6 @@ export enum LocalizationKey {
|
||||
* No article data
|
||||
*/
|
||||
listenersPanelTaxonomyListenerAiSuggestTaxonomyNoDataError = 'listeners.panel.taxonomyListener.aiSuggestTaxonomy.noData.error',
|
||||
/**
|
||||
* Failed to get a response from the GitHub Copilot.
|
||||
*/
|
||||
servicesCopilotGetChatResponseError = 'services.copilot.getChatResponse.error',
|
||||
/**
|
||||
* Select the mode you want to use
|
||||
*/
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import * as l10n from '@vscode/l10n';
|
||||
|
||||
export const localize = (key: string, ...args: any[]): string => {
|
||||
return l10n.t(key, ...args);
|
||||
};
|
||||
@@ -29,7 +29,6 @@ export interface PanelSettings {
|
||||
fieldGroups: FieldGroup[] | undefined;
|
||||
commaSeparatedFields: string[];
|
||||
aiEnabled: boolean;
|
||||
copilotEnabled: boolean;
|
||||
contentFolders: ContentFolder[];
|
||||
websiteUrl: string;
|
||||
disabledActions: PanelAction[];
|
||||
@@ -141,9 +140,6 @@ export interface Field {
|
||||
|
||||
// When clause
|
||||
when?: WhenClause;
|
||||
|
||||
// Custom action
|
||||
actions?: CustomScript[];
|
||||
}
|
||||
|
||||
export interface NumberOptions {
|
||||
|
||||
@@ -42,10 +42,7 @@ export enum CommandToCode {
|
||||
stopServer = 'stop-server',
|
||||
aiSuggestTaxonomy = 'ai-suggest-taxonomy',
|
||||
aiSuggestDescription = 'ai-suggest-description',
|
||||
copilotSuggestDescription = 'copilot-suggest-description',
|
||||
copilotSuggestTaxonomy = 'copilot-suggest-taxonomy',
|
||||
searchByType = 'search-by-type',
|
||||
processMediaData = 'process-media-data',
|
||||
isServerStarted = 'is-server-started',
|
||||
runFieldAction = 'run-field-action'
|
||||
isServerStarted = 'is-server-started'
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
FieldsListener,
|
||||
LocalizationListener
|
||||
} from './../listeners/panel';
|
||||
import { SETTING_EXPERIMENTAL } from '../constants';
|
||||
import { SETTING_EXPERIMENTAL, SETTING_EXTENSIBILITY_SCRIPTS, TelemetryEvent } from '../constants';
|
||||
import {
|
||||
CancellationToken,
|
||||
Disposable,
|
||||
@@ -27,8 +27,9 @@ import { WebviewHelper } from '@estruyf/vscode';
|
||||
import { Extension } from '../helpers/Extension';
|
||||
import { Telemetry } from '../helpers/Telemetry';
|
||||
import { GitListener, ModeListener } from '../listeners/general';
|
||||
import { Folders } from '../commands';
|
||||
import { basename } from 'path';
|
||||
import { getExtensibilityScripts, ignoreMsgCommand } from '../utils';
|
||||
import { ignoreMsgCommand } from '../utils';
|
||||
|
||||
export class PanelProvider implements WebviewViewProvider, Disposable {
|
||||
public static readonly viewType = 'frontMatter.explorer';
|
||||
@@ -119,6 +120,7 @@ export class PanelProvider implements WebviewViewProvider, Disposable {
|
||||
|
||||
webviewView.onDidChangeVisibility(() => {
|
||||
if (this.visible) {
|
||||
Telemetry.send(TelemetryEvent.openPanelWebview);
|
||||
DataListener.getFileData();
|
||||
}
|
||||
});
|
||||
@@ -240,8 +242,20 @@ export class PanelProvider implements WebviewViewProvider, Disposable {
|
||||
|
||||
// Get experimental setting
|
||||
const experimental = Settings.get(SETTING_EXPERIMENTAL);
|
||||
const extensibilityScripts = Settings.get<string[]>(SETTING_EXTENSIBILITY_SCRIPTS) || [];
|
||||
|
||||
const scriptsToLoad: string[] = getExtensibilityScripts(webView);
|
||||
const scriptsToLoad: string[] = [];
|
||||
if (experimental) {
|
||||
for (const script of extensibilityScripts) {
|
||||
if (script.startsWith('https://')) {
|
||||
scriptsToLoad.push(script);
|
||||
} else {
|
||||
const absScriptPath = Folders.getAbsFilePath(script);
|
||||
const scriptUri = webView.asWebviewUri(Uri.file(absScriptPath));
|
||||
scriptsToLoad.push(scriptUri.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const csp = [
|
||||
`default-src 'none';`,
|
||||
@@ -275,9 +289,9 @@ export class PanelProvider implements WebviewViewProvider, Disposable {
|
||||
<body>
|
||||
<div id="app" data-isProd="${isProd}" data-environment="${
|
||||
isBeta ? 'BETA' : 'main'
|
||||
}" data-version="${version.usedVersion}" ${
|
||||
experimental ? `data-experimental="${experimental}"` : ''
|
||||
} data-is-crash-disabled="${!Telemetry.isVscodeEnabled()}"></div>
|
||||
}" data-version="${
|
||||
version.usedVersion
|
||||
}" data-is-crash-disabled="${!Telemetry.isVscodeEnabled()}"></div>
|
||||
|
||||
${(scriptsToLoad || [])
|
||||
.map((script) => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { usePrevious } from './hooks/usePrevious';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../localization';
|
||||
import { InitializeAction } from './components/InitializeAction';
|
||||
import { DEFAULT_PANEL_FEATURE_FLAGS } from '../constants/DefaultFeatureFlags';
|
||||
|
||||
export interface IViewPanelProps { }
|
||||
|
||||
@@ -38,6 +37,10 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
|
||||
const prevMediaSelection = usePrevious(mediaSelecting);
|
||||
const [scrollY, setScrollY] = useState(0);
|
||||
|
||||
const allPanelValues = useMemo(() => {
|
||||
return Object.values(FEATURE_FLAG.panel).filter(v => v !== FEATURE_FLAG.panel.globalSettings)
|
||||
}, [FEATURE_FLAG.panel]);
|
||||
|
||||
const scollListener = useCallback((e: Event) => {
|
||||
if (!mediaSelecting) {
|
||||
setScrollY(window.scrollY);
|
||||
@@ -45,7 +48,7 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
|
||||
}, [mediaSelecting]);
|
||||
|
||||
const isSomethingShown = useMemo(() => {
|
||||
const panelModeValues = (mode?.features || DEFAULT_PANEL_FEATURE_FLAGS).filter(v => v.startsWith('panel.'));
|
||||
const panelModeValues = (mode?.features || [...allPanelValues]).filter(v => v.startsWith('panel.'));
|
||||
|
||||
if (panelModeValues.length === 0) {
|
||||
return false;
|
||||
@@ -122,23 +125,22 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
|
||||
<InitializeAction settings={settings} />
|
||||
|
||||
<div className={`ext_actions`}>
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.gitActions}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.gitActions}>
|
||||
<GitAction settings={settings} />
|
||||
</FeatureFlag>
|
||||
|
||||
{!loading && (<CustomView metadata={metadata} />)}
|
||||
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.globalSettings}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.globalSettings}>
|
||||
<GlobalSettings settings={settings} isBase={!metadata} />
|
||||
</FeatureFlag>
|
||||
|
||||
{
|
||||
!loading && metadata && settings && settings.seo && (
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.seo}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.seo}>
|
||||
<SeoStatus
|
||||
seo={settings.seo}
|
||||
metadata={metadata}
|
||||
settings={settings}
|
||||
data={metadata}
|
||||
focusElm={focusElm}
|
||||
unsetFocus={unsetFocus}
|
||||
/>
|
||||
@@ -147,7 +149,7 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
|
||||
}
|
||||
|
||||
{!loading && settings && (
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.actions}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.actions}>
|
||||
<Actions
|
||||
metadata={metadata}
|
||||
settings={settings}
|
||||
@@ -157,23 +159,23 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
|
||||
|
||||
{
|
||||
!loading && metadata && (
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.metadata}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.metadata}>
|
||||
<Metadata
|
||||
settings={settings}
|
||||
metadata={metadata}
|
||||
focusElm={focusElm}
|
||||
unsetFocus={unsetFocus}
|
||||
features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS}
|
||||
features={mode?.features || [...allPanelValues]}
|
||||
/>
|
||||
</FeatureFlag>
|
||||
)
|
||||
}
|
||||
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.recentlyModified}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.recentlyModified}>
|
||||
<FolderAndFiles data={folderAndFiles} isBase={!metadata} />
|
||||
</FeatureFlag>
|
||||
|
||||
<FeatureFlag features={mode?.features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.otherActions}>
|
||||
<FeatureFlag features={mode?.features || [...allPanelValues]} flag={FEATURE_FLAG.panel.otherActions}>
|
||||
<OtherActions settings={settings} isFile={!!metadata} isBase={!metadata} />
|
||||
</FeatureFlag>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ const Actions: React.FunctionComponent<IActionsProps> = ({
|
||||
}
|
||||
|
||||
if (settings?.preview?.host && !disableActions.includes(`preview`)) {
|
||||
if ((metadata && typeof metadata.slug !== "undefined") || !metadata) {
|
||||
if ((metadata && metadata.slug) || !metadata) {
|
||||
allActions.push(<Preview key="preview" />);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,13 @@ import { IMetadata } from '../Metadata';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { VSCodeLabel } from '../VSCode';
|
||||
import { DefaultFields } from '../../../constants';
|
||||
|
||||
export interface IContentTypeValidatorProps {
|
||||
fields: Field[];
|
||||
metadata: IMetadata;
|
||||
}
|
||||
|
||||
const fieldsToIgnore = [`filePath`, `articleDetails`, DefaultFields.Slug, DefaultFields.Keywords, DefaultFields.Type, DefaultFields.ContentType];
|
||||
const fieldsToIgnore = [`filePath`, `articleDetails`, `slug`, `keywords`, `type`];
|
||||
|
||||
export const ContentTypeValidator: React.FunctionComponent<IContentTypeValidatorProps> = ({
|
||||
fields,
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { CustomScript } from '../../../models';
|
||||
import { messageHandler } from '@estruyf/vscode/dist/client';
|
||||
import { CodeBracketIcon, CommandLineIcon } from '@heroicons/react/24/solid';
|
||||
import { CommandToCode } from '../../CommandToCode';
|
||||
import { LocalizationKey, localize } from '../../../localization';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../../../components/shadcn/Dropdown';
|
||||
|
||||
export interface IFieldCustomActionProps {
|
||||
actions: CustomScript[];
|
||||
disabled?: boolean;
|
||||
triggerLoading?: (message?: string) => void;
|
||||
onChange: (value: any) => void;
|
||||
}
|
||||
|
||||
export const FieldCustomAction: React.FunctionComponent<IFieldCustomActionProps> = ({ actions, disabled, triggerLoading, onChange }: React.PropsWithChildren<IFieldCustomActionProps>) => {
|
||||
|
||||
const triggerAction = React.useCallback((action: CustomScript) => {
|
||||
if (triggerLoading) {
|
||||
triggerLoading(localize(LocalizationKey.panelFieldsFieldCustomActionExecuting));
|
||||
}
|
||||
|
||||
messageHandler.request(CommandToCode.runFieldAction, {
|
||||
...action
|
||||
}).then((value: any) => {
|
||||
onChange(value);
|
||||
|
||||
if (triggerLoading) {
|
||||
triggerLoading();
|
||||
}
|
||||
}).catch(() => {
|
||||
console.error('Error while running the custom action');
|
||||
|
||||
if (triggerLoading) {
|
||||
triggerLoading();
|
||||
}
|
||||
});
|
||||
}, [triggerLoading, onChange]);
|
||||
|
||||
if (!actions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (actions.length === 1) {
|
||||
const action = actions[0];
|
||||
return (
|
||||
<button
|
||||
className="metadata_field__title__action inline-block text-[var(--vscode-editor-foreground)] disabled:opacity-50"
|
||||
title={action?.title || localize(LocalizationKey.panelFieldsFieldCustomActionButtonTitle)}
|
||||
type="button"
|
||||
onClick={triggerAction.bind(null, action)}
|
||||
disabled={disabled}
|
||||
>
|
||||
<span className='sr-only'>{action?.title || localize(LocalizationKey.panelFieldsFieldCustomActionButtonTitle)}</span>
|
||||
<CommandLineIcon style={{ height: "16px", width: "16px" }} aria-hidden="true" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger
|
||||
title={localize(LocalizationKey.commonOpenCustomActions)}
|
||||
className='metadata_field__title__action inline-block text-[var(--vscode-editor-foreground)] disabled:opacity-50'>
|
||||
<span className="sr-only">{localize(LocalizationKey.commonOpenCustomActions)}</span>
|
||||
<CommandLineIcon style={{ height: "16px", width: "16px" }} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
<DropdownMenuContent align='end' className='p-0'>
|
||||
{
|
||||
actions.map((action) => (
|
||||
<DropdownMenuItem
|
||||
key={action.id || action.title}
|
||||
title={action.title}
|
||||
className={`focus:bg-[var(--vscode-button-background)] focus:text-[var(--vscode-button-foreground)] focus:outline-0 rounded-none`}
|
||||
onClick={(e) => triggerAction(action)}>
|
||||
<CommandLineIcon className={`mr-2 h-4 w-4`} aria-hidden={true} />
|
||||
<span>{action.title}</span>
|
||||
</DropdownMenuItem>
|
||||
))
|
||||
}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)
|
||||
};
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { RequiredAsterix } from './RequiredAsterix';
|
||||
import { CustomScript } from '../../../models';
|
||||
import { FieldCustomAction } from './FieldCustomAction';
|
||||
import { VSCodeLabel } from '../VSCode';
|
||||
|
||||
export interface IFieldTitleProps {
|
||||
label: string | JSX.Element;
|
||||
@@ -10,10 +9,6 @@ export interface IFieldTitleProps {
|
||||
className?: string;
|
||||
required?: boolean;
|
||||
actionElement?: JSX.Element;
|
||||
customActions?: CustomScript[];
|
||||
isDisabled?: boolean;
|
||||
triggerLoading?: (message?: string) => void;
|
||||
onChange?: (value: any) => void;
|
||||
}
|
||||
|
||||
export const FieldTitle: React.FunctionComponent<IFieldTitleProps> = ({
|
||||
@@ -22,36 +17,22 @@ export const FieldTitle: React.FunctionComponent<IFieldTitleProps> = ({
|
||||
className,
|
||||
required,
|
||||
actionElement,
|
||||
customActions,
|
||||
isDisabled,
|
||||
triggerLoading,
|
||||
onChange,
|
||||
}: React.PropsWithChildren<IFieldTitleProps>) => {
|
||||
const Icon = useMemo(() => {
|
||||
return icon ? React.cloneElement(icon, { style: { width: '16px', height: '16px' } }) : null;
|
||||
}, [icon]);
|
||||
|
||||
return (
|
||||
<div className='flex items-center justify-between w-full mb-2'>
|
||||
<label className={`metadata_field__label text-base text-[var(--vscode-foreground)] ${className || ''}`}>
|
||||
{Icon}
|
||||
<span style={{ lineHeight: '16px' }}>{label}</span>
|
||||
<RequiredAsterix required={required} />
|
||||
</label>
|
||||
<VSCodeLabel>
|
||||
<div className={`metadata_field__label ${className || ''}`}>
|
||||
<div>
|
||||
{Icon}
|
||||
<span style={{ lineHeight: '16px' }}>{label}</span>
|
||||
<RequiredAsterix required={required} />
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4">
|
||||
{actionElement}
|
||||
|
||||
{
|
||||
customActions && onChange && (
|
||||
<FieldCustomAction
|
||||
actions={customActions}
|
||||
disabled={isDisabled}
|
||||
triggerLoading={triggerLoading}
|
||||
onChange={onChange} />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</VSCodeLabel>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ import { PhotoIcon } from '@heroicons/react/24/outline';
|
||||
import * as React from 'react';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { DefaultFieldValues } from '../../../constants';
|
||||
import { BaseFieldProps, BlockFieldData, CustomScript } from '../../../models';
|
||||
import { BaseFieldProps, BlockFieldData } from '../../../models';
|
||||
import { CommandToCode } from '../../CommandToCode';
|
||||
import { FieldTitle } from './FieldTitle';
|
||||
import { PreviewImage } from './PreviewImage';
|
||||
@@ -23,7 +23,6 @@ export interface IPreviewImageFieldProps
|
||||
parents?: string[];
|
||||
multiple?: boolean;
|
||||
blockData?: BlockFieldData;
|
||||
actions?: CustomScript[];
|
||||
onChange: (value: string | string[] | null) => void;
|
||||
}
|
||||
|
||||
@@ -37,10 +36,8 @@ export const PreviewImageField: React.FunctionComponent<IPreviewImageFieldProps>
|
||||
filePath,
|
||||
multiple,
|
||||
parents,
|
||||
actions,
|
||||
required
|
||||
}: React.PropsWithChildren<IPreviewImageFieldProps>) => {
|
||||
const [loading, setLoading] = React.useState<string | undefined>(undefined);
|
||||
const [imageData, setImageData] = React.useState<PreviewImageValue | PreviewImageValue[] | null>(null);
|
||||
|
||||
const selectImage = useCallback(() => {
|
||||
@@ -98,14 +95,7 @@ export const PreviewImageField: React.FunctionComponent<IPreviewImageFieldProps>
|
||||
|
||||
return (
|
||||
<div className={`metadata_field`}>
|
||||
<FieldTitle
|
||||
label={label}
|
||||
icon={<PhotoIcon />}
|
||||
required={required}
|
||||
isDisabled={!!loading}
|
||||
customActions={actions}
|
||||
triggerLoading={(message) => setLoading(message)}
|
||||
onChange={(value: string) => onChange(value)} />
|
||||
<FieldTitle label={label} icon={<PhotoIcon />} required={required} />
|
||||
|
||||
<div
|
||||
className={`metadata_field__preview_image ${multiple && imageData && (imageData as PreviewImageValue[]).length > 0
|
||||
|
||||
@@ -5,7 +5,7 @@ import { CommandToCode } from '../../CommandToCode';
|
||||
import { TagType } from '../../TagType';
|
||||
import Downshift from 'downshift';
|
||||
import { AddIcon } from '../Icons/AddIcon';
|
||||
import { BlockFieldData, CustomScript, CustomTaxonomyData } from '../../../models';
|
||||
import { BlockFieldData, CustomTaxonomyData } from '../../../models';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { messageHandler, Messenger } from '@estruyf/vscode/dist/client';
|
||||
import { FieldMessage } from '../Fields/FieldMessage';
|
||||
@@ -13,9 +13,9 @@ import { FieldTitle } from '../Fields/FieldTitle';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { PanelSettingsAtom } from '../../state';
|
||||
import { SparklesIcon } from '@heroicons/react/24/outline';
|
||||
import { LocalizationKey, localize } from '../../../localization';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import useDropdownStyle from '../../hooks/useDropdownStyle';
|
||||
import { CopilotIcon } from '../Icons';
|
||||
|
||||
export interface ITagPickerProps {
|
||||
type: TagType;
|
||||
@@ -36,7 +36,6 @@ export interface ITagPickerProps {
|
||||
limit?: number;
|
||||
required?: boolean;
|
||||
renderAsString?: boolean;
|
||||
actions?: CustomScript[];
|
||||
}
|
||||
|
||||
const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
@@ -56,8 +55,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
blockData,
|
||||
limit,
|
||||
required,
|
||||
renderAsString,
|
||||
actions
|
||||
renderAsString
|
||||
}: React.PropsWithChildren<ITagPickerProps>) => {
|
||||
const [selected, setSelected] = React.useState<string[]>([]);
|
||||
const [inputValue, setInputValue] = React.useState<string>('');
|
||||
@@ -66,7 +64,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
const { getDropdownStyle } = useDropdownStyle(inputRef as any);
|
||||
const dsRef = React.useRef<Downshift<string> | null>(null);
|
||||
const settings = useRecoilValue(PanelSettingsAtom);
|
||||
const [loading, setLoading] = React.useState<string | undefined>(undefined);
|
||||
const [loading, setLoading] = React.useState<boolean>(false);
|
||||
|
||||
/**
|
||||
* Removes an option
|
||||
@@ -100,42 +98,39 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
* Send an update to VSCode
|
||||
* @param values
|
||||
*/
|
||||
const sendUpdate = useCallback(
|
||||
(values: string[]) => {
|
||||
if (type === TagType.tags) {
|
||||
Messenger.send(CommandToCode.updateTags, {
|
||||
fieldName,
|
||||
values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
});
|
||||
} else if (type === TagType.categories) {
|
||||
Messenger.send(CommandToCode.updateCategories, {
|
||||
fieldName,
|
||||
values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
});
|
||||
} else if (type === TagType.keywords) {
|
||||
Messenger.send(CommandToCode.updateKeywords, {
|
||||
values,
|
||||
parents
|
||||
});
|
||||
} else if (type === TagType.custom) {
|
||||
Messenger.send(CommandToCode.updateCustomTaxonomy, {
|
||||
id: taxonomyId,
|
||||
name: fieldName,
|
||||
options: values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
} as CustomTaxonomyData);
|
||||
}
|
||||
},
|
||||
[renderAsString]
|
||||
);
|
||||
const sendUpdate = useCallback((values: string[]) => {
|
||||
if (type === TagType.tags) {
|
||||
Messenger.send(CommandToCode.updateTags, {
|
||||
fieldName,
|
||||
values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
});
|
||||
} else if (type === TagType.categories) {
|
||||
Messenger.send(CommandToCode.updateCategories, {
|
||||
fieldName,
|
||||
values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
});
|
||||
} else if (type === TagType.keywords) {
|
||||
Messenger.send(CommandToCode.updateKeywords, {
|
||||
values,
|
||||
parents
|
||||
});
|
||||
} else if (type === TagType.custom) {
|
||||
Messenger.send(CommandToCode.updateCustomTaxonomy, {
|
||||
id: taxonomyId,
|
||||
name: fieldName,
|
||||
options: values,
|
||||
renderAsString,
|
||||
parents,
|
||||
blockData
|
||||
} as CustomTaxonomyData);
|
||||
}
|
||||
}, [renderAsString]);
|
||||
|
||||
/**
|
||||
* Triggers the focus to the input when command is executed
|
||||
@@ -187,24 +182,19 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
* @param option
|
||||
* @param inputValue
|
||||
*/
|
||||
const filterList = useCallback(
|
||||
(option: string, inputValue: string | null) => {
|
||||
if (typeof option !== 'string') {
|
||||
return false;
|
||||
}
|
||||
const filterList = useCallback((option: string, inputValue: string | null) => {
|
||||
if (typeof option !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(selected instanceof Array)) {
|
||||
return true;
|
||||
}
|
||||
if (!(selected instanceof Array)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
option &&
|
||||
!selected.includes(option) &&
|
||||
option.toLowerCase().includes((inputValue || '').toLowerCase())
|
||||
);
|
||||
},
|
||||
[selected]
|
||||
);
|
||||
return (
|
||||
option && !selected.includes(option) && option.toLowerCase().includes((inputValue || '').toLowerCase())
|
||||
);
|
||||
}, [selected]);
|
||||
|
||||
/**
|
||||
* Add the new item to the data
|
||||
@@ -250,33 +240,20 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
[options, inputRef, selected, freeform]
|
||||
);
|
||||
|
||||
const updateTaxonomy = (values: string[]) => {
|
||||
if (values && values instanceof Array && values.length > 0) {
|
||||
const uniqValues = Array.from(new Set([...selected, ...values]));
|
||||
setSelected(uniqValues);
|
||||
sendUpdate(uniqValues);
|
||||
setInputValue('');
|
||||
}
|
||||
}
|
||||
|
||||
const suggestTaxonomy = useCallback(
|
||||
(aiType: 'ai' | 'copilot', type: TagType) => {
|
||||
setLoading(localize(LocalizationKey.panelTagPickerAiGenerating));
|
||||
|
||||
const command =
|
||||
aiType === 'ai' ? CommandToCode.aiSuggestTaxonomy : CommandToCode.copilotSuggestTaxonomy;
|
||||
messageHandler
|
||||
.request<string[]>(command, type)
|
||||
.then((values) => {
|
||||
setLoading(undefined);
|
||||
updateTaxonomy(values)
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading(undefined);
|
||||
});
|
||||
},
|
||||
[selected]
|
||||
);
|
||||
const suggestTaxonomy = useCallback((type: TagType) => {
|
||||
setLoading(true);
|
||||
messageHandler.request<string[]>(CommandToCode.aiSuggestTaxonomy, type).then((values) => {
|
||||
setLoading(false);
|
||||
if (values && values instanceof Array && values.length > 0) {
|
||||
const uniqValues = Array.from(new Set([...selected, ...values]));
|
||||
setSelected(uniqValues);
|
||||
sendUpdate(uniqValues);
|
||||
setInputValue('');
|
||||
}
|
||||
}).catch(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, [selected]);
|
||||
|
||||
/**
|
||||
* Check if the input is disabled
|
||||
@@ -291,13 +268,10 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
|
||||
const inputPlaceholder = useMemo((): string => {
|
||||
if (checkIsDisabled()) {
|
||||
return localize(
|
||||
LocalizationKey.panelTagPickerInputPlaceholderDisabled,
|
||||
`${limit} ${label || type.toLowerCase()}`
|
||||
);
|
||||
return l10n.t(LocalizationKey.panelTagPickerInputPlaceholderDisabled, `${limit} ${label || type.toLowerCase()}`);
|
||||
}
|
||||
|
||||
return localize(LocalizationKey.panelTagPickerInputPlaceholderEmpty, label || type.toLowerCase());
|
||||
return l10n.t(LocalizationKey.panelTagPickerInputPlaceholderEmpty, (label || type.toLowerCase()));
|
||||
}, [label, type, checkIsDisabled]);
|
||||
|
||||
const showRequiredState = useMemo(() => {
|
||||
@@ -305,44 +279,25 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
}, [required, selected]);
|
||||
|
||||
const actionElement = useMemo(() => {
|
||||
if (!settings?.aiEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type !== TagType.tags && type !== TagType.categories) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{settings?.aiEnabled && (
|
||||
<button
|
||||
className="metadata_field__title__action"
|
||||
title={localize(
|
||||
LocalizationKey.panelTagPickerAiSuggest,
|
||||
label?.toLowerCase() || type.toLowerCase()
|
||||
)}
|
||||
type="button"
|
||||
onClick={() => suggestTaxonomy('ai', type)}
|
||||
disabled={!!loading}
|
||||
>
|
||||
<SparklesIcon />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{settings?.copilotEnabled && (
|
||||
<button
|
||||
className="metadata_field__title__action"
|
||||
title={localize(
|
||||
LocalizationKey.panelTagPickerCopilotSuggest,
|
||||
label?.toLowerCase() || type.toLowerCase()
|
||||
)}
|
||||
type="button"
|
||||
onClick={() => suggestTaxonomy('copilot', type)}
|
||||
disabled={!!loading}
|
||||
>
|
||||
<CopilotIcon />
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
<button
|
||||
className='metadata_field__title__action'
|
||||
title={l10n.t(LocalizationKey.panelTagPickerAiSuggest, (label?.toLowerCase() || type.toLowerCase()))}
|
||||
type='button'
|
||||
onClick={() => suggestTaxonomy(type)}
|
||||
disabled={loading}>
|
||||
<SparklesIcon />
|
||||
</button>
|
||||
);
|
||||
}, [settings?.aiEnabled, settings?.copilotEnabled, label, type]);
|
||||
}, [settings?.aiEnabled, label, type]);
|
||||
|
||||
const sortedSelectedTags = useMemo(() => {
|
||||
const safeSelected = selected || [];
|
||||
@@ -373,6 +328,13 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
|
||||
return (
|
||||
<div className={`article__tags metadata_field`}>
|
||||
{
|
||||
loading && (
|
||||
<div className='metadata_field__loading'>
|
||||
{l10n.t(LocalizationKey.panelTagPickerAiGenerating)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<FieldTitle
|
||||
label={
|
||||
<>
|
||||
@@ -380,9 +342,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
{limit !== undefined && limit > 0 ? (
|
||||
<>
|
||||
{` `}
|
||||
<span style={{ fontWeight: 'lighter' }}>
|
||||
({localize(LocalizationKey.panelTagPickerLimit, limit)})
|
||||
</span>
|
||||
<span style={{ fontWeight: 'lighter' }}>({l10n.t(LocalizationKey.panelTagPickerLimit, limit)})</span>
|
||||
</>
|
||||
) : (
|
||||
``
|
||||
@@ -392,91 +352,81 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
|
||||
actionElement={actionElement}
|
||||
icon={icon}
|
||||
required={required}
|
||||
isDisabled={!!loading}
|
||||
customActions={actions}
|
||||
triggerLoading={(message) => setLoading(message)}
|
||||
onChange={updateTaxonomy}
|
||||
/>
|
||||
|
||||
<div className="relative">
|
||||
{loading && (
|
||||
<div className="metadata_field__loading">
|
||||
{loading}
|
||||
</div>
|
||||
)}
|
||||
<Downshift
|
||||
ref={dsRef}
|
||||
onChange={(selected) => onSelect(selected || '')}
|
||||
itemToString={(item) => (item ? item : '')}
|
||||
inputValue={inputValue}
|
||||
onInputValueChange={(value) => setInputValue(value)}
|
||||
>
|
||||
{({
|
||||
getInputProps,
|
||||
getItemProps,
|
||||
getMenuProps,
|
||||
isOpen,
|
||||
inputValue,
|
||||
getRootProps,
|
||||
openMenu,
|
||||
closeMenu,
|
||||
clearSelection,
|
||||
highlightedIndex
|
||||
}) => (
|
||||
<>
|
||||
<div
|
||||
{...getRootProps(undefined, { suppressRefError: true })}
|
||||
className={`article__tags__input ${freeform ? 'freeform' : ''} ${showRequiredState ? 'required' : ''
|
||||
}`}
|
||||
>
|
||||
<input
|
||||
{...getInputProps({
|
||||
ref: inputRef,
|
||||
onFocus: openMenu as any,
|
||||
onClick: openMenu as any,
|
||||
onKeyDown: (e) => onEnterData(e, closeMenu, highlightedIndex),
|
||||
onBlur: () => {
|
||||
closeMenu();
|
||||
unsetFocus();
|
||||
if (!inputValue) {
|
||||
clearSelection();
|
||||
}
|
||||
},
|
||||
disabled: checkIsDisabled()
|
||||
})}
|
||||
placeholder={inputPlaceholder}
|
||||
/>
|
||||
|
||||
<Downshift
|
||||
ref={dsRef}
|
||||
onChange={(selected) => onSelect(selected || '')}
|
||||
itemToString={(item) => (item ? item : '')}
|
||||
inputValue={inputValue}
|
||||
onInputValueChange={(value) => setInputValue(value)}
|
||||
>
|
||||
{({
|
||||
getInputProps,
|
||||
getItemProps,
|
||||
getMenuProps,
|
||||
isOpen,
|
||||
inputValue,
|
||||
getRootProps,
|
||||
openMenu,
|
||||
closeMenu,
|
||||
clearSelection,
|
||||
highlightedIndex
|
||||
}) => (
|
||||
<>
|
||||
<div
|
||||
{...getRootProps(undefined, { suppressRefError: true })}
|
||||
className={`article__tags__input ${freeform ? 'freeform' : ''} ${showRequiredState ? 'required' : ''
|
||||
}`}
|
||||
>
|
||||
<input
|
||||
{...getInputProps({
|
||||
ref: inputRef,
|
||||
onFocus: openMenu as any,
|
||||
onClick: openMenu as any,
|
||||
onKeyDown: (e) => onEnterData(e, closeMenu, highlightedIndex),
|
||||
onBlur: () => {
|
||||
closeMenu();
|
||||
unsetFocus();
|
||||
if (!inputValue) {
|
||||
clearSelection();
|
||||
}
|
||||
},
|
||||
disabled: checkIsDisabled()
|
||||
})}
|
||||
placeholder={inputPlaceholder}
|
||||
/>
|
||||
{freeform && (
|
||||
<button
|
||||
className={`article__tags__input__button`}
|
||||
title={l10n.t(LocalizationKey.panelTagPickerUnkown)}
|
||||
disabled={!inputValue || checkIsDisabled()}
|
||||
onClick={() => insertUnkownTag(closeMenu)}
|
||||
>
|
||||
<AddIcon />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{freeform && (
|
||||
<button
|
||||
className={`article__tags__input__button`}
|
||||
title={localize(LocalizationKey.panelTagPickerUnkown)}
|
||||
disabled={!inputValue || checkIsDisabled()}
|
||||
onClick={() => insertUnkownTag(closeMenu)}
|
||||
>
|
||||
<AddIcon />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ul
|
||||
className={`field_dropdown article__tags__dropbox ${isOpen ? 'open' : 'closed'}`}
|
||||
style={{
|
||||
bottom: getDropdownStyle(isOpen)
|
||||
}}
|
||||
{...getMenuProps()}
|
||||
>
|
||||
{options
|
||||
<ul
|
||||
className={`field_dropdown article__tags__dropbox ${isOpen ? 'open' : 'closed'}`}
|
||||
style={{
|
||||
bottom: getDropdownStyle(isOpen)
|
||||
}}
|
||||
{...getMenuProps()}
|
||||
>
|
||||
{
|
||||
options
|
||||
.filter((option) => filterList(option, inputValue))
|
||||
.map((item, index) => (
|
||||
<li {...getItemProps({ key: item, index, item })}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</Downshift>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</Downshift>
|
||||
|
||||
<FieldMessage
|
||||
name={(label || type).toLowerCase()}
|
||||
|
||||
@@ -2,15 +2,15 @@ import { PencilIcon, SparklesIcon } from '@heroicons/react/24/outline';
|
||||
import * as React from 'react';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { BaseFieldProps, CustomScript, PanelSettings } from '../../../models';
|
||||
import { BaseFieldProps, PanelSettings } from '../../../models';
|
||||
import { RequiredFieldsAtom } from '../../state';
|
||||
import { FieldTitle } from './FieldTitle';
|
||||
import { FieldMessage } from './FieldMessage';
|
||||
import { messageHandler } from '@estruyf/vscode/dist/client';
|
||||
import { CommandToCode } from '../../CommandToCode';
|
||||
import { LocalizationKey, localize } from '../../../localization';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
import { useDebounce } from '../../../hooks/useDebounce';
|
||||
import { CopilotIcon } from '../Icons';
|
||||
|
||||
const DEBOUNCE_TIME = 300;
|
||||
|
||||
@@ -22,7 +22,6 @@ export interface ITextFieldProps extends BaseFieldProps<string> {
|
||||
name: string;
|
||||
placeholder?: string;
|
||||
settings: PanelSettings;
|
||||
actions?: CustomScript[];
|
||||
onChange: (txtValue: string) => void;
|
||||
}
|
||||
|
||||
@@ -40,12 +39,11 @@ export const TextField: React.FunctionComponent<ITextFieldProps> = ({
|
||||
name,
|
||||
settings,
|
||||
onChange,
|
||||
actions,
|
||||
required
|
||||
}: React.PropsWithChildren<ITextFieldProps>) => {
|
||||
const [, setRequiredFields] = useRecoilState(RequiredFieldsAtom);
|
||||
const [text, setText] = React.useState<string | null | undefined>(undefined);
|
||||
const [loading, setLoading] = React.useState<string | undefined>(undefined);
|
||||
const [loading, setLoading] = React.useState<boolean>(false);
|
||||
const [lastUpdated, setLastUpdated] = React.useState<number | null>(null);
|
||||
const debouncedText = useDebounce<string | null | undefined>(text, DEBOUNCE_TIME);
|
||||
|
||||
@@ -93,62 +91,39 @@ export const TextField: React.FunctionComponent<ITextFieldProps> = ({
|
||||
}
|
||||
}, [showRequiredState, isValid]);
|
||||
|
||||
const suggestDescription = (type: 'ai' | 'copilot') => {
|
||||
setLoading(localize(LocalizationKey.panelFieldsTextFieldAiGenerate));
|
||||
const suggestDescription = () => {
|
||||
setLoading(true);
|
||||
messageHandler.request<string>(CommandToCode.aiSuggestDescription).then((suggestion) => {
|
||||
setLoading(false);
|
||||
|
||||
messageHandler
|
||||
.request<string>(
|
||||
type === 'copilot' ? CommandToCode.copilotSuggestDescription : CommandToCode.aiSuggestDescription
|
||||
)
|
||||
.then((suggestion) => {
|
||||
setLoading(undefined);
|
||||
|
||||
if (suggestion) {
|
||||
setText(suggestion);
|
||||
onChange(suggestion);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading(undefined);
|
||||
});
|
||||
if (suggestion) {
|
||||
setText(suggestion);
|
||||
onChange(suggestion);
|
||||
}
|
||||
}).catch(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const actionElement = useMemo(() => {
|
||||
if (settings.seo.descriptionField !== name) {
|
||||
if (!settings?.aiEnabled || settings.seo.descriptionField !== name) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{settings?.aiEnabled && (
|
||||
<button
|
||||
className="metadata_field__title__action inline-block text-[var(--vscode-editor-foreground)] disabled:opacity-50"
|
||||
title={localize(LocalizationKey.panelFieldsTextFieldAiMessage, label?.toLowerCase())}
|
||||
type="button"
|
||||
onClick={() => suggestDescription('ai')}
|
||||
disabled={!!loading}
|
||||
>
|
||||
<SparklesIcon />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{settings?.copilotEnabled && (
|
||||
<button
|
||||
className="metadata_field__title__action inline-block text-[var(--vscode-editor-foreground)] disabled:opacity-50"
|
||||
title={localize(LocalizationKey.panelFieldsTextFieldCopilotMessage, label?.toLowerCase())}
|
||||
type="button"
|
||||
onClick={() => suggestDescription('copilot')}
|
||||
disabled={!!loading}
|
||||
>
|
||||
<CopilotIcon />
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
<button
|
||||
className='metadata_field__title__action'
|
||||
title={l10n.t(LocalizationKey.panelFieldsTextFieldAiMessage, label?.toLowerCase())}
|
||||
type='button'
|
||||
onClick={() => suggestDescription()}
|
||||
disabled={loading}>
|
||||
<SparklesIcon />
|
||||
</button>
|
||||
);
|
||||
}, [settings?.aiEnabled, settings?.copilotEnabled, name, actions, loading]);
|
||||
}, [settings?.aiEnabled, name]);
|
||||
|
||||
useEffect(() => {
|
||||
if (text !== value && (lastUpdated === null || Date.now() - DEBOUNCE_TIME > lastUpdated)) {
|
||||
if (text !== value && (lastUpdated === null || (Date.now() - DEBOUNCE_TIME) > lastUpdated)) {
|
||||
setText(value || null);
|
||||
}
|
||||
setLastUpdated(null);
|
||||
@@ -162,57 +137,46 @@ export const TextField: React.FunctionComponent<ITextFieldProps> = ({
|
||||
|
||||
return (
|
||||
<div className={`metadata_field`}>
|
||||
<FieldTitle
|
||||
label={label}
|
||||
actionElement={actionElement}
|
||||
icon={<PencilIcon />}
|
||||
required={required}
|
||||
isDisabled={!!loading}
|
||||
customActions={actions}
|
||||
triggerLoading={(message) => setLoading(message)}
|
||||
onChange={onTextChange}
|
||||
/>
|
||||
|
||||
<div className='relative'>
|
||||
{loading && (
|
||||
<div className="metadata_field__loading">
|
||||
{loading}
|
||||
{
|
||||
loading && (
|
||||
<div className='metadata_field__loading'>
|
||||
{l10n.t(LocalizationKey.panelFieldsTextFieldAiGenerate)}
|
||||
</div>
|
||||
)}
|
||||
)
|
||||
}
|
||||
|
||||
{wysiwyg ? (
|
||||
<React.Suspense
|
||||
fallback={<div>{localize(LocalizationKey.panelFieldsTextFieldLoading)}</div>}
|
||||
>
|
||||
<WysiwygField text={text || ''} onChange={onTextChange} />
|
||||
</React.Suspense>
|
||||
) : singleLine ? (
|
||||
<input
|
||||
className={`metadata_field__input`}
|
||||
value={text || ''}
|
||||
onChange={(e) => onTextChange(e.currentTarget.value)}
|
||||
placeholder={placeholder}
|
||||
style={{
|
||||
border
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<textarea
|
||||
className={`metadata_field__textarea`}
|
||||
rows={rows || 2}
|
||||
value={text || ''}
|
||||
onChange={(e) => onTextChange(e.currentTarget.value)}
|
||||
placeholder={placeholder}
|
||||
style={{
|
||||
border
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<FieldTitle label={label} actionElement={actionElement} icon={<PencilIcon />} required={required} />
|
||||
|
||||
{wysiwyg ? (
|
||||
<React.Suspense fallback={<div>{l10n.t(LocalizationKey.panelFieldsTextFieldLoading)}</div>}>
|
||||
<WysiwygField text={text || ''} onChange={onTextChange} />
|
||||
</React.Suspense>
|
||||
) : singleLine ? (
|
||||
<input
|
||||
className={`metadata_field__input`}
|
||||
value={text || ''}
|
||||
onChange={(e) => onTextChange(e.currentTarget.value)}
|
||||
placeholder={placeholder}
|
||||
style={{
|
||||
border
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<textarea
|
||||
className={`metadata_field__textarea`}
|
||||
rows={rows || 2}
|
||||
value={text || ''}
|
||||
onChange={(e) => onTextChange(e.currentTarget.value)}
|
||||
placeholder={placeholder}
|
||||
style={{
|
||||
border
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{limit && limit > 0 && (text || '').length > limit && (
|
||||
<div className={`metadata_field__limit`}>
|
||||
{localize(LocalizationKey.panelFieldsTextFieldLimit, `${(text || '').length}/${limit}`)}
|
||||
{l10n.t(LocalizationKey.panelFieldsTextFieldLimit, `${(text || '').length}/${limit}`)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -211,12 +211,11 @@ export const WrapperField: React.FunctionComponent<IWrapperFieldProps> = ({
|
||||
singleLine={field.single}
|
||||
limit={limit}
|
||||
wysiwyg={field.wysiwyg}
|
||||
rows={4}
|
||||
rows={3}
|
||||
onChange={onFieldChange}
|
||||
value={(fieldValue as string) || null}
|
||||
required={!!field.required}
|
||||
settings={settings}
|
||||
actions={field.actions}
|
||||
/>
|
||||
</FieldBoundary>
|
||||
);
|
||||
@@ -252,7 +251,6 @@ export const WrapperField: React.FunctionComponent<IWrapperFieldProps> = ({
|
||||
multiple={field.multiple}
|
||||
blockData={blockData}
|
||||
onChange={onFieldChange}
|
||||
actions={field.actions}
|
||||
/>
|
||||
</FieldBoundary>
|
||||
);
|
||||
@@ -309,7 +307,6 @@ export const WrapperField: React.FunctionComponent<IWrapperFieldProps> = ({
|
||||
limit={field.taxonomyLimit}
|
||||
renderAsString={field.singleValueAsString}
|
||||
required={!!field.required}
|
||||
actions={field.actions}
|
||||
/>
|
||||
</FieldBoundary>
|
||||
);
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export interface ICopilotIconProps { }
|
||||
|
||||
export const CopilotIcon: React.FunctionComponent<ICopilotIconProps> = (props: React.PropsWithChildren<ICopilotIconProps>) => {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 208">
|
||||
<path fill='currentcolor' d="M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48" />
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
@@ -3,7 +3,6 @@ export * from './ArchiveIcon';
|
||||
export * from './BranchIcon';
|
||||
export * from './BugIcon';
|
||||
export * from './CenterIcon';
|
||||
export * from './CopilotIcon';
|
||||
export * from './FileIcon';
|
||||
export * from './FolderOpenedIcon';
|
||||
export * from './FrontMatterIcon';
|
||||
|
||||
@@ -12,7 +12,6 @@ import { FEATURE_FLAG, GeneralCommands } from '../../constants';
|
||||
import { Messenger } from '@estruyf/vscode/dist/client';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
import { DEFAULT_PANEL_FEATURE_FLAGS } from '../../constants/DefaultFeatureFlags';
|
||||
|
||||
export interface IMetadata {
|
||||
[prop: string]: string[] | string | null | IMetadata;
|
||||
@@ -93,29 +92,27 @@ const Metadata: React.FunctionComponent<IMetadataProps> = ({
|
||||
|
||||
return (
|
||||
<Collapsible
|
||||
id={`metadata`}
|
||||
id={`tags`}
|
||||
title={`${l10n.t(LocalizationKey.panelMetadataTitle)}${contentType?.name ? ` (${contentType?.name})` : ""}`}
|
||||
className={`inherit z-20`}>
|
||||
<FeatureFlag features={features || DEFAULT_PANEL_FEATURE_FLAGS} flag={FEATURE_FLAG.panel.contentType}>
|
||||
<FeatureFlag features={features || []} flag={FEATURE_FLAG.panel.contentType}>
|
||||
<ContentTypeValidator fields={contentType?.fields || []} metadata={metadata} />
|
||||
</FeatureFlag>
|
||||
|
||||
<div className='metadata_fields space-y-6'>
|
||||
{
|
||||
metadata.fmError && metadata.fmErrorMessage ? (
|
||||
<div className={`space-y-4`}>
|
||||
<p className={`text-[var(--vscode-errorForeground)]`}>{metadata.fmError}</p>
|
||||
{
|
||||
metadata.fmError && metadata.fmErrorMessage ? (
|
||||
<div className={`space-y-4`}>
|
||||
<p className={`text-[var(--vscode-errorForeground)]`}>{metadata.fmError}</p>
|
||||
|
||||
<button
|
||||
title={l10n.t(LocalizationKey.panelMetadataFocusProblems)}
|
||||
onClick={focusProblems}
|
||||
type={`button`}>
|
||||
{l10n.t(LocalizationKey.panelMetadataFocusProblems)}
|
||||
</button>
|
||||
</div>
|
||||
) : allFields
|
||||
}
|
||||
</div>
|
||||
<button
|
||||
title={l10n.t(LocalizationKey.panelMetadataFocusProblems)}
|
||||
onClick={focusProblems}
|
||||
type={`button`}>
|
||||
{l10n.t(LocalizationKey.panelMetadataFocusProblems)}
|
||||
</button>
|
||||
</div>
|
||||
) : allFields
|
||||
}
|
||||
</Collapsible>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { PanelSettings, SEO } from '../../models/PanelSettings';
|
||||
import { SEO } from '../../models/PanelSettings';
|
||||
import { TagType } from '../TagType';
|
||||
import { ArticleDetails } from './ArticleDetails';
|
||||
import { Collapsible } from './Collapsible';
|
||||
@@ -8,55 +8,49 @@ import { SymbolKeywordIcon } from './Icons/SymbolKeywordIcon';
|
||||
import { SeoFieldInfo } from './SeoFieldInfo';
|
||||
import { SeoKeywords } from './SeoKeywords';
|
||||
import { TagPicker } from './Fields/TagPicker';
|
||||
import { LocalizationKey, localize } from '../../localization';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../localization';
|
||||
import { VSCodeTable, VSCodeTableBody, VSCodeTableHead, VSCodeTableHeader, VSCodeTableRow } from './VSCode/VSCodeTable';
|
||||
import useContentType from '../../hooks/useContentType';
|
||||
|
||||
export interface ISeoStatusProps {
|
||||
seo: SEO;
|
||||
metadata: any;
|
||||
settings: PanelSettings | undefined;
|
||||
data: any;
|
||||
focusElm: TagType | null;
|
||||
unsetFocus: () => void;
|
||||
}
|
||||
|
||||
const SeoStatus: React.FunctionComponent<ISeoStatusProps> = ({
|
||||
metadata,
|
||||
data,
|
||||
seo,
|
||||
settings,
|
||||
focusElm,
|
||||
unsetFocus
|
||||
}: React.PropsWithChildren<ISeoStatusProps>) => {
|
||||
const contentType = useContentType(settings, metadata);
|
||||
const { slug } = metadata;
|
||||
const { title, slug } = data;
|
||||
|
||||
const { descriptionField, titleField } = seo;
|
||||
|
||||
const tableContent = React.useMemo(() => {
|
||||
const titleFieldName = contentType?.fields.find(f => f.name === titleField)?.title || titleField;
|
||||
const descriptionFieldName = contentType?.fields.find(f => f.name === descriptionField)?.title || descriptionField;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={`seo__status__details`}>
|
||||
<h4>{localize(LocalizationKey.panelSeoStatusTitle)}</h4>
|
||||
<h4>{l10n.t(LocalizationKey.panelSeoStatusTitle)}</h4>
|
||||
|
||||
<VSCodeTable>
|
||||
<VSCodeTableHeader>
|
||||
<VSCodeTableRow>
|
||||
<VSCodeTableHead>{localize(LocalizationKey.panelSeoStatusHeaderProperty)}</VSCodeTableHead>
|
||||
<VSCodeTableHead>{localize(LocalizationKey.panelSeoStatusHeaderLength)}</VSCodeTableHead>
|
||||
<VSCodeTableHead>{localize(LocalizationKey.panelSeoStatusHeaderValid)}</VSCodeTableHead>
|
||||
<VSCodeTableHead>{l10n.t(LocalizationKey.panelSeoStatusHeaderProperty)}</VSCodeTableHead>
|
||||
<VSCodeTableHead>{l10n.t(LocalizationKey.panelSeoStatusHeaderLength)}</VSCodeTableHead>
|
||||
<VSCodeTableHead>{l10n.t(LocalizationKey.panelSeoStatusHeaderValid)}</VSCodeTableHead>
|
||||
</VSCodeTableRow>
|
||||
</VSCodeTableHeader>
|
||||
|
||||
<VSCodeTableBody>
|
||||
{metadata[titleField] && seo.title > 0 ? (
|
||||
{data[titleField] && seo.title > 0 ? (
|
||||
<SeoFieldInfo
|
||||
title={titleFieldName}
|
||||
value={metadata[titleField].length}
|
||||
recommendation={localize(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.title)}
|
||||
isValid={metadata[titleField].length <= seo.title}
|
||||
title={titleField}
|
||||
value={data[titleField].length}
|
||||
recommendation={l10n.t(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.title)}
|
||||
isValid={data[titleField].length <= seo.title}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -64,25 +58,25 @@ const SeoStatus: React.FunctionComponent<ISeoStatusProps> = ({
|
||||
<SeoFieldInfo
|
||||
title={`slug`}
|
||||
value={slug.length}
|
||||
recommendation={localize(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.slug)}
|
||||
recommendation={l10n.t(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.slug)}
|
||||
isValid={slug.length <= seo.slug}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{metadata[descriptionField] && seo.description > 0 ? (
|
||||
{data[descriptionField] && seo.description > 0 ? (
|
||||
<SeoFieldInfo
|
||||
title={descriptionFieldName}
|
||||
value={metadata[descriptionField].length}
|
||||
recommendation={localize(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.description)}
|
||||
isValid={metadata[descriptionField].length <= seo.description}
|
||||
title={descriptionField}
|
||||
value={data[descriptionField].length}
|
||||
recommendation={l10n.t(LocalizationKey.panelSeoStatusSeoFieldInfoCharacters, seo.description)}
|
||||
isValid={data[descriptionField].length <= seo.description}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{seo.content > 0 && metadata?.articleDetails?.wordCount > 0 ? (
|
||||
{seo.content > 0 && data?.articleDetails?.wordCount > 0 ? (
|
||||
<SeoFieldInfo
|
||||
title={localize(LocalizationKey.panelSeoStatusSeoFieldInfoArticle)}
|
||||
value={metadata?.articleDetails?.wordCount}
|
||||
recommendation={localize(LocalizationKey.panelSeoStatusSeoFieldInfoWords, seo.content)}
|
||||
title={l10n.t(LocalizationKey.panelSeoStatusSeoFieldInfoArticle)}
|
||||
value={data?.articleDetails?.wordCount}
|
||||
recommendation={l10n.t(LocalizationKey.panelSeoStatusSeoFieldInfoWords, seo.content)}
|
||||
/>
|
||||
) : null}
|
||||
</VSCodeTableBody>
|
||||
@@ -90,20 +84,20 @@ const SeoStatus: React.FunctionComponent<ISeoStatusProps> = ({
|
||||
</div>
|
||||
|
||||
<SeoKeywords
|
||||
keywords={metadata?.keywords}
|
||||
title={metadata[titleField]}
|
||||
description={metadata[descriptionField]}
|
||||
slug={metadata.slug}
|
||||
headings={metadata?.articleDetails?.headingsText}
|
||||
wordCount={metadata?.articleDetails?.wordCount}
|
||||
content={metadata?.articleDetails?.content}
|
||||
keywords={data?.keywords}
|
||||
title={title}
|
||||
description={data[descriptionField]}
|
||||
slug={data.slug}
|
||||
headings={data?.articleDetails?.headingsText}
|
||||
wordCount={data?.articleDetails?.wordCount}
|
||||
content={data?.articleDetails?.content}
|
||||
/>
|
||||
|
||||
<FieldBoundary fieldName={`Keywords`}>
|
||||
<TagPicker
|
||||
type={TagType.keywords}
|
||||
icon={<SymbolKeywordIcon />}
|
||||
crntSelected={(metadata.keywords as string[]) || []}
|
||||
crntSelected={(data.keywords as string[]) || []}
|
||||
options={[]}
|
||||
freeform={true}
|
||||
focussed={focusElm === TagType.keywords}
|
||||
@@ -112,17 +106,17 @@ const SeoStatus: React.FunctionComponent<ISeoStatusProps> = ({
|
||||
/>
|
||||
</FieldBoundary>
|
||||
|
||||
<ArticleDetails details={metadata.articleDetails} />
|
||||
<ArticleDetails details={data.articleDetails} />
|
||||
</div>
|
||||
);
|
||||
}, [contentType, metadata, seo, focusElm, unsetFocus]);
|
||||
}, [data, seo, focusElm, unsetFocus]);
|
||||
|
||||
return (
|
||||
<Collapsible id={`seo`} title={localize(LocalizationKey.panelSeoStatusCollapsibleTitle)}>
|
||||
{!metadata[titleField] && !metadata[descriptionField] ? (
|
||||
<Collapsible id={`seo`} title={l10n.t(LocalizationKey.panelSeoStatusCollapsibleTitle)}>
|
||||
{!title && !data[descriptionField] ? (
|
||||
<div className={`seo__status__empty`}>
|
||||
<p>
|
||||
{localize(LocalizationKey.panelSeoStatusRequired, titleField, descriptionField)}
|
||||
{l10n.t(LocalizationKey.panelSeoStatusRequired, "Title", descriptionField)}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -316,6 +316,7 @@ button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
&.metadata_field__alert {
|
||||
justify-content: flex-start;
|
||||
@@ -325,31 +326,31 @@ button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.metadata_field__title__action {
|
||||
all: unset;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
background: none;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
|
||||
&:hover {
|
||||
color: var(--vscode-button-hoverBackground);
|
||||
fill: var(--vscode-button-hoverBackground);
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
button {
|
||||
all: unset;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
color: var(--vscode-disabledForeground);
|
||||
background: none;
|
||||
}
|
||||
.metadata_field__title__action {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
|
||||
svg {
|
||||
margin-right: 0;
|
||||
&:hover {
|
||||
color: var(--vscode-button-hoverBackground);
|
||||
fill: var(--vscode-button-hoverBackground);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
color: var(--vscode-disabledForeground);
|
||||
}
|
||||
|
||||
svg {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,15 +364,15 @@ button {
|
||||
}
|
||||
|
||||
.metadata_field__loading {
|
||||
border-radius: 0.25rem;
|
||||
backdrop-filter: blur(15px);
|
||||
position: absolute;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: calc(100% + 2.5em);
|
||||
background-color: var(--vscode-button-secondaryBackground);
|
||||
color: var(--vscode-button-secondaryForeground);
|
||||
top: 0;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
top: 30px;
|
||||
left: -1.25rem;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import { commands, Uri, window } from 'vscode';
|
||||
import { EXTENSION_COMMAND_PREFIX } from '../constants';
|
||||
|
||||
export class UriHandler {
|
||||
/**
|
||||
* Register the URI handler
|
||||
*/
|
||||
public static register() {
|
||||
window.registerUriHandler({
|
||||
handleUri(uri: Uri) {
|
||||
const queryParams = new URLSearchParams(uri.query);
|
||||
if (!queryParams.has('command')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const command = queryParams.get('command');
|
||||
let args = queryParams.get('args');
|
||||
|
||||
if (!command || !command.startsWith(EXTENSION_COMMAND_PREFIX)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args) {
|
||||
try {
|
||||
args = JSON.parse(args);
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
}
|
||||
|
||||
commands.executeCommand(command, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
import {
|
||||
CancellationTokenSource,
|
||||
LanguageModelChatMessage,
|
||||
LanguageModelChatResponse,
|
||||
extensions,
|
||||
lm,
|
||||
version as VscodeVersion
|
||||
} from 'vscode';
|
||||
import { Logger, Settings, TaxonomyHelper } from '../helpers';
|
||||
import {
|
||||
SETTING_COPILOT_FAMILY,
|
||||
SETTING_SEO_DESCRIPTION_LENGTH,
|
||||
SETTING_SEO_TITLE_LENGTH
|
||||
} from '../constants';
|
||||
import { TagType } from '../panelWebView/TagType';
|
||||
import { TaxonomyType } from '../models';
|
||||
|
||||
export class Copilot {
|
||||
private static personality =
|
||||
'You are a CMS expert for Front Matter CMS and your task is to assist the user to help generate content for their article.';
|
||||
|
||||
/**
|
||||
* Checks if the GitHub Copilot extension is installed.
|
||||
* @returns A promise that resolves to a boolean indicating whether the extension is installed.
|
||||
*/
|
||||
public static async isInstalled(): Promise<boolean> {
|
||||
const version = VscodeVersion.split('.').map((v) => parseInt(v));
|
||||
// GitHub Copilot requires VS Code version 1.92 or higher
|
||||
if (version[0] < 1 || (version[0] === 1 && version[1] < 92)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const copilotExt = extensions.getExtension(`GitHub.copilot`);
|
||||
return !!copilotExt;
|
||||
}
|
||||
|
||||
public static async suggestTitles(title: string): Promise<string[] | undefined> {
|
||||
if (!title) {
|
||||
return;
|
||||
}
|
||||
|
||||
const chars = Settings.get<number>(SETTING_SEO_TITLE_LENGTH) || 60;
|
||||
const messages = [
|
||||
LanguageModelChatMessage.User(Copilot.personality),
|
||||
LanguageModelChatMessage.User(
|
||||
`The user wants you to create a SEO friendly title. You should give the user a couple of suggestions based on the provided title.
|
||||
|
||||
IMPORTANT: You are only allowed to respond with a text that should not exceed ${chars} characters in length.
|
||||
|
||||
Desired format: just a string, e.g. "My first blog post". Each suggestion is separated by a new line.`
|
||||
),
|
||||
LanguageModelChatMessage.User(`The title of the blog post is """${title}""".`)
|
||||
];
|
||||
|
||||
const chatResponse = await this.getChatResponse(messages);
|
||||
if (!chatResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
let titles = chatResponse.split('\n').map((title) => title.trim());
|
||||
// Remove 1. or - from the beginning of the title
|
||||
titles = titles.map((title) => title.replace(/^\d+\.\s+|-/, '').trim());
|
||||
// Only take the titles wrapped in quotes
|
||||
titles = titles.filter((title) => title.startsWith('"') && title.endsWith('"'));
|
||||
// Remove the quotes from the beginning and end of the title
|
||||
titles = titles.map((title) => title.slice(1, -1));
|
||||
return titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SEO friendly abstract/description for an article based on the provided title and content.
|
||||
*
|
||||
* @param title - The title of the blog post.
|
||||
* @param content - The content of the blog post.
|
||||
* @returns A chat response containing the generated description.
|
||||
*/
|
||||
public static async suggestDescription(title: string, content?: string) {
|
||||
if (!title) {
|
||||
return;
|
||||
}
|
||||
|
||||
const chars = Settings.get<number>(SETTING_SEO_DESCRIPTION_LENGTH) || 160;
|
||||
const messages = [
|
||||
LanguageModelChatMessage.User(Copilot.personality),
|
||||
LanguageModelChatMessage.User(
|
||||
`The user wants you to create a SEO friendly abstract/description. When the user provides a title and/or content, you should use this information to generate the description.
|
||||
|
||||
IMPORTANT: You are only allowed to respond with a text that should not exceed ${chars} characters in length.`
|
||||
),
|
||||
LanguageModelChatMessage.User(`The title of the blog post is """${title}""".`)
|
||||
];
|
||||
|
||||
if (content) {
|
||||
messages.push(
|
||||
LanguageModelChatMessage.User(`The content of the blog post is: """${content}""".`)
|
||||
);
|
||||
}
|
||||
|
||||
const chatResponse = await this.getChatResponse(messages);
|
||||
return chatResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggests taxonomy tags based on the provided title, tag type, description, and content.
|
||||
*
|
||||
* @param title - The title of the blog post.
|
||||
* @param tagType - The type of taxonomy tags to suggest (Tag or Category).
|
||||
* @param description - The description of the blog post (optional).
|
||||
* @param content - The content of the blog post (optional).
|
||||
* @returns A promise that resolves to an array of suggested taxonomy tags, or undefined if no title is provided.
|
||||
*/
|
||||
public static async suggestTaxonomy(
|
||||
title: string,
|
||||
tagType: TagType,
|
||||
description?: string,
|
||||
content?: string
|
||||
): Promise<string[] | undefined> {
|
||||
if (!title) {
|
||||
return;
|
||||
}
|
||||
|
||||
const messages = [
|
||||
LanguageModelChatMessage.User(Copilot.personality),
|
||||
LanguageModelChatMessage.User(
|
||||
`The user wants you to suggest some taxonomy tags. When the user provides a title, description, list of available taxonomy tags, and/or content, you should use this information to generate the tags.
|
||||
|
||||
IMPORTANT: You are only allowed to respond with a list of tags separated by commas. Example: tag1, tag2, tag3.`
|
||||
),
|
||||
LanguageModelChatMessage.User(`The title of the blog post is """${title}""".`)
|
||||
];
|
||||
|
||||
if (description) {
|
||||
messages.push(
|
||||
LanguageModelChatMessage.User(`The description of the blog post is: """${description}""".`)
|
||||
);
|
||||
}
|
||||
|
||||
let options =
|
||||
tagType === TagType.tags
|
||||
? await TaxonomyHelper.get(TaxonomyType.Tag)
|
||||
: await TaxonomyHelper.get(TaxonomyType.Category);
|
||||
const optionsString = options?.join(',') || '';
|
||||
|
||||
if (optionsString) {
|
||||
messages.push(
|
||||
LanguageModelChatMessage.User(
|
||||
`The available taxonomy tags are: ${optionsString}. Please select the tags that are relevant to the article. You are allowed to suggest a maximum of 5 tags and suggest new tags if necessary.`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (content) {
|
||||
messages.push(
|
||||
LanguageModelChatMessage.User(`The content of the blog post is: """${content}""".`)
|
||||
);
|
||||
}
|
||||
|
||||
const chatResponse = await this.getChatResponse(messages);
|
||||
|
||||
if (!chatResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the chat response contains a colon character, we take the text after the colon as the response.
|
||||
if (chatResponse.includes(':')) {
|
||||
return chatResponse
|
||||
.split(':')[1]
|
||||
.split(',')
|
||||
.map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
// Otherwise, we split the response by commas.
|
||||
return chatResponse.split(',').map((tag) => tag.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the chat response from the language model.
|
||||
* @param messages - The chat messages to send to the language model.
|
||||
* @returns The concatenated text fragments from the chat response.
|
||||
*/
|
||||
private static async getChatResponse(messages: LanguageModelChatMessage[]) {
|
||||
let chatResponse: LanguageModelChatResponse | undefined;
|
||||
|
||||
try {
|
||||
const model = await this.getModel();
|
||||
chatResponse = await model.sendRequest(messages, {}, new CancellationTokenSource().token);
|
||||
} catch (err) {
|
||||
Logger.error(`Copilot:getChatResponse:: ${(err as Error).message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let allFragments = [];
|
||||
for await (const fragment of chatResponse.text) {
|
||||
allFragments.push(fragment);
|
||||
}
|
||||
|
||||
return allFragments.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the chat model for the Copilot service.
|
||||
* @returns A Promise that resolves to the chat model.
|
||||
*/
|
||||
private static async getModel() {
|
||||
const [model] = await lm.selectChatModels({
|
||||
vendor: 'copilot',
|
||||
family: Settings.get<string>(SETTING_COPILOT_FAMILY) || 'gpt-3.5-turbo'
|
||||
});
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user