mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-27 05:01:57 +00:00
more tweaks and fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a6670280cd
commit
39582485f7
@ -51,8 +51,8 @@ Promise.all([
|
||||
store.next.update(
|
||||
pwpath.sanitize(pwpath.SYSTEM_PATH),
|
||||
Object.create(basestore.BaseStore).load(page.System)),
|
||||
store.update('Settings',
|
||||
Object.create(basestore.BaseStore).load(page.Settings)),
|
||||
store.update('.config',
|
||||
Object.create(basestore.BaseStore).load(page.Config)),
|
||||
store.update('Test',
|
||||
Object.create(basestore.BaseStore).load(page.Test)),
|
||||
|
||||
|
||||
@ -1313,7 +1313,7 @@ object.Constructor('Page', BasePage, {
|
||||
|
||||
'!': Object.assign(
|
||||
function(){
|
||||
return this.get('.:$ARGS', {energetic: true}).raw },
|
||||
return this.get('..:$ARGS', {energetic: true}).raw },
|
||||
{energetic: true}),
|
||||
|
||||
// XXX DEBUG -- remove these...
|
||||
@ -1790,16 +1790,11 @@ module.System = {
|
||||
text: '@include(.:$ARGS isolated join="@source(file-separator)")' },
|
||||
// XXX /rootpath here is not relative -- makes reuse harder...
|
||||
_view: {
|
||||
// XXX can we avoid explicitly passing args to ./location ????
|
||||
// i.e. do:
|
||||
// @source(./location)
|
||||
// instead of (current):
|
||||
// @source(./location:$ARGS)
|
||||
text: object.doc`
|
||||
<slot name="header">
|
||||
<a href="#/list">☰</a>
|
||||
@source(./location)
|
||||
<a href="#@source(./path)/_edit">✎</a>
|
||||
@source(./location/!)
|
||||
<a href="#@source(./path/!)/edit">✎</a>
|
||||
</slot>
|
||||
<hr>
|
||||
<slot name="content"></slot>
|
||||
@ -1838,7 +1833,7 @@ module.System = {
|
||||
/*/
|
||||
_edit: {
|
||||
text:
|
||||
'@source(./path)'
|
||||
'@source(./path/!)'
|
||||
+'<hr>'
|
||||
+'<macro src="." join="@source(file-separator)">'
|
||||
+'<h1 '
|
||||
@ -1875,8 +1870,8 @@ module.System = {
|
||||
</slot>`},
|
||||
|
||||
// XXX debug...
|
||||
_path: {text: '@source(./path join=" ")'},
|
||||
_location: {text: '@source(./location join=" ")'},
|
||||
_path: {text: '@source(./path/! join=" ")'},
|
||||
_location: {text: '@source(./location/! join=" ")'},
|
||||
|
||||
|
||||
list: {
|
||||
@ -2166,8 +2161,8 @@ PAGES=100
|
||||
for(var i=0; i<PAGES; i++){
|
||||
Test['Subtree/Page'+i] = {text: 'page: '+i} }
|
||||
|
||||
var Settings =
|
||||
module.Settings = {
|
||||
var Config =
|
||||
module.Config = {
|
||||
Export: {
|
||||
text: '<button onclick="exportData()">Export</button>' },
|
||||
// XXX
|
||||
|
||||
14
pwiki2.html
14
pwiki2.html
@ -297,12 +297,20 @@ require(['./browser'], function(browser){
|
||||
// Export...
|
||||
|
||||
// XXX
|
||||
var exportData = async function(){
|
||||
var blob = new Blob([await pwiki.store.json(true)], {type: "text/plain;charset=utf-8"});
|
||||
var exportData = async function(options={}){
|
||||
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 blobURL = a.href = URL.createObjectURL(blob)
|
||||
a.download = 'pWiki-dump.json'
|
||||
a.download = filename
|
||||
?? options.filename
|
||||
?? 'pWiki-dump.json'
|
||||
|
||||
//document.body.appendChild(a)
|
||||
a.dispatchEvent(new MouseEvent("click"))
|
||||
|
||||
11
pwiki2.js
11
pwiki2.js
@ -4,6 +4,8 @@
|
||||
* XXX ASAP start writing docs in pwiki
|
||||
* - WYSIWYG markdown editor/viewer (ASAP)
|
||||
* - 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
|
||||
* as a supplement to .paths()
|
||||
* XXX Q: can we access fs from a pwa???
|
||||
@ -33,6 +35,7 @@
|
||||
* +--------------+ . . search
|
||||
* order is not relevant here...
|
||||
* 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
|
||||
* to enable store-level matching optimization...
|
||||
* ...not trivial to route to alk the stores...
|
||||
@ -52,9 +55,6 @@
|
||||
* i.e. a way to pass tags through path...
|
||||
* /some/path:tags=a,b,c
|
||||
* XXX FEATURE images...
|
||||
* XXX rename??
|
||||
* System -> .system
|
||||
* Config -> .pwiki
|
||||
* XXX async/live render...
|
||||
* 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
|
||||
@ -93,7 +93,6 @@
|
||||
* any resyrictions other than the internally reserved
|
||||
* cars...
|
||||
* (currently: '#', and ':')
|
||||
* XXX revise/update sort...
|
||||
* XXX ASAP: MetaStore: need to correctly integrate the following store
|
||||
* methods:
|
||||
* .get(..) -- DONE
|
||||
@ -488,8 +487,8 @@ Promise.all([
|
||||
store.next.update(
|
||||
pwpath.sanitize(pwpath.SYSTEM_PATH),
|
||||
Object.create(basestore.BaseStore).load(page.System)),
|
||||
store.update('Settings',
|
||||
Object.create(basestore.BaseStore).load(page.Settings)),
|
||||
store.update('.config',
|
||||
Object.create(basestore.BaseStore).load(page.Config)),
|
||||
])
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user