Skip to content

Commit

Permalink
spec export single note
Browse files Browse the repository at this point in the history
  • Loading branch information
rosano committed Mar 2, 2024
1 parent 5a9fe72 commit d145c81
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions os-app/open-guide/text-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ After setting up a custom domain, designate any note as the home page with the `
| `KVCWriteDetailToolbarUnarchiveButtonText` | Launcher |
| `KVCWriteDetailLauncherItemCloneText` | Launcher |
| `KVCWriteDetailLauncherItemShowLocalVersionsText` | Launcher |
| `KVCWriteDetailLauncherItemExportText` | Launcher |
| `KVCWriteDetailLauncherItemDebugText` | Launcher |
| KVCWriteDetailToolbarJumpButtonText | `AccessKey+j` |
| Select previous or next note, if filter field is focused | `Up` or `Down` |
Expand Down
13 changes: 13 additions & 0 deletions os-app/open-write/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,18 @@ const mod = {
mod.ControlNoteClone(mod._OLSKCatalog.modPublic.OLSKCatalogDataItemSelected());
},
async KVCWriteDetailDispatchExport () {
const zip = new JSZip();
[mod._OLSKCatalog.modPublic.OLSKCatalogDataItemSelected()].forEach(function (e) {
zip.file(`${ e.KVCNoteID }.txt`, e.KVCNoteBody, {
date: e.KVCNoteModificationDate,
});
});
return saveAs(await zip.generateAsync({type: 'blob'}), mod.DataExportZIPFilename());
},
KVCWriteDetailDispatchDebug () {
const url = `https://inspektor.5apps.com/inspect?path=wikiavec%2F${ encodeURIComponent(KVCNote.KVCNoteObjectPath(mod._OLSKCatalog.modPublic.OLSKCatalogDataItemSelected())) }`;
Expand Down Expand Up @@ -1145,6 +1157,7 @@ import OLSKUIAssets from 'OLSKUIAssets';
KVCWriteDetailDispatchRetract={ mod.KVCWriteDetailDispatchRetract }
KVCWriteDetailDispatchVersions={ mod.KVCWriteDetailDispatchVersions }
KVCWriteDetailDispatchClone={ mod.KVCWriteDetailDispatchClone }
KVCWriteDetailDispatchExport={ mod.KVCWriteDetailDispatchExport }
KVCWriteDetailDispatchDebug={ mod.KVCWriteDetailDispatchDebug }
KVCWriteDetailDispatchDiscard={ mod.KVCWriteDetailDispatchDiscard }
KVCWriteDetailDispatchUpdate={ mod.KVCWriteDetailDispatchUpdate }
Expand Down
1 change: 1 addition & 0 deletions os-app/sub-detail/i18n-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ KVCWriteDetailToolbarRetractButtonText: Retract
KVCWriteDetailToolbarDiscardButtonText: Discard
KVCWriteDetailLauncherItemShowLocalVersionsText: Show local versions
KVCWriteDetailLauncherItemCloneText: Clone
KVCWriteDetailLauncherItemExportText: Export note
KVCWriteDetailLauncherItemDebugText: Debug note
KVCWriteDetailLauncherItemOpenPublicLinkText: Open public link
KVCWriteDetailLauncherItemSetAsRootPageText: Set as homepage
1 change: 1 addition & 0 deletions os-app/sub-detail/i18n-es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ KVCWriteDetailToolbarRetractButtonText: Retractarse
KVCWriteDetailToolbarDiscardButtonText: Eliminar
KVCWriteDetailLauncherItemShowLocalVersionsText: Mostrar versiones locales
KVCWriteDetailLauncherItemCloneText: Clonar
KVCWriteDetailLauncherItemExportText: Exportar note
KVCWriteDetailLauncherItemDebugText: Debug nota
KVCWriteDetailLauncherItemOpenPublicLinkText: Abrir enlace público
KVCWriteDetailLauncherItemSetAsRootPageText: Fijar como página de raíz
1 change: 1 addition & 0 deletions os-app/sub-detail/i18n-fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ KVCWriteDetailToolbarRetractButtonText: Rétracter
KVCWriteDetailToolbarDiscardButtonText: Supprimer
KVCWriteDetailLauncherItemShowLocalVersionsText: Montrer des versions locales
KVCWriteDetailLauncherItemCloneText: Cloner
KVCWriteDetailLauncherItemExportText: Exporter note
KVCWriteDetailLauncherItemDebugText: Déboguer note
KVCWriteDetailLauncherItemOpenPublicLinkText: Ouvrir le lien publique
KVCWriteDetailLauncherItemSetAsRootPageText: Fixer comme page de racine
1 change: 1 addition & 0 deletions os-app/sub-detail/i18n-pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ KVCWriteDetailToolbarRetractButtonText: Retirar
KVCWriteDetailToolbarDiscardButtonText: Descartar
KVCWriteDetailLauncherItemShowLocalVersionsText: Mostrar versões locais
KVCWriteDetailLauncherItemCloneText: Clonar
KVCWriteDetailLauncherItemExportText: Exportar nota
KVCWriteDetailLauncherItemDebugText: Debug nota
KVCWriteDetailLauncherItemOpenPublicLinkText: Abrir link público
KVCWriteDetailLauncherItemSetAsRootPageText: Definir como página inicial
7 changes: 7 additions & 0 deletions os-app/sub-detail/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export let KVCWriteDetailDispatchPublish;
export let KVCWriteDetailDispatchRetract;
export let KVCWriteDetailDispatchVersions;
export let KVCWriteDetailDispatchClone;
export let KVCWriteDetailDispatchExport;
export let KVCWriteDetailDispatchDebug;
export let KVCWriteDetailDispatchDiscard;
export let KVCWriteDetailDispatchUpdate;
Expand Down Expand Up @@ -86,6 +87,12 @@ const mod = {
LCHRecipeCallback: function KVCWriteDetailLauncherItemClone () {
KVCWriteDetailDispatchClone();
},
}, {
LCHRecipeSignature: 'KVCWriteDetailLauncherItemExport',
LCHRecipeName: OLSKLocalized('KVCWriteDetailLauncherItemExportText'),
LCHRecipeCallback: function KVCWriteDetailLauncherItemExport () {
KVCWriteDetailDispatchExport();
},
}];
if (!KVCWriteDetailItem.KVCNoteIsArchived) {
Expand Down
3 changes: 3 additions & 0 deletions os-app/sub-detail/rollup-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ const KVCWriteDetail = new RollupStart({
KVCWriteDetailDispatchClone: (function () {
window.TestKVCWriteDetailDispatchClone.innerHTML = parseInt(window.TestKVCWriteDetailDispatchClone.innerHTML) + 1;
}),
KVCWriteDetailDispatchExport: (function () {
window.TestKVCWriteDetailDispatchExport.innerHTML = parseInt(window.TestKVCWriteDetailDispatchExport.innerHTML) + 1;
}),
KVCWriteDetailDispatchDebug: (function () {
window.TestKVCWriteDetailDispatchDebug.innerHTML = parseInt(window.TestKVCWriteDetailDispatchDebug.innerHTML) + 1;
}),
Expand Down
5 changes: 5 additions & 0 deletions os-app/sub-detail/stub-view.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ locals.OLSKPagePublicConstants = {
<span id="TestKVCWriteDetailDispatchClone">0</span>
</p>

<p>
<strong>KVCWriteDetailDispatchExport</strong>
<span id="TestKVCWriteDetailDispatchExport">0</span>
</p>

<p>
<strong>KVCWriteDetailDispatchDebug</strong>
<span id="TestKVCWriteDetailDispatchDebug">0</span>
Expand Down
4 changes: 4 additions & 0 deletions os-app/sub-detail/ui-test-_access.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ describe('KVCWriteDetail_Access', function () {
return browser.assert.OLSKLauncherItems('KVCWriteDetailLauncherItemClone', 1);
});

it('shows KVCWriteDetailLauncherItemExport', function () {
return browser.assert.OLSKLauncherItems('KVCWriteDetailLauncherItemExport', 1);
});

it('hides KVCWriteDetailLauncherItemPublish', function () {
return browser.assert.OLSKLauncherItems('KVCWriteDetailLauncherItemPublish', 0);
});
Expand Down
4 changes: 4 additions & 0 deletions os-app/sub-detail/ui-test-_localize.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ kDefaultRoute.OLSKRouteLanguageCodes.forEach(function (OLSKRoutingLanguage) {
return browser.assert.OLSKLauncherItemText('KVCWriteDetailLauncherItemClone', uLocalized('KVCWriteDetailLauncherItemCloneText'));
});

it('localizes KVCWriteDetailLauncherItemExport', function () {
return browser.assert.OLSKLauncherItemText('KVCWriteDetailLauncherItemExport', uLocalized('KVCWriteDetailLauncherItemExportText'));
});

context('KVCWriteInputDispatchHeaderTokens', function() {

before(function() {
Expand Down
16 changes: 16 additions & 0 deletions os-app/sub-detail/ui-test-_misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,22 @@ describe('KVCWriteDetail_Misc', function () {

});

describe('KVCWriteDetailLauncherItemExport', function test_KVCWriteDetailLauncherItemExport() {

before(function () {
browser.assert.text('#TestKVCWriteDetailDispatchExport', '0');
});

before(function () {
return browser.OLSKLauncherRun('KVCWriteDetailLauncherItemExport');
});

it('sends KVCWriteDetailDispatchExport', function () {
browser.assert.text('#TestKVCWriteDetailDispatchExport', '1');
});

});

describe('KVCWriteDetailLauncherItemArchive', function test_KVCWriteDetailLauncherItemArchive() {

before(function () {
Expand Down

0 comments on commit d145c81

Please sign in to comment.