more tweaks and fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-18 20:45:55 +03:00
parent a6670280cd
commit 39582485f7
4 changed files with 26 additions and 24 deletions

View File

@ -51,8 +51,8 @@ Promise.all([
store.next.update( store.next.update(
pwpath.sanitize(pwpath.SYSTEM_PATH), pwpath.sanitize(pwpath.SYSTEM_PATH),
Object.create(basestore.BaseStore).load(page.System)), Object.create(basestore.BaseStore).load(page.System)),
store.update('Settings', store.update('.config',
Object.create(basestore.BaseStore).load(page.Settings)), Object.create(basestore.BaseStore).load(page.Config)),
store.update('Test', store.update('Test',
Object.create(basestore.BaseStore).load(page.Test)), Object.create(basestore.BaseStore).load(page.Test)),

View File

@ -1313,7 +1313,7 @@ object.Constructor('Page', BasePage, {
'!': Object.assign( '!': Object.assign(
function(){ function(){
return this.get('.:$ARGS', {energetic: true}).raw }, return this.get('..:$ARGS', {energetic: true}).raw },
{energetic: true}), {energetic: true}),
// XXX DEBUG -- remove these... // XXX DEBUG -- remove these...
@ -1790,16 +1790,11 @@ module.System = {
text: '@include(.:$ARGS isolated join="@source(file-separator)")' }, text: '@include(.:$ARGS isolated join="@source(file-separator)")' },
// XXX /rootpath here is not relative -- makes reuse harder... // XXX /rootpath here is not relative -- makes reuse harder...
_view: { _view: {
// XXX can we avoid explicitly passing args to ./location ????
// i.e. do:
// @source(./location)
// instead of (current):
// @source(./location:$ARGS)
text: object.doc` text: object.doc`
<slot name="header"> <slot name="header">
<a href="#/list">&#9776</a> <a href="#/list">&#9776</a>
@source(./location) @source(./location/!)
<a href="#@source(./path)/_edit">&#9998;</a> <a href="#@source(./path/!)/edit">&#9998;</a>
</slot> </slot>
<hr> <hr>
<slot name="content"></slot> <slot name="content"></slot>
@ -1838,7 +1833,7 @@ module.System = {
/*/ /*/
_edit: { _edit: {
text: text:
'@source(./path)' '@source(./path/!)'
+'<hr>' +'<hr>'
+'<macro src="." join="@source(file-separator)">' +'<macro src="." join="@source(file-separator)">'
+'<h1 ' +'<h1 '
@ -1875,8 +1870,8 @@ module.System = {
</slot>`}, </slot>`},
// XXX debug... // XXX debug...
_path: {text: '@source(./path join=" ")'}, _path: {text: '@source(./path/! join=" ")'},
_location: {text: '@source(./location join=" ")'}, _location: {text: '@source(./location/! join=" ")'},
list: { list: {
@ -2166,8 +2161,8 @@ PAGES=100
for(var i=0; i<PAGES; i++){ for(var i=0; i<PAGES; i++){
Test['Subtree/Page'+i] = {text: 'page: '+i} } Test['Subtree/Page'+i] = {text: 'page: '+i} }
var Settings = var Config =
module.Settings = { module.Config = {
Export: { Export: {
text: '<button onclick="exportData()">Export</button>' }, text: '<button onclick="exportData()">Export</button>' },
// XXX // XXX

View File

@ -297,12 +297,20 @@ require(['./browser'], function(browser){
// Export... // Export...
// XXX // XXX
var exportData = async function(){ var exportData = async function(options={}){
var blob = new Blob([await pwiki.store.json(true)], {type: "text/plain;charset=utf-8"}); var filename
if(typeof(options) == 'string'){
filename = options
options = arguments[1] ?? {} }
var blob = new Blob(
[await pwiki.store.json({stringify: true, space: 4, ...options})],
{type: "text/plain;charset=utf-8"});
var a = document.createElement('a') var a = document.createElement('a')
var blobURL = a.href = URL.createObjectURL(blob) var blobURL = a.href = URL.createObjectURL(blob)
a.download = 'pWiki-dump.json' a.download = filename
?? options.filename
?? 'pWiki-dump.json'
//document.body.appendChild(a) //document.body.appendChild(a)
a.dispatchEvent(new MouseEvent("click")) a.dispatchEvent(new MouseEvent("click"))

View File

@ -4,6 +4,8 @@
* XXX ASAP start writing docs in pwiki * XXX ASAP start writing docs in pwiki
* - WYSIWYG markdown editor/viewer (ASAP) * - WYSIWYG markdown editor/viewer (ASAP)
* - fs store/export in browser or a simple way to export/import... * - fs store/export in browser or a simple way to export/import...
*
*
* XXX might also be a good idea to investigate a .tree directory index * XXX might also be a good idea to investigate a .tree directory index
* as a supplement to .paths() * as a supplement to .paths()
* XXX Q: can we access fs from a pwa??? * XXX Q: can we access fs from a pwa???
@ -33,6 +35,7 @@
* +--------------+ . . search * +--------------+ . . search
* order is not relevant here... * order is not relevant here...
* each of the methods narrows down the previous' results * each of the methods narrows down the previous' results
* XXX revise/update sort...
* XXX FEATURE tags: might be a good idea to add a .__match__(..) hook * XXX FEATURE tags: might be a good idea to add a .__match__(..) hook
* to enable store-level matching optimization... * to enable store-level matching optimization...
* ...not trivial to route to alk the stores... * ...not trivial to route to alk the stores...
@ -52,9 +55,6 @@
* i.e. a way to pass tags through path... * i.e. a way to pass tags through path...
* /some/path:tags=a,b,c * /some/path:tags=a,b,c
* XXX FEATURE images... * XXX FEATURE images...
* XXX rename??
* System -> .system
* Config -> .pwiki
* XXX async/live render... * XXX async/live render...
* might be fun to push the async parts of the render to the dom... * might be fun to push the async parts of the render to the dom...
* ...i.e. return a partially rendered DOM with handlers to fill * ...i.e. return a partially rendered DOM with handlers to fill
@ -93,7 +93,6 @@
* any resyrictions other than the internally reserved * any resyrictions other than the internally reserved
* cars... * cars...
* (currently: '#', and ':') * (currently: '#', and ':')
* XXX revise/update sort...
* XXX ASAP: MetaStore: need to correctly integrate the following store * XXX ASAP: MetaStore: need to correctly integrate the following store
* methods: * methods:
* .get(..) -- DONE * .get(..) -- DONE
@ -488,8 +487,8 @@ Promise.all([
store.next.update( store.next.update(
pwpath.sanitize(pwpath.SYSTEM_PATH), pwpath.sanitize(pwpath.SYSTEM_PATH),
Object.create(basestore.BaseStore).load(page.System)), Object.create(basestore.BaseStore).load(page.System)),
store.update('Settings', store.update('.config',
Object.create(basestore.BaseStore).load(page.Settings)), Object.create(basestore.BaseStore).load(page.Config)),
]) ])