Welcome to mirror list, hosted at ThFree Co, Russian Federation.

app.php « appinfo - github.com/nextcloud/files_texteditor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ecbadbb901db329f5918d595b5c6ed6b051f96f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

$eventDispatcher = \OC::$server->getEventDispatcher();

// only load text editor if the user is logged in
if (\OC::$server->getUserSession()->isLoggedIn()) {
	$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function () {
		OCP\Util::addStyle('files_texteditor', 'merged');
		OCP\Util::addScript('files_texteditor', '../build/editor');

		$cspManager = \OC::$server->getContentSecurityPolicyManager();
		$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
		$csp->addAllowedWorkerSrcDomain("'self'");
		$csp->addAllowedScriptDomain('blob:');
		$cspManager->addDefaultPolicy($csp);
	});
}

$eventDispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () {
	OC_Util::addVendorScript('core', 'marked/marked.min');
	OCP\Util::addScript('files_texteditor', 'public-share');
	OCP\Util::addStyle('files_texteditor', 'public-share');
});