Skip to content

Commit

Permalink
feat: Add icon svg inline for New text file
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Mar 21, 2024
1 parent 6f681cf commit 51add45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions img/article.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCA\Text\Service\ConfigService;
use OCA\TpAssistant\Event\BeforeAssistantNotificationEvent;
use OCA\Viewer\Event\LoadViewer;
use OCP\App\IAppManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand Down Expand Up @@ -84,12 +85,12 @@ public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService) {
$templateManager->registerTemplateFileCreator(function () use ($l, $configService) {
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l, ConfigService $configService, IAppManager $appManager) {
$templateManager->registerTemplateFileCreator(function () use ($l, $configService, $appManager) {
$markdownFile = new TemplateFileCreator(Application::APP_NAME, $l->t('New text file'), '.' . $configService->getDefaultFileExtension());
$markdownFile->addMimetype('text/markdown');
$markdownFile->addMimetype('text/plain');
$markdownFile->setIconClass('icon-filetype-text');
$markdownFile->setIconSvgInline(file_get_contents($appManager->getAppPath('text') . '/img/article.svg'));
$markdownFile->setRatio(1);
$markdownFile->setOrder(10);
$markdownFile->setActionLabel($l->t('Create new text file'));
Expand Down

0 comments on commit 51add45

Please sign in to comment.