mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 03:05:19 -04:00
fix(frontend): reformat source files
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e260b77760
commit
e390c0dd15
669 changed files with 1741 additions and 2354 deletions
|
@ -3,20 +3,19 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { Nav, Navbar } from 'react-bootstrap'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { NoteType } from '../../../redux/note-details/types/note-details'
|
||||
import { ShowIf } from '../../common/show-if/show-if'
|
||||
import { SignInButton } from '../../landing-layout/navigation/sign-in-button'
|
||||
import { UserDropdown } from '../../landing-layout/navigation/user-dropdown'
|
||||
import { SettingsButton } from '../../layout/settings-dialog/settings-button'
|
||||
import { HelpButton } from './help-button/help-button'
|
||||
import { NavbarBranding } from './navbar-branding'
|
||||
import { SlideModeButton } from './slide-mode-button'
|
||||
import { ReadOnlyModeButton } from './read-only-mode-button'
|
||||
import { NewNoteButton } from './new-note-button'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { NoteType } from '../../../redux/note-details/types/note-details'
|
||||
import { SettingsButton } from '../../layout/settings-dialog/settings-button'
|
||||
import { ReadOnlyModeButton } from './read-only-mode-button'
|
||||
import { SlideModeButton } from './slide-mode-button'
|
||||
import React from 'react'
|
||||
import { Nav, Navbar } from 'react-bootstrap'
|
||||
|
||||
export enum AppBarMode {
|
||||
BASIC,
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Suspense, useEffect, useMemo } from 'react'
|
||||
import type { TaskCheckedEventPayload } from '../../../../extensions/extra-integrations/task-list/event-emitting-task-list-checkbox'
|
||||
import { TaskListCheckboxAppExtension } from '../../../../extensions/extra-integrations/task-list/task-list-checkbox-app-extension'
|
||||
import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner'
|
||||
import { eventEmitterContext } from '../../../markdown-renderer/hooks/use-extension-event-emitter'
|
||||
import EventEmitter2 from 'eventemitter2'
|
||||
import type { TaskCheckedEventPayload } from '../../../../extensions/extra-integrations/task-list/event-emitting-task-list-checkbox'
|
||||
import { TaskListCheckboxAppExtension } from '../../../../extensions/extra-integrations/task-list/task-list-checkbox-app-extension'
|
||||
import React, { Suspense, useEffect, useMemo } from 'react'
|
||||
|
||||
export interface CheatsheetLineProps {
|
||||
markdown: string
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { CheatsheetLine } from './cheatsheet-line'
|
||||
import styles from './cheatsheet.module.scss'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { Table } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { CheatsheetLine } from './cheatsheet-line'
|
||||
import styles from './cheatsheet.module.scss'
|
||||
|
||||
/**
|
||||
* Renders the content of the cheat sheet for the {@link HelpModal}.
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useBooleanState } from '../../../../hooks/common/use-boolean-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { HelpModal } from './help-modal'
|
||||
import React, { Fragment } from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { HelpModal } from './help-modal'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { useBooleanState } from '../../../../hooks/common/use-boolean-state'
|
||||
|
||||
/**
|
||||
* Renders the button to open the {@link HelpModal}.
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { ShortcutTabContent } from './shortcuts-tab-content'
|
||||
import { LinksTabContent } from './links-tab-content'
|
||||
import { CheatsheetTabContent } from './cheatsheet-tab-content'
|
||||
import { LinksTabContent } from './links-tab-content'
|
||||
import { ShortcutTabContent } from './shortcuts-tab-content'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
export enum HelpTabStatus {
|
||||
Cheatsheet = 'cheatsheet.title',
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { Col, Row } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import links from '../../../../links.json'
|
||||
import { TranslatedExternalLink } from '../../../common/links/translated-external-link'
|
||||
import { TranslatedInternalLink } from '../../../common/links/translated-internal-link'
|
||||
import React from 'react'
|
||||
import { Col, Row } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders a bunch of links, where further help can be requested.
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { isMac } from '../../utils'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Card, ListGroup, Row } from 'react-bootstrap'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { isMac } from '../../utils'
|
||||
|
||||
/**
|
||||
* Renders a list of shortcuts usable in HedgeDoc.
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { Navbar } from 'react-bootstrap'
|
||||
import Link from 'next/link'
|
||||
import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state'
|
||||
import { Branding } from '../../common/branding/branding'
|
||||
import {
|
||||
|
@ -14,6 +10,9 @@ import {
|
|||
HedgeDocLogoType,
|
||||
HedgeDocLogoWithText
|
||||
} from '../../common/hedge-doc-logo/hedge-doc-logo-with-text'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import { Navbar } from 'react-bootstrap'
|
||||
|
||||
/**
|
||||
* Renders the branding for the {@link AppBar}
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders a button to create a new note.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* Button that links to the read-only version of a note.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* Button that links to the slide-show presentation of the current note.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React, { createContext, useContext, useState } from 'react'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import type { ContentEdits } from '../editor-pane/tool-bar/formatters/types/changes'
|
||||
import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React, { createContext, useContext, useState } from 'react'
|
||||
|
||||
export type CodeMirrorReference = EditorView | undefined
|
||||
type SetCodeMirrorReference = (value: CodeMirrorReference) => void
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection'
|
||||
import type { ContentFormatter } from './change-content-context'
|
||||
import { useCodeMirrorReference } from './change-content-context'
|
||||
import type { CursorSelection } from '../editor-pane/tool-bar/formatters/types/cursor-selection'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
/**
|
||||
* Changes the content of the given CodeMirror view using the given formatter function.
|
||||
|
|
|
@ -3,16 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as AliasModule from '../../../../api/alias'
|
||||
import * as useApplicationStateModule from '../../../../hooks/common/use-application-state'
|
||||
import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
import { AliasesAddForm } from './aliases-add-form'
|
||||
import { render, act, screen } from '@testing-library/react'
|
||||
import testEvent from '@testing-library/user-event'
|
||||
import React from 'react'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import * as AliasModule from '../../../../api/alias'
|
||||
import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods'
|
||||
import * as useApplicationStateModule from '../../../../hooks/common/use-application-state'
|
||||
import { AliasesAddForm } from './aliases-add-form'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
|
||||
jest.mock('../../../../api/alias')
|
||||
jest.mock('../../../../redux/note-details/methods')
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { addAlias } from '../../../../api/alias'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { useOnInputChange } from '../../../../hooks/common/use-on-input-change'
|
||||
import { updateMetadata } from '../../../../redux/note-details/methods'
|
||||
import { testId } from '../../../../utils/test-id'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import type { FormEvent } from 'react'
|
||||
import React, { useCallback, useMemo, useState } from 'react'
|
||||
import { Button, Form, InputGroup } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { addAlias } from '../../../../api/alias'
|
||||
import { updateMetadata } from '../../../../redux/note-details/methods'
|
||||
import { useOnInputChange } from '../../../../hooks/common/use-on-input-change'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { testId } from '../../../../utils/test-id'
|
||||
|
||||
const validAliasRegex = /^[a-z0-9_-]*$/
|
||||
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as AliasModule from '../../../../api/alias'
|
||||
import type { Alias } from '../../../../api/alias/types'
|
||||
import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
import { AliasesListEntry } from './aliases-list-entry'
|
||||
import { render, act, screen } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import type { Alias } from '../../../../api/alias/types'
|
||||
import { AliasesListEntry } from './aliases-list-entry'
|
||||
import * as AliasModule from '../../../../api/alias'
|
||||
import * as NoteDetailsReduxModule from '../../../../redux/note-details/methods'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
|
||||
jest.mock('../../../../api/alias')
|
||||
jest.mock('../../../../redux/note-details/methods')
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useCallback } from 'react'
|
||||
import { deleteAlias, markAliasAsPrimary } from '../../../../api/alias'
|
||||
import type { Alias } from '../../../../api/alias/types'
|
||||
import { updateMetadata } from '../../../../redux/note-details/methods'
|
||||
import { testId } from '../../../../utils/test-id'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import React, { useCallback } from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import type { Alias } from '../../../../api/alias/types'
|
||||
import { deleteAlias, markAliasAsPrimary } from '../../../../api/alias'
|
||||
import { updateMetadata } from '../../../../redux/note-details/methods'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { testId } from '../../../../utils/test-id'
|
||||
|
||||
export interface AliasesListEntryProps {
|
||||
alias: Alias
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import type { Alias } from '../../../../api/alias/types'
|
||||
import * as useApplicationStateModule from '../../../../hooks/common/use-application-state'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import { AliasesList } from './aliases-list'
|
||||
import * as AliasesListEntryModule from './aliases-list-entry'
|
||||
import type { AliasesListEntryProps } from './aliases-list-entry'
|
||||
import { AliasesList } from './aliases-list'
|
||||
import { render } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
|
||||
jest.mock('../../../../hooks/common/use-application-state')
|
||||
jest.mock('./aliases-list-entry')
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import type { ApplicationState } from '../../../../redux/application-state'
|
||||
import { AliasesListEntry } from './aliases-list-entry'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
|
||||
/**
|
||||
* Renders the list of aliases.
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type { CommonModalProps } from '../../../common/modals/common-modal'
|
||||
import * as CommonModalModule from '../../../common/modals/common-modal'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
import * as AliasesAddFormModule from './aliases-add-form'
|
||||
import * as AliasesListModule from './aliases-list'
|
||||
import { AliasesModal } from './aliases-modal'
|
||||
import { render } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import type { CommonModalProps } from '../../../common/modals/common-modal'
|
||||
import * as CommonModalModule from '../../../common/modals/common-modal'
|
||||
import * as AliasesListModule from './aliases-list'
|
||||
import * as AliasesAddFormModule from './aliases-add-form'
|
||||
import * as useUiNotificationsModule from '../../../notifications/ui-notification-boundary'
|
||||
import { AliasesModal } from './aliases-modal'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
|
||||
jest.mock('./aliases-list')
|
||||
jest.mock('./aliases-add-form')
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React from 'react'
|
||||
import { ListGroup, ListGroupItem, Modal } from 'react-bootstrap'
|
||||
import type { CommonModalProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { AliasesList } from './aliases-list'
|
||||
import { AliasesAddForm } from './aliases-add-form'
|
||||
import { AliasesList } from './aliases-list'
|
||||
import React from 'react'
|
||||
import { ListGroup, ListGroupItem, Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Component that holds a modal containing a list of aliases associated with the current note.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import { UnitalicBoldContent } from './unitalic-bold-content'
|
||||
import React from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { UnitalicBoldContent } from './unitalic-bold-content'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
/**
|
||||
* Renders an info line about the number of contributors for the note.
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import type { NoteInfoTimeLineProps } from './note-info-time-line'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { UnitalicBoldTimeFromNow } from './utils/unitalic-bold-time-from-now'
|
||||
import { DateTime } from 'luxon'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders an info line about the creation of the current note.
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import type { NoteInfoTimeLineProps } from './note-info-time-line'
|
||||
import { UnitalicBoldTimeFromNow } from './utils/unitalic-bold-time-from-now'
|
||||
import { UnitalicBoldTrans } from './utils/unitalic-bold-trans'
|
||||
import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username'
|
||||
import { DateTime } from 'luxon'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders an info line about the last update of the current note.
|
||||
|
|
|
@ -3,19 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { useEditorReceiveHandler } from '../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler'
|
||||
import type { OnWordCountCalculatedMessage } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import { UnitalicBoldContent } from './unitalic-bold-content'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { NoteInfoLine } from './note-info-line'
|
||||
import { UnitalicBoldContent } from './unitalic-bold-content'
|
||||
import { useEditorToRendererCommunicator } from '../../render-context/editor-to-renderer-communicator-context-provider'
|
||||
import type { OnWordCountCalculatedMessage } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { CommunicationMessageType } from '../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { useEditorReceiveHandler } from '../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
/**
|
||||
* Creates a new info line for the document information dialog that holds the
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React from 'react'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import type { IconName } from '../../../common/fork-awesome/types'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
export interface NoteInfoLineProps {
|
||||
icon: IconName
|
||||
|
|
|
@ -3,17 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { NoteInfoLineContributors } from './note-info-line-contributors'
|
||||
import { NoteInfoLineCreated } from './note-info-line-created'
|
||||
import { NoteInfoLineUpdated } from './note-info-line-updated'
|
||||
import { NoteInfoLineWordCount } from './note-info-line-word-count'
|
||||
import React from 'react'
|
||||
import { ListGroup, Modal } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { NoteInfoLineWordCount } from './note-info-line-word-count'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { NoteInfoLineCreated } from './note-info-line-created'
|
||||
import { NoteInfoLineUpdated } from './note-info-line-updated'
|
||||
import { NoteInfoLineContributors } from './note-info-line-contributors'
|
||||
|
||||
/**
|
||||
* Modal that shows informational data about the current note.
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { DateTime } from 'luxon'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
export interface TimeFromNowProps {
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React from 'react'
|
||||
import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
export interface UnitalicBoldContentProps extends PropsWithDataCypressId {
|
||||
text?: string | number
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import type { TimeFromNowProps } from '../time-from-now'
|
||||
import { TimeFromNow } from '../time-from-now'
|
||||
import { UnitalicBoldContent } from '../unitalic-bold-content'
|
||||
import React from 'react'
|
||||
|
||||
export const UnitalicBoldTimeFromNow: React.FC<TimeFromNowProps> = ({ time }) => {
|
||||
return (
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { UnitalicBoldContent } from '../unitalic-bold-content'
|
||||
import React from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { UnitalicBoldContent } from '../unitalic-bold-content'
|
||||
|
||||
export interface UnitalicBoldTransProps {
|
||||
i18nKey?: string
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useOnInputChange } from '../../../../hooks/common/use-on-input-change'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import React, { useCallback, useState } from 'react'
|
||||
import { Button, FormControl, InputGroup } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useOnInputChange } from '../../../../hooks/common/use-on-input-change'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export interface PermissionAddEntryFieldProps {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useMemo } from 'react'
|
||||
import { Button, ToggleButtonGroup } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { AccessLevel } from './types'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Button, ToggleButtonGroup } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
interface PermissionEntryButtonI18nKeys {
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useCallback, useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { AccessLevel, SpecialGroup } from './types'
|
||||
import { Button, ToggleButtonGroup } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { removeGroupPermission, setGroupPermission } from '../../../../api/permissions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { AccessLevel, SpecialGroup } from './types'
|
||||
import React, { useCallback, useMemo } from 'react'
|
||||
import { Button, ToggleButtonGroup } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export interface PermissionEntrySpecialGroupProps {
|
||||
level: AccessLevel
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useCallback } from 'react'
|
||||
import { UserAvatar } from '../../../common/user-avatar/user-avatar'
|
||||
import type { NoteUserPermissionEntry } from '../../../../api/notes/types'
|
||||
import { PermissionEntryButtons, PermissionType } from './permission-entry-buttons'
|
||||
import { AccessLevel } from './types'
|
||||
import { useAsync } from 'react-use'
|
||||
import { getUser } from '../../../../api/users'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { removeUserPermission, setUserPermission } from '../../../../api/permissions'
|
||||
import { getUser } from '../../../../api/users'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { UserAvatar } from '../../../common/user-avatar/user-avatar'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { PermissionEntryButtons, PermissionType } from './permission-entry-buttons'
|
||||
import { AccessLevel } from './types'
|
||||
import React, { useCallback } from 'react'
|
||||
import { useAsync } from 'react-use'
|
||||
|
||||
export interface PermissionEntryUserProps {
|
||||
entry: NoteUserPermissionEntry
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { Modal } from 'react-bootstrap'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { PermissionSectionOwner } from './permission-section-owner'
|
||||
import { PermissionSectionUsers } from './permission-section-users'
|
||||
import { PermissionSectionSpecialGroups } from './permission-section-special-groups'
|
||||
import { PermissionSectionUsers } from './permission-section-users'
|
||||
import React from 'react'
|
||||
import { Modal } from 'react-bootstrap'
|
||||
|
||||
/**
|
||||
* Modal for viewing and managing the permissions of the note.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback, useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useOnInputChange } from '../../../../hooks/common/use-on-input-change'
|
||||
import { Button, FormControl, InputGroup } from 'react-bootstrap'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import React, { useCallback, useMemo, useState } from 'react'
|
||||
import { Button, FormControl, InputGroup } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export interface PermissionOwnerChangeProps {
|
||||
onConfirmOwnerChange: (newOwner: string) => void
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment } from 'react'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username'
|
||||
import React, { Fragment } from 'react'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { UserAvatarForUsername } from '../../../common/user-avatar/user-avatar-for-username'
|
||||
|
||||
export interface PermissionOwnerInfoProps {
|
||||
onEditOwner: () => void
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { Fragment, useCallback, useState } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { PermissionOwnerChange } from './permission-owner-change'
|
||||
import { PermissionOwnerInfo } from './permission-owner-info'
|
||||
import { setNoteOwner } from '../../../../api/permissions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { PermissionOwnerChange } from './permission-owner-change'
|
||||
import { PermissionOwnerInfo } from './permission-owner-info'
|
||||
import React, { Fragment, useCallback, useState } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Section in the permissions modal for managing the owner of a note.
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { PermissionEntrySpecialGroup } from './permission-entry-special-group'
|
||||
import { AccessLevel, SpecialGroup } from './types'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Section of the permission modal for managing special group access to the note.
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { Fragment, useCallback, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { PermissionEntryUser } from './permission-entry-user'
|
||||
import { PermissionAddEntryField } from './permission-add-entry-field'
|
||||
import { setUserPermission } from '../../../../api/permissions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { setNotePermissionsFromServer } from '../../../../redux/note-details/methods'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { PermissionAddEntryField } from './permission-add-entry-field'
|
||||
import { PermissionEntryUser } from './permission-entry-user'
|
||||
import React, { Fragment, useCallback, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Section of the permission modal for managing user access to the note.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { invertUnifiedPatch } from './invert-unified-patch'
|
||||
import { parsePatch } from 'diff'
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Hunk, ParsedDiff } from 'diff'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,20 +3,19 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { RevisionMetadata } from '../../../../api/revisions/types'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { UserAvatar } from '../../../common/user-avatar/user-avatar'
|
||||
import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import styles from './revision-list-entry.module.scss'
|
||||
import { getUserDataForRevision } from './utils'
|
||||
import { DateTime } from 'luxon'
|
||||
import React, { useMemo } from 'react'
|
||||
import { ListGroup } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||
import { UserAvatar } from '../../../common/user-avatar/user-avatar'
|
||||
import styles from './revision-list-entry.module.scss'
|
||||
import type { RevisionMetadata } from '../../../../api/revisions/types'
|
||||
import { getUserDataForRevision } from './utils'
|
||||
import { useAsync } from 'react-use'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { WaitSpinner } from '../../../common/wait-spinner/wait-spinner'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
|
||||
export interface RevisionListEntryProps {
|
||||
active: boolean
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react'
|
||||
import { RevisionListEntry } from './revision-list-entry'
|
||||
import { useAsync } from 'react-use'
|
||||
import { getAllRevisions } from '../../../../api/revisions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { ListGroup } from 'react-bootstrap'
|
||||
import { AsyncLoadingBoundary } from '../../../common/async-loading-boundary'
|
||||
import { RevisionListEntry } from './revision-list-entry'
|
||||
import { DateTime } from 'luxon'
|
||||
import React, { useMemo } from 'react'
|
||||
import { ListGroup } from 'react-bootstrap'
|
||||
import { useAsync } from 'react-use'
|
||||
|
||||
export interface RevisionListProps {
|
||||
selectedRevisionId?: number
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { getRevision } from '../../../../api/revisions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { downloadRevision } from './utils'
|
||||
import React, { useCallback } from 'react'
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { downloadRevision } from './utils'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { getRevision } from '../../../../api/revisions'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
|
||||
export interface RevisionModalFooterProps {
|
||||
selectedRevisionId?: number
|
||||
|
|
|
@ -3,16 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { RevisionList } from './revision-list'
|
||||
import { RevisionModalFooter } from './revision-modal-footer'
|
||||
import styles from './revision-modal.module.scss'
|
||||
import { RevisionViewer } from './revision-viewer'
|
||||
import React, { useState } from 'react'
|
||||
import { Col, Modal, Row } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import styles from './revision-modal.module.scss'
|
||||
import { RevisionModalFooter } from './revision-modal-footer'
|
||||
import { RevisionViewer } from './revision-viewer'
|
||||
import { RevisionList } from './revision-list'
|
||||
|
||||
/**
|
||||
* Modal that shows the available revisions and allows for comparison between them.
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import React, { useMemo } from 'react'
|
||||
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer'
|
||||
import { useAsync } from 'react-use'
|
||||
import { getRevision } from '../../../../api/revisions'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state'
|
||||
import { AsyncLoadingBoundary } from '../../../common/async-loading-boundary'
|
||||
import { applyPatch, parsePatch } from 'diff'
|
||||
import { invertUnifiedPatch } from './invert-unified-patch'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { applyPatch, parsePatch } from 'diff'
|
||||
import React, { useMemo } from 'react'
|
||||
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer'
|
||||
import { useAsync } from 'react-use'
|
||||
|
||||
export interface RevisionViewerProps {
|
||||
selectedRevisionId?: number
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { RevisionDetails } from '../../../../api/revisions/types'
|
||||
import { getUser } from '../../../../api/users'
|
||||
import type { UserInfo } from '../../../../api/users/types'
|
||||
|
|
|
@ -3,17 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { useBaseUrl } from '../../../../hooks/common/use-base-url'
|
||||
import { NoteType } from '../../../../redux/note-details/types/note-details'
|
||||
import { CopyableField } from '../../../common/copyable/copyable-field/copyable-field'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { ShowIf } from '../../../common/show-if/show-if'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { NoteType } from '../../../../redux/note-details/types/note-details'
|
||||
import { useBaseUrl } from '../../../../hooks/common/use-base-url'
|
||||
import React from 'react'
|
||||
import { Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders a modal which provides shareable URLs of this note.
|
||||
|
|
|
@ -3,17 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import type { RenderIframeProps } from '../renderer-pane/render-iframe'
|
||||
import { RenderIframe } from '../renderer-pane/render-iframe'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { useTrimmedNoteMarkdownContentWithoutFrontmatter } from '../../../hooks/common/use-trimmed-note-markdown-content-without-frontmatter'
|
||||
import { NoteType } from '../../../redux/note-details/types/note-details'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { setRendererStatus } from '../../../redux/renderer-status/methods'
|
||||
import { RendererType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||
import type { RenderIframeProps } from '../renderer-pane/render-iframe'
|
||||
import { RenderIframe } from '../renderer-pane/render-iframe'
|
||||
import { useOnScrollWithLineOffset } from './hooks/use-on-scroll-with-line-offset'
|
||||
import { useScrollStateWithoutLineOffset } from './hooks/use-scroll-state-without-line-offset'
|
||||
import { setRendererStatus } from '../../../redux/renderer-status/methods'
|
||||
import React from 'react'
|
||||
|
||||
export type EditorDocumentRendererProps = Omit<
|
||||
RenderIframeProps,
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { ScrollState } from '../../synced-scroll/scroll-props'
|
||||
import { getGlobalState } from '../../../../redux'
|
||||
import { useMemo } from 'react'
|
||||
import type { ScrollState } from '../../synced-scroll/scroll-props'
|
||||
import type { ScrollCallback } from '../../synced-scroll/scroll-props'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
/**
|
||||
* Adjusts the given onScroll callback to include the frontmatter line offset.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import type { ScrollState } from '../../synced-scroll/scroll-props'
|
||||
import { useMemo } from 'react'
|
||||
|
|
|
@ -3,27 +3,26 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../hooks/common/use-application-state'
|
||||
import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode'
|
||||
import { updateNoteTitleByFirstHeading } from '../../redux/note-details/methods'
|
||||
import { Logger } from '../../utils/logger'
|
||||
import { MotdModal } from '../common/motd-modal/motd-modal'
|
||||
import { NoteAndAppTitleHead } from '../layout/note-and-app-title-head'
|
||||
import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox'
|
||||
import { ExtensionEventEmitterProvider } from '../markdown-renderer/hooks/use-extension-event-emitter'
|
||||
import { AppBar, AppBarMode } from './app-bar/app-bar'
|
||||
import { ChangeEditorContentContextProvider } from './change-content-context/change-content-context'
|
||||
import { EditorDocumentRenderer } from './editor-document-renderer/editor-document-renderer'
|
||||
import { EditorPane } from './editor-pane/editor-pane'
|
||||
import { useComponentsFromAppExtensions } from './editor-pane/hooks/use-components-from-app-extensions'
|
||||
import { useUpdateLocalHistoryEntry } from './hooks/use-update-local-history-entry'
|
||||
import { Sidebar } from './sidebar/sidebar'
|
||||
import { Splitter } from './splitter/splitter'
|
||||
import type { DualScrollState, ScrollState } from './synced-scroll/scroll-props'
|
||||
import { useUpdateLocalHistoryEntry } from './hooks/use-update-local-history-entry'
|
||||
import { useApplicationState } from '../../hooks/common/use-application-state'
|
||||
import { EditorDocumentRenderer } from './editor-document-renderer/editor-document-renderer'
|
||||
import { Logger } from '../../utils/logger'
|
||||
import { NoteAndAppTitleHead } from '../layout/note-and-app-title-head'
|
||||
import equal from 'fast-deep-equal'
|
||||
import { EditorPane } from './editor-pane/editor-pane'
|
||||
import { ChangeEditorContentContextProvider } from './change-content-context/change-content-context'
|
||||
import { ExtensionEventEmitterProvider } from '../markdown-renderer/hooks/use-extension-event-emitter'
|
||||
import { useComponentsFromAppExtensions } from './editor-pane/hooks/use-components-from-app-extensions'
|
||||
import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox'
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export enum ScrollSource {
|
||||
EDITOR = 'editor',
|
||||
|
|
|
@ -3,44 +3,43 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react'
|
||||
import type { ScrollProps } from '../synced-scroll/scroll-props'
|
||||
import { StatusBar } from './status-bar/status-bar'
|
||||
import { ToolBar } from './tool-bar/tool-bar'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { MaxLengthWarning } from './max-length-warning/max-length-warning'
|
||||
import ReactCodeMirror from '@uiw/react-codemirror'
|
||||
import { useApplyScrollState } from './hooks/use-apply-scroll-state'
|
||||
import styles from './extended-codemirror/codemirror.module.scss'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useCodeMirrorScrollWatchExtension } from './hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension'
|
||||
import { useCodeMirrorFileInsertExtension } from './hooks/code-mirror-extensions/use-code-mirror-file-insert-extension'
|
||||
import { markdown, markdownLanguage } from '@codemirror/lang-markdown'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { autocompletion } from '@codemirror/autocomplete'
|
||||
import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state'
|
||||
import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute'
|
||||
import { languages } from '@codemirror/language-data'
|
||||
import { useCursorActivityCallback } from './hooks/use-cursor-activity-callback'
|
||||
import { findLanguageByCodeBlockName } from '../../markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name'
|
||||
import { useCodeMirrorReference, useSetCodeMirrorReference } from '../change-content-context/change-content-context'
|
||||
import { useCodeMirrorTablePasteExtension } from './hooks/table-paste/use-code-mirror-table-paste-extension'
|
||||
import type { ScrollProps } from '../synced-scroll/scroll-props'
|
||||
import styles from './extended-codemirror/codemirror.module.scss'
|
||||
import { useCodeMirrorFileInsertExtension } from './hooks/code-mirror-extensions/use-code-mirror-file-insert-extension'
|
||||
import { useCodeMirrorScrollWatchExtension } from './hooks/code-mirror-extensions/use-code-mirror-scroll-watch-extension'
|
||||
import { useOnImageUploadFromRenderer } from './hooks/image-upload-from-renderer/use-on-image-upload-from-renderer'
|
||||
import { useCodeMirrorYjsExtension } from './hooks/yjs/use-code-mirror-yjs-extension'
|
||||
import { useYDoc } from './hooks/yjs/use-y-doc'
|
||||
import { useCodeMirrorTablePasteExtension } from './hooks/table-paste/use-code-mirror-table-paste-extension'
|
||||
import { useApplyScrollState } from './hooks/use-apply-scroll-state'
|
||||
import { useCursorActivityCallback } from './hooks/use-cursor-activity-callback'
|
||||
import { useAwareness } from './hooks/yjs/use-awareness'
|
||||
import { useWebsocketConnection } from './hooks/yjs/use-websocket-connection'
|
||||
import { useBindYTextToRedux } from './hooks/yjs/use-bind-y-text-to-redux'
|
||||
import { useCodeMirrorYjsExtension } from './hooks/yjs/use-code-mirror-yjs-extension'
|
||||
import { useInsertNoteContentIntoYTextInMockModeEffect } from './hooks/yjs/use-insert-note-content-into-y-text-in-mock-mode-effect'
|
||||
import { useOnFirstEditorUpdateExtension } from './hooks/yjs/use-on-first-editor-update-extension'
|
||||
import { useOnMetadataUpdated } from './hooks/yjs/use-on-metadata-updated'
|
||||
import { useIsConnectionSynced } from './hooks/yjs/use-is-connection-synced'
|
||||
import { useMarkdownContentYText } from './hooks/yjs/use-markdown-content-y-text'
|
||||
import { lintGutter } from '@codemirror/lint'
|
||||
import { useLinter } from './linter/linter'
|
||||
import { useOnFirstEditorUpdateExtension } from './hooks/yjs/use-on-first-editor-update-extension'
|
||||
import { useOnMetadataUpdated } from './hooks/yjs/use-on-metadata-updated'
|
||||
import { useOnNoteDeleted } from './hooks/yjs/use-on-note-deleted'
|
||||
import { findLanguageByCodeBlockName } from '../../markdown-renderer/extensions/base/code-block-markdown-extension/find-language-by-code-block-name'
|
||||
import { useDarkModeState } from '../../../hooks/common/use-dark-mode-state'
|
||||
import { useWebsocketConnection } from './hooks/yjs/use-websocket-connection'
|
||||
import { useYDoc } from './hooks/yjs/use-y-doc'
|
||||
import { useLinter } from './linter/linter'
|
||||
import { MaxLengthWarning } from './max-length-warning/max-length-warning'
|
||||
import { StatusBar } from './status-bar/status-bar'
|
||||
import { ToolBar } from './tool-bar/tool-bar'
|
||||
import { autocompletion } from '@codemirror/autocomplete'
|
||||
import { markdown, markdownLanguage } from '@codemirror/lang-markdown'
|
||||
import { languages } from '@codemirror/language-data'
|
||||
import { lintGutter } from '@codemirror/lint'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import ReactCodeMirror from '@uiw/react-codemirror'
|
||||
import React, { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders the text editor pane of the editor.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { useHandleUpload } from '../use-handle-upload'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
const calculateCursorPositionInEditor = (view: EditorView, event: MouseEvent): number => {
|
||||
return Optional.ofNullable(event.pageX)
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import type { ScrollState } from '../../../synced-scroll/scroll-props'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { useCallback, useMemo } from 'react'
|
||||
|
||||
export type OnScrollCallback = ((scrollState: ScrollState) => void) | undefined
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { findRegexMatchInText } from './find-regex-match-in-text'
|
||||
|
||||
describe('find regex index in line', function () {
|
||||
|
|
|
@ -3,18 +3,17 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { getGlobalState } from '../../../../../redux'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useEditorReceiveHandler } from '../../../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler'
|
||||
import type { ImageUploadMessage } from '../../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { CommunicationMessageType } from '../../../../render-page/window-post-message-communicator/rendering-message'
|
||||
import { useCallback } from 'react'
|
||||
import { getGlobalState } from '../../../../../redux'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useCodeMirrorReference } from '../../../change-content-context/change-content-context'
|
||||
import type { CursorSelection } from '../../tool-bar/formatters/types/cursor-selection'
|
||||
import { useHandleUpload } from '../use-handle-upload'
|
||||
import { findRegexMatchInText } from './find-regex-match-in-text'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { useHandleUpload } from '../use-handle-upload'
|
||||
import type { CursorSelection } from '../../tool-bar/formatters/types/cursor-selection'
|
||||
import { useCodeMirrorReference } from '../../../change-content-context/change-content-context'
|
||||
import { useCallback } from 'react'
|
||||
|
||||
const log = new Logger('useOnImageUpload')
|
||||
const imageWithPlaceholderLinkRegex = /!\[([^\]]*)]\(https:\/\/([^)]*)\)/g
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { isCursorInCodeFence } from './codefenceDetection'
|
||||
|
||||
describe('Check whether cursor is in codefence', () => {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { convertClipboardTableToMarkdown, isTable } from './table-extractor'
|
||||
|
||||
describe('isTable detection: ', () => {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { createNumberRangeArray } from '../../../../common/number-range/number-range'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,16 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { changeEditorContent } from '../../../change-content-context/use-change-editor-content-callback'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { replaceSelection } from '../../tool-bar/formatters/replace-selection'
|
||||
import { convertClipboardTableToMarkdown, isTable } from './table-extractor'
|
||||
import { isCursorInCodeFence } from './codefenceDetection'
|
||||
import { convertClipboardTableToMarkdown, isTable } from './table-extractor'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
/**
|
||||
* Creates a {@link Extension code mirror extension} that handles the smart table detection on paste-from-clipboard events.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { Logger } from '../../../../utils/logger'
|
||||
import { useCodeMirrorReference } from '../../change-content-context/change-content-context'
|
||||
import type { ScrollState } from '../../synced-scroll/scroll-props'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import equal from 'fast-deep-equal'
|
||||
import { useCodeMirrorReference } from '../../change-content-context/change-content-context'
|
||||
import { Logger } from '../../../../utils/logger'
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
const logger = new Logger('useApplyScrollState')
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions'
|
||||
import type { ReactElement } from 'react'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions'
|
||||
|
||||
/**
|
||||
* Generator react elements for components that are generated by the used {@link AppExtension app extensions}.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo, useRef } from 'react'
|
||||
import { updateCursorPositions } from '../../../../redux/note-details/methods'
|
||||
import type { Extension, SelectionRange } from '@codemirror/state'
|
||||
import type { ViewUpdate } from '@codemirror/view'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import type { Extension, SelectionRange } from '@codemirror/state'
|
||||
import { useMemo, useRef } from 'react'
|
||||
|
||||
/**
|
||||
* Provides a callback for codemirror that handles cursor changes.
|
||||
|
|
|
@ -3,19 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { uploadFile } from '../../../../api/media'
|
||||
import { getGlobalState } from '../../../../redux'
|
||||
import { supportedMimeTypes } from '../../../common/upload-image-mimetypes'
|
||||
import { t } from 'i18next'
|
||||
import { useCallback } from 'react'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import type { ContentFormatter } from '../../change-content-context/change-content-context'
|
||||
import { changeEditorContent } from '../../change-content-context/use-change-editor-content-callback'
|
||||
import { replaceSelection } from '../tool-bar/formatters/replace-selection'
|
||||
import { replaceInContent } from '../tool-bar/formatters/replace-in-content'
|
||||
import { replaceSelection } from '../tool-bar/formatters/replace-selection'
|
||||
import type { CursorSelection } from '../tool-bar/formatters/types/cursor-selection'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import type { ContentFormatter } from '../../change-content-context/change-content-context'
|
||||
import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
|
||||
import { t } from 'i18next'
|
||||
import { useCallback } from 'react'
|
||||
|
||||
/**
|
||||
* @param view the codemirror instance that is used to insert the Markdown code
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
export interface LineBasedPosition {
|
||||
line: number
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import type { Doc } from 'yjs'
|
||||
import type { Awareness } from 'y-protocols/awareness'
|
||||
import { MARKDOWN_CONTENT_CHANNEL_NAME } from './use-markdown-content-y-text'
|
||||
import { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import type { Awareness } from 'y-protocols/awareness'
|
||||
import type { Doc } from 'yjs'
|
||||
|
||||
/**
|
||||
* A mocked connection that doesn't send or receive any data and is instantly ready.
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Awareness } from 'y-protocols/awareness'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { addOnlineUser, removeOnlineUser } from '../../../../../redux/realtime/methods'
|
||||
import { ActiveIndicatorStatus } from '../../../../../redux/realtime/types'
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import type { Doc } from 'yjs'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { Awareness } from 'y-protocols/awareness'
|
||||
import type { Doc } from 'yjs'
|
||||
|
||||
const ownAwarenessClientId = -1
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { setNoteContent } from '../../../../../redux/note-details/methods'
|
||||
import { useEffect } from 'react'
|
||||
import type { YText } from 'yjs/dist/src/types/YText'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { useMemo } from 'react'
|
||||
import { yCollab } from 'y-codemirror.next'
|
||||
import type { Awareness } from 'y-protocols/awareness'
|
||||
import type { YText } from 'yjs/dist/src/types/YText'
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { isMockMode } from '../../../../../utils/test-modes'
|
||||
import { getGlobalState } from '../../../../../redux'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { isMockMode } from '../../../../../utils/test-modes'
|
||||
import { MockConnection } from './mock-connection'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* When in mock mode this effect inserts the current markdown content into the yDoc of the given connection to simulate a sync from the server.
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
/**
|
||||
* Checks if the given message transporter has received at least one full synchronisation.
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Doc } from 'yjs'
|
||||
import { useMemo } from 'react'
|
||||
import type { Doc } from 'yjs'
|
||||
import type { YText } from 'yjs/dist/src/types/YText'
|
||||
|
||||
export const MARKDOWN_CONTENT_CHANNEL_NAME = 'markdownContent'
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo, useState } from 'react'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { useMemo, useState } from 'react'
|
||||
|
||||
/**
|
||||
* Provides an extension that checks when the code mirror, that loads the extension, has its first update.
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { updateMetadata } from '../../../../../redux/note-details/methods'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { MessageType } from '@hedgedoc/realtime'
|
||||
import { updateMetadata } from '../../../../../redux/note-details/methods'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useUiNotifications } from '../../../../notifications/ui-notification-boundary'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { MessageType } from '@hedgedoc/realtime'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { Logger } from '../../../../../utils/logger'
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { useUiNotifications } from '../../../../notifications/ui-notification-boundary'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
|
||||
const logger = new Logger('UseOnNoteDeleted')
|
||||
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { WebsocketConnection } from './websocket-connection'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { useWebsocketUrl } from './use-websocket-url'
|
||||
import type { Doc } from 'yjs'
|
||||
import type { Awareness } from 'y-protocols/awareness'
|
||||
import { isMockMode } from '../../../../../utils/test-modes'
|
||||
import { MockConnection } from './mock-connection'
|
||||
import { useWebsocketUrl } from './use-websocket-url'
|
||||
import { WebsocketConnection } from './websocket-connection'
|
||||
import type { YDocMessageTransporter } from '@hedgedoc/realtime'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import type { Awareness } from 'y-protocols/awareness'
|
||||
import type { Doc } from 'yjs'
|
||||
|
||||
/**
|
||||
* Creates a {@link WebsocketConnection websocket connection handler } that handles the realtime communication with the backend.
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { isMockMode } from '../../../../../utils/test-modes'
|
||||
import { useApplicationState } from '../../../../../hooks/common/use-application-state'
|
||||
import { useBaseUrl } from '../../../../../hooks/common/use-base-url'
|
||||
import { isMockMode } from '../../../../../utils/test-modes'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
const LOCAL_FALLBACK_URL = 'ws://localhost:8080/realtime/'
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Doc } from 'yjs'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { Doc } from 'yjs'
|
||||
|
||||
/**
|
||||
* Creates a new {@link Doc y-doc}.
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { mockEditorView } from './single-line-regex-linter.spec'
|
||||
import { FrontmatterLinter } from './frontmatter-linter'
|
||||
import { mockEditorView } from './single-line-regex-linter.spec'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { t } from 'i18next'
|
||||
|
||||
const testFrontmatterLinter = (
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type { Linter } from './linter'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { extractFrontmatter } from '../../../../redux/note-details/frontmatter-extractor/extractor'
|
||||
import { load } from 'js-yaml'
|
||||
import type { RawNoteFrontmatter } from '../../../../redux/note-details/raw-note-frontmatter-parser/types'
|
||||
import type { Linter } from './linter'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { t } from 'i18next'
|
||||
import { load } from 'js-yaml'
|
||||
|
||||
/**
|
||||
* Creates a {@link Linter linter} for the yaml frontmatter.
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions'
|
||||
import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state'
|
||||
import { FrontmatterLinter } from './frontmatter-linter'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { linter } from '@codemirror/lint'
|
||||
import { useMemo } from 'react'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions'
|
||||
import { FrontmatterLinter } from './frontmatter-linter'
|
||||
import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
/**
|
||||
* The Linter interface.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import { SingleLineRegexLinter } from './single-line-regex-linter'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { mockI18n } from '../../../markdown-renderer/test-utils/mock-i18n'
|
||||
import type { EditorState, Text } from '@codemirror/state'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { Mock } from 'ts-mockery'
|
||||
import type { EditorState, Text } from '@codemirror/state'
|
||||
|
||||
export const mockEditorView = (content: string): EditorView => {
|
||||
const docMock = Mock.of<Text>()
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Linter } from './linter'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { t } from 'i18next'
|
||||
|
||||
interface LineWithStartIndex {
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import React from 'react'
|
||||
import { Button, Modal } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import type { ModalVisibilityProps } from '../../../common/modals/common-modal'
|
||||
import { CommonModal } from '../../../common/modals/common-modal'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
/**
|
||||
* Shows a modal that informs the user that the document is too long.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
import { MaxLengthWarningModal } from './max-length-warning-modal'
|
||||
import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { useBooleanState } from '../../../../hooks/common/use-boolean-state'
|
||||
import { useNoteMarkdownContent } from '../../../../hooks/common/use-note-markdown-content'
|
||||
import { MaxLengthWarningModal } from './max-length-warning-modal'
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
|
||||
/**
|
||||
* Watches the length of the document and shows a warning modal to the user if the document length exceeds the configured value.
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useLineBasedFromPosition } from '../hooks/use-line-based-position'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { useLineBasedFromPosition } from '../hooks/use-line-based-position'
|
||||
|
||||
/**
|
||||
* Renders a translated text that shows the given cursor position.
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
/**
|
||||
* Renders a translated text that shows the number of lines in the document.
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Renders a translated text that shows the number of remaining characters.
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { SeparatorDash } from './separator-dash'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { SeparatorDash } from './separator-dash'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useLineBasedFromPosition, useLineBasedToPosition } from '../hooks/use-line-based-position'
|
||||
import { SeparatorDash } from './separator-dash'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Shows the total number of selected lines.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { RemainingCharactersInfo } from './remaining-characters-info'
|
||||
import { NumberOfLinesInDocumentInfo } from './number-of-lines-in-document-info'
|
||||
import { CursorPositionInfo } from './cursor-position-info'
|
||||
import { SeparatorDash } from './separator-dash'
|
||||
import { NumberOfLinesInDocumentInfo } from './number-of-lines-in-document-info'
|
||||
import { RemainingCharactersInfo } from './remaining-characters-info'
|
||||
import { SelectedCharacters } from './selected-characters'
|
||||
import { SelectedLines } from './selected-lines'
|
||||
import { SeparatorDash } from './separator-dash'
|
||||
import React from 'react'
|
||||
|
||||
/**
|
||||
* Shows additional information about the document length and the current selection.
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback } from 'react'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import type { ContentFormatter } from '../../../change-content-context/change-content-context'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import React, { useCallback } from 'react'
|
||||
|
||||
/**
|
||||
* Renders a button to make the selection in the {@link Editor editor} bold.
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback } from 'react'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import type { ContentFormatter } from '../../../change-content-context/change-content-context'
|
||||
import { prependLinesOfSelection } from '../formatters/prepend-lines-of-selection'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import React, { useCallback } from 'react'
|
||||
|
||||
/**
|
||||
* Renders a button to create a checklist in the {@link Editor editor}.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback } from 'react'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import type { ContentFormatter } from '../../../change-content-context/change-content-context'
|
||||
import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import React, { useCallback } from 'react'
|
||||
|
||||
/**
|
||||
* Renders a button to create a code fence in the {@link Editor editor}.
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import React, { useCallback } from 'react'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor'
|
||||
import type { ContentFormatter } from '../../../change-content-context/change-content-context'
|
||||
import { changeCursorsToWholeLineIfNoToCursor } from '../formatters/utils/change-cursors-to-whole-line-if-no-to-cursor'
|
||||
import { wrapSelection } from '../formatters/wrap-selection'
|
||||
import { ToolbarButton } from '../toolbar-button'
|
||||
import React, { useCallback } from 'react'
|
||||
|
||||
/**
|
||||
* Renders a button to create a spoiler section in the {@link Editor editor}.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue