WikiContent using easy-markdown-editor
This commit is contained in:
@ -151,9 +151,24 @@ class WikiHelper {
|
||||
return $wikiTreePage->id;
|
||||
}
|
||||
|
||||
public function getWikiPageContent($id): string {
|
||||
try {
|
||||
$pageFolder = $this->getFolderById($id);
|
||||
$path = $pageFolder->getInternalPath().'/'.self::WIKI_FILE_CONTENT;
|
||||
if ( $this->wikiFolder->nodeExists($path) ) {
|
||||
return $this->getFileByName(self::WIKI_FILE_CONTENT)->getContent();
|
||||
}
|
||||
$this->wikiFolder->newFile(self::WIKI_FILE_CONTENT, '');
|
||||
} catch(\Exception $ex) {
|
||||
return null;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function update(int $id, string $content) {
|
||||
try {
|
||||
$path = $this->wikiFolder->getInternalPath().'/'.self::WIKI_FILE_CONTENT;
|
||||
$pageFolder = $this->getFolderById($id);
|
||||
$path = $pageFolder->getInternalPath().'/'.self::WIKI_FILE_CONTENT;
|
||||
if ( $this->wikiFolder->nodeExists($path) ) {
|
||||
$this->getFileByName(self::WIKI_FILE_CONTENT)->putContent($content);
|
||||
} else {
|
||||
|
@ -43,10 +43,13 @@ class WikiPageService {
|
||||
}
|
||||
|
||||
public function find(int $wikiId, int $id, string $userId) {
|
||||
echo "\nwikiId: $wikiId";
|
||||
echo "\nid: $id";
|
||||
echo "\nuserId: $userId";
|
||||
die();
|
||||
try {
|
||||
$wiki = $this->mapper->find($wikiId, $userId);
|
||||
$wikiPageContent = $this->wikiHelper->setFolderId($wiki->getFileId())->getWikiPageContent($id);
|
||||
} catch(Exception $e) {
|
||||
$this->handleException($e);
|
||||
}
|
||||
return ['content'=>$wikiPageContent];
|
||||
}
|
||||
|
||||
public function create(int $wikiId, int $parentFolderId, string $title, ?string $content, string $userId):array {
|
||||
|
Reference in New Issue
Block a user