├── .nvmrc
├── .prettierignore
├── renovate.json
├── cypress
├── fixtures
│ ├── invalid-history.txt
│ ├── import.md
│ ├── demo.png
│ ├── demo.png.license
│ ├── history-2.json.license
│ ├── history.json.license
│ ├── import.md.license
│ ├── invalid-history.txt.license
│ ├── history.json
│ ├── history-2.json
│ └── languages.ts
├── .eslintrc.json.license
├── tsconfig.json.license
├── e2e
│ ├── slideshow-only-page.spec.ts
│ ├── document-read-only-page.spec.ts
│ ├── helpDialog.spec.ts
│ ├── diagrams.spec.ts
│ ├── iframe-capsule.ts
│ ├── linkEmbedder.spec.ts
│ └── renderer-mode.spec.ts
├── tsconfig.json
├── support
│ ├── logout.ts
│ ├── check-links.ts
│ └── get-by-id.ts
└── .eslintrc.json
├── public
├── public
│ ├── motd.md
│ ├── readme.md
│ ├── img
│ │ ├── avatar.png
│ │ ├── demo.png
│ │ └── highres.jpg
│ ├── screenshot.png
│ └── intro.md
├── robots.txt
└── icons
│ ├── favicon.ico
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── mstile-70x70.png
│ ├── apple-touch-icon.png
│ ├── mstile-144x144.png
│ ├── mstile-150x150.png
│ ├── mstile-310x150.png
│ ├── mstile-310x310.png
│ ├── android-chrome-192x192.png
│ ├── android-chrome-512x512.png
│ ├── browserconfig.xml
│ └── site.webmanifest
├── .gitattributes
├── .env.production
├── .netlify
└── state.json
├── .dockerignore
├── .nvmrc.license
├── .env.test.license
├── .mailmap.license
├── package.json.license
├── yarn.lock.license
├── .dockerignore.license
├── .env.development.license
├── .env.production.license
├── .env.test
├── .eslintrc.json.license
├── .prettierrc.json.license
├── netlify
├── intro.md.license
├── motd.md.license
├── intro.md
└── motd.md
├── next-env.d.ts.license
├── renovate.json.license
├── src
├── links.json.license
├── version.json.license
├── components
│ ├── common
│ │ ├── user-avatar
│ │ │ ├── default-avatar.png
│ │ │ ├── default-avatar.png.license
│ │ │ └── user-avatar.module.scss
│ │ ├── simple-alert
│ │ │ └── simple-alert-props.ts
│ │ ├── branding
│ │ │ └── branding.module.scss
│ │ ├── show-if
│ │ │ ├── __snapshots__
│ │ │ │ └── show-if.test.tsx.snap
│ │ │ ├── show-if.test.tsx
│ │ │ └── show-if.tsx
│ │ ├── links
│ │ │ ├── __snapshots__
│ │ │ │ ├── translated-internal-link.test.tsx.snap
│ │ │ │ └── translated-external-link.test.tsx.snap
│ │ │ ├── types.d.ts
│ │ │ ├── translated-internal-link.test.tsx
│ │ │ ├── translated-external-link.test.tsx
│ │ │ ├── translated-internal-link.tsx
│ │ │ └── translated-external-link.tsx
│ │ ├── fields
│ │ │ └── fields.ts
│ │ ├── fork-awesome
│ │ │ └── types.d.ts
│ │ ├── number-range
│ │ │ ├── number-range.ts
│ │ │ └── number-range.test.ts
│ │ ├── redirect-back.tsx
│ │ ├── upload-image-mimetypes.ts
│ │ ├── wait-spinner
│ │ │ └── wait-spinner.tsx
│ │ ├── icon-button
│ │ │ ├── icon-button.module.scss
│ │ │ ├── __snapshots__
│ │ │ │ └── translated-icon-button.test.tsx.snap
│ │ │ └── translated-icon-button.test.tsx
│ │ ├── pagination
│ │ │ └── pager-item.tsx
│ │ ├── note-loading-boundary
│ │ │ └── __snapshots__
│ │ │ │ └── note-loading-boundary.test.tsx.snap
│ │ └── modals
│ │ │ └── deletion-moadal.test.tsx
│ ├── editor-page
│ │ ├── editor-pane
│ │ │ ├── tool-bar
│ │ │ │ ├── emoji-picker
│ │ │ │ │ ├── forkawesome.png.license
│ │ │ │ │ ├── forkawesome.png
│ │ │ │ │ └── emoji-picker.module.scss
│ │ │ │ ├── formatters
│ │ │ │ │ ├── types
│ │ │ │ │ │ ├── cursor-selection.d.ts
│ │ │ │ │ │ └── changes.d.ts
│ │ │ │ │ └── replace-in-content.ts
│ │ │ │ ├── table-picker
│ │ │ │ │ └── table-picker.module.scss
│ │ │ │ ├── tool-bar.module.scss
│ │ │ │ └── buttons
│ │ │ │ │ ├── link-button.tsx
│ │ │ │ │ ├── bold-button.tsx
│ │ │ │ │ ├── italic-button.tsx
│ │ │ │ │ ├── highlight-button.tsx
│ │ │ │ │ ├── image-link-button.tsx
│ │ │ │ │ ├── underline-button.tsx
│ │ │ │ │ └── subscript-button.tsx
│ │ │ ├── status-bar
│ │ │ │ └── separator-dash.tsx
│ │ │ ├── hooks
│ │ │ │ └── yjs
│ │ │ │ │ ├── use-y-doc.ts
│ │ │ │ │ ├── use-markdown-content-y-text.ts
│ │ │ │ │ └── use-bind-y-text-to-redux.ts
│ │ │ └── extended-codemirror
│ │ │ │ ├── hints.scss
│ │ │ │ └── codemirror.module.scss
│ │ ├── sidebar
│ │ │ ├── style
│ │ │ │ ├── variables.scss
│ │ │ │ └── sidebar.module.scss
│ │ │ ├── specific-sidebar-entries
│ │ │ │ └── pin-note-sidebar-entry.module.css
│ │ │ ├── users-online-sidebar-menu
│ │ │ │ ├── active-indicator.module.scss
│ │ │ │ ├── online-counter.module.scss
│ │ │ │ └── active-indicator.tsx
│ │ │ ├── sidebar-menu
│ │ │ │ ├── sidebar-menu.module.scss
│ │ │ │ └── sidebar-menu.tsx
│ │ │ └── user-line
│ │ │ │ └── user-line.module.scss
│ │ ├── app-bar
│ │ │ ├── help-button
│ │ │ │ └── cheatsheet.module.scss
│ │ │ └── new-note-button.tsx
│ │ ├── document-bar
│ │ │ ├── note-info
│ │ │ │ ├── note-info-time-line.ts
│ │ │ │ ├── utils
│ │ │ │ │ ├── unitalic-bold-time-from-now.tsx
│ │ │ │ │ └── unitalic-bold-trans.tsx
│ │ │ │ └── time-from-now.tsx
│ │ │ ├── revisions
│ │ │ │ ├── revision-modal.module.scss
│ │ │ │ └── revision-list-entry.module.scss
│ │ │ ├── permissions
│ │ │ │ └── types.ts
│ │ │ └── aliases
│ │ │ │ └── __snapshots__
│ │ │ │ ├── aliases-list.test.tsx.snap
│ │ │ │ ├── aliases-add-form.test.tsx.snap
│ │ │ │ └── aliases-modal.test.tsx.snap
│ │ ├── change-content-context
│ │ │ └── code-mirror-selection.d.ts
│ │ ├── splitter
│ │ │ └── splitter.module.scss
│ │ ├── table-of-contents
│ │ │ └── toc-slugify.ts
│ │ ├── utils.ts
│ │ └── synced-scroll
│ │ │ └── scroll-props.ts
│ ├── intro-page
│ │ ├── cover-buttons
│ │ │ └── cover-buttons.module.scss
│ │ └── requests.ts
│ ├── document-read-only-page
│ │ └── document-infobar.module.scss
│ ├── history-page
│ │ ├── entry-menu
│ │ │ └── entry-menu.module.scss
│ │ ├── history-card
│ │ │ └── history-card.module.scss
│ │ ├── history-toolbar
│ │ │ ├── toolbar-context
│ │ │ │ └── toolbar-context.d.ts
│ │ │ ├── history-toolbar-state.d.ts
│ │ │ ├── hooks
│ │ │ │ └── use-safe-refresh-history-state.tsx
│ │ │ └── export-history-button.tsx
│ │ ├── pin-button
│ │ │ └── pin-button.module.scss
│ │ └── history-table
│ │ │ └── history-table.module.scss
│ ├── landing-layout
│ │ ├── navigation
│ │ │ └── header-bar
│ │ │ │ └── header-nav-link.module.scss
│ │ └── footer
│ │ │ └── footer.tsx
│ ├── markdown-renderer
│ │ ├── extensions
│ │ │ ├── image
│ │ │ │ ├── lightbox.module.scss
│ │ │ │ └── proxy-image-markdown-extension.ts
│ │ │ ├── linemarker
│ │ │ │ ├── types.d.ts
│ │ │ │ └── linemarker-replacer.tsx
│ │ │ ├── image-placeholder
│ │ │ │ └── image-placeholder.module.scss
│ │ │ ├── emoji
│ │ │ │ ├── __snapshots__
│ │ │ │ │ └── emoji-markdown-extension.test.tsx.snap
│ │ │ │ └── emoji-markdown-extension.ts
│ │ │ ├── linkify-fix
│ │ │ │ └── __snapshots__
│ │ │ │ │ └── linkify-fix-markdown-extension.test.tsx.snap
│ │ │ ├── iframe-capsule
│ │ │ │ └── iframe-capsule-markdown-extension.ts
│ │ │ ├── base
│ │ │ │ └── code-block-markdown-extension
│ │ │ │ │ └── code-block-parameters.ts
│ │ │ ├── sanitizer
│ │ │ │ └── sanitizer-markdown-extension.ts
│ │ │ └── upload-indicating-image-frame
│ │ │ │ └── upload-indicating-image-frame-markdown-extension.ts
│ │ ├── node-preprocessors
│ │ │ └── node-processor.ts
│ │ ├── common-markdown-renderer-props.ts
│ │ ├── loading-slide.tsx
│ │ └── test-utils
│ │ │ └── mock-i18n.ts
│ ├── login-page
│ │ └── auth
│ │ │ ├── fields
│ │ │ └── fields.ts
│ │ │ ├── social-link-button
│ │ │ └── social-link-button.module.scss
│ │ │ └── via-one-click.module.scss
│ ├── profile-page
│ │ └── access-tokens
│ │ │ └── access-token-creation-form
│ │ │ └── access-token-creation-form-field.d.ts
│ ├── application-loader
│ │ ├── application-loader.module.scss
│ │ ├── application-loader-error.ts
│ │ ├── initializers
│ │ │ └── fetch-frontend-config.ts
│ │ └── loading-screen
│ │ │ └── icon-row.tsx
│ ├── render-page
│ │ ├── markdown-toc-button
│ │ │ └── markdown-toc-button.module.scss
│ │ ├── markdown-document.module.scss
│ │ └── window-post-message-communicator
│ │ │ └── hooks
│ │ │ └── use-is-renderer-ready.ts
│ ├── notifications
│ │ ├── notifications.module.scss
│ │ └── types.ts
│ └── layout
│ │ ├── settings-dialog
│ │ └── editor
│ │ │ ├── ligature-setting-button-group.tsx
│ │ │ ├── smart-paste-setting-button-group.tsx
│ │ │ └── sync-scroll-setting-button-group.tsx
│ │ ├── base-head.tsx
│ │ └── note-and-app-title-head.tsx
├── version.json
├── extensions
│ └── extra-integrations
│ │ ├── mermaid
│ │ ├── mermaid.module.scss
│ │ └── mermaid-app-extension.ts
│ │ ├── csv
│ │ ├── __snapshots__
│ │ │ └── csv-table-markdown-extension.test.tsx.snap
│ │ ├── csv-table-app-extension.ts
│ │ └── csv-table-markdown-extension.ts
│ │ ├── graphviz
│ │ ├── __snapshots__
│ │ │ └── graphviz-markdown-extension.test.tsx.snap
│ │ └── graphviz-app-extension.ts
│ │ ├── flowchart
│ │ ├── __snapshots__
│ │ │ ├── flowchart-markdown-extension.test.tsx.snap
│ │ │ └── flowchart.test.tsx.snap
│ │ └── flowchart-app-extension.ts
│ │ ├── abcjs
│ │ ├── abc.module.scss
│ │ ├── __snapshots__
│ │ │ └── abcjs-markdown-extension.test.tsx.snap
│ │ ├── abcjs-app-extension.ts
│ │ └── abcjs-markdown-extension.ts
│ │ ├── gist
│ │ ├── gist-frame.module.scss
│ │ ├── gist-app-extension.ts
│ │ ├── replace-gist-link.ts
│ │ └── replace-legacy-gist-short-code.ts
│ │ ├── vega-lite
│ │ ├── __snapshots__
│ │ │ └── vega-lite-markdown-extension.test.tsx.snap
│ │ └── vega-lite-app-extension.ts
│ │ ├── plantuml
│ │ ├── __snapshots__
│ │ │ └── plantuml-markdown-extension.test.tsx.snap
│ │ ├── plantuml-not-configured-alert.tsx
│ │ └── plantuml-app-extension.ts
│ │ ├── vimeo
│ │ └── __snapshots__
│ │ │ └── vimeo-frame.test.tsx.snap
│ │ ├── youtube
│ │ └── __snapshots__
│ │ │ ├── youtube-frame.test.tsx.snap
│ │ │ └── youtube-markdown-extension.test.tsx.snap
│ │ ├── sequence-diagram
│ │ └── sequence-diagram.tsx
│ │ ├── alert
│ │ └── alert-app-extension.ts
│ │ ├── katex
│ │ └── katex-app-extension.ts
│ │ ├── spoiler
│ │ └── spoiler-app-extension.ts
│ │ ├── highlighted-code-fence
│ │ └── highlighted-code-fence-app-extension.ts
│ │ ├── blockquote
│ │ └── blockquote-app-extension.ts
│ │ ├── task-list
│ │ └── set-checkbox-in-editor.tsx
│ │ └── legacy-short-codes
│ │ ├── replace-legacy-slideshare-short-code.test.ts
│ │ └── replace-legacy-speakerdeck-short-code.test.ts
├── api
│ ├── group
│ │ ├── types.ts
│ │ └── index.ts
│ ├── users
│ │ ├── types.ts
│ │ └── index.ts
│ ├── permissions
│ │ └── types.ts
│ ├── me
│ │ └── types.ts
│ ├── common
│ │ ├── default-config.ts
│ │ └── api-request-builder
│ │ │ ├── get-api-request-builder.ts
│ │ │ └── post-api-request-builder.ts
│ ├── alias
│ │ └── types.ts
│ ├── media
│ │ └── types.ts
│ ├── auth
│ │ ├── index.ts
│ │ └── types.ts
│ ├── tokens
│ │ └── types.ts
│ ├── revisions
│ │ └── types.ts
│ ├── config
│ │ └── index.ts
│ └── history
│ │ └── types.ts
├── external-types
│ ├── markdown-it-regex
│ │ ├── interface.ts
│ │ └── index.d.ts
│ ├── markdown-it-emoji
│ │ ├── interface.d.ts
│ │ └── index.d.ts
│ ├── markdown-it-mark
│ │ └── index.d.ts
│ ├── markdown-it-ins
│ │ └── index.d.ts
│ ├── markdown-it-sub
│ │ └── index.d.ts
│ ├── markdown-it-sup
│ │ └── index.d.ts
│ ├── markdown-it-abbr
│ │ └── index.d.ts
│ ├── markdown-it-footnote
│ │ └── index.d.ts
│ ├── markdown-it-deflist
│ │ └── index.d.ts
│ ├── markdown-it-linkify
│ │ └── index.d.ts
│ └── markdown-it-mathjax
│ │ ├── index.d.ts
│ │ └── interface.ts
├── utils
│ ├── is-client-side-rendering.ts
│ ├── read-file.test.ts
│ ├── wait-for-other-promises-to-finish.ts
│ └── test-id.ts
├── links.json
├── redux
│ ├── note-details
│ │ ├── types
│ │ │ └── slide-show-options.d.ts
│ │ ├── frontmatter-extractor
│ │ │ └── types.d.ts
│ │ ├── raw-note-frontmatter-parser
│ │ │ └── types.d.ts
│ │ ├── calculate-line-start-indexes.ts
│ │ ├── reducers
│ │ │ ├── build-state-from-server-permissions.ts
│ │ │ └── build-state-from-update-cursor-position.test.ts
│ │ └── calculate-line-start-indexes.test.ts
│ ├── config
│ │ ├── methods.ts
│ │ └── types.ts
│ ├── index.ts
│ ├── dark-mode
│ │ ├── methods.ts
│ │ ├── types.ts
│ │ └── reducers.ts
│ ├── store-provider.tsx
│ ├── renderer-status
│ │ ├── types.ts
│ │ └── methods.ts
│ ├── user
│ │ ├── reducers.ts
│ │ └── types.ts
│ └── realtime
│ │ └── reducers
│ │ ├── build-state-from-remove-user.ts
│ │ └── build-state-from-add-user.ts
├── pages
│ ├── 404.tsx
│ └── api
│ │ ├── private
│ │ ├── groups
│ │ │ ├── _EVERYONE.ts
│ │ │ ├── _LOGGED_IN.ts
│ │ │ └── hedgedoc-devs.ts
│ │ ├── users
│ │ │ ├── erik.ts
│ │ │ ├── tilman.ts
│ │ │ └── molly.ts
│ │ └── me
│ │ │ └── index.ts
│ │ └── mock-backend
│ │ └── private
│ │ └── alias.ts
└── hooks
│ └── common
│ ├── use-note-markdown-content.ts
│ ├── use-app-title.ts
│ ├── use-on-input-change.ts
│ ├── use-array-string-url-parameter.ts
│ ├── use-note-title.ts
│ ├── use-single-string-url-parameter.ts
│ ├── use-boolean-state.ts
│ └── use-dark-mode-state.ts
├── tsconfig.json.license
├── .env.development
├── .prettierignore.license
├── LICENSES
└── LicenseRef-DCO.txt
├── dev-reverse-proxy
├── .gitignore
├── run-caddy.sh
└── Caddyfile
├── developer-certificate-of-origin.txt.license
├── .idea
├── prettier.xml
├── copyright
│ ├── profiles_settings.xml
│ └── hedgedoc.xml
└── dictionaries
│ └── hedgedoc.xml
├── .yarnrc.yml
├── netlify.toml
├── next-env.d.ts
├── global-styles
├── button-inside.scss
├── highlight-js.scss
├── colors-only-bootstrap
│ ├── _helpers.scss
│ ├── _type.scss
│ ├── forms
│ │ ├── _form-text.scss
│ │ ├── _labels.scss
│ │ ├── _input-group.scss
│ │ └── _validation.scss
│ ├── _tooltip.scss
│ ├── _forms.scss
│ ├── _images.scss
│ ├── _badge.scss
│ ├── _breadcrumb.scss
│ ├── _progress.scss
│ ├── _card.scss
│ ├── helpers
│ │ ├── _color-bg.scss
│ │ └── _colored-links.scss
│ ├── _toasts.scss
│ └── _popover.scss
├── typeahead.scss
├── variables.light.scss
├── variables.module.scss
└── dark.scss
├── .prettierrc.json
├── cypress.config.ts
├── .github
├── workflows
│ └── reuse.yml
├── pull_request_template.md
└── ISSUE_TEMPLATE
│ └── question---other.md
├── README.md
├── .mailmap
├── AUTHORS.md
└── tsconfig.json
/.nvmrc:
--------------------------------------------------------------------------------
1 | v18
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "enabled": false
3 | }
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/invalid-history.txt:
--------------------------------------------------------------------------------
1 | Invalid json
2 |
--------------------------------------------------------------------------------
/cypress/fixtures/import.md:
--------------------------------------------------------------------------------
1 | # Some short import test file
2 | :)
3 |
--------------------------------------------------------------------------------
/public/public/motd.md:
--------------------------------------------------------------------------------
1 | This is the test motd text
2 | :smile:
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | /.yarn/releases/** binary
2 | /.yarn/plugins/** binary
3 |
4 |
--------------------------------------------------------------------------------
/public/public/readme.md:
--------------------------------------------------------------------------------
1 | This directory should only be used in mock mode.
2 |
--------------------------------------------------------------------------------
/.env.production:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_USE_MOCK_API=false
2 | NEXT_PUBLIC_TEST_MODE=false
3 |
--------------------------------------------------------------------------------
/.netlify/state.json:
--------------------------------------------------------------------------------
1 | {
2 | "siteId": "329450c0-b852-424e-8b75-7441cefb5bea"
3 | }
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/cypress/fixtures/demo.png
--------------------------------------------------------------------------------
/public/icons/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/favicon.ico
--------------------------------------------------------------------------------
/public/public/img/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/public/img/avatar.png
--------------------------------------------------------------------------------
/public/public/img/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/public/img/demo.png
--------------------------------------------------------------------------------
/public/public/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/public/screenshot.png
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | Dockerfile
2 | .dockerignore
3 | node_modules
4 | npm-debug.log
5 | README.md
6 | .next
7 | .git
8 |
--------------------------------------------------------------------------------
/public/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/public/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/public/icons/mstile-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/mstile-70x70.png
--------------------------------------------------------------------------------
/public/public/img/highres.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/public/img/highres.jpg
--------------------------------------------------------------------------------
/public/icons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/icons/mstile-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/mstile-144x144.png
--------------------------------------------------------------------------------
/public/icons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/mstile-150x150.png
--------------------------------------------------------------------------------
/public/icons/mstile-310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/mstile-310x150.png
--------------------------------------------------------------------------------
/public/icons/mstile-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/mstile-310x310.png
--------------------------------------------------------------------------------
/.nvmrc.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.env.test.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.mailmap.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/package.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/public/icons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/public/icons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/public/icons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/yarn.lock.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.dockerignore.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.env.development.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.env.production.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.env.test:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_USE_MOCK_API=true
2 | HD_EDITOR_BASE_URL="http://127.0.0.1:3001/"
3 | HD_RENDERER_BASE_URL="http://127.0.0.1:3001/"
4 |
--------------------------------------------------------------------------------
/.eslintrc.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.prettierrc.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/netlify/intro.md.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/netlify/motd.md.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/next-env.d.ts.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/renovate.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/src/links.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/src/version.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/tsconfig.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/.env.development:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_USE_MOCK_API=true
2 | HD_EDITOR_BASE_URL="http://localhost:3001/"
3 | HD_RENDERER_BASE_URL="http://127.0.0.1:3001/"
4 |
--------------------------------------------------------------------------------
/.prettierignore.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
5 |
--------------------------------------------------------------------------------
/cypress/.eslintrc.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/cypress/tsconfig.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/demo.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/LICENSES/LicenseRef-DCO.txt:
--------------------------------------------------------------------------------
1 | Everyone is permitted to copy and distribute verbatim copies of this
2 | license document, but changing it is not allowed.
3 |
--------------------------------------------------------------------------------
/cypress/fixtures/history-2.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/history.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/import.md.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC-BY-SA-4.0
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/invalid-history.txt.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/src/components/common/user-avatar/default-avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/src/components/common/user-avatar/default-avatar.png
--------------------------------------------------------------------------------
/dev-reverse-proxy/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
2 | #
3 | # SPDX-License-Identifier: CC0-1.0
4 |
5 | caddy
6 |
--------------------------------------------------------------------------------
/developer-certificate-of-origin.txt.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2004, 2006 The Linux Foundation and its contributors.
2 |
3 | SPDX-License-Identifier: LicenseRef-DCO
--------------------------------------------------------------------------------
/cypress/fixtures/history.json:
--------------------------------------------------------------------------------
1 | {"version":2,"entries":[{"identifier":"cypress","title":"cy-Test","tags":[],"lastVisited":"2019-04-30T09:36:45.249+02:00","pinStatus":false}]}
2 |
--------------------------------------------------------------------------------
/src/components/common/user-avatar/default-avatar.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
2 |
3 | SPDX-License-Identifier: CC0-1.0
4 |
--------------------------------------------------------------------------------
/cypress/fixtures/history-2.json:
--------------------------------------------------------------------------------
1 | {"version":2,"entries":[{"identifier":"cypress2","title":"cy-Test2","tags":[],"lastVisited":"2019-04-30T09:36:45.249+02:00","pinStatus":false}]}
2 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/emoji-picker/forkawesome.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2018 Dave Gandy & Fork Awesome
2 |
3 | SPDX-License-Identifier: OFL-1.1
4 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/emoji-picker/forkawesome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hedgedoc/react-client/HEAD/src/components/editor-page/editor-pane/tool-bar/emoji-picker/forkawesome.png
--------------------------------------------------------------------------------
/src/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "CLIENT_VERSION_MISSING",
3 | "sourceCodeUrl": "https://github.com/hedgedoc/react-client",
4 | "issueTrackerUrl": "https://github.com/hedgedoc/react-client/issues"
5 | }
6 |
--------------------------------------------------------------------------------
/.idea/prettier.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/public/public/intro.md:
--------------------------------------------------------------------------------
1 | :::warning
2 | What you see is an UI-Test! It's filled with dummy data, not connected to a backend and no data will be saved.
3 | :::
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | nodeLinker: node-modules
2 |
3 | plugins:
4 | - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
5 | spec: "@yarnpkg/plugin-workspace-tools"
6 |
7 | yarnPath: .yarn/releases/yarn-3.2.4.cjs
8 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | publish = ".next"
3 | command = "echo Pseudo build command because the build is made by the CI"
4 |
5 | [[plugins]]
6 | package = "@netlify/plugin-nextjs"
7 |
8 | [dev]
9 | targetPort = 3001
10 |
--------------------------------------------------------------------------------
/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/style/variables.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | $height: 40px;
8 | $menu-width: 175px;
9 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/components/intro-page/cover-buttons/cover-buttons.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .cover-button {
8 | min-width: 200px;
9 | }
10 |
--------------------------------------------------------------------------------
/global-styles/button-inside.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .button-inside {
8 | position: absolute;
9 | bottom: 10px;
10 | right: 10px;
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/common/simple-alert/simple-alert-props.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface SimpleAlertProps {
8 | show: boolean
9 | }
10 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/mermaid/mermaid.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .mermaid > svg {
8 | background-color: #f8f9fa;
9 | }
10 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "typescript",
3 | "singleQuote": true,
4 | "jsxSingleQuote": true,
5 | "semi": false,
6 | "tabWidth": 2,
7 | "trailingComma": "none",
8 | "bracketSpacing": true,
9 | "bracketSameLine": true,
10 | "arrowParens": "always"
11 | }
12 |
--------------------------------------------------------------------------------
/src/api/group/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface GroupInfo {
8 | name: string
9 | displayName: string
10 | special: boolean
11 | }
12 |
--------------------------------------------------------------------------------
/src/api/users/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface UserInfo {
8 | username: string
9 | displayName: string
10 | photo: string
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/document-read-only-page/document-infobar.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .document-infobar {
8 | color: #777;
9 | font-size: 0.85rem;
10 | }
11 |
--------------------------------------------------------------------------------
/src/components/common/branding/branding.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .regular-size {
8 | height: 50px;
9 | }
10 |
11 | .inline-size {
12 | height: 30px;
13 | }
14 |
--------------------------------------------------------------------------------
/src/components/editor-page/app-bar/help-button/cheatsheet.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .table-cheatsheet > tr > td {
8 | vertical-align: middle !important;
9 | }
10 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/note-info/note-info-time-line.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export interface NoteInfoTimeLineProps {
7 | size?: '2x' | '3x' | '4x' | '5x'
8 | }
9 |
--------------------------------------------------------------------------------
/global-styles/highlight-js.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | @import '~highlight.js/styles/github';
8 |
9 | body.dark {
10 | @import '~highlight.js/styles/github-dark';
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/common/show-if/__snapshots__/show-if.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`ShowIf does not render child if condition is false 1`] = `
`;
4 |
5 | exports[`ShowIf renders child if condition is true 1`] = `
6 |
7 | test
8 |
9 | `;
10 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/specific-sidebar-entries/pin-note-sidebar-entry.module.css:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .highlighted {
8 | color: #b51f08 !important;
9 | }
10 |
--------------------------------------------------------------------------------
/src/components/history-page/entry-menu/entry-menu.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .history-menu {
8 | &:global(.btn) {
9 | padding: 0.6rem 0.65rem;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/public/icons/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #b51f08
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/api/permissions/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export interface OwnerChangeDto {
7 | owner: string
8 | }
9 |
10 | export interface PermissionSetDto {
11 | canEdit: boolean
12 | }
13 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/revisions/revision-modal.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .revision-modal .scroll-col {
8 | max-height: 75vh;
9 | overflow-y: auto;
10 | }
11 |
--------------------------------------------------------------------------------
/src/components/editor-page/change-content-context/code-mirror-selection.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface CodeMirrorSelection {
8 | anchor: number
9 | head?: number
10 | }
11 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface CursorSelection {
8 | from: number
9 | to?: number
10 | }
11 |
--------------------------------------------------------------------------------
/netlify/intro.md:
--------------------------------------------------------------------------------
1 | :::info
2 | What you see is an UI-Test! It's filled with dummy data, not connected to a backend and no data will be saved.
3 | :::
4 |
5 | 
6 |
7 | [](https://www.netlify.com)
8 |
--------------------------------------------------------------------------------
/src/components/common/links/__snapshots__/translated-internal-link.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`TranslatedInternalLink renders with i18nKey 1`] = `
4 |
12 | `;
13 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-regex/interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface RegexOptions {
8 | name: string
9 | regex: RegExp
10 | replace: (match: string) => string
11 | }
12 |
--------------------------------------------------------------------------------
/.idea/copyright/hedgedoc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/netlify/motd.md:
--------------------------------------------------------------------------------
1 | This demo is hosted by [netlify](https://netlify.com).
2 | Please check their [privacy policy](https://netlify.com/privacy) as well as [our privacy policy](https://hedgedoc.org/privacy-policy).
3 |
4 | :::info
5 | What you see is an UI-Test! It's filled with dummy data, not connected to a backend and no data will be saved.
6 | :::
7 |
--------------------------------------------------------------------------------
/src/components/history-page/history-card/history-card.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .card-min-height {
8 | min-height: 160px;
9 | }
10 |
11 | .card-footer-min-height {
12 | min-height: 27px;
13 | }
14 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/revisions/revision-list-entry.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .revision-item {
8 | cursor: pointer;
9 |
10 | span > img {
11 | height: 1.25rem;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/dev-reverse-proxy/run-caddy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
4 | #
5 | # SPDX-License-Identifier: AGPL-3.0-only
6 | #
7 |
8 | set -e
9 |
10 | if [ ! -f caddy ]
11 | then
12 | curl -o caddy "https://caddyserver.com/api/download"
13 | chmod +x ./caddy
14 | fi
15 |
16 | exec ./caddy run
17 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-emoji/interface.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface EmojiOptions {
8 | defs?: { [key: string]: string }
9 | enabled: string[]
10 | shortcuts?: { [key: string]: string }
11 | }
12 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_helpers.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | @import "helpers/color-bg";
8 | @import "helpers/colored-links";
9 |
--------------------------------------------------------------------------------
/src/components/landing-layout/navigation/header-bar/header-nav-link.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .nav-link {
8 | border-bottom: 2px solid transparent
9 | }
10 |
11 | .nav-link-active {
12 | border-bottom-color: #fff;
13 | }
14 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/image/lightbox.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .lightbox img {
8 | max-width: calc(100vw - 3.5rem);
9 | max-height: calc(100vh - 3.5rem - 75px);
10 | object-fit: contain;
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/common/fields/fields.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { ChangeEvent } from 'react'
8 |
9 | export interface CommonFieldProps {
10 | onChange: (event: ChangeEvent) => void
11 | value: string
12 | }
13 |
--------------------------------------------------------------------------------
/src/components/common/user-avatar/user-avatar.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .user-line-name {
8 | text-overflow: ellipsis;
9 | flex: 1 1;
10 | overflow: hidden;
11 | }
12 |
13 | .user-image {
14 | color: transparent;
15 | }
16 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_type.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | .blockquote-footer {
8 | color: $blockquote-footer-color;
9 | }
10 |
--------------------------------------------------------------------------------
/src/components/common/fork-awesome/types.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { ForkAwesomeIcons } from './fork-awesome-icons'
8 |
9 | export type IconName = typeof ForkAwesomeIcons[number]
10 | export type IconSize = '2x' | '3x' | '4x' | '5x'
11 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/formatters/types/changes.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface ContentEdit {
8 | from: number
9 | to: number
10 | insert: string
11 | }
12 |
13 | export type ContentEdits = ContentEdit[]
14 |
--------------------------------------------------------------------------------
/src/components/login-page/auth/fields/fields.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { ChangeEvent } from 'react'
8 |
9 | export interface AuthFieldProps {
10 | onChange: (event: ChangeEvent) => void
11 | invalid: boolean
12 | }
13 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-mark/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-mark' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItMark: MarkdownIt.PluginSimple
10 | export = markdownItMark
11 | }
12 |
--------------------------------------------------------------------------------
/global-styles/typeahead.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .rbt-input-multi {
8 | min-width: 200px !important;
9 |
10 | .rbt-input-main {
11 | &[placeholder=""] {
12 | width: 10px !important;
13 | }
14 |
15 | width: 100%;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/csv/__snapshots__/csv-table-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`CSV Table Markdown Extension renders a csv codeblock 1`] = `
4 |
5 |
6 |
9 | a;b;c
10 | d;e;f
11 |
12 |
13 |
14 |
15 |
16 |
17 | `;
18 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-ins/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-ins' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItInserted: MarkdownIt.PluginSimple
10 | export = markdownItInserted
11 | }
12 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-sub/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-sub' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItSubscript: MarkdownIt.PluginSimple
10 | export = markdownItSubscript
11 | }
12 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-sup/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-sup' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItSuperscript: MarkdownIt.PluginSimple
10 | export = markdownItSuperscript
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/permissions/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export enum AccessLevel {
7 | NONE,
8 | READ_ONLY,
9 | WRITEABLE
10 | }
11 |
12 | export enum SpecialGroup {
13 | EVERYONE = '_EVERYONE',
14 | LOGGED_IN = '_LOGGED_IN'
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/linemarker/types.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface LineWithId {
8 | line: string
9 | id: number
10 | }
11 |
12 | export interface LineMarkerPosition {
13 | line: number
14 | position: number
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/profile-page/access-tokens/access-token-creation-form/access-token-creation-form-field.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | interface AccessTokenCreationFormFieldProps {
8 | formValues: {
9 | expiryDate: string
10 | label: string
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-abbr/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-abbr' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItAbbreviation: MarkdownIt.PluginSimple
10 | export = markdownItAbbreviation
11 | }
12 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-footnote/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-footnote' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItFootnote: MarkdownIt.PluginSimple
10 | export = markdownItFootnote
11 | }
12 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-deflist/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-deflist' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItDefinitionList: MarkdownIt.PluginSimple
10 | export = markdownItDefinitionList
11 | }
12 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-linkify/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it/lib/rules_core/linkify' {
8 | import type { RuleCore } from 'markdown-it/lib/parser_core'
9 | const markdownItLinkify: RuleCore
10 | export = markdownItLinkify
11 | }
12 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/forms/_form-text.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | //
8 | // Form text
9 | //
10 |
11 | .form-text {
12 | color: $form-text-color;
13 | }
14 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-mathjax/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-mathjax' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | const markdownItMathJax: (MathJaxOptions) => MarkdownIt.PluginSimple
10 | export = markdownItMathJax
11 | }
12 |
--------------------------------------------------------------------------------
/src/api/me/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { UserInfo } from '../users/types'
7 |
8 | export interface LoginUserInfo extends UserInfo {
9 | authProvider: string
10 | email: string
11 | }
12 |
13 | export interface ChangeDisplayNameDto {
14 | displayName: string
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/common/links/__snapshots__/translated-external-link.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`TranslatedExternalLink renders with i18nKey 1`] = `
4 |
15 | `;
16 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/emoji-picker/emoji-picker.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .tooltip {
8 | &, :global(body.dark) & {
9 | --bs-popover-max-width: 100%;
10 | --bs-popover-body-padding-y: 0;
11 | --bs-popover-body-padding-x: 0;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/utils/is-client-side-rendering.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | /**
8 | * Detects if the application is running on client side.
9 | */
10 | export const isClientSideRendering = (): boolean => {
11 | return typeof window !== 'undefined' && typeof window.navigator !== 'undefined'
12 | }
13 |
--------------------------------------------------------------------------------
/.idea/dictionaries/hedgedoc.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 | CodiMD
11 | HedgeDoc
12 | codimd
13 | hedgedoc
14 |
15 |
16 |
--------------------------------------------------------------------------------
/dev-reverse-proxy/Caddyfile:
--------------------------------------------------------------------------------
1 | #
2 | # SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | #
4 | # SPDX-License-Identifier: AGPL-3.0-only
5 | #
6 |
7 | :8080
8 |
9 | log {
10 | output stdout
11 | }
12 |
13 | reverse_proxy /realtime http://127.0.0.1:3000
14 | reverse_proxy /api/* http://127.0.0.1:3000
15 | reverse_proxy /public/* http://127.0.0.1:3000
16 | reverse_proxy /* http://127.0.0.1:3001
17 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-mathjax/interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface MathJaxOptions {
8 | beforeMath: string
9 | afterMath: string
10 | beforeInlineMath: string
11 | afterInlineMath: string
12 | beforeDisplayMath: string
13 | afterDisplayMath: string
14 | }
15 |
--------------------------------------------------------------------------------
/cypress/e2e/slideshow-only-page.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { PAGE_MODE } from '../support/visit'
8 |
9 | describe('Slideshow only page', () => {
10 | it('renders slide show mode', () => {
11 | cy.visitTestNote(PAGE_MODE.PRESENTATION)
12 | cy.getReveal().should('exist')
13 | })
14 | })
15 |
--------------------------------------------------------------------------------
/src/components/application-loader/application-loader.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .loader {
8 | height: 100%;
9 | width: 100%;
10 |
11 | &.middle, .middle {
12 | display: flex;
13 | align-items: center;
14 | justify-content: center;
15 | flex-direction: column;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/node-preprocessors/node-processor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Document } from 'domhandler'
8 |
9 | /**
10 | * Base class for node processors.
11 | */
12 | export abstract class NodeProcessor {
13 | public abstract process(document: Document): Document
14 | }
15 |
--------------------------------------------------------------------------------
/global-styles/variables.light.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | $blue: #337ab7 !default;
8 | $cyan: #5EB7E0 !default;
9 | $dark: #222222 !default;
10 |
11 | @import "~bootstrap/scss/functions";
12 | @import "~bootstrap/scss/mixins";
13 | @import "~bootstrap/scss/variables";
14 |
15 | $toast-background-color: $white;
16 |
17 |
--------------------------------------------------------------------------------
/src/api/common/default-config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export const defaultHeaders: HeadersInit = {}
8 |
9 | export const defaultConfig: Partial = {
10 | mode: 'cors',
11 | cache: 'no-cache',
12 | credentials: 'same-origin',
13 | redirect: 'follow',
14 | referrerPolicy: 'no-referrer'
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/application-loader/application-loader-error.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | /**
7 | * Custom {@link Error} class for the {@link ApplicationLoader}.
8 | */
9 | export class ApplicationLoaderError extends Error {
10 | constructor(taskName: string) {
11 | super(`The task ${taskName} failed`)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/status-bar/separator-dash.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { Fragment } from 'react'
8 |
9 | /**
10 | * Renders a dash without breaking spaces around.
11 | */
12 | export const SeparatorDash: React.FC = () => {
13 | return –
14 | }
15 |
--------------------------------------------------------------------------------
/src/components/render-page/markdown-toc-button/markdown-toc-button.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .markdown-toc-sidebar-button {
8 | position: fixed;
9 | right: 70px;
10 | bottom: 30px;
11 |
12 | & > :global(.dropup) {
13 | position: sticky;
14 | bottom: 20px;
15 | right: 0;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/global-styles/variables.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | $font-family-emojis: "Apple Color Emoji", "Twemoji";
8 | $font-family-base: "Source Sans Pro", Helvetica, Arial, $font-family-emojis, sans-serif;
9 |
10 | :export {
11 | font-family-emojis: $font-family-emojis;
12 | font-family-base: $font-family-base;
13 | }
14 |
--------------------------------------------------------------------------------
/src/api/alias/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export interface Alias {
7 | name: string
8 | primaryAlias: boolean
9 | noteId: string
10 | }
11 |
12 | export interface NewAliasDto {
13 | noteIdOrAlias: string
14 | newAlias: string
15 | }
16 |
17 | export interface PrimaryAliasDto {
18 | primaryAlias: boolean
19 | }
20 |
--------------------------------------------------------------------------------
/src/api/media/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export interface MediaUpload {
7 | url: string
8 | noteId: string | null
9 | createdAt: string
10 | username: string
11 | }
12 |
13 | export interface ImageProxyResponse {
14 | url: string
15 | }
16 |
17 | export interface ImageProxyRequestDto {
18 | url: string
19 | }
20 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/graphviz/__snapshots__/graphviz-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`PlantUML markdown extensions renders a plantuml codeblock 1`] = `
4 |
5 |
6 |
7 | this is a mock for graphviz frame
8 |
9 | graph {
10 | a -- b
11 | }
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | `;
20 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-regex/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-regex' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | import type { RegexOptions } from './interface'
10 | const markdownItRegex: MarkdownIt.PluginWithOptions
11 | export = markdownItRegex
12 | }
13 |
--------------------------------------------------------------------------------
/src/external-types/markdown-it-emoji/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare module 'markdown-it-emoji/bare' {
8 | import type MarkdownIt from 'markdown-it/lib'
9 | import type { EmojiOptions } from './interface'
10 | const markdownItEmoji: MarkdownIt.PluginWithOptions
11 | export = markdownItEmoji
12 | }
13 |
--------------------------------------------------------------------------------
/cypress/e2e/document-read-only-page.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { PAGE_MODE } from '../support/visit'
8 |
9 | describe('Document read only page', () => {
10 | it('renders the document mode', () => {
11 | cy.visitTestNote(PAGE_MODE.DOCUMENT_READ_ONLY)
12 | cy.getMarkdownBody().should('exist')
13 | })
14 | })
15 |
--------------------------------------------------------------------------------
/src/links.json:
--------------------------------------------------------------------------------
1 | {
2 | "chat": "https://matrix.to/#/#hedgedoc:matrix.org",
3 | "community": "https://community.hedgedoc.org",
4 | "githubOrg": "https://github.com/hedgedoc/",
5 | "backendSourceCode": "https://github.com/hedgedoc/hedgedoc",
6 | "backendIssues": "https://github.com/hedgedoc/hedgedoc/issues",
7 | "mastodon": "https://social.hedgedoc.org",
8 | "translate": "https://translate.hedgedoc.org",
9 | "webpage": "https://hedgedoc.org"
10 | }
11 |
--------------------------------------------------------------------------------
/src/redux/note-details/types/slide-show-options.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { RevealOptions } from 'reveal.js'
8 |
9 | type WantedRevealOptions = 'autoSlide' | 'autoSlideStoppable' | 'transition' | 'backgroundTransition' | 'slideNumber'
10 |
11 | export type SlideOptions = Required>
12 |
--------------------------------------------------------------------------------
/cypress.config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { defineConfig } from 'cypress'
8 |
9 | export default defineConfig({
10 | defaultCommandTimeout: 15000,
11 | video: false,
12 | projectId: 'ht3vbo',
13 |
14 | e2e: {
15 | baseUrl: 'http://127.0.0.1:3001/',
16 | specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}'
17 | }
18 | })
19 |
--------------------------------------------------------------------------------
/cypress/e2e/helpDialog.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | describe('Help Dialog', () => {
8 | beforeEach(() => {
9 | cy.visitTestNote()
10 | })
11 |
12 | it('ToDo-List', () => {
13 | cy.getByCypressId('editor-help-button').click()
14 | cy.get('input[type="checkbox"]').should('exist').should('not.be.checked')
15 | })
16 | })
17 |
--------------------------------------------------------------------------------
/cypress/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "noEmit": true,
5 | "strict": true,
6 | "target": "es6",
7 | "lib": [
8 | "es6",
9 | "dom"
10 | ],
11 | "types": [
12 | "cypress",
13 | "cypress-commands",
14 | "cypress-file-upload",
15 | "node"
16 | ]
17 | },
18 | "include": [
19 | "../node_modules/cypress",
20 | "./**/*.ts"
21 | ],
22 | "exclude": []
23 | }
24 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/flowchart/__snapshots__/flowchart-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Flowchart markdown extensions renders a flowchart codeblock 1`] = `
4 |
5 |
6 |
7 | this is a mock for flowchart frame
8 |
9 | st=>start: Start
10 | e=>end: End
11 | st->e
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | `;
20 |
--------------------------------------------------------------------------------
/src/components/history-page/history-toolbar/toolbar-context/toolbar-context.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Dispatch, SetStateAction } from 'react'
8 | import type { HistoryToolbarState } from '../history-toolbar-state'
9 |
10 | export type HistoryToolbarStateWithDispatcher = [HistoryToolbarState, Dispatch>]
11 |
--------------------------------------------------------------------------------
/src/components/history-page/pin-button/pin-button.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .history-pin {
8 | .fa {
9 | opacity: 0.2;
10 | transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
11 | }
12 |
13 | &:hover .fa {
14 | opacity: 1;
15 | }
16 |
17 | &.pinned .fa {
18 | color: #d43f3a;
19 | opacity: 1;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/.github/workflows/reuse.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
2 | #
3 | # SPDX-License-Identifier: AGPL-3.0-only
4 |
5 | name: REUSE Compliance Check
6 |
7 | on:
8 | push:
9 | branches: [ main ]
10 | pull_request:
11 | branches: [ main ]
12 |
13 | jobs:
14 | reuse:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v3
18 | - name: REUSE Compliance Check
19 | uses: fsfe/reuse-action@v1
20 |
--------------------------------------------------------------------------------
/src/components/notifications/notifications.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .notifications-area {
8 | position: fixed;
9 | top: 15px;
10 | right: 15px;
11 | z-index: 2000;
12 |
13 | .toast {
14 | min-width: 250px;
15 | max-width: 100vw;
16 | }
17 |
18 | .progress {
19 | border-radius: 0;
20 | height: 0.25rem;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/editor-page/splitter/splitter.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | .left, .right {
7 | overflow: hidden;
8 | }
9 |
10 | .inner {
11 | display: flex;
12 | min-width: 20vw;
13 | height: 100%;
14 | flex-direction: column;
15 | }
16 |
17 | .move-overlay {
18 | position: absolute;
19 | height: 100%;
20 | width: 100%;
21 | z-index: 100000;
22 | }
23 |
--------------------------------------------------------------------------------
/cypress/e2e/diagrams.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | describe('Diagram codeblock ', () => {
8 | beforeEach(() => {
9 | cy.visitTestNote()
10 | })
11 |
12 | it('renders mermaid', () => {
13 | cy.setCodemirrorContent('```mermaid\ngraph TD;\n A-->B;\n```')
14 | cy.getMarkdownBody().findByCypressId('mermaid-frame').children().should('be.visible')
15 | })
16 | })
17 |
--------------------------------------------------------------------------------
/src/components/common/number-range/number-range.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | /**
8 | * Create an array with numbers from 1 to n.
9 | *
10 | * @param length The length of the array (or the number n)
11 | * @return An array of numbers from 1 to n
12 | */
13 | export const createNumberRangeArray = (length: number): number[] => {
14 | return Array.from(Array(length).keys())
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/table-picker/table-picker.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .table-cell {
8 | margin: 1px;
9 | border-radius: 2px;
10 | border: solid 1px var(--bs-dark);
11 | }
12 |
13 | .table-container {
14 | display: grid;
15 | grid-template-columns: repeat(10, 15px [col-start]);
16 | grid-template-rows: repeat(8, 15px [row-start]);
17 | }
18 |
--------------------------------------------------------------------------------
/src/components/editor-page/table-of-contents/toc-slugify.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | /**
7 | * Transforms a given content into an url slug.
8 | *
9 | * @param content The content to slugify
10 | * @return The slugifyed content.
11 | */
12 | export const tocSlugify = (content: string): string => {
13 | return encodeURIComponent(content.trim().toLowerCase().replace(/\s+/g, '-'))
14 | }
15 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/abcjs/abc.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 |
8 | .abcjs-score {
9 | :global(.markdown-body) & {
10 | overflow-x: auto !important;
11 | }
12 |
13 | & > svg {
14 | max-width: unset !important;
15 | }
16 |
17 | &, text {
18 | @import "../../../../global-styles/variables.module";
19 | font-family: $font-family-base;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/gist/gist-frame.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .gist-resizer-row {
8 | display: flex;
9 | justify-content: center;
10 |
11 | .gist-resizer {
12 | display: flex;
13 | width: 48px;
14 | height: 5px;
15 | background: white;
16 | border-radius: 90px;
17 | cursor: row-resize;
18 | box-shadow: black 0 0 3px;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | # HedgeDoc - React Client
8 |
9 |
10 | This is the new, improved and better looking frontend for HedgeDoc 2.0.
11 | Our goal is to recreate the current frontend in react and to improve it.
12 |
13 | :warning::warning: This repository is deprecated. The frontend has been merged into the [main HedgeDoc repository](https://github.com/hedgedoc/hedgedoc) :warning::warning:
14 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_tooltip.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // Base class
8 | .tooltip {
9 | // scss-docs-start tooltip-css-vars
10 | --#{$prefix}tooltip-color: #{$tooltip-color};
11 | --#{$prefix}tooltip-bg: #{$tooltip-bg};
12 | // scss-docs-end tooltip-css-vars
13 | }
14 |
--------------------------------------------------------------------------------
/src/api/auth/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder'
7 |
8 | /**
9 | * Requests to log out the current user.
10 | *
11 | * @throws {Error} if logout is not possible.
12 | */
13 | export const doLogout = async (): Promise => {
14 | await new DeleteApiRequestBuilder('auth/logout').sendRequest()
15 | }
16 |
--------------------------------------------------------------------------------
/public/icons/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "HedgeDoc",
3 | "short_name": "HedgeDoc",
4 | "icons": [
5 | {
6 | "src": "/icons/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/icons/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#b51f08",
17 | "background_color": "#303030"
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/history-page/history-table/history-table.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .history-table tr {
8 | th, td {
9 |
10 | &:nth-child(1) {
11 | width: 45%;
12 | }
13 |
14 | &:nth-child(2) {
15 | width: 20%;
16 | }
17 |
18 | &:nth-child(3) {
19 | width: 20%;
20 | }
21 |
22 | &:nth-child(4) {
23 | width: 15%;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/aliases/__snapshots__/aliases-list.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`AliasesList renders the AliasList sorted 1`] = `
4 |
5 |
6 | Alias:
7 | a-test
8 | (
9 | non-primary
10 | )
11 |
12 |
13 | Alias:
14 | b-test
15 | (
16 | primary
17 | )
18 |
19 |
20 | Alias:
21 | z-test
22 | (
23 | non-primary
24 | )
25 |
26 |
27 | `;
28 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .activeIndicator {
8 | $indicator-size: 12px;
9 | border-radius: $indicator-size;
10 | height: $indicator-size;
11 | width: $indicator-size;
12 |
13 | &.active {
14 | background-color: #5cb85c;
15 | }
16 |
17 | &.inactive {
18 | background-color: #d20000;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/editor-page/utils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { isClientSideRendering } from '../../utils/is-client-side-rendering'
8 |
9 | /**
10 | * Determines if the client is running on a Mac.
11 | * This is necessary to e.g. determine different keyboard shortcuts.
12 | */
13 | export const isMac: () => boolean = () => isClientSideRendering() && navigator.platform.toLowerCase().includes('mac')
14 |
--------------------------------------------------------------------------------
/src/api/tokens/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface AccessToken {
8 | label: string
9 | validUntil: string
10 | keyId: string
11 | createdAt: string
12 | lastUsedAt: string | null
13 | }
14 |
15 | export interface AccessTokenWithSecret extends AccessToken {
16 | secret: string
17 | }
18 |
19 | export interface CreateAccessTokenDto {
20 | label: string
21 | validUntil: number
22 | }
23 |
--------------------------------------------------------------------------------
/src/redux/config/methods.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { store } from '..'
8 | import type { Config } from '../../api/config/types'
9 | import type { SetConfigAction } from './types'
10 | import { ConfigActionType } from './types'
11 |
12 | export const setConfig = (state: Config): void => {
13 | store.dispatch({
14 | type: ConfigActionType.SET_CONFIG,
15 | state: state
16 | } as SetConfigAction)
17 | }
18 |
--------------------------------------------------------------------------------
/src/redux/config/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Action } from 'redux'
8 | import type { Config } from '../../api/config/types'
9 |
10 | export enum ConfigActionType {
11 | SET_CONFIG = 'config/set'
12 | }
13 |
14 | export type ConfigActions = SetConfigAction
15 |
16 | export interface SetConfigAction extends Action {
17 | type: ConfigActionType.SET_CONFIG
18 | state: Config
19 | }
20 |
--------------------------------------------------------------------------------
/src/api/revisions/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { NoteEdit } from '../notes/types'
8 |
9 | export interface RevisionDetails extends RevisionMetadata {
10 | content: string
11 | patch: string
12 | edits: NoteEdit[]
13 | }
14 |
15 | export interface RevisionMetadata {
16 | id: number
17 | createdAt: string
18 | length: number
19 | authorUsernames: string[]
20 | anonymousAuthorCount: number
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/common/redirect-back.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useEffect } from 'react'
8 | import { useRouter } from 'next/router'
9 |
10 | /**
11 | * Redirects the user back to the previous URL.
12 | */
13 | export const RedirectBack: React.FC = () => {
14 | const router = useRouter()
15 |
16 | useEffect(() => {
17 | router.back()
18 | })
19 |
20 | return Redirecting back
21 | }
22 |
--------------------------------------------------------------------------------
/src/pages/404.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import { CommonErrorPage } from '../components/error-pages/common-error-page'
7 | import type { NextPage } from 'next'
8 |
9 | /**
10 | * Renders a hedgedoc themed 404 page.
11 | */
12 | const Custom404: NextPage = () => {
13 | return
14 | }
15 |
16 | export default Custom404
17 |
--------------------------------------------------------------------------------
/src/redux/note-details/frontmatter-extractor/types.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export type FrontmatterExtractionResult = PresentFrontmatterExtractionResult | NonPresentFrontmatterExtractionResult
8 |
9 | export interface PresentFrontmatterExtractionResult {
10 | isPresent: true
11 | rawText: string
12 | lineOffset: number
13 | }
14 |
15 | interface NonPresentFrontmatterExtractionResult {
16 | isPresent: false
17 | }
18 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_forms.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | @import "forms/labels";
8 | @import "forms/form-text";
9 | @import "forms/form-control";
10 | @import "forms/form-select";
11 | @import "forms/form-check";
12 | @import "forms/form-range";
13 | @import "forms/input-group";
14 | @import "forms/validation";
15 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_images.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // Image thumbnails
8 | .img-thumbnail {
9 | background-color: $thumbnail-bg;
10 | border-color: $thumbnail-border-color;
11 | @include box-shadow($thumbnail-box-shadow);
12 | }
13 |
14 | .figure-caption {
15 | color: $figure-caption-color;
16 | }
17 |
--------------------------------------------------------------------------------
/cypress/support/logout.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare namespace Cypress {
8 | interface Chainable {
9 | /**
10 | * Custom command to log the user out.
11 | * @example cy.logout()
12 | */
13 | logout(): Chainable
14 | }
15 | }
16 |
17 | Cypress.Commands.add('logout', () => {
18 | cy.getByCypressId('user-dropdown').click()
19 | cy.getByCypressId('user-dropdown-sign-out-button').click()
20 | })
21 |
--------------------------------------------------------------------------------
/src/components/history-page/history-toolbar/history-toolbar-state.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { SortModeEnum } from '../sort-button/sort-button'
8 | import type { ViewStateEnum } from './history-toolbar'
9 |
10 | export type HistoryToolbarState = {
11 | viewState: ViewStateEnum
12 | search: string
13 | selectedTags: string[]
14 | titleSortDirection: SortModeEnum
15 | lastVisitedSortDirection: SortModeEnum
16 | }
17 |
--------------------------------------------------------------------------------
/cypress/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parserOptions": {
3 | "tsconfigRootDir": "",
4 | "project": [
5 | "./tsconfig.json"
6 | ]
7 | },
8 | "plugins": [
9 | "cypress",
10 | "chai-friendly"
11 | ],
12 | "extends": [
13 | "plugin:cypress/recommended"
14 | ],
15 | "rules": {
16 | "@typescript-eslint/no-unused-expressions": 0,
17 | "no-unused-expressions": 0,
18 | "chai-friendly/no-unused-expressions": 2,
19 | "@typescript-eslint/no-namespace": 0
20 | },
21 | "env": {
22 | "cypress/globals": true
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/hooks/yjs/use-y-doc.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { Doc } from 'yjs'
8 | import { useEffect, useMemo } from 'react'
9 |
10 | /**
11 | * Creates a new {@link Doc y-doc}.
12 | *
13 | * @return The created {@link Doc y-doc}
14 | */
15 | export const useYDoc = (): Doc => {
16 | const yDoc = useMemo(() => new Doc(), [])
17 | useEffect(() => () => yDoc.destroy(), [yDoc])
18 | return yDoc
19 | }
20 |
--------------------------------------------------------------------------------
/src/redux/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { allReducers } from './reducers'
8 | import type { ApplicationState } from './application-state'
9 | import { configureStore } from '@reduxjs/toolkit'
10 | import { isDevMode } from '../utils/test-modes'
11 |
12 | export const store = configureStore({
13 | reducer: allReducers,
14 | devTools: isDevMode
15 | })
16 |
17 | export const getGlobalState = (): ApplicationState => store.getState()
18 |
--------------------------------------------------------------------------------
/src/components/landing-layout/footer/footer.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { PoweredByLinks } from './powered-by-links'
9 | import { SocialLink } from './social-links'
10 |
11 | /**
12 | * Renders the footer.
13 | */
14 | export const Footer: React.FC = () => {
15 | return (
16 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/common-markdown-renderer-props.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Ref } from 'react'
8 |
9 | export interface CommonMarkdownRendererProps {
10 | onFirstHeadingChange?: (firstHeading: string | undefined) => void
11 | baseUrl: string
12 | outerContainerRef?: Ref
13 | newlinesAreBreaks?: boolean
14 | lineOffset?: number
15 | className?: string
16 | markdownContentLines: string[]
17 | }
18 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/vega-lite/__snapshots__/vega-lite-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Vega-Lite markdown extensions renders a vega-lite codeblock 1`] = `
4 |
5 |
6 |
7 | this is a mock for vega lite
8 |
9 | {"$schema":"https://vega.github.io/schema/vega-lite/v4.json","data":{"values":[{"a":"","b":28}]},"mark":"bar","encoding":{"x":{"field":"a"},"y":{"field":"b"}}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | `;
18 |
--------------------------------------------------------------------------------
/src/hooks/common/use-note-markdown-content.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useApplicationState } from './use-application-state'
8 |
9 | /**
10 | * Extracts the markdown content of the current note from the global application state.
11 | *
12 | * @return The markdown content of the note
13 | */
14 | export const useNoteMarkdownContent = (): string => {
15 | return useApplicationState((state) => state.noteDetails.markdownContent.plain)
16 | }
17 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_badge.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // Base class
8 | //
9 | // Requires one of the contextual, color modifier classes for `color` and
10 | // `background-color`.
11 |
12 | .badge {
13 | // scss-docs-start badge-css-vars
14 | --#{$prefix}badge-color: #{$badge-color};
15 | // scss-docs-end badge-css-vars
16 | }
17 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/image-placeholder/image-placeholder.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .image-drop {
8 | border: 3px dashed var(--bs-dark);
9 |
10 | border-radius: 3px;
11 | transition: background-color 50ms, color 50ms;
12 |
13 | .altText {
14 | text-overflow: ellipsis;
15 | flex: 1 1;
16 | overflow: hidden;
17 | width: 100%;
18 | white-space: nowrap;
19 | text-align: center;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/redux/dark-mode/methods.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { store } from '..'
8 | import type { DarkModeConfigAction, DarkModePreference } from './types'
9 | import { DarkModeConfigActionType } from './types'
10 |
11 | export const setDarkModePreference = (darkModePreference: DarkModePreference): void => {
12 | store.dispatch({
13 | type: DarkModeConfigActionType.SET_DARK_MODE,
14 | darkModePreference
15 | } as DarkModeConfigAction)
16 | }
17 |
--------------------------------------------------------------------------------
/src/components/common/upload-image-mimetypes.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export const supportedMimeTypes: string[] = [
8 | 'image/apng',
9 | 'image/bmp',
10 | 'image/gif',
11 | 'image/heif',
12 | 'image/heic',
13 | 'image/heif-sequence',
14 | 'image/heic-sequence',
15 | 'image/jpeg',
16 | 'image/png',
17 | 'image/svg+xml',
18 | 'image/tiff',
19 | 'image/webp'
20 | ]
21 |
22 | export const acceptedMimeTypes = supportedMimeTypes.join(', ')
23 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/forms/_labels.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | //
8 | // Labels
9 | //
10 |
11 | .form-label {
12 | color: $form-label-color;
13 | }
14 |
15 | // For use with horizontal and inline forms, when you need the label (or legend)
16 | // text to align with the form controls.
17 | .col-form-label {
18 | color: $form-label-color;
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/loading-slide.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { Trans, useTranslation } from 'react-i18next'
9 |
10 | /**
11 | * Shows a static text placeholder while reveal.js is loading.
12 | */
13 | export const LoadingSlide: React.FC = () => {
14 | useTranslation()
15 | return (
16 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/src/redux/dark-mode/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Action } from 'redux'
8 |
9 | export enum DarkModeConfigActionType {
10 | SET_DARK_MODE = 'dark-mode/set'
11 | }
12 |
13 | export enum DarkModePreference {
14 | DARK,
15 | LIGHT,
16 | AUTO
17 | }
18 |
19 | export interface DarkModeConfig {
20 | darkModePreference: DarkModePreference
21 | }
22 |
23 | export type DarkModeConfigAction = Action & DarkModeConfig
24 |
--------------------------------------------------------------------------------
/src/components/login-page/auth/social-link-button/social-link-button.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .social-link-button {
8 |
9 | &, &:hover {
10 | color: #FFFFFF;
11 | }
12 |
13 | .icon-part {
14 | padding: 0.375rem 0.375rem;
15 | border-right: 1px solid rgba(0, 0, 0, 0.2);
16 | display: flex;
17 |
18 | .social-icon {
19 | font-size: 1.5em;
20 | }
21 | }
22 |
23 | .text-part {
24 | padding: 0.375rem 0.75rem;
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/src/components/common/wait-spinner/wait-spinner.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
9 |
10 | /**
11 | * Renders a indefinitely spinning spinner.
12 | */
13 | export const WaitSpinner: React.FC = () => {
14 | return (
15 |
16 |
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/render-page/markdown-document.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .markdown-document {
8 | width: 100%;
9 | height: 100%;
10 | margin: 0;
11 | overflow: auto;
12 | display: flex;
13 | flex-direction: row;
14 |
15 | .markdown-document-side {
16 | flex: 1 0 0;
17 | }
18 |
19 | .markdown-document-content {
20 | padding-left: 10px;
21 | padding-right: 10px;
22 | flex: 0 0 900px;
23 | max-width: 100%;
24 | width: 900px;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/render-page/window-post-message-communicator/hooks/use-is-renderer-ready.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useApplicationState } from '../../../../hooks/common/use-application-state'
8 |
9 | /**
10 | * Extracts the ready status of the renderer from the global application state.
11 | *
12 | * @return The current ready status of the renderer.
13 | */
14 | export const useIsRendererReady = (): boolean => useApplicationState((state) => state.rendererStatus.rendererReady)
15 |
--------------------------------------------------------------------------------
/.mailmap:
--------------------------------------------------------------------------------
1 | Tilman Vatteroth mrdrogdrog
2 | Tilman Vatteroth mrdrogdrog
3 | Tilman Vatteroth Tilman Vatteroth
4 |
5 | Philip Molares Philip Molares
6 | Philip Molares Philip Molares
7 |
8 | Sheogorath Christoph Kern
9 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_breadcrumb.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | .breadcrumb {
8 | // scss-docs-start breadcrumb-css-vars
9 | --#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
10 | --#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color};
11 | --#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color};
12 | // scss-docs-end breadcrumb-css-vars
13 | }
14 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ### Component/Part
2 |
3 |
4 | ### Description
5 | This PR fixes/adds/improves/...
6 |
7 | ### Steps
8 |
9 |
10 |
11 | - [ ] Added implementation
12 | - [ ] Added / updated tests
13 | - [ ] Added / updated documentation
14 | - [ ] Extended changelog
15 | - [ ] I read the [contribution documentation](https://github.com/hedgedoc/react-client/blob/main/CONTRIBUTING.md) and signed-off my commits to accept the DCO.
16 |
17 | ### Related Issue(s)
18 |
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/abcjs/__snapshots__/abcjs-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`AbcJs Markdown Extension renders an abc codeblock 1`] = `
4 |
5 |
6 |
7 | this is a mock for abc js frame
8 |
9 | X:1\\nT:Speed the Plough\\nM:4/4\\nC:Trad.\\nK:G\\n|:GABc dedB|dedB dedB|c2ec B2dB|c2A2 A2BA|\\nGABc dedB|dedB dedB|c2ec B2dB|A2F2 G4:|\\n|:g2gf gdBd|g2f2 e2d2|c2ec B2dB|c2A2 A2df|\\ng2gf g2Bd|g2f2 e2d2|c2ec B2dB|A2F2 G4:|
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | `;
18 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/plantuml/__snapshots__/plantuml-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`PlantUML markdown extensions renders a plantuml codeblock 1`] = `
4 |
5 |
9 |
10 |
11 |
12 | `;
13 |
14 | exports[`PlantUML markdown extensions renders an error if no server is defined 1`] = `
15 |
16 |
19 | renderer.plantuml.notConfigured
20 |
21 |
22 | `;
23 |
--------------------------------------------------------------------------------
/AUTHORS.md:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 | # Authors
13 |
14 | - Erik Michelson
15 | - Henrik Hüttemann
16 | - Jakob Klepp
17 | - Philip Molares
18 | - Christoph Kern
19 | - Tilman Vatteroth
20 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .sidebar-menu {
8 | transition: height 0.2s, flex-basis 0.2s;
9 | display: flex;
10 | flex-direction: column;
11 | overflow: hidden;
12 | flex: 0 1 0;
13 | height: 0;
14 |
15 | &.show {
16 | height: 100%;
17 | flex-basis: 100%;
18 | overflow-y: auto;
19 | }
20 |
21 | & > div {
22 | background: var(--bs-body-bg);
23 | box-shadow: inset 0 7px 7px -6px #bbbbbb;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/plantuml/plantuml-not-configured-alert.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { Trans, useTranslation } from 'react-i18next'
9 |
10 | /**
11 | * Renders an alert if plantuml is not configured.
12 | */
13 | export const PlantumlNotConfiguredAlert: React.FC = () => {
14 | useTranslation()
15 |
16 | return (
17 |
18 |
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_progress.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | .progress {
8 | // scss-docs-start progress-css-vars
9 | --#{$prefix}progress-bg: #{$progress-bg};
10 | --#{$prefix}progress-box-shadow: #{$progress-box-shadow};
11 | --#{$prefix}progress-bar-color: #{$progress-bar-color};
12 | --#{$prefix}progress-bar-bg: #{$progress-bar-bg};
13 | // scss-docs-end progress-css-vars
14 | }
15 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/tool-bar.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | :global(.btn-toolbar).toolbar {
8 | border-bottom: 1px solid #ededed;
9 | border-top: 1px solid #ededed;
10 |
11 | :global(.btn) {
12 | padding: 0.1875rem 0.5rem;
13 | min-width: 30px;
14 | }
15 |
16 | :global(.btn-group):not(:last-of-type)::after {
17 | background-color: #e2e6ea;
18 | width: 2px;
19 | padding: 0.25rem 0;
20 | content: ' ';
21 | margin-left: 0.5rem;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/users-online-sidebar-menu/online-counter.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | .online-entry {
7 | &:hover {
8 | :global(.sidebar-button-icon):after {
9 | color: inherit;
10 | }
11 | }
12 |
13 | --users-online: '0';
14 |
15 | :global(.sidebar-button-icon):after {
16 | content: var(--users-online);
17 | position: absolute;
18 | right: 5px;
19 | bottom: 3px;
20 | font-size: 0.9rem;
21 | color: var(--bg-primary);
22 | line-height: 1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/emoji/__snapshots__/emoji-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Emoji Markdown Extension renders a fork awesome code 1`] = `
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 | `;
14 |
15 | exports[`Emoji Markdown Extension renders a skin tone code 1`] = `
16 |
17 |
18 | 🏽
19 |
20 |
21 |
22 |
23 | `;
24 |
25 | exports[`Emoji Markdown Extension renders an emoji code 1`] = `
26 |
27 |
28 | 😄
29 |
30 |
31 |
32 |
33 | `;
34 |
--------------------------------------------------------------------------------
/cypress/e2e/iframe-capsule.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | describe('Iframe capsule', () => {
8 | beforeEach(() => {
9 | cy.visitTestNote()
10 | })
11 |
12 | it('shows a clickable click shield instead of the iframe', () => {
13 | cy.setCodemirrorContent('')
14 | cy.getMarkdownBody().findByCypressId('iframe-capsule-click-shield').should('exist').click()
15 | cy.getMarkdownBody().find('iframe').should('exist').should('have.attr', 'src', 'https://example.org')
16 | })
17 | })
18 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/forms/_input-group.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // Textual addons
8 | //
9 | // Serves as a catch-all element for any text or radio/checkbox input you wish
10 | // to prepend or append to an input.
11 |
12 | .input-group-text {
13 | color: $input-group-addon-color;
14 | background-color: $input-group-addon-bg;
15 | border: $input-border-width solid $input-group-addon-border-color;
16 | }
17 |
--------------------------------------------------------------------------------
/src/components/editor-page/synced-scroll/scroll-props.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export type ScrollCallback = (scrollState: ScrollState) => void
8 |
9 | export interface ScrollProps {
10 | scrollState?: ScrollState
11 | onScroll?: ScrollCallback
12 | onMakeScrollSource?: () => void
13 | }
14 |
15 | export interface ScrollState {
16 | firstLineInView: number
17 | scrolledPercentage: number
18 | }
19 |
20 | export interface DualScrollState {
21 | editorScrollState: ScrollState
22 | rendererScrollState: ScrollState
23 | }
24 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/vimeo/__snapshots__/vimeo-frame.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`VimeoFrame renders a click shield 1`] = `
4 |
5 |
6 | This is a click shield for
7 |
10 |
16 |
17 |
18 |
19 | `;
20 |
--------------------------------------------------------------------------------
/src/redux/store-provider.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { PropsWithChildren } from 'react'
8 | import React from 'react'
9 | import { Provider } from 'react-redux'
10 | import { store } from './index'
11 |
12 | /**
13 | * Sets the redux store for the children components.
14 | *
15 | * @param children The child components that should access the redux store
16 | */
17 | export const StoreProvider: React.FC> = ({ children }) => {
18 | return {children}
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-time-from-now.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import type { TimeFromNowProps } from '../time-from-now'
9 | import { TimeFromNow } from '../time-from-now'
10 | import { UnitalicBoldContent } from '../unitalic-bold-content'
11 |
12 | export const UnitalicBoldTimeFromNow: React.FC = ({ time }) => {
13 | return (
14 |
15 |
16 |
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/linkify-fix/__snapshots__/linkify-fix-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Linkify markdown extensions renders a .rocks link correctly 1`] = `
4 |
33 | `;
34 |
--------------------------------------------------------------------------------
/src/components/application-loader/initializers/fetch-frontend-config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { getConfig } from '../../../api/config'
8 | import { setConfig } from '../../../redux/config/methods'
9 |
10 | /**
11 | * Get the {@link Config frontend config} and save it in the global application state.
12 | */
13 | export const fetchFrontendConfig = async (): Promise => {
14 | const config = await getConfig()
15 | if (!config) {
16 | return Promise.reject(new Error('Config empty!'))
17 | }
18 | setConfig(config)
19 | }
20 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/abcjs/abcjs-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import { AbcjsMarkdownExtension } from './abcjs-markdown-extension'
9 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
10 |
11 | export class AbcjsAppExtension extends AppExtension {
12 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
13 | return [new AbcjsMarkdownExtension()]
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/redux/renderer-status/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Action } from 'redux'
8 |
9 | export enum RendererStatusActionType {
10 | SET_RENDERER_STATUS = 'renderer-status/set-ready'
11 | }
12 |
13 | export interface RendererStatus {
14 | rendererReady: boolean
15 | }
16 |
17 | export interface SetRendererStatusAction extends Action {
18 | type: RendererStatusActionType.SET_RENDERER_STATUS
19 | rendererReady: boolean
20 | }
21 |
22 | export type RendererStatusActions = SetRendererStatusAction
23 |
--------------------------------------------------------------------------------
/src/components/common/icon-button/icon-button.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .btn-icon {
8 |
9 | &.with-border {
10 | .icon-part {
11 | border-right: 1px solid rgba(0, 0, 0, 0.2);
12 | }
13 |
14 | .text-part {
15 | padding: 0.375rem 0.75rem;
16 | }
17 | }
18 |
19 | .icon-part {
20 | padding: 0.375rem 0.375rem;
21 | display: flex;
22 |
23 | .social-icon {
24 | font-size: 1.5em;
25 | }
26 | }
27 |
28 | .text-part {
29 | padding: 0.375rem 0.75rem 0.375rem 0;
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/note-info/utils/unitalic-bold-trans.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { Trans } from 'react-i18next'
9 | import { UnitalicBoldContent } from '../unitalic-bold-content'
10 |
11 | export interface UnitalicBoldTransProps {
12 | i18nKey?: string
13 | }
14 |
15 | export const UnitalicBoldTrans: React.FC = ({ i18nKey }) => {
16 | return (
17 |
18 |
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/common/links/types.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { TOptions } from 'i18next'
8 | import type { IconName } from '../fork-awesome/fork-awesome-icon'
9 |
10 | interface GeneralLinkProp {
11 | href: string
12 | icon?: IconName
13 | id?: string
14 | className?: string
15 | title?: string
16 | }
17 |
18 | export interface LinkWithTextProps extends GeneralLinkProp {
19 | text: string
20 | }
21 |
22 | export interface TranslatedLinkProps extends GeneralLinkProp {
23 | i18nKey: string
24 | i18nOption?: TOptions
25 | }
26 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/youtube/__snapshots__/youtube-frame.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`YoutubeFrame renders a click shield 1`] = `
4 |
5 |
6 | This is a click shield for
7 |
10 |
16 |
17 |
18 |
19 | `;
20 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/user-line/user-line.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .user-line-color-indicator {
8 | border-left: 3px solid;
9 | min-height: 30px;
10 | height: 100%;
11 | flex: 0 0 3px;
12 | }
13 |
14 | .user-avatar {
15 | flex: 0 0 20px;
16 | }
17 |
18 | .user-line-name {
19 | text-overflow: ellipsis;
20 | flex: 1 1 0;
21 | overflow: hidden;
22 | }
23 |
24 | .active-indicator-container {
25 | height: 100%;
26 | display: flex;
27 | flex: 0 0 20px;
28 | align-items: center;
29 | justify-content: center;
30 | }
31 |
--------------------------------------------------------------------------------
/src/hooks/common/use-app-title.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useMemo } from 'react'
8 | import { useApplicationState } from './use-application-state'
9 |
10 | /**
11 | * Calculates the app title with branding if set.
12 | *
13 | * @return The app title with branding.
14 | */
15 | export const useAppTitle = (): string => {
16 | const brandingName = useApplicationState((state) => state.config.branding.name)
17 |
18 | return useMemo(() => {
19 | return 'HedgeDoc' + (brandingName ? ` @ ${brandingName}` : '')
20 | }, [brandingName])
21 | }
22 |
--------------------------------------------------------------------------------
/cypress/support/check-links.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | declare namespace Cypress {
8 | interface Chainable {
9 | /**
10 | * Custom command to check an external Link.
11 | * @example cy.get(a#extern).checkExternalLink('http://example.com')
12 | */
13 | checkExternalLink(url: string): Chainable
14 | }
15 | }
16 |
17 | Cypress.Commands.add('checkExternalLink', { prevSubject: 'element' }, ($element: JQuery, url: string) => {
18 | cy.wrap($element).should('have.attr', 'href', url).should('have.attr', 'target', '_blank')
19 | })
20 |
--------------------------------------------------------------------------------
/src/api/config/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Config } from './types'
8 | import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder'
9 |
10 | /**
11 | * Fetches the frontend config from the backend.
12 | *
13 | * @return The frontend config.
14 | * @throws {Error} when the api request wasn't successful.
15 | */
16 | export const getConfig = async (): Promise => {
17 | const response = await new GetApiRequestBuilder('config').sendRequest()
18 | return response.asParsedJsonObject()
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/common/icon-button/__snapshots__/translated-icon-button.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`TranslatedIconButton renders heart icon with i18nKey 1`] = `
4 |
5 |
10 |
13 |
16 |
17 |
20 | testi18nKey
21 |
22 |
23 |
24 | `;
25 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/formatters/replace-in-content.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { ContentEdits } from './types/changes'
8 | import { Optional } from '@mrdrogdrog/optional'
9 |
10 | export const replaceInContent = (currentContent: string, replaceable: string, replacement: string): ContentEdits => {
11 | return Optional.ofNullable(currentContent.indexOf(replaceable))
12 | .filter((index) => index > -1)
13 | .map((index) => [{ from: index, to: index + replaceable.length, insert: replacement }])
14 | .orElse([])
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/common/icon-button/translated-icon-button.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
8 | import { render } from '@testing-library/react'
9 | import { TranslatedIconButton } from './translated-icon-button'
10 |
11 | describe('TranslatedIconButton', () => {
12 | it('renders heart icon with i18nKey', async () => {
13 | await mockI18n()
14 | const view = render( )
15 | expect(view.container).toMatchSnapshot()
16 | })
17 | })
18 |
--------------------------------------------------------------------------------
/src/components/common/number-range/number-range.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { createNumberRangeArray } from './number-range'
8 |
9 | describe('number range', () => {
10 | it('creates an empty number range', () => {
11 | expect(createNumberRangeArray(0)).toEqual([])
12 | })
13 |
14 | it('creates a non-empty number range', () => {
15 | expect(createNumberRangeArray(10)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
16 | })
17 |
18 | it('fails with a negative range', () => {
19 | expect(() => createNumberRangeArray(-1)).toThrow()
20 | })
21 | })
22 |
--------------------------------------------------------------------------------
/src/pages/api/private/groups/_EVERYONE.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NextApiRequest, NextApiResponse } from 'next'
7 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
8 | import type { GroupInfo } from '../../../../api/group/types'
9 |
10 | const handler = (req: NextApiRequest, res: NextApiResponse) => {
11 | respondToMatchingRequest(HttpMethod.GET, req, res, {
12 | name: '_EVERYONE',
13 | displayName: 'Everyone',
14 | special: true
15 | })
16 | }
17 |
18 | export default handler
19 |
--------------------------------------------------------------------------------
/src/redux/user/reducers.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Reducer } from 'redux'
8 | import type { OptionalUserState, UserActions } from './types'
9 | import { UserActionType } from './types'
10 |
11 | export const UserReducer: Reducer = (
12 | state: OptionalUserState = null,
13 | action: UserActions
14 | ) => {
15 | switch (action.type) {
16 | case UserActionType.SET_USER:
17 | return action.state
18 | case UserActionType.CLEAR_USER:
19 | return null
20 | default:
21 | return state
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/redux/note-details/raw-note-frontmatter-parser/types.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface RawNoteFrontmatter {
8 | title: string | undefined
9 | description: string | undefined
10 | tags: string | number | string[] | undefined
11 | robots: string | undefined
12 | lang: string | undefined
13 | dir: string | undefined
14 | breaks: boolean | undefined
15 | GA: string | undefined
16 | disqus: string | undefined
17 | type: string | undefined
18 | slideOptions: { [key: string]: string } | null
19 | opengraph: { [key: string]: string } | null
20 | }
21 |
--------------------------------------------------------------------------------
/global-styles/dark.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 |
8 | body.dark {
9 | @import "variables.dark";
10 |
11 | /* redefine theme color variables */
12 | @each $color, $value in $theme-colors {
13 | --#{$prefix}#{$color}: #{$value};
14 | }
15 |
16 | $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
17 |
18 | @each $color, $value in $theme-colors-rgb {
19 | --#{$prefix}#{$color}-rgb: #{$value};
20 | }
21 |
22 | --#{$prefix}body-color: #{$body-color};
23 | --#{$prefix}body-bg: #{$body-bg};
24 |
25 | @import "colors-only-bootstrap/bootstrap";
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/common/show-if/show-if.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { render } from '@testing-library/react'
8 | import { ShowIf } from './show-if'
9 |
10 | describe('ShowIf', () => {
11 | it('renders child if condition is true', () => {
12 | const view = render(test )
13 | expect(view.container).toMatchSnapshot()
14 | })
15 |
16 | it('does not render child if condition is false', () => {
17 | const view = render(test )
18 | expect(view.container).toMatchSnapshot()
19 | })
20 | })
21 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/sequence-diagram/sequence-diagram.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { MermaidChart } from '../mermaid/mermaid-chart'
9 | import type { CodeProps } from '../../../components/markdown-renderer/replace-components/code-block-component-replacer'
10 |
11 | /**
12 | * Renders a sequence diagram with a deprecation notice.
13 | *
14 | * @param code the sequence diagram code
15 | */
16 | export const SequenceDiagram: React.FC = ({ code }) => {
17 | return
18 | }
19 |
--------------------------------------------------------------------------------
/src/pages/api/private/users/erik.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NextApiRequest, NextApiResponse } from 'next'
7 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
8 | import type { UserInfo } from '../../../../api/users/types'
9 |
10 | const handler = (req: NextApiRequest, res: NextApiResponse): void => {
11 | respondToMatchingRequest(HttpMethod.GET, req, res, {
12 | username: 'erik',
13 | displayName: 'Erik',
14 | photo: 'public/img/avatar.png'
15 | })
16 | }
17 |
18 | export default handler
19 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "types": ["node", "@testing-library/jest-dom", "@types/jest"]
18 | },
19 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
20 | "exclude": ["node_modules", "cypress", "cypress.config.ts"]
21 | }
22 |
--------------------------------------------------------------------------------
/src/pages/api/private/groups/_LOGGED_IN.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NextApiRequest, NextApiResponse } from 'next'
7 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
8 | import type { GroupInfo } from '../../../../api/group/types'
9 |
10 | const handler = (req: NextApiRequest, res: NextApiResponse) => {
11 | respondToMatchingRequest(HttpMethod.GET, req, res, {
12 | name: '_LOGGED_IN',
13 | displayName: 'All registered users',
14 | special: true
15 | })
16 | }
17 |
18 | export default handler
19 |
--------------------------------------------------------------------------------
/src/pages/api/private/groups/hedgedoc-devs.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NextApiRequest, NextApiResponse } from 'next'
7 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
8 | import type { GroupInfo } from '../../../../api/group/types'
9 |
10 | const handler = (req: NextApiRequest, res: NextApiResponse) => {
11 | respondToMatchingRequest(HttpMethod.GET, req, res, {
12 | name: 'hedgedoc-devs',
13 | displayName: 'HedgeDoc devs',
14 | special: true
15 | })
16 | }
17 |
18 | export default handler
19 |
--------------------------------------------------------------------------------
/src/pages/api/private/users/tilman.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NextApiRequest, NextApiResponse } from 'next'
7 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
8 | import type { UserInfo } from '../../../../api/users/types'
9 |
10 | const handler = (req: NextApiRequest, res: NextApiResponse): void => {
11 | respondToMatchingRequest(HttpMethod.GET, req, res, {
12 | username: 'tilman',
13 | displayName: 'Tilman',
14 | photo: 'public/img/avatar.png'
15 | })
16 | }
17 |
18 | export default handler
19 |
--------------------------------------------------------------------------------
/src/pages/api/private/users/molly.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { NextApiRequest, NextApiResponse } from 'next'
8 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
9 | import type { UserInfo } from '../../../../api/users/types'
10 |
11 | const handler = (req: NextApiRequest, res: NextApiResponse): void => {
12 | respondToMatchingRequest(HttpMethod.GET, req, res, {
13 | username: 'molly',
14 | displayName: 'Molly',
15 | photo: 'public/img/avatar.png'
16 | })
17 | }
18 |
19 | export default handler
20 |
--------------------------------------------------------------------------------
/cypress/fixtures/languages.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export const languages: string[] = [
8 | 'English',
9 | '简体中文',
10 | '繁體中文',
11 | 'Français',
12 | 'Deutsch',
13 | '日本語',
14 | 'Español',
15 | 'Català',
16 | 'Ελληνικά',
17 | 'Português',
18 | 'Italiano',
19 | 'Türkçe',
20 | 'Русский',
21 | 'Nederlands',
22 | 'Hrvatski',
23 | 'Polski',
24 | 'Українська',
25 | 'हिन्दी',
26 | 'Svenska',
27 | 'Esperanto',
28 | 'Dansk',
29 | '한국어',
30 | 'Bahasa Indonesia',
31 | 'Cрпски',
32 | 'Tiếng Việt',
33 | 'العربية',
34 | 'Česky',
35 | 'Slovensky'
36 | ]
37 |
--------------------------------------------------------------------------------
/src/utils/read-file.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { FileContentFormat, readFile } from './read-file'
8 |
9 | describe('read file', () => {
10 | it('reads files as text', async () => {
11 | const a = await readFile(new Blob(['Kinderriegel'], { type: 'text/plain' }), FileContentFormat.TEXT)
12 | expect(a).toBe('Kinderriegel')
13 | })
14 | it('reads files as data url', async () => {
15 | const a = await readFile(new Blob(['Kinderriegel'], { type: 'text/plain' }), FileContentFormat.DATA_URL)
16 | expect(a).toBe('data:text/plain;base64,S2luZGVycmllZ2Vs')
17 | })
18 | })
19 |
--------------------------------------------------------------------------------
/src/components/common/show-if/show-if.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { PropsWithChildren } from 'react'
8 | import React, { Fragment } from 'react'
9 |
10 | export interface ShowIfProps {
11 | condition: boolean
12 | }
13 |
14 | /**
15 | * Renders the children if the condition is met.
16 | *
17 | * @param children The children to show if the condition is met.
18 | * @param condition If the children should be shown
19 | */
20 | export const ShowIf: React.FC> = ({ children, condition }) => {
21 | return condition ? {children} : null
22 | }
23 |
--------------------------------------------------------------------------------
/src/redux/note-details/calculate-line-start-indexes.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | /**
8 | * Calculates the absolute start position of every line.
9 | *
10 | * @param markdownContentLines The lines of the document
11 | * @returns the calculated line starts
12 | */
13 | export const calculateLineStartIndexes = (markdownContentLines: string[]): number[] => {
14 | return markdownContentLines.reduce((state, line, lineIndex, lines) => {
15 | const lastIndex = lineIndex === 0 ? 0 : state[lineIndex - 1] + lines[lineIndex - 1].length + 1
16 | return [...state, lastIndex]
17 | }, [] as number[])
18 | }
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question---other.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question / Other
3 | about: Questions about the project, features, or organziational issues
4 | title: ''
5 | labels: question
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
12 |
13 |
14 | **What is your question?**
15 |
16 |
17 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_card.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | //
8 | // Base styles
9 | //
10 |
11 | .card {
12 | // scss-docs-start card-css-vars
13 | --#{$prefix}card-border-color: #{$card-border-color};
14 | --#{$prefix}card-box-shadow: #{$card-box-shadow};
15 | --#{$prefix}card-cap-bg: #{$card-cap-bg};
16 | --#{$prefix}card-cap-color: #{$card-cap-color};
17 | --#{$prefix}card-color: #{$card-color};
18 | --#{$prefix}card-bg: #{$card-bg};
19 | // scss-docs-end card-css-vars
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/image/proxy-image-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { MarkdownRendererExtension } from '../base/markdown-renderer-extension'
8 | import type { ComponentReplacer } from '../../replace-components/component-replacer'
9 | import { ProxyImageReplacer } from './proxy-image-replacer'
10 |
11 | /**
12 | * Adds support for image lightbox and image proxy redirection.
13 | */
14 | export class ProxyImageMarkdownExtension extends MarkdownRendererExtension {
15 | buildReplacers(): ComponentReplacer[] {
16 | return [new ProxyImageReplacer()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/alert/alert-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import { AlertMarkdownExtension } from './alert-markdown-extension'
9 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
10 |
11 | /**
12 | * Adds alert boxes to the markdown rendering.
13 | */
14 | export class AlertAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new AlertMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/note-info/time-from-now.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { DateTime } from 'luxon'
8 |
9 | import React from 'react'
10 |
11 | export interface TimeFromNowProps {
12 | time: DateTime
13 | }
14 |
15 | /**
16 | * Renders a given time relative to the current time.
17 | *
18 | * @param time The time to be rendered.
19 | */
20 | export const TimeFromNow: React.FC = ({ time }) => {
21 | return (
22 |
23 | {time.toRelative()}
24 |
25 | )
26 | }
27 |
--------------------------------------------------------------------------------
/src/api/history/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export enum HistoryEntryOrigin {
7 | LOCAL = 'local',
8 | REMOTE = 'remote'
9 | }
10 |
11 | export interface HistoryEntryPutDto {
12 | note: string
13 | pinStatus: boolean
14 | lastVisitedAt: string
15 | }
16 |
17 | export interface HistoryEntry {
18 | identifier: string
19 | title: string
20 | lastVisitedAt: string
21 | tags: string[]
22 | pinStatus: boolean
23 | }
24 |
25 | export interface HistoryEntryWithOrigin extends HistoryEntry {
26 | origin: HistoryEntryOrigin
27 | }
28 |
29 | export interface ChangePinStatusDto {
30 | pinStatus: boolean
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/emoji/emoji-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { MarkdownRendererExtension } from '../base/markdown-renderer-extension'
8 | import type MarkdownIt from 'markdown-it'
9 | import emoji from 'markdown-it-emoji/bare'
10 | import { combinedEmojiData } from './mapping'
11 |
12 | /**
13 | * Adds support for utf-8 emojis.
14 | */
15 | export class EmojiMarkdownExtension extends MarkdownRendererExtension {
16 | public configureMarkdownIt(markdownIt: MarkdownIt): void {
17 | markdownIt.use(emoji, {
18 | defs: combinedEmojiData
19 | })
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/redux/renderer-status/methods.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { store } from '..'
8 | import type { SetRendererStatusAction } from './types'
9 | import { RendererStatusActionType } from './types'
10 |
11 | /**
12 | * Dispatches a global application state change for the "renderer ready" state.
13 | *
14 | * @param rendererReady The new renderer ready state.
15 | */
16 | export const setRendererStatus = (rendererReady: boolean): void => {
17 | const action: SetRendererStatusAction = {
18 | type: RendererStatusActionType.SET_RENDERER_STATUS,
19 | rendererReady
20 | }
21 | store.dispatch(action)
22 | }
23 |
--------------------------------------------------------------------------------
/cypress/e2e/linkEmbedder.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | describe('Link gets replaced with embedding: ', () => {
8 | beforeEach(() => {
9 | cy.visitTestNote()
10 | })
11 |
12 | // TODO Add general testing of one-click-embedding component. The tests below just test a specific use of the component.
13 |
14 | it('GitHub Gist', () => {
15 | cy.setCodemirrorContent('https://gist.github.com/schacon/1')
16 | cy.getMarkdownBody().findByCypressId('click-shield-gist').findByCypressId('preview-background').parent().click()
17 | cy.getMarkdownBody().findByCypressId('gh-gist').should('be.visible')
18 | })
19 | })
20 |
--------------------------------------------------------------------------------
/src/components/common/links/translated-internal-link.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { TranslatedInternalLink } from './translated-internal-link'
8 | import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
9 | import { render } from '@testing-library/react'
10 |
11 | describe('TranslatedInternalLink', () => {
12 | const href = '/test'
13 | beforeAll(async () => {
14 | await mockI18n()
15 | })
16 | it('renders with i18nKey', () => {
17 | const view = render( )
18 | expect(view.container).toMatchSnapshot()
19 | })
20 | })
21 |
--------------------------------------------------------------------------------
/src/hooks/common/use-on-input-change.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { ChangeEvent } from 'react'
8 | import { useCallback } from 'react'
9 |
10 | /**
11 | * Takes an input change event and sends the event value to a state setter.
12 | *
13 | * @param setter The setter method for the state.
14 | * @return Hook that can be used as callback for onChange.
15 | */
16 | export const useOnInputChange = (setter: (value: string) => void): ((event: ChangeEvent) => void) => {
17 | return useCallback(
18 | (event) => {
19 | setter(event.target.value)
20 | },
21 | [setter]
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/src/utils/wait-for-other-promises-to-finish.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | /**
8 | * Waits until all other pending promises are processed.
9 | *
10 | * NodeJS has a queue for async code that waits for being processed. This method adds a promise to the very end of this queue.
11 | * If the promise is resolved then this means that all other promises before it have been processed as well.
12 | *
13 | * @return A promise which resolves when all other promises have been processed
14 | */
15 | export function waitForOtherPromisesToFinish(): Promise {
16 | return new Promise((resolve) => process.nextTick(resolve))
17 | }
18 |
--------------------------------------------------------------------------------
/src/components/application-loader/loading-screen/icon-row.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useMemo } from 'react'
8 | import { createNumberRangeArray } from '../../common/number-range/number-range'
9 | import { RandomIcon } from './random-icon'
10 | import styles from './animations.module.scss'
11 |
12 | /**
13 | * Shows a number of {@link RandomIcon random icons in a row}.
14 | */
15 | export const IconRow: React.FC = () => {
16 | const children = useMemo(() => createNumberRangeArray(5).map((index) => ), [])
17 |
18 | return {children}
19 | }
20 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/gist/gist-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { GistMarkdownExtension } from './gist-markdown-extension'
10 |
11 | /**
12 | * Adds support for embeddings of GitHub Gists to the markdown renderer.
13 | */
14 | export class GistAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new GistMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/utils/test-id.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | export interface PropsWithDataTestId {
8 | 'data-testid'?: string | undefined
9 | }
10 |
11 | /**
12 | * Returns an object with the "data-testid" attribute that is used to find
13 | * elements in unit tests.
14 | * This works only if the runtime is built in test mode.
15 | *
16 | * @param identifier The identifier that is used to find the element
17 | * @return An object if in test mode, undefined otherwise.
18 | */
19 | export const testId = (identifier: string): PropsWithDataTestId => {
20 | return process.env.NODE_ENV === 'test' ? { 'data-testid': identifier } : {}
21 | }
22 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/csv/csv-table-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { CsvTableMarkdownExtension } from './csv-table-markdown-extension'
10 |
11 | /**
12 | * Adds support for csv tables to the markdown rendering.
13 | */
14 | export class CsvTableAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new CsvTableMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/graphviz/graphviz-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { GraphvizMarkdownExtension } from './graphviz-markdown-extension'
10 |
11 | /**
12 | * Adds support for graphviz to the markdown rendering.
13 | */
14 | export class GraphvizAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new GraphvizMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/common/links/translated-external-link.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { TranslatedExternalLink } from './translated-external-link'
8 | import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
9 | import { render } from '@testing-library/react'
10 |
11 | describe('TranslatedExternalLink', () => {
12 | const href = 'https://example.com'
13 | beforeAll(async () => {
14 | await mockI18n()
15 | })
16 | it('renders with i18nKey', () => {
17 | const view = render( )
18 | expect(view.container).toMatchSnapshot()
19 | })
20 | })
21 |
--------------------------------------------------------------------------------
/cypress/e2e/renderer-mode.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | describe('Renderer mode', () => {
8 | beforeEach(() => {
9 | cy.visitTestNote()
10 | })
11 |
12 | it("should be 'document' without type specified", () => {
13 | cy.getMarkdownBody().should('exist')
14 | })
15 |
16 | it("should be 'reveal.js' with type 'slide'", () => {
17 | cy.setCodemirrorContent('---\ntype: slide\n---\n')
18 | cy.getReveal().should('exist')
19 | })
20 |
21 | it("should be 'document' with invalid type", () => {
22 | cy.setCodemirrorContent('---\ntype: EinDokument\n---\n')
23 | cy.getMarkdownBody().should('exist')
24 | })
25 | })
26 |
--------------------------------------------------------------------------------
/src/components/intro-page/requests.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { defaultConfig } from '../../api/common/default-config'
8 |
9 | /**
10 | * Get the intro.md contents from the public directory.
11 | *
12 | * @return The content of intro.md
13 | * @throws {Error} if the content can't be fetched
14 | */
15 | export const fetchFrontPageContent = async (): Promise => {
16 | const response = await fetch('public/intro.md', {
17 | ...defaultConfig,
18 | method: 'GET'
19 | })
20 | if (response.status !== 200) {
21 | throw new Error('Error fetching intro content')
22 | }
23 |
24 | return await response.text()
25 | }
26 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/flowchart/flowchart-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { FlowchartMarkdownExtension } from './flowchart-markdown-extension'
10 |
11 | /**
12 | * Adds support for flow charts to the markdown rendering.
13 | */
14 | export class FlowchartAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new FlowchartMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/redux/user/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Action } from 'redux'
8 | import type { LoginUserInfo } from '../../api/me/types'
9 |
10 | export enum UserActionType {
11 | SET_USER = 'user/set',
12 | CLEAR_USER = 'user/clear'
13 | }
14 |
15 | export type UserActions = SetUserAction | ClearUserAction
16 |
17 | export interface SetUserAction extends Action {
18 | type: UserActionType.SET_USER
19 | state: LoginUserInfo
20 | }
21 |
22 | export interface ClearUserAction extends Action {
23 | type: UserActionType.CLEAR_USER
24 | }
25 |
26 | export type OptionalUserState = LoginUserInfo | null
27 |
--------------------------------------------------------------------------------
/cypress/support/get-by-id.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | declare namespace Cypress {
7 | interface Chainable {
8 | getByCypressId(id: string): Chainable
9 |
10 | findByCypressId(id: string): Chainable
11 | }
12 | }
13 |
14 | const CYPRESS_ATTR = 'data-cypress-id'
15 |
16 | Cypress.Commands.add('getByCypressId', (id: string) => {
17 | return cy.get(`[${CYPRESS_ATTR}="${id}"]`)
18 | })
19 |
20 | Cypress.Commands.add(
21 | 'findByCypressId',
22 | {
23 | prevSubject: 'element'
24 | },
25 | (parent: JQuery, id: string) => {
26 | return cy.wrap(parent).find(`[${CYPRESS_ATTR}="${id}"]`)
27 | }
28 | )
29 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/mermaid/mermaid-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { MermaidMarkdownExtension } from './mermaid-markdown-extension'
10 |
11 | /**
12 | * Adds support for chart rendering using mermaid to the markdown renderer.
13 | */
14 | export class MermaidAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new MermaidMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/api/group/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { GroupInfo } from './types'
8 | import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder'
9 |
10 | /**
11 | * Retrieves information about a group with a given name.
12 | *
13 | * @param groupName The name of the group.
14 | * @return Information about the group.
15 | * @throws {Error} when the api request wasn't successful.
16 | */
17 | export const getGroup = async (groupName: string): Promise => {
18 | const response = await new GetApiRequestBuilder('groups/' + groupName).sendRequest()
19 | return response.asParsedJsonObject()
20 | }
21 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/vega-lite/vega-lite-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { VegaLiteMarkdownExtension } from './vega-lite-markdown-extension'
10 |
11 | /**
12 | * Adds support for chart rendering using vega lite to the markdown renderer.
13 | */
14 | export class VegaLiteAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new VegaLiteMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/login-page/auth/via-one-click.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | @mixin button($color) {
8 | color: #ffffff;
9 | background-color: $color;
10 | &:hover {
11 | background-color: darken($color, 15%);
12 | }
13 | }
14 |
15 | .btn-social-dropbox {
16 | @include button(#1087DD);
17 | }
18 |
19 | .btn-social-facebook {
20 | @include button(#3B5998);
21 | }
22 |
23 | .btn-social-github {
24 | @include button(#444444);
25 | }
26 |
27 | .btn-social-gitlab {
28 | @include button(#FA7035);
29 | }
30 |
31 | .btn-social-google {
32 | @include button(#DD4B39);
33 | }
34 |
35 | .btn-social-twitter {
36 | @include button(#55ACEE);
37 | }
38 |
--------------------------------------------------------------------------------
/src/pages/api/private/me/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { NextApiRequest, NextApiResponse } from 'next'
8 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
9 | import type { LoginUserInfo } from '../../../../api/me/types'
10 |
11 | const handler = (req: NextApiRequest, res: NextApiResponse): void => {
12 | respondToMatchingRequest(HttpMethod.GET, req, res, {
13 | username: 'mock',
14 | photo: 'public/img/avatar.png',
15 | displayName: 'Mock User',
16 | authProvider: 'local',
17 | email: 'mock@hedgedoc.test'
18 | })
19 | }
20 |
21 | export default handler
22 |
--------------------------------------------------------------------------------
/src/api/common/api-request-builder/get-api-request-builder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { ApiRequestBuilder } from './api-request-builder'
8 | import type { ApiResponse } from '../api-response'
9 |
10 | /**
11 | * Builder to construct a GET request to the API.
12 | *
13 | * @param ResponseType The type of the expected response.
14 | * @see ApiRequestBuilder
15 | */
16 | export class GetApiRequestBuilder extends ApiRequestBuilder {
17 | /**
18 | * @see ApiRequestBuilder#sendRequest
19 | */
20 | sendRequest(): Promise> {
21 | return this.sendRequestAndVerifyResponse('GET', 200)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/common/pagination/pager-item.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 |
9 | export interface PageItemProps {
10 | onClick: (index: number) => void
11 | index: number
12 | }
13 |
14 | /**
15 | * Renders a number and adds an onClick handler to it.
16 | *
17 | * @param index The number to render
18 | * @param onClick The onClick Handler
19 | */
20 | export const PagerItem: React.FC = ({ index, onClick }) => {
21 | return (
22 |
23 | onClick(index)}>
24 | {index + 1}
25 |
26 |
27 | )
28 | }
29 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/helpers/_color-bg.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // stylelint-disable function-name-case
8 |
9 | // All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251
10 | @each $color, $value in $theme-colors {
11 | $color-rgb: to-rgb($value);
12 | .text-bg-#{$color} {
13 | color: color-contrast($value) if($enable-important-utilities, !important, null);
14 | background-color: RGBA($color-rgb, var(--#{$prefix}bg-opacity, 1)) if($enable-important-utilities, !important, null);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/hooks/common/use-array-string-url-parameter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useRouter } from 'next/router'
8 | import { useMemo } from 'react'
9 |
10 | /**
11 | * Extracts the parameter from the router expected to be an array of values.
12 | *
13 | * @param parameter The parameter to extract
14 | * @return An array of values extracted from the router.
15 | */
16 | export const useArrayStringUrlParameter = (parameter: string): string[] => {
17 | const router = useRouter()
18 |
19 | return useMemo(() => {
20 | const value = router.query[parameter]
21 | return (typeof value === 'string' ? [value] : value) ?? []
22 | }, [parameter, router.query])
23 | }
24 |
--------------------------------------------------------------------------------
/src/redux/realtime/reducers/build-state-from-remove-user.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { RealtimeState } from '../types'
8 |
9 | /**
10 | * Builds a new {@link RealtimeState} but removes the information about a client.
11 | *
12 | * @param oldState The old state that will be copied
13 | * @param clientIdToRemove The identifier of the client that should be removed
14 | * @return the generated state
15 | */
16 | export const buildStateFromRemoveUser = (oldState: RealtimeState, clientIdToRemove: number): RealtimeState => {
17 | const newUsers = { ...oldState.users }
18 | delete newUsers[clientIdToRemove]
19 | return {
20 | users: newUsers
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/users-online-sidebar-menu/active-indicator.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import styles from './active-indicator.module.scss'
9 | import type { ActiveIndicatorStatus } from '../../../../redux/realtime/types'
10 |
11 | export interface ActiveIndicatorProps {
12 | status: ActiveIndicatorStatus
13 | }
14 |
15 | /**
16 | * Renders an indicator corresponding to the given status.
17 | *
18 | * @param status The state of the indicator to render
19 | */
20 | export const ActiveIndicator: React.FC = ({ status }) => {
21 | return
22 | }
23 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/katex/katex-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { KatexMarkdownExtension } from './katex-markdown-extension'
10 |
11 | /**
12 | * Adds support for LaTeX rendering using KaTeX to the markdown rendering.
13 | *
14 | * @see https://katex.org/
15 | */
16 | export class KatexAppExtension extends AppExtension {
17 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
18 | return [new KatexMarkdownExtension()]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/spoiler/spoiler-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { SpoilerMarkdownExtension } from './spoiler-markdown-extension'
10 |
11 | /**
12 | * Adds support for html spoiler tags.
13 | *
14 | * @see https://www.w3schools.com/tags/tag_details.asp
15 | */
16 | export class SpoilerAppExtension extends AppExtension {
17 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
18 | return [new SpoilerMarkdownExtension()]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/redux/note-details/reducers/build-state-from-server-permissions.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { NoteDetails } from '../types/note-details'
7 | import type { NotePermissions } from '../../../api/notes/types'
8 |
9 | /**
10 | * Builds the updated state from a given previous state and updated NotePermissions data.
11 | * @param state The previous note details state.
12 | * @param serverPermissions The updated NotePermissions data.
13 | */
14 | export const buildStateFromServerPermissions = (
15 | state: NoteDetails,
16 | serverPermissions: NotePermissions
17 | ): NoteDetails => {
18 | return {
19 | ...state,
20 | permissions: serverPermissions
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/layout/settings-dialog/editor/ligature-setting-button-group.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { OnOffButtonGroup } from '../utils/on-off-button-group'
9 | import { useApplicationState } from '../../../../hooks/common/use-application-state'
10 | import { setEditorLigatures } from '../../../../redux/editor/methods'
11 |
12 | /**
13 | * Allows to change if ligatures should be used or not in the editor.
14 | */
15 | export const LigatureSettingButtonGroup: React.FC = () => {
16 | const enabled = useApplicationState((state) => state.editorConfig.ligatures)
17 | return
18 | }
19 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/helpers/_colored-links.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | @each $color, $value in $theme-colors {
8 | .link-#{$color} {
9 | color: $value !important; // stylelint-disable-line declaration-no-important
10 |
11 | @if $link-shade-percentage != 0 {
12 | &:hover,
13 | &:focus {
14 | color: if(color-contrast($value) == $color-contrast-light, shade-color($value, $link-shade-percentage), tint-color($value, $link-shade-percentage)) !important; // stylelint-disable-line declaration-no-important
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/hooks/yjs/use-markdown-content-y-text.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Doc } from 'yjs'
8 | import { useMemo } from 'react'
9 | import type { YText } from 'yjs/dist/src/types/YText'
10 |
11 | export const MARKDOWN_CONTENT_CHANNEL_NAME = 'markdownContent'
12 |
13 | /**
14 | * Extracts the y-text channel that saves the markdown content from the given yDoc.
15 | *
16 | * @param yDoc The yjs document from which the yText should be extracted
17 | * @return the extracted yText channel
18 | */
19 | export const useMarkdownContentYText = (yDoc: Doc): YText => {
20 | return useMemo(() => yDoc.getText(MARKDOWN_CONTENT_CHANNEL_NAME), [yDoc])
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/layout/settings-dialog/editor/smart-paste-setting-button-group.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { OnOffButtonGroup } from '../utils/on-off-button-group'
9 | import { useApplicationState } from '../../../../hooks/common/use-application-state'
10 | import { setEditorSmartPaste } from '../../../../redux/editor/methods'
11 |
12 | /**
13 | * Allows to change if smart paste should be used in the editor.
14 | */
15 | export const SmartPasteSettingButtonGroup: React.FC = () => {
16 | const enabled = useApplicationState((state) => state.editorConfig.smartPaste)
17 | return
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/layout/settings-dialog/editor/sync-scroll-setting-button-group.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { OnOffButtonGroup } from '../utils/on-off-button-group'
9 | import { useApplicationState } from '../../../../hooks/common/use-application-state'
10 | import { setEditorSyncScroll } from '../../../../redux/editor/methods'
11 |
12 | /**
13 | * Allows to change if editor and rendering should scroll in sync.
14 | */
15 | export const SyncScrollSettingButtonGroup: React.FC = () => {
16 | const enabled = useApplicationState((state) => state.editorConfig.syncScroll)
17 | return
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/notifications/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { TOptions } from 'i18next'
8 | import type { IconName } from '../common/fork-awesome/types'
9 |
10 | export interface UiNotificationButton {
11 | label: string
12 | onClick: () => void
13 | }
14 |
15 | export interface DispatchOptions {
16 | titleI18nOptions: TOptions
17 | contentI18nOptions: TOptions
18 | durationInSecond: number
19 | icon?: IconName
20 | buttons: UiNotificationButton[]
21 | }
22 |
23 | export interface UiNotification extends DispatchOptions {
24 | titleI18nKey: string
25 | contentI18nKey: string
26 | createdAtTimestamp: number
27 | dismissed: boolean
28 | uuid: string
29 | }
30 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/csv/csv-table-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { CsvReplacer } from './csv-replacer'
8 | import { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import type { ComponentReplacer } from '../../../components/markdown-renderer/replace-components/component-replacer'
10 |
11 | /**
12 | * Adds support for csv tables to the markdown rendering using code fences with "csv" as language.
13 | */
14 | export class CsvTableMarkdownExtension extends MarkdownRendererExtension {
15 | public buildReplacers(): ComponentReplacer[] {
16 | return [new CsvReplacer()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/highlighted-code-fence/highlighted-code-fence-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { HighlightedCodeMarkdownExtension } from './highlighted-code-markdown-extension'
10 |
11 | /**
12 | * Adds code highlighting to the markdown rendering.
13 | */
14 | export class HighlightedCodeFenceAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new HighlightedCodeMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/redux/note-details/calculate-line-start-indexes.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { calculateLineStartIndexes } from './calculate-line-start-indexes'
8 |
9 | describe('calculateLineStartIndexes', () => {
10 | it('works with an empty list', () => {
11 | expect(calculateLineStartIndexes([])).toEqual([])
12 | })
13 | it('works with an non empty list', () => {
14 | expect(calculateLineStartIndexes(['a', 'bc', 'def', 'ghij', 'klmno', 'pqrstu', 'vwxyz'])).toEqual([
15 | 0, 2, 5, 9, 14, 20, 27
16 | ])
17 | })
18 | it('works with an non empty list with empty lines', () => {
19 | expect(calculateLineStartIndexes(['', '', ''])).toEqual([0, 1, 2])
20 | })
21 | })
22 |
--------------------------------------------------------------------------------
/src/redux/realtime/reducers/build-state-from-add-user.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { OnlineUser, RealtimeState } from '../types'
8 |
9 | /**
10 | * Builds a new {@link RealtimeState} with a new client id that is shown as online.
11 | *
12 | * @param oldState The old state that will be copied
13 | * @param clientId The identifier of the new client
14 | * @param user The information about the new user
15 | * @return the generated state
16 | */
17 | export const buildStateFromAddUser = (oldState: RealtimeState, clientId: number, user: OnlineUser): RealtimeState => {
18 | return {
19 | users: {
20 | ...oldState.users,
21 | [clientId]: user
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/blockquote/blockquote-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { BlockquoteExtraTagMarkdownExtension } from './blockquote-extra-tag-markdown-extension'
10 |
11 | /**
12 | * Adds support for generic blockquote extra tags and blockquote color extra tags.
13 | */
14 | export class BlockquoteAppExtension extends AppExtension {
15 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
16 | return [new BlockquoteExtraTagMarkdownExtension()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/plantuml/plantuml-app-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AppExtension } from '../../base/app-extension'
8 | import type { MarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/markdown-renderer-extension'
9 | import { PlantumlMarkdownExtension } from './plantuml-markdown-extension'
10 |
11 | /**
12 | * Adds support for chart rendering using plantuml to the markdown renderer.
13 | *
14 | * @see https://plantuml.com
15 | */
16 | export class PlantumlAppExtension extends AppExtension {
17 | buildMarkdownRendererExtensions(): MarkdownRendererExtension[] {
18 | return [new PlantumlMarkdownExtension()]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_toasts.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | .toast {
8 | // scss-docs-start toast-css-vars
9 | --#{$prefix}toast-color: #{$toast-color};
10 | --#{$prefix}toast-bg: #{$toast-background-color};
11 | --#{$prefix}toast-border-color: #{$toast-border-color};
12 | --#{$prefix}toast-box-shadow: #{$toast-box-shadow};
13 | --#{$prefix}toast-header-color: #{$toast-header-color};
14 | --#{$prefix}toast-header-bg: #{$toast-header-background-color};
15 | --#{$prefix}toast-header-border-color: #{$toast-header-border-color};
16 | // scss-docs-end toast-css-vars
17 | }
18 |
--------------------------------------------------------------------------------
/src/hooks/common/use-note-title.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useTranslation } from 'react-i18next'
8 | import { useApplicationState } from './use-application-state'
9 | import { useMemo } from 'react'
10 |
11 | /**
12 | * Retrieves the title of the note or a placeholder text, if no title is set.
13 | *
14 | * @return The title of the note
15 | */
16 | export const useNoteTitle = (): string => {
17 | const { t } = useTranslation()
18 | const untitledNote = useMemo(() => t('editor.untitledNote'), [t])
19 | const noteTitle = useApplicationState((state) => state.noteDetails.title)
20 |
21 | return useMemo(() => (noteTitle === '' ? untitledNote : noteTitle), [noteTitle, untitledNote])
22 | }
23 |
--------------------------------------------------------------------------------
/src/pages/api/mock-backend/private/alias.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { NextApiRequest, NextApiResponse } from 'next'
8 | import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
9 | import type { Alias, NewAliasDto } from '../../../../api/alias/types'
10 |
11 | const handler = (req: NextApiRequest, res: NextApiResponse) => {
12 | respondToMatchingRequest(
13 | HttpMethod.POST,
14 | req,
15 | res,
16 | {
17 | name: (req.body as NewAliasDto).newAlias,
18 | noteId: (req.body as NewAliasDto).noteIdOrAlias,
19 | primaryAlias: false
20 | },
21 | 201
22 | )
23 | }
24 |
25 | export default handler
26 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/forms/_validation.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | // Form validation
8 | //
9 | // Provide feedback to users when form field values are valid or invalid. Works
10 | // primarily for client-side validation via scoped `:invalid` and `:valid`
11 | // pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
12 | // server-side validation.
13 |
14 | // scss-docs-start form-validation-states-loop
15 | @each $state, $data in $form-validation-states {
16 | @include form-validation-state($state, $data...);
17 | }
18 | // scss-docs-end form-validation-states-loop
19 |
--------------------------------------------------------------------------------
/src/components/common/note-loading-boundary/__snapshots__/note-loading-boundary.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Note loading boundary loads a note 1`] = `
4 |
5 |
8 | success!
9 |
10 |
11 | `;
12 |
13 | exports[`Note loading boundary shows an error 1`] = `
14 |
15 |
18 | This is a mock for CommonErrorPage.
19 |
20 |
21 | titleI18nKey:
22 | api.note.notFound.title
23 |
24 |
25 | descriptionI18nKey:
26 | api.note.notFound.description
27 |
28 |
29 | children:
30 |
31 | This is a mock for CreateNonExistingNoteHint
32 |
33 |
34 |
35 | `;
36 |
--------------------------------------------------------------------------------
/src/components/layout/base-head.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import Head from 'next/head'
9 | import { useAppTitle } from '../../hooks/common/use-app-title'
10 | import { FavIcon } from './fav-icon'
11 | import { useBaseUrl } from '../../hooks/common/use-base-url'
12 |
13 | /**
14 | * Sets basic browser meta tags.
15 | */
16 | export const BaseHead: React.FC = () => {
17 | const appTitle = useAppTitle()
18 | const baseUrl = useBaseUrl()
19 | return (
20 |
21 | {appTitle}
22 |
23 |
24 |
25 |
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/src/api/auth/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | export enum AuthError {
7 | INVALID_CREDENTIALS = 'invalidCredentials',
8 | LOGIN_DISABLED = 'loginDisabled',
9 | OPENID_ERROR = 'openIdError',
10 | OTHER = 'other'
11 | }
12 |
13 | export enum RegisterError {
14 | USERNAME_EXISTING = 'usernameExisting',
15 | REGISTRATION_DISABLED = 'registrationDisabled',
16 | OTHER = 'other'
17 | }
18 |
19 | export interface LoginDto {
20 | username: string
21 | password: string
22 | }
23 |
24 | export interface RegisterDto {
25 | username: string
26 | password: string
27 | displayName: string
28 | }
29 |
30 | export interface ChangePasswordDto {
31 | currentPassword: string
32 | newPassword: string
33 | }
34 |
--------------------------------------------------------------------------------
/src/api/users/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { UserInfo } from './types'
8 | import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder'
9 |
10 | /**
11 | * Retrieves information about a specific user while using a cache to avoid many requests for the same username.
12 | *
13 | * @param username The username of interest.
14 | * @return Metadata about the requested user.
15 | * @throws {Error} when the api request wasn't successful.
16 | */
17 | export const getUser = async (username: string): Promise => {
18 | const response = await new GetApiRequestBuilder('users/' + username).sendRequest()
19 | return response.asParsedJsonObject()
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/hooks/yjs/use-bind-y-text-to-redux.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useEffect } from 'react'
8 | import { setNoteContent } from '../../../../../redux/note-details/methods'
9 | import type { YText } from 'yjs/dist/src/types/YText'
10 |
11 | /**
12 | * One-Way-synchronizes the text of the given {@link YText y-text} into the global application state.
13 | *
14 | * @param yText The source text
15 | */
16 | export const useBindYTextToRedux = (yText: YText): void => {
17 | useEffect(() => {
18 | const yTextCallback = () => setNoteContent(yText.toString())
19 | yText.observe(yTextCallback)
20 | return () => yText.unobserve(yTextCallback)
21 | }, [yText])
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/style/sidebar.module.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .slide-sidebar {
8 | @import "./variables.scss";
9 |
10 | flex: 0 0 $height;
11 | position: relative;
12 |
13 | .sidebar-inner {
14 | height: 100%;
15 | display: flex;
16 | overflow-y: auto;
17 | flex-direction: column;
18 | position: absolute;
19 | z-index: 999;
20 | width: $menu-width;
21 | top: 0;
22 | left: 0;
23 | transition: left 0.3s;
24 | box-shadow: 0 0 0 rgba(0, 0, 0, 0.15);
25 |
26 | &:hover, &.show {
27 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
28 | left: (-$menu-width + $height);
29 | }
30 |
31 | background: var(--bs-light);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/global-styles/colors-only-bootstrap/_popover.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: Original code: Copyright (c) 2011-2022 Twitter, Inc. + Copyright (c) 2011-2022 The Bootstrap Authors. Modification: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: MIT
5 | */
6 |
7 | .popover {
8 | // scss-docs-start popover-css-vars
9 | --#{$prefix}popover-bg: #{$popover-bg};
10 | --#{$prefix}popover-border-color: #{$popover-border-color};
11 | --#{$prefix}popover-box-shadow: #{$popover-box-shadow};
12 | --#{$prefix}popover-header-color: #{$popover-header-color};
13 | --#{$prefix}popover-header-bg: #{$popover-header-bg};
14 | --#{$prefix}popover-body-color: #{$popover-body-color};
15 | --#{$prefix}popover-arrow-border: var(--#{$prefix}popover-border-color);
16 | // scss-docs-end popover-css-vars
17 | }
18 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/extended-codemirror/hints.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .CodeMirror-hints {
8 | position: absolute;
9 | z-index: 10;
10 | overflow: hidden;
11 | list-style: none;
12 |
13 | margin: 0;
14 | padding: 4px;
15 |
16 | box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
17 | border-radius: 3px;
18 | border: 1px solid silver;
19 |
20 | background: white;
21 |
22 | max-height: 20em;
23 | overflow-y: auto;
24 | }
25 |
26 | .CodeMirror-hint {
27 | margin: 0;
28 | padding: 3px 15px;
29 | border-radius: 2px;
30 | white-space: pre;
31 | color: black;
32 | cursor: pointer;
33 | }
34 |
35 | li.CodeMirror-hint-active {
36 | background: #08f;
37 | color: white;
38 | }
39 |
--------------------------------------------------------------------------------
/src/components/history-page/history-toolbar/hooks/use-safe-refresh-history-state.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useUiNotifications } from '../../../notifications/ui-notification-boundary'
8 | import { useCallback } from 'react'
9 | import { refreshHistoryState } from '../../../../redux/history/methods'
10 |
11 | /**
12 | * Tries to refresh the history from the backend and shows notification if that request fails.
13 | */
14 | export const useSafeRefreshHistoryStateCallback = () => {
15 | const { showErrorNotification } = useUiNotifications()
16 | return useCallback(() => {
17 | refreshHistoryState().catch(showErrorNotification('landing.history.error.getHistory.text'))
18 | }, [showErrorNotification])
19 | }
20 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/youtube/__snapshots__/youtube-markdown-extension.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`youtube markdown extension doesn't render invalid youtube ids in short code syntax 1`] = `
4 |
5 |
6 | {%youtube a %}
7 |
8 |
9 |
10 |
11 | `;
12 |
13 | exports[`youtube markdown extension renders legacy youtube syntax 1`] = `
14 |
15 |
16 |
17 | this is a mock for the youtube frame with id
18 | XDnhKh5V5XQ
19 |
20 |
21 |
22 |
23 |
24 | `;
25 |
26 | exports[`youtube markdown extension renders plain youtube URLs 1`] = `
27 |
28 |
29 |
30 | this is a mock for the youtube frame with id
31 | XDnhKh5V5XQ
32 |
33 |
34 |
35 |
36 |
37 | `;
38 |
--------------------------------------------------------------------------------
/src/components/editor-page/app-bar/new-note-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
9 | import { Trans, useTranslation } from 'react-i18next'
10 | import { Button } from 'react-bootstrap'
11 | import Link from 'next/link'
12 |
13 | /**
14 | * Renders a button to create a new note.
15 | */
16 | export const NewNoteButton: React.FC = () => {
17 | useTranslation()
18 |
19 | return (
20 |
21 |
22 |
23 |
24 |
25 | )
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/iframe-capsule/iframe-capsule-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { MarkdownRendererExtension } from '../base/markdown-renderer-extension'
8 | import type { ComponentReplacer } from '../../replace-components/component-replacer'
9 | import { IframeCapsuleReplacer } from './iframe-capsule-replacer'
10 |
11 | /**
12 | * Adds a replacer that capsules iframes in a click shield.
13 | */
14 | export class IframeCapsuleMarkdownExtension extends MarkdownRendererExtension {
15 | public buildReplacers(): ComponentReplacer[] {
16 | return [new IframeCapsuleReplacer()]
17 | }
18 |
19 | public buildTagNameAllowList(): string[] {
20 | return ['iframe']
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/linemarker/linemarker-replacer.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Element } from 'domhandler'
8 | import type { NodeReplacement } from '../../replace-components/component-replacer'
9 | import { ComponentReplacer, DO_NOT_REPLACE } from '../../replace-components/component-replacer'
10 | import { LinemarkerMarkdownExtension } from './linemarker-markdown-extension'
11 |
12 | /**
13 | * Detects line markers and suppresses them in the resulting DOM.
14 | */
15 | export class LinemarkerReplacer extends ComponentReplacer {
16 | public replace(codeNode: Element): NodeReplacement {
17 | return codeNode.name === LinemarkerMarkdownExtension.tagName ? null : DO_NOT_REPLACE
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/common/modals/deletion-moadal.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
8 | import { render, screen } from '@testing-library/react'
9 | import { DeletionModal } from './deletion-modal'
10 |
11 | describe('DeletionModal', () => {
12 | it('renders correctly with deletionButtonI18nKey', async () => {
13 | await mockI18n()
14 | const onConfirm = jest.fn()
15 | render(
16 |
17 | testText
18 |
19 | )
20 | const modal = await screen.findByTestId('commonModal')
21 | expect(modal).toMatchSnapshot()
22 | })
23 | })
24 |
--------------------------------------------------------------------------------
/src/components/layout/note-and-app-title-head.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import Head from 'next/head'
8 | import React, { useMemo } from 'react'
9 | import { useNoteTitle } from '../../hooks/common/use-note-title'
10 | import { useAppTitle } from '../../hooks/common/use-app-title'
11 |
12 | /**
13 | * Sets the note and app title for the browser window
14 | */
15 | export const NoteAndAppTitleHead: React.FC = () => {
16 | const noteTitle = useNoteTitle()
17 | const appTitle = useAppTitle()
18 |
19 | const noteAndAppTitle = useMemo(() => {
20 | return noteTitle + ' - ' + appTitle
21 | }, [appTitle, noteTitle])
22 |
23 | return (
24 |
25 | {noteAndAppTitle}
26 |
27 | )
28 | }
29 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/aliases/__snapshots__/aliases-add-form.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`AliasesAddForm renders the input form 1`] = `
4 |
30 | `;
31 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/task-list/set-checkbox-in-editor.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type React from 'react'
8 | import { useSetCheckboxInEditor } from './use-set-checkbox-in-editor'
9 | import { useExtensionEventEmitterHandler } from '../../../components/markdown-renderer/hooks/use-extension-event-emitter'
10 | import { TaskListCheckboxAppExtension } from './task-list-checkbox-app-extension'
11 |
12 | /**
13 | * Receives task-checkbox-change events and modify the current editor content.
14 | */
15 | export const SetCheckboxInEditor: React.FC = () => {
16 | const changeCallback = useSetCheckboxInEditor()
17 | useExtensionEventEmitterHandler(TaskListCheckboxAppExtension.EVENT_NAME, changeCallback)
18 | return null
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/history-page/history-toolbar/export-history-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { Button } from 'react-bootstrap'
9 | import { useTranslation } from 'react-i18next'
10 | import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
11 | import { downloadHistory } from '../../../redux/history/methods'
12 |
13 | /**
14 | * Renders a button to export the history.
15 | */
16 | export const ExportHistoryButton: React.FC = () => {
17 | const { t } = useTranslation()
18 |
19 | return (
20 |
21 |
22 |
23 | )
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-parameters.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | const codeFenceArguments = /^ *([\w-]*)(.*)$/
8 |
9 | interface CodeBlockParameters {
10 | language: string
11 | codeFenceParameters: string
12 | }
13 |
14 | /**
15 | * Parses the language name and additional parameters from a code block name input.
16 | *
17 | * @param text The text to parse
18 | * @return The parsed parameters
19 | */
20 | export const parseCodeBlockParameters = (text: string): CodeBlockParameters => {
21 | const parsedText = codeFenceArguments.exec(text)
22 | return {
23 | language: parsedText?.[1].trim() ?? '',
24 | codeFenceParameters: parsedText?.[2].trim() ?? ''
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/extended-codemirror/codemirror.module.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | .extendedCodemirror {
8 | :global(.cm-editor .cm-line) {
9 | @import '../../../../../global-styles/variables.module';
10 | font-family: "Fira Code", $font-family-emojis, Consolas, monaco, monospace;
11 | }
12 |
13 | &.no-ligatures {
14 | :global(.cm-editor .cm-line) {
15 | font-variant-ligatures: none;
16 | }
17 | }
18 |
19 | :global {
20 | .cm-widgetBuffer {
21 | display: none;
22 | }
23 |
24 | .cm-diagnostic {
25 | max-width: 400px;
26 | padding: 10px;
27 | }
28 |
29 | //workarounds for line break problem.. see https://github.com/yjs/y-codemirror.next/pull/12
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/common/links/translated-internal-link.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { useTranslation } from 'react-i18next'
9 | import { InternalLink } from './internal-link'
10 | import type { TranslatedLinkProps } from './types'
11 | /**
12 | * An {@link InternalLink internal link} with translated text.
13 | *
14 | * @param i18nKey The key of the translation
15 | * @param i18nOption The translation options
16 | * @param props Additional props directly given to the {@link InternalLink}
17 | */
18 | export const TranslatedInternalLink: React.FC = ({ i18nKey, i18nOption, ...props }) => {
19 | const { t } = useTranslation()
20 | return
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/sanitizer/sanitizer-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { SanitizerNodePreprocessor } from './dom-purifier-node-preprocessor'
8 | import type { NodeProcessor } from '../../node-preprocessors/node-processor'
9 | import { MarkdownRendererExtension } from '../base/markdown-renderer-extension'
10 |
11 | /**
12 | * Adds support for html sanitizing using dompurify to the markdown rendering.
13 | */
14 | export class SanitizerMarkdownExtension extends MarkdownRendererExtension {
15 | constructor(private tagNameWhiteList: string[]) {
16 | super()
17 | }
18 |
19 | public buildNodeProcessors(): NodeProcessor[] {
20 | return [new SanitizerNodePreprocessor(this.tagNameWhiteList)]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/extensions/upload-indicating-image-frame/upload-indicating-image-frame-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { MarkdownRendererExtension } from '../base/markdown-renderer-extension'
8 | import type { ComponentReplacer } from '../../replace-components/component-replacer'
9 | import { UploadIndicatingImageFrameReplacer } from './upload-indicating-image-frame-replacer'
10 |
11 | /**
12 | * A markdown extension that shows {@link UploadIndicatingFrame} for images that are getting uploaded.
13 | */
14 | export class UploadIndicatingImageFrameMarkdownExtension extends MarkdownRendererExtension {
15 | buildReplacers(): ComponentReplacer[] {
16 | return [new UploadIndicatingImageFrameReplacer()]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/redux/dark-mode/reducers.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { Reducer } from 'redux'
8 | import type { DarkModeConfig, DarkModeConfigAction } from './types'
9 | import { DarkModeConfigActionType, DarkModePreference } from './types'
10 |
11 | const initialState: DarkModeConfig = {
12 | darkModePreference: DarkModePreference.AUTO
13 | }
14 |
15 | export const DarkModeConfigReducer: Reducer = (
16 | state: DarkModeConfig = initialState,
17 | action: DarkModeConfigAction
18 | ) => {
19 | switch (action.type) {
20 | case DarkModeConfigActionType.SET_DARK_MODE:
21 | return {
22 | darkModePreference: action.darkModePreference
23 | }
24 | default:
25 | return state
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/link-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
10 | import { addLink } from '../formatters/add-link'
11 |
12 | /**
13 | * Renders a button to insert a link in the {@link Editor editor}.
14 | */
15 | export const LinkButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection, markdownContent }) => {
17 | return addLink(markdownContent, currentSelection)
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/editor-page/sidebar/sidebar-menu/sidebar-menu.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { PropsWithChildren } from 'react'
8 | import React from 'react'
9 | import type { SidebarMenuProps } from '../types'
10 | import styles from './sidebar-menu.module.scss'
11 |
12 | /**
13 | * Renders a sidebar menu.
14 | *
15 | * @param children The children in the menu.
16 | * @param expand If the menu is extended (and the children are shown) or not.
17 | */
18 | export const SidebarMenu: React.FC> = ({ children, expand }) => {
19 | return (
20 |
23 | )
24 | }
25 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/gist/replace-gist-link.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { GistMarkdownExtension } from './gist-markdown-extension'
8 | import type { RegexOptions } from '../../../external-types/markdown-it-regex/interface'
9 |
10 | const linkRegex = /^(?:https?:\/\/)?gist\.github\.com\/(\w+\/\w+)(?:[./?#].*)?$/i
11 |
12 | /**
13 | * Replacer for gist links.
14 | */
15 | export const replaceGistLink: RegexOptions = {
16 | name: 'gist-link',
17 | regex: linkRegex,
18 | replace: (match) => {
19 | // ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
20 | // noinspection CheckTagEmptyBody
21 | return `<${GistMarkdownExtension.tagName} id='${match}'>${GistMarkdownExtension.tagName}>`
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/common/links/translated-external-link.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React from 'react'
8 | import { useTranslation } from 'react-i18next'
9 | import { ExternalLink } from './external-link'
10 | import type { TranslatedLinkProps } from './types'
11 |
12 | /**
13 | * An {@link ExternalLink external link} with translated text.
14 | *
15 | * @param i18nKey The key of the translation
16 | * @param i18nOption The translation options
17 | * @param props Additional props directly given to the {@link ExternalLink}
18 | */
19 | export const TranslatedExternalLink: React.FC = ({ i18nKey, i18nOption, ...props }) => {
20 | const { t } = useTranslation()
21 | return
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/bold-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import { wrapSelection } from '../formatters/wrap-selection'
10 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
11 |
12 | /**
13 | * Renders a button to make the selection in the {@link Editor editor} bold.
14 | */
15 | export const BoldButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection }) => {
17 | return wrapSelection(currentSelection, '**', '**')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/hooks/common/use-single-string-url-parameter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useRouter } from 'next/router'
8 | import { useMemo } from 'react'
9 |
10 | /**
11 | * Extracts the parameter from the router expected to be a single value.
12 | *
13 | * @param parameter The parameter to extract
14 | * @param fallback The fallback returned if there is no value.
15 | * @return A value extracted from the router.
16 | */
17 | export const useSingleStringUrlParameter = (parameter: string, fallback: T): string | T => {
18 | const router = useRouter()
19 |
20 | return useMemo(() => {
21 | const value = router.query[parameter]
22 | return (typeof value === 'string' ? value : value?.[0]) ?? fallback
23 | }, [fallback, parameter, router.query])
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/markdown-renderer/test-utils/mock-i18n.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import type { TFunction } from 'i18next'
8 | import i18n from 'i18next'
9 | import { initReactI18next } from 'react-i18next'
10 |
11 | /**
12 | * Initializes i18n with minimal settings and without any data, so it just returns the used key as translation.
13 | *
14 | * @return A promise that resolves if i18n has been initialized
15 | */
16 | export const mockI18n = (): Promise => {
17 | return i18n.use(initReactI18next).init({
18 | lng: 'en',
19 | fallbackLng: 'en',
20 | ns: ['translationsNS'],
21 | defaultNS: 'translationsNS',
22 | interpolation: {
23 | escapeValue: false
24 | },
25 | resources: { en: { translationsNS: {} } }
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/flowchart/__snapshots__/flowchart.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Flowchart handles error if lib loading failed 1`] = `
4 |
5 |
9 | common.errorWhileLoading
10 |
11 |
12 | `;
13 |
14 | exports[`Flowchart handles error while rendering 1`] = `
15 |
16 |
20 | renderer.flowchart.invalidSyntax
21 |
22 |
26 |
27 | `;
28 |
29 | exports[`Flowchart renders correctly 1`] = `
30 |
31 |
35 | Flowchart rendering succeeded!
36 |
37 |
38 | `;
39 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/italic-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import { wrapSelection } from '../formatters/wrap-selection'
10 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
11 |
12 | /**
13 | * Renders a button to make the selection in the {@link Editor editor} italic.
14 | */
15 | export const ItalicButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection }) => {
17 | return wrapSelection(currentSelection, '*', '*')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/redux/note-details/reducers/build-state-from-update-cursor-position.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { initialState } from '../initial-state'
8 | import { Mock } from 'ts-mockery'
9 | import { buildStateFromUpdateCursorPosition } from './build-state-from-update-cursor-position'
10 | import type { CursorSelection } from '../../../components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection'
11 |
12 | describe('build state from update cursor position', () => {
13 | it('creates a new state with the given cursor', () => {
14 | const state = { ...initialState }
15 | const selection: CursorSelection = Mock.of()
16 | expect(buildStateFromUpdateCursorPosition(state, selection)).toStrictEqual({ ...state, selection })
17 | })
18 | })
19 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/highlight-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import { wrapSelection } from '../formatters/wrap-selection'
10 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
11 |
12 | /**
13 | * Renders a button that highlights the selection in the {@link Editor editor}.
14 | */
15 | export const HighlightButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection }) => {
17 | return wrapSelection(currentSelection, '==', '==')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/image-link-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
10 | import { addLink } from '../formatters/add-link'
11 |
12 | /**
13 | * Renders a button to insert an image in the {@link Editor editor}.
14 | */
15 | export const ImageLinkButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection, markdownContent }) => {
17 | return addLink(markdownContent, currentSelection, '!')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/underline-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import { wrapSelection } from '../formatters/wrap-selection'
10 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
11 |
12 | /**
13 | * Renders a button to underline the selection in the {@link Editor editor}.
14 | */
15 | export const UnderlineButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection }) => {
17 | return wrapSelection(currentSelection, '++', '++')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/abcjs/abcjs-markdown-extension.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { AbcFrame } from './abc-frame'
8 | import { CodeBlockMarkdownRendererExtension } from '../../../components/markdown-renderer/extensions/base/code-block-markdown-extension/code-block-markdown-renderer-extension'
9 | import { CodeBlockComponentReplacer } from '../../../components/markdown-renderer/replace-components/code-block-component-replacer'
10 |
11 | /**
12 | * Adds support for abc.js to the markdown rendering using code fences with "abc" as language.
13 | */
14 | export class AbcjsMarkdownExtension extends CodeBlockMarkdownRendererExtension {
15 | public buildReplacers(): CodeBlockComponentReplacer[] {
16 | return [new CodeBlockComponentReplacer(AbcFrame, 'abc')]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/legacy-short-codes/replace-legacy-slideshare-short-code.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import MarkdownIt from 'markdown-it'
8 | import { legacySlideshareShortCode } from './replace-legacy-slideshare-short-code'
9 |
10 | describe('Legacy slideshare short code', () => {
11 | it('replaces with link', () => {
12 | const markdownIt = new MarkdownIt('default', {
13 | html: false,
14 | breaks: true,
15 | langPrefix: '',
16 | typographer: true
17 | })
18 | markdownIt.use(legacySlideshareShortCode)
19 | expect(markdownIt.renderInline('{%slideshare example/123456789 %}')).toEqual(
20 | "https://www.slideshare.net/example/123456789 "
21 | )
22 | })
23 | })
24 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/legacy-short-codes/replace-legacy-speakerdeck-short-code.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import MarkdownIt from 'markdown-it'
8 | import { legacySpeakerdeckShortCode } from './replace-legacy-speakerdeck-short-code'
9 |
10 | describe('Legacy speakerdeck short code', () => {
11 | it('replaces with link', () => {
12 | const markdownIt = new MarkdownIt('default', {
13 | html: false,
14 | breaks: true,
15 | langPrefix: '',
16 | typographer: true
17 | })
18 | markdownIt.use(legacySpeakerdeckShortCode)
19 | expect(markdownIt.renderInline('{%speakerdeck example/123456789 %}')).toEqual(
20 | 'https://speakerdeck.com/example/123456789 '
21 | )
22 | })
23 | })
24 |
--------------------------------------------------------------------------------
/src/extensions/extra-integrations/gist/replace-legacy-gist-short-code.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { GistMarkdownExtension } from './gist-markdown-extension'
8 | import type { RegexOptions } from '../../../external-types/markdown-it-regex/interface'
9 |
10 | const finalRegex = /^{%gist\s+(\w+\/\w+)\s*%}$/
11 |
12 | /**
13 | * Replacer for legacy hedgedoc 1 gist shortcodes.
14 | */
15 | export const replaceLegacyGistShortCode: RegexOptions = {
16 | name: 'legacy-gist-short-code',
17 | regex: finalRegex,
18 | replace: (match) => {
19 | // ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
20 | // noinspection CheckTagEmptyBody
21 | return `<${GistMarkdownExtension.tagName} id="${match}">${GistMarkdownExtension.tagName}>`
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/hooks/common/use-boolean-state.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useCallback, useState } from 'react'
8 |
9 | /**
10 | * Provides a boolean state and two functions that set the boolean to true or false.
11 | *
12 | * @param initialState The initial value of the state
13 | * @return An array containing the state, and two functions that set the state value to true or false.
14 | */
15 | export const useBooleanState = (
16 | initialState: boolean | (() => boolean) = false
17 | ): [state: boolean, setToTrue: () => void, setToFalse: () => void] => {
18 | const [state, setState] = useState(initialState)
19 | const setToFalse = useCallback(() => setState(false), [])
20 | const setToTrue = useCallback(() => setState(true), [])
21 |
22 | return [state, setToTrue, setToFalse]
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/editor-page/document-bar/aliases/__snapshots__/aliases-modal.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`AliasesModal renders the modal 1`] = `
4 |
5 |
6 | This is a mock implementation of a Modal:
7 |
8 |
11 |
12 | editor.modal.aliases.explanation
13 |
14 |
17 |
18 | This is a mock for the AliasesList that is tested separately.
19 |
20 |
23 |
24 | This is a mock for the AliasesAddForm that is tested separately.
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | `;
33 |
--------------------------------------------------------------------------------
/src/components/editor-page/editor-pane/tool-bar/buttons/subscript-button.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import React, { useCallback } from 'react'
8 | import { ToolbarButton } from '../toolbar-button'
9 | import { wrapSelection } from '../formatters/wrap-selection'
10 | import type { ContentFormatter } from '../../../change-content-context/change-content-context'
11 |
12 | /**
13 | * Renders a button to format the selection in the {@link Editor editor} as subscript.
14 | */
15 | export const SubscriptButton: React.FC = () => {
16 | const formatter: ContentFormatter = useCallback(({ currentSelection }) => {
17 | return wrapSelection(currentSelection, '~', '~')
18 | }, [])
19 | return
20 | }
21 |
--------------------------------------------------------------------------------
/src/hooks/common/use-dark-mode-state.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 |
7 | import { useApplicationState } from './use-application-state'
8 | import useMediaQuery from '@restart/hooks/useMediaQuery'
9 | import { DarkModePreference } from '../../redux/dark-mode/types'
10 |
11 | /**
12 | * Uses the user settings and the browser preference to determine if dark mode should be used.
13 | *
14 | * @return The current state of the dark mode.
15 | */
16 | export const useDarkModeState = (): boolean => {
17 | const preference = useApplicationState((state) => state.darkMode.darkModePreference)
18 | const isBrowserPreferringDark = useMediaQuery('(prefers-color-scheme: dark)')
19 |
20 | return preference === DarkModePreference.DARK || (preference === DarkModePreference.AUTO && isBrowserPreferringDark)
21 | }
22 |
--------------------------------------------------------------------------------
/src/api/common/api-request-builder/post-api-request-builder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
3 | *
4 | * SPDX-License-Identifier: AGPL-3.0-only
5 | */
6 | import type { ApiResponse } from '../api-response'
7 | import { ApiRequestBuilderWithBody } from './api-request-builder-with-body'
8 |
9 | /**
10 | * Builder to construct a POST request to the API.
11 | *
12 | * @param ResponseType The type of the expected response.
13 | * @param RequestBodyType The type of the request body
14 | * @see ApiRequestBuilder
15 | */
16 | export class PostApiRequestBuilder extends ApiRequestBuilderWithBody<
17 | ResponseType,
18 | RequestBodyType
19 | > {
20 | /**
21 | * @see ApiRequestBuilder#sendRequest
22 | */
23 | sendRequest(): Promise> {
24 | return this.sendRequestAndVerifyResponse('POST', 201)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------