mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-04 13:00:10 +00:00
ideas and notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4846a5d69d
commit
5549a688fe
@ -91,7 +91,7 @@ object.Constructor('BasePage', {
|
|||||||
// XXX EXPERIMENTAL...
|
// XXX EXPERIMENTAL...
|
||||||
path_vars: {
|
path_vars: {
|
||||||
NOW: function(){
|
NOW: function(){
|
||||||
return Date.now() },
|
return Date.timeStamp() },
|
||||||
PATH: function(){
|
PATH: function(){
|
||||||
return this.path },
|
return this.path },
|
||||||
NAME: function(){
|
NAME: function(){
|
||||||
@ -135,9 +135,16 @@ object.Constructor('BasePage', {
|
|||||||
|
|
||||||
// events...
|
// events...
|
||||||
//
|
//
|
||||||
|
//__beforenavigate__: function(location){ .. },
|
||||||
|
//
|
||||||
|
//__navigate__: function(){ .. },
|
||||||
|
//
|
||||||
// XXX revise naming...
|
// XXX revise naming...
|
||||||
// XXX should this be able to prevent navigation???
|
// 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',
|
onNavigate: types.event.Event('navigate',
|
||||||
function(handle, location){
|
function(handle, location){
|
||||||
this.onBeforeNavigate(location)
|
this.onBeforeNavigate(location)
|
||||||
@ -154,6 +161,8 @@ object.Constructor('BasePage', {
|
|||||||
path),
|
path),
|
||||||
pwpath.obj2args(args)))
|
pwpath.obj2args(args)))
|
||||||
// trigger handlers...
|
// trigger handlers...
|
||||||
|
'__navigate__' in this
|
||||||
|
&& this.__navigate__()
|
||||||
handle() }),
|
handle() }),
|
||||||
|
|
||||||
// .path is a proxy to .location
|
// .path is a proxy to .location
|
||||||
@ -1543,6 +1552,23 @@ object.Constructor('CachedPage', Page, {
|
|||||||
return getCachedProp(this, 'text') },
|
return getCachedProp(this, 'text') },
|
||||||
set text(value){
|
set text(value){
|
||||||
return setCachedProp(this, '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 = {
|
|||||||
<slot name="header">
|
<slot name="header">
|
||||||
<a href="#/list">☰</a>
|
<a href="#/list">☰</a>
|
||||||
@source(./path/!)
|
@source(./path/!)
|
||||||
<a href="#@source(./path/!)/_edit">(edit)</a>
|
<a href="#@source(./path/!)/_edit">✎</a>
|
||||||
</slot>
|
</slot>
|
||||||
<hr>
|
<hr>
|
||||||
<slot name="content"></slot>
|
<slot name="content"></slot>
|
||||||
|
|||||||
@ -178,10 +178,7 @@ require(['./browser'], function(browser){
|
|||||||
// that will push an extra history item...
|
// that will push an extra history item...
|
||||||
history.replaceState(
|
history.replaceState(
|
||||||
{path: this.location},
|
{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.location
|
||||||
+(this.hash ?
|
+(this.hash ?
|
||||||
'#'+this.hash
|
'#'+this.hash
|
||||||
@ -196,7 +193,7 @@ require(['./browser'], function(browser){
|
|||||||
.onLoad(function(evt){
|
.onLoad(function(evt){
|
||||||
var that = this
|
var that = this
|
||||||
// handle title...
|
// handle title...
|
||||||
document.querySelector('title').innerHTML = this.title
|
document.querySelector('title').innerHTML = this.path
|
||||||
// scroll to anchor element...
|
// scroll to anchor element...
|
||||||
this.hash
|
this.hash
|
||||||
&& this.dom
|
&& this.dom
|
||||||
|
|||||||
10
pwiki2.js
10
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
|
* XXX do we need something like /System/Actions/.. for fast actions called
|
||||||
* in the same way as direct page actions???
|
* in the same way as direct page actions???
|
||||||
* XXX FEATURE tags and accompanying API...
|
* XXX FEATURE tags and accompanying API...
|
||||||
@ -27,7 +36,6 @@
|
|||||||
* XXX TITLE revise how title is handled...
|
* XXX TITLE revise how title is handled...
|
||||||
* ...do we need a separate title and path???
|
* ...do we need a separate title and path???
|
||||||
* XXX revise/update sort...
|
* XXX revise/update sort...
|
||||||
* XXX prevent paths from using reserved chars like: ":", "#", ...
|
|
||||||
* 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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user