diff --git a/CHANGELOG.md b/CHANGELOG.md index c49f6a082..72992e671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 - A toggle in the editor preferences for turning ligatures on and off. - Easier possibility to share notes via native share-buttons on supported devices. - Surround selected text with a link via shortcut (ctrl+k or cmd+k). +- A sidebar for menu options - Improved security by wrapping the markdown rendering into an iframe ### Changed diff --git a/cypress/integration/export.spec.ts b/cypress/integration/export.spec.ts index b69e7ef36..6260e2708 100644 --- a/cypress/integration/export.spec.ts +++ b/cypress/integration/export.spec.ts @@ -14,9 +14,9 @@ describe('Export', () => { }) it('Markdown', () => { - cy.get('#editor-menu-export') + cy.get('[data-cy="menu-export"]') .click() - cy.get('a.dropdown-item > i.fa-file-text') + cy.get('[data-cy="menu-export-markdown"]') .click() cy.get('a[download]') .then((anchor) => ( diff --git a/cypress/integration/import.spec.ts b/cypress/integration/import.spec.ts index bac29cebd..f7d5964c5 100644 --- a/cypress/integration/import.spec.ts +++ b/cypress/integration/import.spec.ts @@ -10,11 +10,11 @@ describe('Import markdown file', () => { }) it('import on blank note', () => { - cy.get('button#editor-menu-import') + cy.get('[data-cy="menu-import"]') .click() - cy.get('.import-md-file') + cy.get('[data-cy="menu-import-markdown"]') .click() - cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]') + cy.get('[data-cy="menu-import-markdown-input"]') .attachFile({ filePath: 'import.md', mimeType: 'text/markdown' }) cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span') .should('have.text', '# Some short import test file') @@ -25,11 +25,11 @@ describe('Import markdown file', () => { it('import on note with content', () => { cy.codemirrorFill('test\nabc') - cy.get('button#editor-menu-import') + cy.get('[data-cy="menu-import"]') .click() - cy.get('.import-md-file') + cy.get('[data-cy="menu-import-markdown"]') .click() - cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]') + cy.get('[data-cy="menu-import-markdown-input"]') .attachFile({ filePath: 'import.md', mimeType: 'text/markdown' }) cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span') .should('have.text', 'test') diff --git a/cypress/integration/toolbar.spec.ts b/cypress/integration/toolbar.spec.ts index 1166ae71b..3ad8aaf19 100644 --- a/cypress/integration/toolbar.spec.ts +++ b/cypress/integration/toolbar.spec.ts @@ -104,7 +104,7 @@ describe('Toolbar Buttons', () => { .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') .should('have.text', `# ${testText}`) - cy.get('.btn-toolbar [data-cy="format-heading"]') + cy.get('.fa-header') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') .should('have.text', `## ${testText}`) diff --git a/public/locales/en.json b/public/locales/en.json index 23c748d7a..6e490a021 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -224,6 +224,9 @@ "highlightedText": "Highlight" } }, + "onlineStatus": { + "online": "Online" + }, "error": { "locked": { "title": "This note is locked", @@ -260,6 +263,7 @@ "switchToLight": "Switch to Light Mode" }, "appBar": { + "new": "New", "syncScroll": { "disable": "Disable sync scroll", "enable": "Enable sync scroll" @@ -299,16 +303,11 @@ "menu": "Menu", "import": "Import", "export": "Export", - "new": "New", - "shareLink": "Share link", "extra": "Extra", - "revision": "Revision", "slideMode": "Slide Mode", "download": "Download", "help": "Help", "deleteNote": "Delete note", - "permissions": "Permissions", - "documentInfo": "Document info", "pinNoteToHistory": "Pin note to history", "pinnedToHistory": "Pinned to history" }, @@ -328,7 +327,8 @@ }, "export": { "rawHtml": "Raw HTML", - "pdf": "PDF export is unavailable." + "pdf": "PDF export is unavailable.", + "markdown-file": "Markdown file" }, "import": { "clipboard": "Clipboard", diff --git a/src/components/common/hidden-input-menu-entry/hidden-input-menu-entry.tsx b/src/components/common/hidden-input-menu-entry/hidden-input-menu-entry.tsx deleted file mode 100644 index 5fd65f5d9..000000000 --- a/src/components/common/hidden-input-menu-entry/hidden-input-menu-entry.tsx +++ /dev/null @@ -1,59 +0,0 @@ -/* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - -SPDX-License-Identifier: AGPL-3.0-only -*/ - -import React, { Fragment, useCallback, useRef } from 'react' -import { Button, Dropdown } from 'react-bootstrap' -import { Trans, useTranslation } from 'react-i18next' -import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon' -import { IconName } from '../fork-awesome/types' - -export interface HiddenInputMenuEntryProps { - type: 'dropdown' | 'button' - acceptedFiles: string - i18nKey: string - icon: IconName - onLoad: (file: File) => Promise -} - -export const HiddenInputMenuEntry: React.FC = ({ type, acceptedFiles, i18nKey, icon, onLoad }) => { - const { t } = useTranslation() - - const fileInputReference = useRef(null) - const onClick = useCallback(() => { - const fileInput = fileInputReference.current - if (!fileInput) { - return - } - fileInput.addEventListener('change', () => { - if (!fileInput.files || fileInput.files.length < 1) { - return - } - const file = fileInput.files[0] - onLoad(file).then(() => { - fileInput.value = '' - }).catch((error) => { - console.error(error) - }) - }) - fileInput.click() - }, [onLoad]) - - return ( - - - { - type === 'dropdown' - ? - - - - : - } - - ) -} diff --git a/src/components/common/user-avatar/user-avatar.tsx b/src/components/common/user-avatar/user-avatar.tsx index c50325604..28a11b703 100644 --- a/src/components/common/user-avatar/user-avatar.tsx +++ b/src/components/common/user-avatar/user-avatar.tsx @@ -29,7 +29,7 @@ const UserAvatar: React.FC = ({ name, photo, size, additionalCl title={name} /> - {name} + {name} ) diff --git a/src/components/editor/app-bar/app-bar.tsx b/src/components/editor/app-bar/app-bar.tsx index 9a39f9b24..eeb0b62e8 100644 --- a/src/components/editor/app-bar/app-bar.tsx +++ b/src/components/editor/app-bar/app-bar.tsx @@ -56,7 +56,7 @@ export const AppBar: React.FC = ({ mode }) => {