Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hyoo-ru/dragon-way
Browse files Browse the repository at this point in the history
# Conflicts:
#	wiki.view.tree
#	wiki.view.ts
  • Loading branch information
jin committed Feb 9, 2024
2 parents 66de93e + 3eeca64 commit 4297192
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 34 deletions.
12 changes: 0 additions & 12 deletions .github/FUNDING.yml

This file was deleted.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!doctype html>
<html style=" height: 100% ">
<html mol_view_root>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
</head>

<body style=" width: 100%; height: 100%; margin: 0 ">
<body mol_view_root>
<div mol_view_root="$my_wiki"></div>
<script src="web.js"></script>
</body>
Expand Down
14 changes: 14 additions & 0 deletions note/note.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace $.$$ {

export class $my_wiki_note extends $hyoo_crus_entity.with({
Body: $hyoo_crus_text,
}) {

@ $mol_mem
body_selection( next?: readonly[ begin: number, end: number ] ) {
return this.Body.selection( this.land().lord()!.ref(), next )
}

}

}
24 changes: 22 additions & 2 deletions wiki.view.css.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
namespace $ {

const { rem } = $mol_style_unit

$mol_style_define( $my_wiki, {

Body: {
padding: $mol_gap.block,
View_page: {
margin: [ 0, 'auto' ],
flex: {
basis: rem(60),
grow: 0,
},
},

Note_changed_moment: {
align: {
self: 'flex-end',
},
},

Edit_page: {
margin: [ 0, 'auto' ],
flex: {
basis: rem(60),
grow: 0,
},
},

} )
Expand Down
62 changes: 52 additions & 10 deletions wiki.view.tree
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
$my_wiki $mol_page
Store $mol_store_shared
head /
<= Title $mol_string
hint @ \Title
value?val <=> title?val @ \My Wiki
body /
<= Text $mol_textarea
hint @ \What do you think?
value?val <=> text?val \
$my_wiki $mol_book2
realm $hyoo_crus_realm
note* $my_wiki_note
note_current $my_wiki_note
Placeholder null
plugins /
<= Theme $mol_theme_auto
pages /
<= View_page $mol_page
title <= note_title
tools /
<= Lights $mol_lights_toggle
<= Source $mol_link_source
uri \https://github.com/hyoo-ru/dragon-way/
<= Add $mol_button_minor
hint \Make new page
click? <=> add? null
sub /
<= Add_icon $mol_icon_plus
<= Edit_toggle $mol_check_icon
hint \Edit page
checked? <=> editing? false
Icon <= Edit_icon $mol_icon_pencil
<= Profile $mol_link
hint \Profile
arg <= profile_arg *
sub /
<= Profile_icon $mol_icon_account
body /
<= Content $mol_list rows /
<= Body $mol_text
text <= note_body
<= Note_changed_moment $mol_date
value_moment <= note_changed_moment $mol_time_moment
enabled false
<= Edit_page $mol_page
head /
<= Title $mol_string
hint \Title
value? <=> note_title? \
enabled <= editable
selection? <=> title_selection? /
<= Edit_close $mol_button_minor
hint \Close editor
click? <=> edit_close? null
sub / <= Edit_close_icon $mol_icon_cross
body /
<= Body_edit $mol_textarea
hint \Node Content
value? <=> note_body? \
enabled <= editable
selection? <=> note_body_selection?
61 changes: 53 additions & 8 deletions wiki.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,66 @@ namespace $.$$ {

export class $my_wiki extends $.$my_wiki {

@ $mol_mem_key
note( ref: $hyoo_crus_ref ) {
return this.realm().Node( ref, $my_wiki_note )
}

note_current() {
const str = this.$.$mol_state_arg.value( '' )
if( !str ) return null!
const ref = $hyoo_crus_ref( str )
return this.note( ref )
}

note_title( next?: string ) {
return this.note_current().title( next ) ?? ''
}

note_body( next?: string ) {
return this.note_current().body( next ) ?? ''
}

note_body_selection( next?: readonly[ begin: number, end: number ] ) {
return this.note_current().body_selection( next )
}

note_changed_moment() {
return this.note_current().last_change()!
}

@ $mol_action
add() {

const land = this.realm().home().Land_new( 0 )

this.$.$mol_dom_context.location.href = '#!=' + land.ref().description
this.editing( true )

}

@ $mol_mem
Note( id: string ) {
return this.Store().sub( id, new $my_wiki_note )
profile_arg() {
return {
'': this.realm().home().Profile( '$my_wiki', $my_wiki_note, null )!.ref().description
}
}

Wiki() {
return this.Note( 'wiki' )
@ $mol_mem
editing( next?: boolean ) {
return this.$.$mol_state_history.value( 'edit', next ) ?? false
}

title( next?: string ) {
return this.Wiki().title( next ) ?? super.title()
edit_close() {
this.editing( false )
}

text( next?: string ) {
return this.Wiki().text( next ) ?? ''
@ $mol_mem
pages() {
return [
this.View_page(),
... this.editing() ? [ this.Edit_page() ] : [],
]
}

}
Expand Down

0 comments on commit 4297192

Please sign in to comment.