mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-17 16:41:39 +00:00
added <page>.toggleTags(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f58b5fbd56
commit
9343c4f0c4
@ -339,6 +339,8 @@ object.Constructor('BasePage', {
|
|||||||
} else {
|
} else {
|
||||||
this.__update__(value) } },
|
this.__update__(value) } },
|
||||||
|
|
||||||
|
// tags...
|
||||||
|
//
|
||||||
get tags(){ return async function(){
|
get tags(){ return async function(){
|
||||||
return (await this.data).tags ?? [] }.call(this) },
|
return (await this.data).tags ?? [] }.call(this) },
|
||||||
set tags(value){ return async function(){
|
set tags(value){ return async function(){
|
||||||
@ -348,7 +350,7 @@ object.Constructor('BasePage', {
|
|||||||
} }.call(this) },
|
} }.call(this) },
|
||||||
// XXX TAGS HACK -- should this be a list???
|
// XXX TAGS HACK -- should this be a list???
|
||||||
get tagstr(){ return async function(){
|
get tagstr(){ return async function(){
|
||||||
return JSON.stringify(await this.tags ?? []) }.call(this) },
|
return JSON.stringify(await this.tags ?? []).slice(1,-1) }.call(this) },
|
||||||
tag: async function(...tags){
|
tag: async function(...tags){
|
||||||
this.tags = [...new Set([
|
this.tags = [...new Set([
|
||||||
...(await this.tags),
|
...(await this.tags),
|
||||||
@ -360,6 +362,14 @@ object.Constructor('BasePage', {
|
|||||||
.filter(function(tag){
|
.filter(function(tag){
|
||||||
return !tags.includes(tag) })
|
return !tags.includes(tag) })
|
||||||
return this },
|
return this },
|
||||||
|
toggleTags: async function(...tags){
|
||||||
|
var t = new Set(await this.tags)
|
||||||
|
for(var tag of tags){
|
||||||
|
t.has(tag) ?
|
||||||
|
t.delete(tag)
|
||||||
|
: t.add(tag) }
|
||||||
|
this.tags = t
|
||||||
|
return this },
|
||||||
|
|
||||||
// metadata...
|
// metadata...
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user