0.0.1 • Published 4 years ago

@digitalus-app/wiki v0.0.1

Weekly downloads
2
License
-
Repository
-
Last release
4 years ago

DigApp/wiki

The DigApp/Wiki adds a simple editable wiki to your DigPlatform application.

Installation

Add libraries to your project

# install platform dependencies if your project doesn't already include them
npm i @digitalus/db @digitalus/platform @digitalus/db @digitalus/ui @digitalus/user

# install peer dependencies
npm i ngx-markdown

# install wiki app
npm i @digitalus-app/wiki

Include the modules in your application

// app.module.ts

// ...
import {DigAppWikiModule} from '@digitalus-app/wiki';
import {DigDbModule} from '@digitalus/db';
import {DigUiModule} from '@digitalus/ui';
import {DigUserModule} from '@digitalus/user';
import { environment } from '../environments/environment';

@NgModule({
  // ...
  imports: [
    // ...
    DigPlatformModule.forRoot(environment.digPlatform),
    DigDbModule,
    DigUiModule,
    DigUserModule,
    DigAppWikiModule,
    // ...
  ]
})
export class AppModule { }

DigAppWikiPage

Wiki pages implement the following interface:

PropertyDescription
uid?: stringfirebase document id
created_at?: numbertimestamp the the page was created
created_by?: stringuid of the user that created the page
updated_at?: numbertimestamp page was last updated
updated_by?: stringuid of the user that last updated the page
path: stringpath to page
title: stringpage title
excerpt: stringshort text excerpt
body: stringpage body, markdown
labels?: string[]string labels

Wiki Service

The DigAppWiki service provides the public API for wikis.

MethodReturnsDescription
get(path: string / string[])Observable<DigAppWikiPage>load a page
children(path: string / string[])Observable<DigAppWikiPage[]>loads an array of a page's children
index()Observable<DigAppWikiPage[]>loads an array of a page's children
set(path: string / string[], data: DigAppWikiPage)Observable<DigAppWikiPage>set page data (replaces all data)
update(path: string / string[], data: any)Observable<DigAppWikiPage>update an existing page (merges data)
delete(path: string / string[])Observable<boolean>delete a page

Wiki Page Component

A wiki page is an editable markdown page.

API

PropertyDescription
@Input() path: string / string[]path to the page
@Input() editable: booleanenable the editor UI

Example

<dig-app-wiki-page path="/my/demo/page" [editable]="true"></dig-app-wiki-page>