diff --git a/pwiki/page.js b/pwiki/page.js index cecdd82..2b21065 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -91,7 +91,7 @@ object.Constructor('BasePage', { // XXX EXPERIMENTAL... path_vars: { NOW: function(){ - return Date.now() }, + return Date.timeStamp() }, PATH: function(){ return this.path }, NAME: function(){ @@ -135,9 +135,16 @@ object.Constructor('BasePage', { // events... // + //__beforenavigate__: function(location){ .. }, + // + //__navigate__: function(){ .. }, + // // XXX revise naming... // XXX should this be able to prevent navigation??? - onBeforeNavigate: types.event.Event('beforeNavigate'), + onBeforeNavigate: types.event.Event('beforeNavigate', + function(_, location){ + '__beforenavigate__' in this + && this.__beforenavigate__(location) }), onNavigate: types.event.Event('navigate', function(handle, location){ this.onBeforeNavigate(location) @@ -154,6 +161,8 @@ object.Constructor('BasePage', { path), pwpath.obj2args(args))) // trigger handlers... + '__navigate__' in this + && this.__navigate__() handle() }), // .path is a proxy to .location @@ -1543,6 +1552,23 @@ object.Constructor('CachedPage', Page, { return getCachedProp(this, 'text') }, set text(value){ return setCachedProp(this, 'text', value) }, + + + /*/ XXX PREVIEW EXPERIMENTAL... + // ...this can be usefull for partial rendering and then on the + // js level filling in the details... + __preview_size__: 100, + get preview(){ + var text = this.text + if(text instanceof Promise){ + text.then(function(text){ + this.onPreviewReady() }) + // return a placeholder for the upcoming data... + return '...' } + return text.slice(0, this.__preview_size__ || 100) }, + onPreviewReady: types.event.Event('onPreviewReady'), + //*/ + }) @@ -1693,7 +1719,7 @@ module.System = { @source(./path/!) - (edit) +
diff --git a/pwiki2.html b/pwiki2.html index f33b664..0e93aab 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -178,10 +178,7 @@ require(['./browser'], function(browser){ // that will push an extra history item... history.replaceState( {path: this.location}, - // XXX TITLE .title must be sync as history will not wait for - // the value even it await is given... - //this.title, - this.path, + '', '#'+this.location +(this.hash ? '#'+this.hash @@ -196,7 +193,7 @@ require(['./browser'], function(browser){ .onLoad(function(evt){ var that = this // handle title... - document.querySelector('title').innerHTML = this.title + document.querySelector('title').innerHTML = this.path // scroll to anchor element... this.hash && this.dom diff --git a/pwiki2.js b/pwiki2.js index 6590af3..b74ac21 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -1,6 +1,15 @@ /********************************************************************** * * +* XXX 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 +* in the blanks wen they are ready... +* XXX UI/UX: add a cached/sync page.preview with ready events... +* XXX Q: empty title??? +* - special default name +* a timestamp or some thing similar +* this can be hidden until changed by user +* XXX FILE prevent paths from using reserved chars like: ":", "#", ... * XXX do we need something like /System/Actions/.. for fast actions called * in the same way as direct page actions??? * XXX FEATURE tags and accompanying API... @@ -27,7 +36,6 @@ * XXX TITLE revise how title is handled... * ...do we need a separate title and path??? * XXX revise/update sort... -* XXX prevent paths from using reserved chars like: ":", "#", ... * XXX ASAP: MetaStore: need to correctly integrate the following store * methods: * .get(..) -- DONE