Skip to content

Commit

Permalink
feat(editor): Use text editor
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Feb 24, 2023
1 parent db226eb commit b5c7a99
Show file tree
Hide file tree
Showing 4 changed files with 661 additions and 483 deletions.
11 changes: 10 additions & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

use OCA\Notes\Service\NotesService;

use OCA\Text\Event\LoadEditor;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
Expand All @@ -18,18 +20,21 @@ class PageController extends Controller {
private NotesService $notesService;
private IUserSession $userSession;
private IURLGenerator $urlGenerator;
private IEventDispatcher $eventDispatcher;

public function __construct(
string $AppName,
IRequest $request,
NotesService $notesService,
IUserSession $userSession,
IURLGenerator $urlGenerator
IURLGenerator $urlGenerator,
IEventDispatcher $eventDispatcher
) {
parent::__construct($AppName, $request);
$this->notesService = $notesService;
$this->userSession = $userSession;
$this->urlGenerator = $urlGenerator;
$this->eventDispatcher = $eventDispatcher;
}


Expand All @@ -45,6 +50,10 @@ public function index() : TemplateResponse {
[ ]
);

if (class_exists(LoadEditor::class)) {
$this->eventDispatcher->dispatchTyped(new LoadEditor());
}

$csp = new ContentSecurityPolicy();
$csp->addAllowedImageDomain('*');
$response->setContentSecurityPolicy($csp);
Expand Down
Loading

0 comments on commit b5c7a99

Please sign in to comment.