diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 26097c329fc..5928c88e2a5 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -519,7 +519,7 @@ Cypress.Commands.add('createDescription', () => { cy.get('[data-cy-files-list] tr[data-cy-files-list-row-name="Readme.md"]').should('not.exist') cy.get('[data-cy-upload-picker] button.action-item__menutoggle').click() - cy.get('li.upload-picker__menu-entry button').contains('Add description').click() + cy.get('li.upload-picker__menu-entry button').contains('Add folder description').click() cy.wait('@addDescription') }) diff --git a/img/article.svg b/img/article.svg new file mode 100644 index 00000000000..1b2345a3b55 --- /dev/null +++ b/img/article.svg @@ -0,0 +1,5 @@ + + + + diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 07e37032863..e8e7c83e2f8 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -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; @@ -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')); diff --git a/src/helpers/files.js b/src/helpers/files.js index 1e6f4760434..ea1474d9f7f 100644 --- a/src/helpers/files.js +++ b/src/helpers/files.js @@ -33,7 +33,7 @@ import { showSuccess, showError } from '@nextcloud/dialogs' import axios from '@nextcloud/axios' import { dirname } from 'path' -import FilePlusSvg from '@mdi/svg/svg/file-plus.svg' +import TextSvg from '@mdi/svg/svg/text.svg' const FILE_ACTION_IDENTIFIER = 'Edit with text app' @@ -134,14 +134,14 @@ export const addMenuRichWorkspace = () => { const descriptionFile = t('text', 'Readme') + '.' + loadState('text', 'default_file_extension') addNewFileMenuEntry({ id: 'rich-workspace-init', - displayName: t('text', 'Add description'), + displayName: t('text', 'Add folder description'), enabled(context) { if (Number(context.attributes['rich-workspace-file'])) { return false } return (context.permissions & Permission.CREATE) !== 0 }, - iconSvgInline: FilePlusSvg, + iconSvgInline: TextSvg, async handler(context, content) { const contentNames = content.map((node) => node.basename) diff --git a/src/public.js b/src/public.js index 803a26495ed..0972514ad6e 100644 --- a/src/public.js +++ b/src/public.js @@ -26,9 +26,9 @@ const newRichWorkspaceFileMenuPlugin = { // register the new menu entry menu.addMenuEntry({ id: 'rich-workspace-init', - displayName: t('text', 'Add description'), + displayName: t('text', 'Add folder description'), templateName: descriptionFile, - iconClass: 'icon-rename', + iconClass: 'icon-add-folder-description', fileType: 'file', useInput: false, actionHandler() {