From e12dc523f8f4b613d7a2b917380af743df10835a Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Wed, 3 Feb 2021 22:13:04 +0100 Subject: [PATCH] Adjust editor config (#976) * Adjust editor config Signed-off-by: Tilman Vatteroth Co-authored-by: Erik Michelson --- .editorconfig | 103 +- cypress/integration/banner.spec.ts | 4 +- cypress/integration/documentTitle.spec.ts | 46 +- cypress/integration/export.spec.ts | 2 +- cypress/integration/fileUpload.spec.ts | 61 +- .../integration/highlightedCodeBlock.spec.ts | 9 +- cypress/integration/language.spec.ts | 3 +- cypress/integration/link.spec.ts | 6 +- cypress/integration/maxLength.spec.ts | 2 +- cypress/integration/profile.spec.ts | 2 +- cypress/integration/toolbar.spec.ts | 48 +- cypress/support/checkLinks.ts | 5 +- cypress/support/config.ts | 6 +- cypress/support/fill.ts | 14 +- cypress/support/getMarkdownRenderer.ts | 16 +- cypress/support/login.ts | 8 +- cypress/support/visit-test-editor.ts | 26 +- cypress/tsconfig.json | 11 +- src/api/notes/index.ts | 4 +- src/api/revisions/index.ts | 6 +- src/api/tokens/index.ts | 6 +- src/api/users/index.ts | 2 +- src/api/utils.ts | 2 +- .../application-loader.scss | 80 +- .../application-loader/application-loader.tsx | 21 +- .../application-loader/loading-screen.tsx | 16 +- src/components/common/branding/branding.tsx | 22 +- src/components/common/cache/cache.test.ts | 60 +- src/components/common/cache/cache.ts | 14 +- .../common/copyable/copy-overlay.tsx | 45 +- .../copy-to-clipboard-button.tsx | 18 +- .../copyable-field/copyable-field.tsx | 21 +- .../common/fork-awesome/fork-awesome-icon.tsx | 12 +- .../fork-awesome/fork-awesome-stack.tsx | 10 +- src/components/common/fork-awesome/types.d.ts | 122 +- .../hedge-doc-logo-with-text.tsx | 14 +- .../common/hedge-doc-logo/hedge-doc-logo.tsx | 8 +- .../common/hedge-doc-logo/logo_color.svg | 30 +- .../logo_text_bw_horizontal.svg | 22 +- .../logo_text_color_vertical.svg | 36 +- .../logo_text_wb_horizontal.svg | 25 +- src/components/common/hljs/hljs.ts | 392 ++--- .../common/icon-button/icon-button.tsx | 15 +- .../icon-button/translated-icon-button.tsx | 10 +- src/components/common/links/external-link.tsx | 26 +- src/components/common/links/internal-link.tsx | 20 +- .../common/links/translated-external-link.tsx | 8 +- .../common/links/translated-internal-link.tsx | 8 +- src/components/common/links/types.d.ts | 2 +- .../common/lock-button/lock-button.tsx | 8 +- src/components/common/modals/common-modal.tsx | 19 +- .../common/modals/deletion-modal.tsx | 12 +- src/components/common/modals/error-modal.tsx | 8 +- .../common/motd-banner/motd-banner.tsx | 12 +- .../common/number-range/number-range.ts | 5 +- .../common/pagination/pager-item.tsx | 14 +- .../common/pagination/pager-pagination.tsx | 39 +- src/components/common/pagination/pager.tsx | 21 +- .../common/routing/not-found-error-screen.tsx | 6 +- src/components/common/routing/redirector.tsx | 8 +- src/components/common/show-if/show-if.tsx | 8 +- .../common/user-avatar/user-avatar.tsx | 20 +- .../ErrorWhileLoadingNoteAlert.tsx | 8 +- .../LoadingNoteAlert.tsx | 6 +- .../document-infobar.tsx | 36 +- .../document-read-only-page.tsx | 34 +- .../editor-page/app-bar/app-bar.tsx | 19 +- .../editor-page/app-bar/dark-mode-button.tsx | 14 +- .../editor-page/app-bar/editor-view-mode.tsx | 12 +- .../app-bar/help-button/cheatsheet.tsx | 64 +- .../app-bar/help-button/help-button.tsx | 38 +- .../editor-page/app-bar/help-button/links.tsx | 16 +- .../app-bar/help-button/shortcuts.tsx | 38 +- .../editor-page/app-bar/navbar-branding.tsx | 6 +- .../sync-scroll-buttons/buttonIcon.svg | 140 +- .../sync-scroll-buttons.scss | 1 + .../sync-scroll-buttons.tsx | 20 +- .../document-info/document-info-line.tsx | 8 +- .../document-info/document-info-modal.tsx | 88 +- .../document-info/document-info-time-line.tsx | 9 +- .../document-info/time-from-now.tsx | 3 +- .../document-info/unitalic-bold-text.tsx | 4 +- .../permissions/permission-group-entry.tsx | 32 +- .../permissions/permission-list.tsx | 62 +- .../permissions/permission-modal.tsx | 84 +- .../revisions/revision-modal-list-entry.tsx | 29 +- .../document-bar/revisions/revision-modal.tsx | 75 +- .../document-bar/revisions/utils.ts | 2 +- .../document-bar/share/share-modal.tsx | 28 +- .../use-adapted-line-markers-callback.ts | 4 +- .../hooks/use-on-iframe-load.ts | 4 +- .../show-on-prop-change-image-lightbox.tsx | 4 +- .../max-length-warning-modal.tsx | 9 +- src/components/editor-page/editor-page.tsx | 47 +- .../editor-pane/autocompletion/code-block.ts | 5 +- .../autocompletion/collapsable-block.ts | 2 +- .../editor-pane/autocompletion/container.ts | 3 +- .../editor-pane/autocompletion/emoji.ts | 4 +- .../editor-pane/autocompletion/header.ts | 2 +- .../editor-pane/autocompletion/image.ts | 2 +- .../editor-pane/autocompletion/index.ts | 10 +- .../autocompletion/link-and-extra-tag.ts | 7 +- .../editor-pane/autocompletion/pdf.ts | 2 +- .../editor-page/editor-pane/editor-pane.scss | 1 + .../editor-page/editor-pane/editor-pane.tsx | 34 +- .../editor-page/editor-pane/hints.scss | 2 +- .../editor-page/editor-pane/key-map.ts | 68 +- .../editor-page/editor-pane/one-dark.scss | 199 ++- .../editor-pane/status-bar/status-bar.tsx | 25 +- .../editor-preference-boolean-property.tsx | 15 +- .../editor-preference-input.tsx | 15 +- .../editor-preference-ligatures-select.tsx | 11 +- .../editor-preference-number-property.tsx | 5 +- .../editor-preference-select-property.tsx | 15 +- .../editor-preferences/editor-preferences.tsx | 34 +- .../emoji-picker/emoji-picker-button.tsx | 11 +- .../tool-bar/emoji-picker/emoji-picker.tsx | 16 +- .../tool-bar/emoji-picker/icon-names.ts | 1516 ++++++++--------- .../table-picker/custom-table-size-modal.tsx | 42 +- .../table-picker/table-picker-button.tsx | 11 +- .../tool-bar/table-picker/table-picker.scss | 1 - .../tool-bar/table-picker/table-picker.tsx | 53 +- .../editor-pane/tool-bar/tool-bar.tsx | 67 +- .../tool-bar/upload-image-button.tsx | 6 +- .../editor-pane/tool-bar/utils/emojiUtils.ts | 8 +- .../tool-bar/utils/toolbarButtonUtils.test.ts | 146 +- .../tool-bar/utils/toolbarButtonUtils.ts | 38 +- .../editor-page/editor-pane/upload-handler.ts | 6 +- .../editor-page/hooks/useViewModeShortcuts.ts | 2 +- .../note-frontmatter/note-frontmatter.test.ts | 130 +- .../note-frontmatter/note-frontmatter.ts | 11 +- .../renderer-pane/hooks/use-on-iframe-load.ts | 4 +- .../renderer-pane/render-iframe.tsx | 25 +- .../show-on-prop-change-image-lightbox.tsx | 4 +- .../yaml-array-deprecation-alert.tsx | 12 +- .../sidebar/delete-note-sidebar-entry.tsx | 18 +- .../sidebar/document-info-sidebar-entry.tsx | 8 +- .../sidebar/export-markdown-sidebar-entry.tsx | 4 +- .../sidebar/export-menu-sidebar-menu.tsx | 27 +- .../sidebar/import-markdown-sidebar-entry.tsx | 10 +- .../sidebar/import-menu-sidebar-menu.tsx | 16 +- .../sidebar/permissions-sidebar-entry.tsx | 8 +- .../sidebar/pin-note-sidebar-entry.tsx | 4 +- .../sidebar/revision-sidebar-entry.tsx | 8 +- .../sidebar/share-sidebar-entry.tsx | 8 +- .../editor-page/sidebar/sidebar-button.tsx | 18 +- .../editor-page/sidebar/sidebar-menu.tsx | 14 +- .../editor-page/sidebar/sidebar.tsx | 28 +- .../editor-page/sidebar/style/colors.scss | 2 +- src/components/editor-page/sidebar/types.ts | 2 +- .../editor-page/sidebar/upload-input.tsx | 17 +- .../active-indicator.tsx | 2 +- .../users-online-sidebar-menu/user-line.tsx | 11 +- .../users-online-sidebar-menu.tsx | 29 +- .../splitter/split-divider/split-divider.tsx | 6 +- .../editor-page/splitter/splitter.tsx | 17 +- .../hooks/use-synced-scrolling.ts | 8 +- .../table-of-contents/table-of-contents.tsx | 40 +- src/components/editor-page/utils.ts | 3 +- .../error-boundary/error-boundary.tsx | 28 +- .../entry-menu/delete-note-item.tsx | 22 +- .../dropdown-item-with-deletion-modal.tsx | 28 +- .../history-page/entry-menu/entry-menu.tsx | 25 +- .../entry-menu/remove-note-entry-item.tsx | 22 +- .../history-card/history-card-list.tsx | 18 +- .../history-card/history-card.tsx | 43 +- .../history-content/history-content.tsx | 54 +- src/components/history-page/history-page.tsx | 60 +- .../history-table/history-table-row.tsx | 31 +- .../history-table/history-table.tsx | 44 +- .../history-toolbar/clear-history-button.tsx | 26 +- .../history-toolbar/export-history-button.tsx | 8 +- .../history-toolbar/history-toolbar.tsx | 78 +- .../history-toolbar/import-history-button.tsx | 20 +- .../history-page/pin-button/pin-button.tsx | 10 +- .../history-page/sort-button/sort-button.tsx | 19 +- src/components/history-page/utils.ts | 43 +- .../cover-buttons/cover-buttons.tsx | 11 +- src/components/intro-page/feature-links.tsx | 18 +- src/components/intro-page/intro-page.tsx | 16 +- .../landing-layout/footer/footer.tsx | 6 +- .../landing-layout/footer/language-picker.tsx | 23 +- .../footer/powered-by-links.tsx | 12 +- .../landing-layout/footer/social-links.tsx | 20 +- .../landing-layout/footer/version-info.tsx | 38 +- .../landing-layout/landing-layout.tsx | 10 +- .../navigation/header-bar/header-bar.tsx | 20 +- .../navigation/header-nav-link.tsx | 10 +- .../navigation/new-guest-note-button.tsx | 8 +- .../navigation/new-user-note-button.tsx | 8 +- .../navigation/sign-in-button.tsx | 21 +- .../navigation/user-dropdown.tsx | 26 +- .../social-link-button/social-link-button.tsx | 14 +- .../login-page/auth/via-internal.tsx | 28 +- src/components/login-page/auth/via-ldap.tsx | 26 +- .../login-page/auth/via-one-click.tsx | 18 +- src/components/login-page/auth/via-openid.tsx | 21 +- src/components/login-page/login-page.tsx | 46 +- .../basic-markdown-renderer.tsx | 11 +- .../document-length-limit-reached-alert.tsx | 6 +- .../full-markdown-renderer.tsx | 18 +- .../markdown-renderer/github-markdown.scss | 165 +- .../hooks/use-extract-first-headline.ts | 5 +- .../hooks/use-post-toc-ast-on-change.ts | 2 +- .../use-replacer-instance-list-creator.ts | 2 +- .../markdown-renderer/invalid-yaml-alert.tsx | 2 +- .../BasicMarkdownItConfigurator.tsx | 8 +- .../FullMarkdownItConfigurator.tsx | 4 +- .../MarkdownItConfigurator.tsx | 18 +- .../markdown-it-plugins/alert-container.ts | 2 +- .../markdown-it-plugins/emoji/mapping.ts | 16 +- .../markdown-it-plugins/headline-anchors.ts | 2 +- .../markdown-it-plugins/quote-extra.ts | 6 +- .../markdown-it-plugins/spoiler-container.ts | 4 +- .../replace-legacy-pdf-short-code.ts | 2 +- .../replace-legacy-slideshare-short-code.ts | 2 +- .../replace-legacy-speakerdeck-short-code.ts | 2 +- .../replace-components/ComponentReplacer.ts | 2 +- .../replace-components/abc/abc-frame.tsx | 7 +- .../replace-components/abc/abc-replacer.tsx | 10 +- .../asciinema/asciinema-frame.tsx | 18 +- .../asciinema/asciinema-replacer.tsx | 18 +- .../asciinema/replace-asciinema-link.ts | 2 +- .../replace-components/csv/csv-parser.test.ts | 9 +- .../replace-components/csv/csv-parser.ts | 3 +- .../replace-components/csv/csv-replacer.tsx | 10 +- .../replace-components/csv/csv-table.tsx | 66 +- .../flow/flowchart-replacer.tsx | 10 +- .../flow/flowchart/flowchart.tsx | 20 +- .../replace-components/gist/gist-frame.tsx | 16 +- .../replace-components/gist/gist-replacer.tsx | 23 +- .../gist/replace-gist-link.ts | 2 +- .../gist/replace-legacy-gist-short-code.ts | 2 +- .../graphviz/graphviz-frame.tsx | 24 +- .../graphviz/graphviz-replacer.tsx | 10 +- .../highlighted-code/highlighted-code.scss | 1 + .../highlighted-code/highlighted-code.tsx | 38 +- .../highlighted-fence-replacer.tsx | 15 +- .../image/image-lightbox-modal.tsx | 25 +- .../image/image-replacer.tsx | 20 +- .../image/proxy-image-frame.tsx | 2 +- .../katex/katex-replacer.tsx | 24 +- .../linemarker/line-number-marker.ts | 6 +- .../linemarker/linemarker-replacer.tsx | 8 +- .../link-replacer/link-replacer.tsx | 15 +- .../markmap/markmap-frame.tsx | 24 +- .../markmap/markmap-loader.ts | 9 +- .../markmap/markmap-replacer.tsx | 10 +- .../mermaid/mermaid-chart.tsx | 39 +- .../mermaid/mermaid-replacer.tsx | 10 +- .../replace-components/mermaid/mermaid.scss | 2 +- .../one-click-frame/one-click-embedding.tsx | 41 +- .../quote-options/quote-options-replacer.tsx | 10 +- .../sequence-diagram/deprecation-warning.tsx | 8 +- .../sequence-diagram-replacer.tsx | 10 +- .../task-list/task-list-replacer.tsx | 20 +- .../replace-components/utils.ts | 4 +- .../vega-lite/vega-chart.tsx | 23 +- .../vega-lite/vega-replacer.tsx | 10 +- .../vimeo/replace-legacy-vimeo-short-code.ts | 2 +- .../vimeo/replace-vimeo-link.ts | 2 +- .../replace-components/vimeo/vimeo-frame.tsx | 20 +- .../vimeo/vimeo-replacer.tsx | 20 +- .../replace-legacy-youtube-short-code.ts | 2 +- .../youtube/replace-youtube-link.ts | 2 +- .../youtube/youtube-frame.tsx | 18 +- .../youtube/youtube-replacer.tsx | 20 +- .../utils/calculate-line-marker-positions.ts | 47 +- .../utils/html-react-transformer.tsx | 6 +- .../utils/line-number-mapping.ts | 2 +- .../access-tokens/profile-access-tokens.tsx | 56 +- src/components/profile-page/profile-page.tsx | 12 +- .../settings/profile-account-management.tsx | 26 +- .../settings/profile-change-password.tsx | 22 +- .../settings/profile-display-name.tsx | 25 +- .../register-page/register-page.tsx | 58 +- .../render-page/iframe-communicator.ts | 20 +- .../iframe-editor-to-renderer-communicator.ts | 92 +- .../iframe-renderer-to-editor-communicator.ts | 44 +- .../render-page/markdown-document.tsx | 50 +- src/components/render-page/render-page.tsx | 22 +- src/external-types/abcjs/abcjs.d.ts | 2 +- src/external-types/highlight.js/core.d.ts | 8 +- src/hooks/common/use-document-title.ts | 4 +- src/hooks/common/use-frontend-base-url.ts | 8 +- src/index.tsx | 4 +- src/links.json | 14 +- src/redux/editor/methods.ts | 2 +- src/redux/note-details/reducers.ts | 2 +- src/service-worker-registration.ts | 121 +- src/service-worker.ts | 5 +- src/style/bootstrap-color-theme/_buttons.scss | 1 + src/style/bootstrap-color-theme/_card.scss | 2 +- src/style/bootstrap-color-theme/_code.scss | 1 + src/style/bootstrap-color-theme/_navbar.scss | 2 + src/style/bootstrap-color-theme/_popover.scss | 3 + src/style/bootstrap-color-theme/_tables.scss | 1 - src/style/bootstrap-color-theme/_tooltip.scss | 3 + .../utilities/_borders.scss | 24 +- .../utilities/_text.scss | 22 +- src/style/variables.light.scss | 4 +- 301 files changed, 4393 insertions(+), 3741 deletions(-) diff --git a/.editorconfig b/.editorconfig index e4cfe071d..5675928b7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -51,31 +51,39 @@ ij_scss_hex_color_upper_case = false ij_scss_keep_blank_lines_in_code = 2 ij_scss_keep_indents_on_empty_lines = false ij_scss_keep_single_line_blocks = false -ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow ij_scss_space_after_colon = true ij_scss_space_before_opening_brace = true ij_scss_use_double_quotes = true ij_scss_value_alignment = 0 -[{*.ats,*.ts,*.tsx}] +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ats, *.ts, *.tsx}] indent_size = 2 tab_width = 2 ij_continuation_indent_size = 2 ij_typescript_align_imports = false ij_typescript_align_multiline_array_initializer_expression = false ij_typescript_align_multiline_binary_operation = false -ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_chained_methods = true ij_typescript_align_multiline_extends_list = false ij_typescript_align_multiline_for = true -ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters = false ij_typescript_align_multiline_parameters_in_calls = false ij_typescript_align_multiline_ternary_operation = false ij_typescript_align_object_properties = 0 -ij_typescript_align_union_types = false +ij_typescript_align_union_types = true ij_typescript_align_var_statements = 0 ij_typescript_array_initializer_new_line_after_left_brace = false ij_typescript_array_initializer_right_brace_on_new_line = false -ij_typescript_array_initializer_wrap = off +ij_typescript_array_initializer_wrap = normal ij_typescript_assignment_wrap = off ij_typescript_binary_operation_sign_on_next_line = false ij_typescript_binary_operation_wrap = off @@ -95,26 +103,26 @@ ij_typescript_catch_on_new_line = false ij_typescript_chained_call_dot_on_new_line = true ij_typescript_class_brace_style = end_of_line ij_typescript_comma_on_new_line = false -ij_typescript_do_while_brace_force = never +ij_typescript_do_while_brace_force = always ij_typescript_else_on_new_line = false -ij_typescript_enforce_trailing_comma = keep +ij_typescript_enforce_trailing_comma = remove ij_typescript_extends_keyword_wrap = off ij_typescript_extends_list_wrap = off ij_typescript_field_prefix = _ ij_typescript_file_name_style = relaxed ij_typescript_finally_on_new_line = false -ij_typescript_for_brace_force = never +ij_typescript_for_brace_force = always ij_typescript_for_statement_new_line_after_left_paren = false ij_typescript_for_statement_right_paren_on_new_line = false ij_typescript_for_statement_wrap = off -ij_typescript_force_quote_style = false +ij_typescript_force_quote_style = true ij_typescript_force_semicolon_style = true ij_typescript_function_expression_brace_style = end_of_line -ij_typescript_if_brace_force = never +ij_typescript_if_brace_force = always ij_typescript_import_merge_members = global ij_typescript_import_prefer_absolute_path = global ij_typescript_import_sort_members = true -ij_typescript_import_sort_module_name = true +ij_typescript_import_sort_module_name = false ij_typescript_import_use_node_resolution = true ij_typescript_imports_wrap = on_every_item ij_typescript_indent_case_from_switch = true @@ -122,7 +130,7 @@ ij_typescript_indent_chained_calls = true ij_typescript_indent_package_children = 0 ij_typescript_jsdoc_include_types = false ij_typescript_jsx_attribute_value = braces -ij_typescript_keep_blank_lines_in_code = 1 +ij_typescript_keep_blank_lines_in_code = 2 ij_typescript_keep_first_column_comment = true ij_typescript_keep_indents_on_empty_lines = false ij_typescript_keep_line_breaks = true @@ -131,11 +139,11 @@ ij_typescript_keep_simple_methods_in_one_line = false ij_typescript_line_comment_add_space = true ij_typescript_line_comment_at_first_column = false ij_typescript_method_brace_style = end_of_line -ij_typescript_method_call_chain_wrap = off +ij_typescript_method_call_chain_wrap = split_into_lines ij_typescript_method_parameters_new_line_after_left_paren = false ij_typescript_method_parameters_right_paren_on_new_line = false ij_typescript_method_parameters_wrap = off -ij_typescript_object_literal_wrap = on_every_item +ij_typescript_object_literal_wrap = off ij_typescript_parentheses_expression_new_line_after_left_paren = false ij_typescript_parentheses_expression_right_paren_on_new_line = false ij_typescript_place_assignment_sign_on_next_line = false @@ -144,7 +152,7 @@ ij_typescript_prefer_explicit_types_function_expression_returns = false ij_typescript_prefer_explicit_types_function_returns = false ij_typescript_prefer_explicit_types_vars_fields = false ij_typescript_prefer_parameters_wrap = false -ij_typescript_reformat_c_style_comments = false +ij_typescript_reformat_c_style_comments = true ij_typescript_space_after_colon = true ij_typescript_space_after_comma = true ij_typescript_space_after_dots_in_rest_parameter = false @@ -175,7 +183,7 @@ ij_typescript_space_before_if_left_brace = true ij_typescript_space_before_if_parentheses = true ij_typescript_space_before_method_call_parentheses = false ij_typescript_space_before_method_left_brace = true -ij_typescript_space_before_method_parentheses = true +ij_typescript_space_before_method_parentheses = false ij_typescript_space_before_property_colon = false ij_typescript_space_before_quest = true ij_typescript_space_before_switch_left_brace = true @@ -202,7 +210,7 @@ ij_typescript_spaces_within_catch_parentheses = false ij_typescript_spaces_within_for_parentheses = false ij_typescript_spaces_within_if_parentheses = false ij_typescript_spaces_within_imports = true -ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_interpolation_expressions = true ij_typescript_spaces_within_method_call_parentheses = false ij_typescript_spaces_within_method_parentheses = false ij_typescript_spaces_within_object_literal_braces = true @@ -215,15 +223,15 @@ ij_typescript_spaces_within_while_parentheses = false ij_typescript_special_else_if_treatment = true ij_typescript_ternary_operation_signs_on_next_line = false ij_typescript_ternary_operation_wrap = off -ij_typescript_union_types_wrap = on_every_item +ij_typescript_union_types_wrap = normal ij_typescript_use_chained_calls_group_indents = false ij_typescript_use_double_quotes = false ij_typescript_use_explicit_js_extension = global ij_typescript_use_path_mapping = always ij_typescript_use_public_modifier = false ij_typescript_use_semicolon_after_statement = false -ij_typescript_var_declaration_wrap = normal -ij_typescript_while_brace_force = never +ij_typescript_var_declaration_wrap = on_every_item +ij_typescript_while_brace_force = always ij_typescript_while_on_new_line = false ij_typescript_wrap_comments = false @@ -275,8 +283,8 @@ ij_javascript_for_brace_force = never ij_javascript_for_statement_new_line_after_left_paren = false ij_javascript_for_statement_right_paren_on_new_line = false ij_javascript_for_statement_wrap = off -ij_javascript_force_quote_style = true -ij_javascript_force_semicolon_style = true +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false ij_javascript_function_expression_brace_style = end_of_line ij_javascript_if_brace_force = never ij_javascript_import_merge_members = global @@ -289,12 +297,12 @@ ij_javascript_indent_case_from_switch = true ij_javascript_indent_chained_calls = true ij_javascript_indent_package_children = 0 ij_javascript_jsx_attribute_value = braces -ij_javascript_keep_blank_lines_in_code = 1 +ij_javascript_keep_blank_lines_in_code = 2 ij_javascript_keep_first_column_comment = true ij_javascript_keep_indents_on_empty_lines = false ij_javascript_keep_line_breaks = true -ij_javascript_keep_simple_blocks_in_one_line = true -ij_javascript_keep_simple_methods_in_one_line = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false ij_javascript_line_comment_add_space = true ij_javascript_line_comment_at_first_column = false ij_javascript_method_brace_style = end_of_line @@ -337,12 +345,12 @@ ij_javascript_space_before_for_left_brace = true ij_javascript_space_before_for_parentheses = true ij_javascript_space_before_for_semicolon = false ij_javascript_space_before_function_left_parenth = true -ij_javascript_space_before_generator_mult = true +ij_javascript_space_before_generator_mult = false ij_javascript_space_before_if_left_brace = true ij_javascript_space_before_if_parentheses = true ij_javascript_space_before_method_call_parentheses = false ij_javascript_space_before_method_left_brace = true -ij_javascript_space_before_method_parentheses = true +ij_javascript_space_before_method_parentheses = false ij_javascript_space_before_property_colon = false ij_javascript_space_before_quest = true ij_javascript_space_before_switch_left_brace = true @@ -368,11 +376,11 @@ ij_javascript_spaces_within_brackets = false ij_javascript_spaces_within_catch_parentheses = false ij_javascript_spaces_within_for_parentheses = false ij_javascript_spaces_within_if_parentheses = false -ij_javascript_spaces_within_imports = true +ij_javascript_spaces_within_imports = false ij_javascript_spaces_within_interpolation_expressions = false ij_javascript_spaces_within_method_call_parentheses = false ij_javascript_spaces_within_method_parentheses = false -ij_javascript_spaces_within_object_literal_braces = true +ij_javascript_spaces_within_object_literal_braces = false ij_javascript_spaces_within_object_type_braces = true ij_javascript_spaces_within_parentheses = false ij_javascript_spaces_within_switch_parentheses = false @@ -380,22 +388,22 @@ ij_javascript_spaces_within_type_assertion = false ij_javascript_spaces_within_union_types = true ij_javascript_spaces_within_while_parentheses = false ij_javascript_special_else_if_treatment = true -ij_javascript_ternary_operation_signs_on_next_line = true +ij_javascript_ternary_operation_signs_on_next_line = false ij_javascript_ternary_operation_wrap = off ij_javascript_union_types_wrap = on_every_item ij_javascript_use_chained_calls_group_indents = false -ij_javascript_use_double_quotes = false +ij_javascript_use_double_quotes = true ij_javascript_use_explicit_js_extension = global ij_javascript_use_path_mapping = always ij_javascript_use_public_modifier = false -ij_javascript_use_semicolon_after_statement = false +ij_javascript_use_semicolon_after_statement = true ij_javascript_var_declaration_wrap = normal ij_javascript_while_brace_force = never ij_javascript_while_on_new_line = false ij_javascript_wrap_comments = false [{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}] -indent_size = 4 +indent_size = 2 ij_json_keep_blank_lines_in_code = 0 ij_json_keep_indents_on_empty_lines = false ij_json_keep_line_breaks = true @@ -423,7 +431,7 @@ ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_keep_whitespaces_inside = span, pre, textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -433,9 +441,30 @@ ij_html_space_after_tag_name = false ij_html_space_around_equality_in_attribute = false ij_html_space_inside_empty_tag = false ij_html_text_wrap = normal +ij_html_uniform_ident = false -[{*.yaml,*.yml}] +[{*.markdown, *.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 + +[{*.yaml, *.yml}] indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true ij_yaml_keep_indents_on_empty_lines = false ij_yaml_keep_line_breaks = true - +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/cypress/integration/banner.spec.ts b/cypress/integration/banner.spec.ts index 1965bbebd..6dcbcd34f 100644 --- a/cypress/integration/banner.spec.ts +++ b/cypress/integration/banner.spec.ts @@ -24,7 +24,9 @@ describe('Banner', () => { .find('.fa-times') .click() .then(() => { - expect(localStorage.getItem('bannerTimeStamp')).to.equal(banner.timestamp) + expect(localStorage.getItem('bannerTimeStamp')) + .to + .equal(banner.timestamp) }) cy.get('.alert-primary.show') .should('not.exist') diff --git a/cypress/integration/documentTitle.spec.ts b/cypress/integration/documentTitle.spec.ts index 82c2292f6..8d7745708 100644 --- a/cypress/integration/documentTitle.spec.ts +++ b/cypress/integration/documentTitle.spec.ts @@ -16,73 +16,73 @@ describe('Document Title', () => { describe('title should be yaml metadata title', () => { it('just yaml metadata title', () => { - cy.codemirrorFill(`---\ntitle: ${title}\n---`) + cy.codemirrorFill(`---\ntitle: ${ title }\n---`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) it('yaml metadata title and opengraph title', () => { - cy.codemirrorFill(`---\ntitle: ${title}\nopengraph:\n title: False title\n---`) + cy.codemirrorFill(`---\ntitle: ${ title }\nopengraph:\n title: False title\n---`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) it('yaml metadata title, opengraph title and first heading', () => { - cy.codemirrorFill(`---\ntitle: ${title}\nopengraph:\n title: False title\n---\n# a first title`) + cy.codemirrorFill(`---\ntitle: ${ title }\nopengraph:\n title: False title\n---\n# a first title`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) }) describe('title should be opengraph title', () => { it('just opengraph title', () => { - cy.codemirrorFill(`---\nopengraph:\n title: ${title}\n---`) + cy.codemirrorFill(`---\nopengraph:\n title: ${ title }\n---`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) it('opengraph title and first heading', () => { - cy.codemirrorFill(`---\nopengraph:\n title: ${title}\n---\n# a first title`) + cy.codemirrorFill(`---\nopengraph:\n title: ${ title }\n---\n# a first title`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) }) describe('title should be first heading', () => { it('just first heading', () => { - cy.codemirrorFill(`# ${title}`) + cy.codemirrorFill(`# ${ title }`) cy.title() - .should('eq', `${title} - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } - HedgeDoc @ ${ branding.name }`) }) it('just first heading with alt-text instead of image', () => { - cy.codemirrorFill(`# ${title} ![abc](https://dummyimage.com/48)`) + cy.codemirrorFill(`# ${ title } ![abc](https://dummyimage.com/48)`) cy.title() - .should('eq', `${title} abc - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } abc - HedgeDoc @ ${ branding.name }`) }) it('just first heading without link syntax', () => { - cy.codemirrorFill(`# ${title} [link](https://hedgedoc.org)`) + cy.codemirrorFill(`# ${ title } [link](https://hedgedoc.org)`) cy.title() - .should('eq', `${title} link - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } link - HedgeDoc @ ${ branding.name }`) }) it('markdown syntax removed first', () => { - cy.codemirrorFill(`# ${title} 1*2*3 4*5**`) + cy.codemirrorFill(`# ${ title } 1*2*3 4*5**`) cy.title() - .should('eq', `${title} 123 4*5** - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } 123 4*5** - HedgeDoc @ ${ branding.name }`) }) it('markdown syntax removed second', () => { - cy.codemirrorFill(`# ${title} **1 2*`) + cy.codemirrorFill(`# ${ title } **1 2*`) cy.title() - .should('eq', `${title} *1 2 - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } *1 2 - HedgeDoc @ ${ branding.name }`) }) it('markdown syntax removed third', () => { - cy.codemirrorFill(`# ${title} _asd_`) + cy.codemirrorFill(`# ${ title } _asd_`) cy.title() - .should('eq', `${title} asd - HedgeDoc @ ${branding.name}`) + .should('eq', `${ title } asd - HedgeDoc @ ${ branding.name }`) }) it('katex code looks right', () => { @@ -93,7 +93,7 @@ describe('Document Title', () => { cy.get('.CodeMirror textarea') .type('{Enter}{Enter}{Enter}{Enter}{Enter}') //This is a workaround because I don't know how to make sure, that the title gets updated in time. cy.title() - .should('eq', `α-foo - HedgeDoc @ ${branding.name}`) + .should('eq', `α-foo - HedgeDoc @ ${ branding.name }`) }) }) }) diff --git a/cypress/integration/export.spec.ts b/cypress/integration/export.spec.ts index 819fd25f7..b76a44160 100644 --- a/cypress/integration/export.spec.ts +++ b/cypress/integration/export.spec.ts @@ -6,7 +6,7 @@ describe('Export', () => { const testTitle = 'testContent' - const testContent = `---\ntitle: ${testTitle}\n---\nThis is some test content` + const testContent = `---\ntitle: ${ testTitle }\n---\nThis is some test content` beforeEach(() => { cy.visitTestEditor() diff --git a/cypress/integration/fileUpload.spec.ts b/cypress/integration/fileUpload.spec.ts index 67dc6589b..7cc136988 100644 --- a/cypress/integration/fileUpload.spec.ts +++ b/cypress/integration/fileUpload.spec.ts @@ -45,35 +45,40 @@ describe('File upload', () => { cy.get('div.btn-group > input[type=file]') .attachFile({ filePath: 'acme.png', mimeType: 'image/png' }) cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `![](${imageUrl})`) + .should('have.text', `![](${ imageUrl })`) }) it('via paste', () => { - cy.fixture('acme.png').then((image: string) => { - const pasteEvent = { - clipboardData: { - files: [Cypress.Blob.base64StringToBlob(image, 'image/png')] + cy.fixture('acme.png') + .then((image: string) => { + const pasteEvent = { + clipboardData: { + files: [Cypress.Blob.base64StringToBlob(image, 'image/png')] + } } - } - cy.get('.CodeMirror-scroll').trigger('paste', pasteEvent) - cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `![](${imageUrl})`) - }) + cy.get('.CodeMirror-scroll') + .trigger('paste', pasteEvent) + cy.get('.CodeMirror-activeline > .CodeMirror-line > span') + .should('have.text', `![](${ imageUrl })`) + }) }) it('via drag and drop', () => { - cy.fixture('acme.png').then((image: string) => { - const dropEvent = { - dataTransfer: { - files: [Cypress.Blob.base64StringToBlob(image, 'image/png')], - effectAllowed: 'uninitialized' + cy.fixture('acme.png') + .then((image: string) => { + const dropEvent = { + dataTransfer: { + files: [Cypress.Blob.base64StringToBlob(image, 'image/png')], + effectAllowed: 'uninitialized' + } } - } - cy.get('.CodeMirror-scroll').trigger('dragenter', dropEvent) - cy.get('.CodeMirror-scroll').trigger('drop', dropEvent) - cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `![](${imageUrl})`) - }) + cy.get('.CodeMirror-scroll') + .trigger('dragenter', dropEvent) + cy.get('.CodeMirror-scroll') + .trigger('drop', dropEvent) + cy.get('.CodeMirror-activeline > .CodeMirror-line > span') + .should('have.text', `![](${ imageUrl })`) + }) }) }) @@ -86,10 +91,11 @@ describe('File upload', () => { }) cy.get('.fa-upload') .click() - cy.fixture('acme.png').then(() => { - cy.get('input[type=file]') - .attachFile({ filePath: 'acme.png', mimeType: 'image/png' }) - }) + cy.fixture('acme.png') + .then(() => { + cy.get('input[type=file]') + .attachFile({ filePath: 'acme.png', mimeType: 'image/png' }) + }) cy.get('.CodeMirror-activeline > .CodeMirror-line > span > span') .should('have.text', String.fromCharCode(8203)) //thanks codemirror.... }) @@ -101,8 +107,9 @@ describe('File upload', () => { getData: (type = 'text') => testText } } - cy.get('.CodeMirror-scroll').trigger('paste', pasteEvent) + cy.get('.CodeMirror-scroll') + .trigger('paste', pasteEvent) cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `${testText}`) + .should('have.text', `${ testText }`) }) }) diff --git a/cypress/integration/highlightedCodeBlock.spec.ts b/cypress/integration/highlightedCodeBlock.spec.ts index 14d6034c2..ecc3463c2 100644 --- a/cypress/integration/highlightedCodeBlock.spec.ts +++ b/cypress/integration/highlightedCodeBlock.spec.ts @@ -6,8 +6,8 @@ const findHljsCodeBlock = () => { return cy.getMarkdownBody() - .find('pre > code.hljs') - .should('be.visible') + .find('pre > code.hljs') + .should('be.visible') } describe('Code', () => { @@ -160,14 +160,15 @@ describe('Code', () => { return cy.wrap(null) } - cy.spy(frame.contentWindow.navigator.clipboard, 'writeText').as("copy") + cy.spy(frame.contentWindow.navigator.clipboard, 'writeText') + .as('copy') }) cy.getMarkdownRenderer() .find('[data-cy="copy-code-button"]') .click() - cy.get("@copy") + cy.get('@copy') .should('be.calledWithExactly', 'let x = 0\n') }) }) diff --git a/cypress/integration/language.spec.ts b/cypress/integration/language.spec.ts index 4402e67e6..50c398ce8 100644 --- a/cypress/integration/language.spec.ts +++ b/cypress/integration/language.spec.ts @@ -17,7 +17,8 @@ describe('Languages', () => { cy.get('@languages') .should('have.length', 28) languages.forEach(language => { - cy.get('@languages').contains(language) + cy.get('@languages') + .contains(language) }) }) diff --git a/cypress/integration/link.spec.ts b/cypress/integration/link.spec.ts index ed43de58f..0cbec980a 100644 --- a/cypress/integration/link.spec.ts +++ b/cypress/integration/link.spec.ts @@ -64,14 +64,16 @@ describe('Links Intro', () => { describe('Menu Buttons logged in', () => { it('New note', () => { - cy.get('.d-inline-flex.btn-primary').click() + cy.get('.d-inline-flex.btn-primary') + .click() cy.url() .should('include', '/new') }) describe('User Menu', () => { beforeEach(() => { - cy.get('#dropdown-user').click() + cy.get('#dropdown-user') + .click() }) it('Features', () => { diff --git a/cypress/integration/maxLength.spec.ts b/cypress/integration/maxLength.spec.ts index 2e1108f64..1aca4b986 100644 --- a/cypress/integration/maxLength.spec.ts +++ b/cypress/integration/maxLength.spec.ts @@ -7,7 +7,7 @@ describe('The status bar text length info', () => { const warningTestContent = ('0123456789'.repeat(10)) const dangerTestContent = ('0123456789'.repeat(20)) - const tooMuchTestContent = `${dangerTestContent}a` + const tooMuchTestContent = `${ dangerTestContent }a` beforeEach(() => { cy.visitTestEditor() diff --git a/cypress/integration/profile.spec.ts b/cypress/integration/profile.spec.ts index a686ceb70..e5183db5f 100644 --- a/cypress/integration/profile.spec.ts +++ b/cypress/integration/profile.spec.ts @@ -12,7 +12,7 @@ describe('profile page', () => { }, { body: [ { - label: "cypress-App", + label: 'cypress-App', created: 1601991518 } ] diff --git a/cypress/integration/toolbar.spec.ts b/cypress/integration/toolbar.spec.ts index 631b2cf01..3053c9c0f 100644 --- a/cypress/integration/toolbar.spec.ts +++ b/cypress/integration/toolbar.spec.ts @@ -21,7 +21,7 @@ describe('Toolbar Buttons', () => { beforeEach(() => { cy.codemirrorFill(testText) cy.get('.CodeMirror-line > span') - .should("exist") + .should('exist') .should('have.text', testText) }) @@ -35,42 +35,42 @@ describe('Toolbar Buttons', () => { cy.get('.btn-toolbar [data-cy="format-bold"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `**${testText}**`) + .should('have.text', `**${ testText }**`) }) it('should format as italic', () => { cy.get('.btn-toolbar [data-cy="format-italic"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `*${testText}*`) + .should('have.text', `*${ testText }*`) }) it('should format as underline', () => { cy.get('.btn-toolbar [data-cy="format-underline"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `++${testText}++`) + .should('have.text', `++${ testText }++`) }) it('should format as strikethrough', () => { cy.get('.btn-toolbar [data-cy="format-strikethrough"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `~~${testText}~~`) + .should('have.text', `~~${ testText }~~`) }) it('should format as subscript', () => { cy.get('.btn-toolbar [data-cy="format-subscript"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `~${testText}~`) + .should('have.text', `~${ testText }~`) }) it('should format as superscript', () => { cy.get('.btn-toolbar [data-cy="format-superscript"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `^${testText}^`) + .should('have.text', `^${ testText }^`) }) it('should format the line as code block', () => { @@ -88,14 +88,14 @@ describe('Toolbar Buttons', () => { cy.get('.btn-toolbar [data-cy="format-link"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `[${testText}](https://)`) + .should('have.text', `[${ testText }](https://)`) }) it('should format as image', () => { cy.get('.btn-toolbar [data-cy="format-image"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `![${testText}](https://)`) + .should('have.text', `![${ testText }](https://)`) }) }) @@ -103,11 +103,11 @@ describe('Toolbar Buttons', () => { cy.get('.btn-toolbar [data-cy="format-heading"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `# ${testText}`) + .should('have.text', `# ${ testText }`) cy.get('.fa-header') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `## ${testText}`) + .should('have.text', `## ${ testText }`) }) it('should format the line as code', () => { @@ -125,58 +125,58 @@ describe('Toolbar Buttons', () => { cy.get('.btn-toolbar [data-cy="format-block-quote"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `> ${testText}`) + .should('have.text', `> ${ testText }`) cy.get('.btn-toolbar [data-cy="format-block-quote"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `> > ${testText}`) + .should('have.text', `> > ${ testText }`) }) it('should format as unordered list', () => { cy.get('.btn-toolbar [data-cy="format-unordered-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `- ${testText}`) + .should('have.text', `- ${ testText }`) cy.get('.btn-toolbar [data-cy="format-unordered-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `- - ${testText}`) + .should('have.text', `- - ${ testText }`) }) it('should format as ordered list', () => { cy.get('.btn-toolbar [data-cy="format-ordered-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `1. ${testText}`) + .should('have.text', `1. ${ testText }`) cy.get('.btn-toolbar [data-cy="format-ordered-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `1. 1. ${testText}`) + .should('have.text', `1. 1. ${ testText }`) }) it('should format as check list', () => { cy.get('.btn-toolbar [data-cy="format-check-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `- [ ] ${testText}`) + .should('have.text', `- [ ] ${ testText }`) cy.get('.btn-toolbar [data-cy="format-check-list"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `- [ ] - [ ] ${testText}`) + .should('have.text', `- [ ] - [ ] ${ testText }`) }) it('should insert links', () => { cy.get('.btn-toolbar [data-cy="format-link"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `${testText}[](https://)`) + .should('have.text', `${ testText }[](https://)`) }) it('should insert an empty image link', () => { cy.get('.btn-toolbar [data-cy="format-image"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `${testText}![](https://)`) + .should('have.text', `${ testText }![](https://)`) }) }) @@ -184,7 +184,7 @@ describe('Toolbar Buttons', () => { beforeEach(() => { cy.codemirrorFill(testLink) cy.get('.CodeMirror-line > span') - .should("exist") + .should('exist') .should('have.text', testLink) cy.get('@codeinput') .type('{ctrl}a') @@ -194,14 +194,14 @@ describe('Toolbar Buttons', () => { cy.get('.btn-toolbar [data-cy="format-link"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `[](${testLink})`) + .should('have.text', `[](${ testLink })`) }) it('should format as image', () => { cy.get('.btn-toolbar [data-cy="format-image"]') .click() cy.get('.CodeMirror-activeline > .CodeMirror-line > span') - .should('have.text', `![](${testLink})`) + .should('have.text', `![](${ testLink })`) }) }) diff --git a/cypress/support/checkLinks.ts b/cypress/support/checkLinks.ts index 14ee38366..5cbe666ea 100644 --- a/cypress/support/checkLinks.ts +++ b/cypress/support/checkLinks.ts @@ -11,11 +11,12 @@ declare namespace Cypress { * Custom command to check an external Link. * @example cy.get(a#extern).checkExternalLink('http://example.com') */ - checkExternalLink (url: string): Chainable + checkExternalLink(url: string): Chainable } } Cypress.Commands.add('checkExternalLink', { prevSubject: 'element' }, ($element: JQuery, url: string) => { - cy.wrap($element).should('have.attr', 'href', url) + cy.wrap($element) + .should('have.attr', 'href', url) .should('have.attr', 'target', '_blank') }) diff --git a/cypress/support/config.ts b/cypress/support/config.ts index c957c2432..aaa89d9d1 100644 --- a/cypress/support/config.ts +++ b/cypress/support/config.ts @@ -50,9 +50,9 @@ beforeEach(() => { sourceCodeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', issueTrackerUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }, - "iframeCommunication": { - "editorOrigin": "http://127.0.0.1:3001", - "rendererOrigin": "http://127.0.0.1:3001" + 'iframeCommunication': { + 'editorOrigin': 'http://127.0.0.1:3001', + 'rendererOrigin': 'http://127.0.0.1:3001' } } }) diff --git a/cypress/support/fill.ts b/cypress/support/fill.ts index 97ca7ee5c..0f35de554 100644 --- a/cypress/support/fill.ts +++ b/cypress/support/fill.ts @@ -11,8 +11,9 @@ declare namespace Cypress { * Custom command to fill an input field with text and trigger a change event. * @example cy.get(input).fill('content') */ - fill (value: string): Chainable - codemirrorFill (value: string): Chainable + fill(value: string): Chainable + + codemirrorFill(value: string): Chainable } } @@ -20,17 +21,18 @@ Cypress.Commands.add('fill', { prevSubject: 'element' }, (subject, value) => { return cy.wrap(subject) - .invoke('val', value) - .trigger('change', { force: true }) + .invoke('val', value) + .trigger('change', { force: true }) }) Cypress.Commands.add('codemirrorFill', (content: string) => { - const line = content.split("\n").find(value => value !== ''); + const line = content.split('\n') + .find(value => value !== '') cy.get('.CodeMirror') .click() .get('textarea') .fill(content) - if(line) { + if (line) { cy.get('.CodeMirror') .contains('.CodeMirror-line', line) } diff --git a/cypress/support/getMarkdownRenderer.ts b/cypress/support/getMarkdownRenderer.ts index 26f6be1cc..78ecdf28a 100644 --- a/cypress/support/getMarkdownRenderer.ts +++ b/cypress/support/getMarkdownRenderer.ts @@ -6,22 +6,22 @@ declare namespace Cypress { interface Chainable { - getMarkdownRenderer (): Chainable + getMarkdownRenderer(): Chainable - getMarkdownBody (): Chainable + getMarkdownBody(): Chainable } } Cypress.Commands.add('getMarkdownRenderer', () => { return cy.get(`iframe[data-cy="documentIframe"]`) - .its('0.contentDocument') - .should('exist') - .its('body') - .should('not.be.undefined') - .then(cy.wrap.bind(cy)) + .its('0.contentDocument') + .should('exist') + .its('body') + .should('not.be.undefined') + .then(cy.wrap.bind(cy)) }) Cypress.Commands.add('getMarkdownBody', () => { return cy.getMarkdownRenderer() - .find('.markdown-body') + .find('.markdown-body') }) diff --git a/cypress/support/login.ts b/cypress/support/login.ts index e0e3ee2cc..b21c4d3d9 100644 --- a/cypress/support/login.ts +++ b/cypress/support/login.ts @@ -11,11 +11,13 @@ declare namespace Cypress { * Custom command to log the user out. * @example cy.logout() */ - logout (): Chainable + logout(): Chainable } } Cypress.Commands.add('logout', () => { - cy.get('#dropdown-user').click() - cy.get('.fa-sign-out').click() + cy.get('#dropdown-user') + .click() + cy.get('.fa-sign-out') + .click() }) diff --git a/cypress/support/visit-test-editor.ts b/cypress/support/visit-test-editor.ts index 640a4e630..b7f845053 100644 --- a/cypress/support/visit-test-editor.ts +++ b/cypress/support/visit-test-editor.ts @@ -6,28 +6,28 @@ declare namespace Cypress { interface Chainable { - visitTestEditor (query?: string): Chainable + visitTestEditor(query?: string): Chainable } } export const testNoteId = 'test' Cypress.Commands.add('visitTestEditor', (query?: string) => { - return cy.visit(`/n/${testNoteId}${query ? `?${query}` : ''}`) + return cy.visit(`/n/${ testNoteId }${ query ? `?${ query }` : '' }`) }) beforeEach(() => { - cy.intercept(`/api/v2/notes/${testNoteId}-get`, { - "id": "ABC123", - "alias": "banner", - "lastChange": { - "userId": "test", - "timestamp": 1600033920 + cy.intercept(`/api/v2/notes/${ testNoteId }-get`, { + 'id': 'ABC123', + 'alias': 'banner', + 'lastChange': { + 'userId': 'test', + 'timestamp': 1600033920 }, - "viewCount": 0, - "createTime": 1600033920, - "content": "", - "authorship": [], - "preVersionTwoNote": true + 'viewCount': 0, + 'createTime': 1600033920, + 'content': '', + 'authorship': [], + 'preVersionTwoNote': true }) }) diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 8aaf42929..5bf928fb9 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -3,8 +3,15 @@ "strict": true, "baseUrl": "../node_modules", "target": "es6", - "lib": ["es6", "dom"], - "types": ["cypress" ,"cypress-commands", "cypress-file-upload"] + "lib": [ + "es6", + "dom" + ], + "types": [ + "cypress", + "cypress-commands", + "cypress-file-upload" + ] }, "include": [ "**/*.ts" diff --git a/src/api/notes/index.ts b/src/api/notes/index.ts index 96354009e..794ca6eec 100644 --- a/src/api/notes/index.ts +++ b/src/api/notes/index.ts @@ -25,7 +25,7 @@ export interface Note { export const getNote = async (noteId: string): Promise => { // The "-get" suffix is necessary, because in our mock api (filesystem) the note id might already be a folder. // TODO: [mrdrogdrog] replace -get with actual api route as soon as api backend is ready. - const response = await fetch(getApiUrl() + `/notes/${noteId}-get`, { + const response = await fetch(getApiUrl() + `/notes/${ noteId }-get`, { ...defaultFetchConfig }) expectResponseCode(response) @@ -33,7 +33,7 @@ export const getNote = async (noteId: string): Promise => { } export const deleteNote = async (noteId: string): Promise => { - const response = await fetch(getApiUrl() + `/notes/${noteId}`, { + const response = await fetch(getApiUrl() + `/notes/${ noteId }`, { ...defaultFetchConfig, method: 'DELETE' }) diff --git a/src/api/revisions/index.ts b/src/api/revisions/index.ts index d68449f91..a482b67f0 100644 --- a/src/api/revisions/index.ts +++ b/src/api/revisions/index.ts @@ -11,11 +11,11 @@ import { Revision, RevisionListEntry } from './types' const revisionCache = new Cache(3600) export const getRevision = async (noteId: string, timestamp: number): Promise => { - const cacheKey = `${noteId}:${timestamp}` + const cacheKey = `${ noteId }:${ timestamp }` if (revisionCache.has(cacheKey)) { return revisionCache.get(cacheKey) } - const response = await fetch(getApiUrl() + `/notes/${noteId}/revisions/${timestamp}`, { + const response = await fetch(getApiUrl() + `/notes/${ noteId }/revisions/${ timestamp }`, { ...defaultFetchConfig }) expectResponseCode(response) @@ -26,7 +26,7 @@ export const getRevision = async (noteId: string, timestamp: number): Promise => { // TODO Change 'revisions-list' to 'revisions' as soon as the backend is ready to serve some data! - const response = await fetch(getApiUrl() + `/notes/${noteId}/revisions-list`, { + const response = await fetch(getApiUrl() + `/notes/${ noteId }/revisions-list`, { ...defaultFetchConfig }) expectResponseCode(response) diff --git a/src/api/tokens/index.ts b/src/api/tokens/index.ts index 29a8cfdee..ee004e0ef 100644 --- a/src/api/tokens/index.ts +++ b/src/api/tokens/index.ts @@ -8,7 +8,7 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils' import { AccessToken, AccessTokenSecret } from './types' export const getAccessTokenList = async (): Promise => { - const response = await fetch(`${getApiUrl()}/tokens`, { + const response = await fetch(`${ getApiUrl() }/tokens`, { ...defaultFetchConfig }) expectResponseCode(response) @@ -16,7 +16,7 @@ export const getAccessTokenList = async (): Promise => { } export const postNewAccessToken = async (label: string): Promise => { - const response = await fetch(`${getApiUrl()}/tokens`, { + const response = await fetch(`${ getApiUrl() }/tokens`, { ...defaultFetchConfig, method: 'POST', body: label @@ -26,7 +26,7 @@ export const postNewAccessToken = async (label: string): Promise => { - const response = await fetch(`${getApiUrl()}/tokens/${timestamp}`, { + const response = await fetch(`${ getApiUrl() }/tokens/${ timestamp }`, { ...defaultFetchConfig, method: 'DELETE' }) diff --git a/src/api/users/index.ts b/src/api/users/index.ts index 69316ec67..8dfcd03ce 100644 --- a/src/api/users/index.ts +++ b/src/api/users/index.ts @@ -14,7 +14,7 @@ export const getUserById = async (userid: string): Promise => { if (cache.has(userid)) { return cache.get(userid) } - const response = await fetch(`${getApiUrl()}/users/${userid}`, { + const response = await fetch(`${ getApiUrl() }/users/${ userid }`, { ...defaultFetchConfig }) expectResponseCode(response) diff --git a/src/api/utils.ts b/src/api/utils.ts index e79492c97..12a591ae5 100644 --- a/src/api/utils.ts +++ b/src/api/utils.ts @@ -24,6 +24,6 @@ export const getApiUrl = (): string => { export const expectResponseCode = (response: Response, code = 200): void => { if (response.status !== code) { - throw new Error(`response code is not ${code}`) + throw new Error(`response code is not ${ code }`) } } diff --git a/src/components/application-loader/application-loader.scss b/src/components/application-loader/application-loader.scss index 193f4d690..fda4fac73 100644 --- a/src/components/application-loader/application-loader.scss +++ b/src/components/application-loader/application-loader.scss @@ -6,32 +6,72 @@ .loader { @keyframes animation-roll { - 0% { transform: translateX(calc(-100vw / 2 - 100%)) rotateZ(0deg); } - 100% { transform: translateX(calc(100vw / 2 + 100%)) rotateZ(720deg); } + 0% { + transform: translateX(calc(-100vw / 2 - 100%)) rotateZ(0deg); + } + 100% { + transform: translateX(calc(100vw / 2 + 100%)) rotateZ(720deg); + } } @keyframes animation-jump { - 0% { transform: scale(1,1) translateY(0); } - 10% { transform: scale(1.1,.9) translateY(0); } - 30% { transform: scale(.9,1.1) translateY(-100px); } - 50% { transform: scale(1.05,.95) translateY(0); } - 57% { transform: scale(1,1) translateY(-7px); } - 64% { transform: scale(1,1) translateY(0); } - 100% { transform: scale(1,1) translateY(0); } + 0% { + transform: scale(1, 1) translateY(0); + } + 10% { + transform: scale(1.1, .9) translateY(0); + } + 30% { + transform: scale(.9, 1.1) translateY(-100px); + } + 50% { + transform: scale(1.05, .95) translateY(0); + } + 57% { + transform: scale(1, 1) translateY(-7px); + } + 64% { + transform: scale(1, 1) translateY(0); + } + 100% { + transform: scale(1, 1) translateY(0); + } } @keyframes animation-shake { - 0% { transform: translate(1px, 1px) rotate(0deg); } - 10% { transform: translate(-1px, -2px) rotate(-1deg); } - 20% { transform: translate(-3px, 0px) rotate(1deg); } - 30% { transform: translate(3px, 2px) rotate(0deg); } - 40% { transform: translate(1px, -1px) rotate(1deg); } - 50% { transform: translate(-1px, 2px) rotate(-1deg); } - 60% { transform: translate(-3px, 1px) rotate(0deg); } - 70% { transform: translate(3px, 1px) rotate(-1deg); } - 80% { transform: translate(-1px, -1px) rotate(1deg); } - 90% { transform: translate(1px, 2px) rotate(0deg); } - 100% { transform: translate(1px, -2px) rotate(-1deg); } + 0% { + transform: translate(1px, 1px) rotate(0deg); + } + 10% { + transform: translate(-1px, -2px) rotate(-1deg); + } + 20% { + transform: translate(-3px, 0px) rotate(1deg); + } + 30% { + transform: translate(3px, 2px) rotate(0deg); + } + 40% { + transform: translate(1px, -1px) rotate(1deg); + } + 50% { + transform: translate(-1px, 2px) rotate(-1deg); + } + 60% { + transform: translate(-3px, 1px) rotate(0deg); + } + 70% { + transform: translate(3px, 1px) rotate(-1deg); + } + 80% { + transform: translate(-1px, -1px) rotate(1deg); + } + 90% { + transform: translate(1px, 2px) rotate(0deg); + } + 100% { + transform: translate(1px, -2px) rotate(-1deg); + } } .animation-roll { diff --git a/src/components/application-loader/application-loader.tsx b/src/components/application-loader/application-loader.tsx index 0d75b67fa..634746c73 100644 --- a/src/components/application-loader/application-loader.tsx +++ b/src/components/application-loader/application-loader.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { Suspense, useCallback, useEffect, useState } from 'react' import { useFrontendBaseUrl } from '../../hooks/common/use-frontend-base-url' @@ -30,20 +30,21 @@ export const ApplicationLoader: React.FC = ({ children }) => { useEffect(() => { for (const task of initTasks) { - runTask(task.task).catch((reason: Error) => { - console.error(reason) - setFailedTitle(task.name) - }) + runTask(task.task) + .catch((reason: Error) => { + console.error(reason) + setFailedTitle(task.name) + }) } }, [initTasks, runTask]) const tasksAreRunning = doneTasks < initTasks.length || initTasks.length === 0 if (tasksAreRunning) { - return + return } else { - return )}> - {children} + return ) }> + { children } } } diff --git a/src/components/application-loader/loading-screen.tsx b/src/components/application-loader/loading-screen.tsx index 8d6d52d81..9910c89d6 100644 --- a/src/components/application-loader/loading-screen.tsx +++ b/src/components/application-loader/loading-screen.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Alert } from 'react-bootstrap' @@ -17,13 +17,13 @@ export const LoadingScreen: React.FC = ({ failedTitle }) => return (
- - + +
- - - The task '{failedTitle}' failed.
+ + + The task '{ failedTitle }' failed.
For further information look into the browser console.
diff --git a/src/components/common/branding/branding.tsx b/src/components/common/branding/branding.tsx index 16942ef0d..7b72afa54 100644 --- a/src/components/common/branding/branding.tsx +++ b/src/components/common/branding/branding.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import equal from 'fast-deep-equal' import React from 'react' @@ -21,18 +21,18 @@ export const Branding: React.FC = ({ inline = false, delimiter = const showBranding = !!branding.name || !!branding.logo return ( - - - @ + + + @ { branding.logo ? {branding.name} + src={ branding.logo } + alt={ branding.name } + title={ branding.name } + className={ inline ? 'inline-size' : 'regular-size' } + /> : branding.name } diff --git a/src/components/common/cache/cache.test.ts b/src/components/common/cache/cache.test.ts index b2c7fa005..9723248be 100644 --- a/src/components/common/cache/cache.test.ts +++ b/src/components/common/cache/cache.test.ts @@ -16,68 +16,88 @@ describe('Test caching functionality', () => { it('initialize with right lifetime, no entry limit', () => { const lifetime = 1000 const lifetimedCache = new Cache(lifetime) - expect(lifetimedCache.entryLifetime).toEqual(lifetime) - expect(lifetimedCache.maxEntries).toEqual(0) + expect(lifetimedCache.entryLifetime) + .toEqual(lifetime) + expect(lifetimedCache.maxEntries) + .toEqual(0) }) it('initialize with right lifetime, given entry limit', () => { const lifetime = 1000 const maxEntries = 10 const limitedCache = new Cache(lifetime, maxEntries) - expect(limitedCache.entryLifetime).toEqual(lifetime) - expect(limitedCache.maxEntries).toEqual(maxEntries) + expect(limitedCache.entryLifetime) + .toEqual(lifetime) + expect(limitedCache.maxEntries) + .toEqual(maxEntries) }) it('entry exists after inserting', () => { testCache.put('test', 123) - expect(testCache.has('test')).toBe(true) + expect(testCache.has('test')) + .toBe(true) }) it('entry does not exist prior inserting', () => { - expect(testCache.has('test')).toBe(false) + expect(testCache.has('test')) + .toBe(false) }) it('entry does expire', () => { const shortLivingCache = new Cache(2) shortLivingCache.put('test', 123) - expect(shortLivingCache.has('test')).toBe(true) + expect(shortLivingCache.has('test')) + .toBe(true) setTimeout(() => { - expect(shortLivingCache.has('test')).toBe(false) + expect(shortLivingCache.has('test')) + .toBe(false) }, 2000) }) it('entry value does not change', () => { const testValue = Date.now() testCache.put('test', testValue) - expect(testCache.get('test')).toEqual(testValue) + expect(testCache.get('test')) + .toEqual(testValue) }) it('error is thrown on non-existent entry', () => { const accessNonExistentEntry = () => { testCache.get('test') } - expect(accessNonExistentEntry).toThrow(Error) + expect(accessNonExistentEntry) + .toThrow(Error) }) it('newer item replaces older item', () => { testCache.put('test', 123) testCache.put('test', 456) - expect(testCache.get('test')).toEqual(456) + expect(testCache.get('test')) + .toEqual(456) }) it('entry limit is respected', () => { const limitedCache = new Cache(1000, 2) limitedCache.put('first', 1) - expect(limitedCache.has('first')).toBe(true) - expect(limitedCache.has('second')).toBe(false) - expect(limitedCache.has('third')).toBe(false) + expect(limitedCache.has('first')) + .toBe(true) + expect(limitedCache.has('second')) + .toBe(false) + expect(limitedCache.has('third')) + .toBe(false) limitedCache.put('second', 2) - expect(limitedCache.has('first')).toBe(true) - expect(limitedCache.has('second')).toBe(true) - expect(limitedCache.has('third')).toBe(false) + expect(limitedCache.has('first')) + .toBe(true) + expect(limitedCache.has('second')) + .toBe(true) + expect(limitedCache.has('third')) + .toBe(false) limitedCache.put('third', 3) - expect(limitedCache.has('first')).toBe(false) - expect(limitedCache.has('second')).toBe(true) - expect(limitedCache.has('third')).toBe(true) + expect(limitedCache.has('first')) + .toBe(false) + expect(limitedCache.has('second')) + .toBe(true) + expect(limitedCache.has('third')) + .toBe(true) }) }) diff --git a/src/components/common/cache/cache.ts b/src/components/common/cache/cache.ts index 5178156d1..68486c943 100644 --- a/src/components/common/cache/cache.ts +++ b/src/components/common/cache/cache.ts @@ -10,12 +10,11 @@ export interface CacheEntry { } export class Cache { - private store = new Map>() - readonly entryLifetime: number readonly maxEntries: number + private store = new Map>() - constructor (lifetime: number, maxEntries = 0) { + constructor(lifetime: number, maxEntries = 0) { if (lifetime < 0) { throw new Error('Cache entry lifetime can not be less than 0 seconds.') } @@ -23,7 +22,7 @@ export class Cache { this.maxEntries = maxEntries } - has (key: K): boolean { + has(key: K): boolean { if (!this.store.has(key)) { return false } @@ -31,7 +30,7 @@ export class Cache { return (!!entry && entry.entryCreated >= (Date.now() - this.entryLifetime * 1000)) } - get (key: K): V { + get(key: K): V { const entry = this.store.get(key) if (!entry) { throw new Error('This cache entry does not exist. Check with ".has()" before using ".get()".') @@ -39,9 +38,10 @@ export class Cache { return entry.data } - put (key: K, value: V): void { + put(key: K, value: V): void { if (this.maxEntries > 0 && this.store.size === this.maxEntries) { - this.store.delete(this.store.keys().next().value) + this.store.delete(this.store.keys() + .next().value) } this.store.set(key, { entryCreated: Date.now(), diff --git a/src/components/common/copyable/copy-overlay.tsx b/src/components/common/copyable/copy-overlay.tsx index 876579f56..569be1ebb 100644 --- a/src/components/common/copyable/copy-overlay.tsx +++ b/src/components/common/copyable/copy-overlay.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { RefObject, useCallback, useEffect, useState } from 'react' import { Overlay, Tooltip } from 'react-bootstrap' @@ -22,15 +22,20 @@ export const CopyOverlay: React.FC = ({ content, clickComponen const [tooltipId] = useState(() => uuid()) const copyToClipboard = useCallback((content: string) => { - navigator.clipboard.writeText(content).then(() => { - setError(false) - }).catch(() => { - setError(true) - console.error("couldn't copy") - }).finally(() => { - setShowCopiedTooltip(true) - setTimeout(() => { setShowCopiedTooltip(false) }, 2000) - }) + navigator.clipboard.writeText(content) + .then(() => { + setError(false) + }) + .catch(() => { + setError(true) + console.error('couldn\'t copy') + }) + .finally(() => { + setShowCopiedTooltip(true) + setTimeout(() => { + setShowCopiedTooltip(false) + }, 2000) + }) }, []) useEffect(() => { @@ -46,17 +51,17 @@ export const CopyOverlay: React.FC = ({ content, clickComponen }, [clickComponent, copyToClipboard, content]) return ( - - {(props) => ( - - - + + { (props) => ( + + + - - + + - )} + ) } ) } diff --git a/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx b/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx index 99745ca9e..6bfc27cf8 100644 --- a/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx +++ b/src/components/common/copyable/copy-to-clipboard-button/copy-to-clipboard-button.tsx @@ -15,25 +15,25 @@ export interface CopyToClipboardButtonProps { content: string size?: 'sm' | 'lg' variant?: Variant - "data-cy"?: string + 'data-cy'?: string } export const CopyToClipboardButton: React.FC = ({ - content, - size = 'sm', - variant = 'dark', - ...props - }) => { + content, + size = 'sm', + variant = 'dark', + ...props +}) => { const { t } = useTranslation() const button = useRef(null) return ( - - + ) } diff --git a/src/components/common/copyable/copyable-field/copyable-field.tsx b/src/components/common/copyable/copyable-field/copyable-field.tsx index 76c6fd27b..74bc3dd96 100644 --- a/src/components/common/copyable/copyable-field/copyable-field.tsx +++ b/src/components/common/copyable/copyable-field/copyable-field.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { Fragment, useCallback, useRef } from 'react' import { Button, FormControl, InputGroup } from 'react-bootstrap' @@ -25,9 +25,10 @@ export const CopyableField: React.FC = ({ content, nativeSha navigator.share({ text: content, url: url - }).catch(err => { - console.error('Native sharing failed: ', err) }) + .catch(err => { + console.error('Native sharing failed: ', err) + }) }, [content, url]) const sharingSupported = typeof navigator.share === 'function' @@ -35,21 +36,21 @@ export const CopyableField: React.FC = ({ content, nativeSha return ( - + - - + - - + ) } diff --git a/src/components/common/fork-awesome/fork-awesome-icon.tsx b/src/components/common/fork-awesome/fork-awesome-icon.tsx index ceb1e8f36..4b7c5ab7d 100644 --- a/src/components/common/fork-awesome/fork-awesome-icon.tsx +++ b/src/components/common/fork-awesome/fork-awesome-icon.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { IconName, IconSize } from './types' @@ -17,10 +17,10 @@ export interface ForkAwesomeIconProps { export const ForkAwesomeIcon: React.FC = ({ icon, fixedWidth = false, size, className, stacked = false }) => { const fixedWithClass = fixedWidth ? 'fa-fw' : '' - const sizeClass = size ? `-${size}` : (stacked ? '-1x' : '') + const sizeClass = size ? `-${ size }` : (stacked ? '-1x' : '') const stackClass = stacked ? '-stack' : '' - const extraClasses = `${className ?? ''} ${sizeClass || stackClass ? `fa${stackClass}${sizeClass}` : ''}` + const extraClasses = `${ className ?? '' } ${ sizeClass || stackClass ? `fa${ stackClass }${ sizeClass }` : '' }` return ( - + ) } diff --git a/src/components/common/fork-awesome/fork-awesome-stack.tsx b/src/components/common/fork-awesome/fork-awesome-stack.tsx index 9da49c4a4..f19408ef2 100644 --- a/src/components/common/fork-awesome/fork-awesome-stack.tsx +++ b/src/components/common/fork-awesome/fork-awesome-stack.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { ReactElement } from 'react' import { ForkAwesomeIcon, ForkAwesomeIconProps } from './fork-awesome-icon' @@ -15,13 +15,13 @@ export interface ForkAwesomeStackProps { export const ForkAwesomeStack: React.FC = ({ size, children }) => { return ( - + { React.Children.map(children, (child) => { if (!React.isValidElement(child)) { return null } - return + return }) } diff --git a/src/components/common/fork-awesome/types.d.ts b/src/components/common/fork-awesome/types.d.ts index 71b52257c..37d52523e 100644 --- a/src/components/common/fork-awesome/types.d.ts +++ b/src/components/common/fork-awesome/types.d.ts @@ -4,5 +4,123 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export type IconName = '500px'|'activitypub'|'address-book-o'|'address-book'|'address-card-o'|'address-card'|'adjust'|'adn'|'align-center'|'align-justify'|'align-left'|'align-right'|'amazon'|'ambulance'|'american-sign-language-interpreting'|'anchor'|'android'|'angellist'|'angle-double-down'|'angle-double-left'|'angle-double-right'|'angle-double-up'|'angle-down'|'angle-left'|'angle-right'|'angle-up'|'apple'|'archive-org'|'archive'|'archlinux'|'area-chart'|'arrow-circle-down'|'arrow-circle-left'|'arrow-circle-o-down'|'arrow-circle-o-left'|'arrow-circle-o-right'|'arrow-circle-o-up'|'arrow-circle-right'|'arrow-circle-up'|'arrow-down'|'arrow-left'|'arrow-right'|'arrows-alt'|'arrows-h'|'arrows'|'arrows-v'|'arrow-up'|'artstation'|'assistive-listening-systems'|'asterisk'|'at'|'att'|'audio-description'|'backward'|'balance-scale'|'bandcamp'|'ban'|'bar-chart'|'barcode'|'bars'|'bath'|'battery-empty'|'battery-full'|'battery-half'|'battery-quarter'|'battery-three-quarters'|'bed'|'beer'|'behance-square'|'behance'|'bell-o'|'bell-rigning-o'|'bell-ringing'|'bell-slash-o'|'bell-slash'|'bell'|'bicycle'|'binoculars'|'biometric'|'birthday-cake'|'bitbucket-square'|'bitbucket'|'black-tie'|'blind'|'bluetooth-b'|'bluetooth'|'bold'|'bolt'|'bomb'|'bookmark-o'|'bookmark'|'book'|'bootstrap'|'braille'|'briefcase'|'btc'|'bug'|'building-o'|'building'|'bullhorn'|'bullseye'|'bus'|'buysellads'|'calculator'|'calendar-check-o'|'calendar-minus-o'|'calendar-o'|'calendar-plus-o'|'calendar'|'calendar-times-o'|'camera-retro'|'camera'|'caret-down'|'caret-left'|'caret-right'|'caret-square-o-down'|'caret-square-o-left'|'caret-square-o-right'|'caret-square-o-up'|'caret-up'|'car'|'cart-arrow-down'|'cart-plus'|'cc-amex'|'cc-diners-club'|'cc-discover'|'cc-jcb'|'cc-mastercard'|'cc-paypal'|'cc-stripe'|'cc'|'cc-visa'|'certificate'|'chain-broken'|'check-circle-o'|'check-circle'|'check-square-o'|'check-square'|'check'|'chevron-circle-down'|'chevron-circle-left'|'chevron-circle-right'|'chevron-circle-up'|'chevron-down'|'chevron-left'|'chevron-right'|'chevron-up'|'child'|'chrome'|'circle-o-notch'|'circle-o'|'circle'|'circle-thin'|'classicpress-circle'|'classicpress'|'clipboard'|'clock-o'|'clone'|'cloud-download'|'cloud'|'cloud-upload'|'code-fork'|'codepen'|'code'|'codiepie'|'coffee'|'cogs'|'cog'|'columns'|'commenting-o'|'commenting'|'comment-o'|'comments-o'|'comments'|'comment'|'compass'|'compress'|'connectdevelop'|'contao'|'copyright'|'creative-commons'|'credit-card-alt'|'credit-card'|'crop'|'crosshairs'|'css3'|'c'|'cubes'|'cube'|'cutlery'|'dashcube'|'database'|'deaf'|'debian'|'delicious'|'desktop'|'deviantart'|'dev-to'|'diamond'|'diaspora'|'digg'|'digitalocean'|'discord-alt'|'discord'|'dogmazic'|'dot-circle-o'|'download'|'dribbble'|'dropbox'|'drupal'|'edge'|'eercast'|'eject'|'ellipsis-h'|'ellipsis-v'|'emby'|'empire'|'envelope-open-o'|'envelope-open'|'envelope-o'|'envelope-square'|'envelope'|'envira'|'eraser'|'ethereum'|'etsy'|'eur'|'exchange'|'exclamation-circle'|'exclamation'|'exclamation-triangle'|'expand'|'expeditedssl'|'external-link-square'|'external-link'|'eyedropper'|'eye-slash'|'eye'|'facebook-messenger'|'facebook-official'|'facebook-square'|'facebook'|'fast-backward'|'fast-forward'|'fax'|'f-droid'|'female'|'ffmpeg'|'fighter-jet'|'file-archive-o'|'file-audio-o'|'file-code-o'|'file-epub'|'file-excel-o'|'file-image-o'|'file-o'|'file-pdf-o'|'file-powerpoint-o'|'files-o'|'file'|'file-text-o'|'file-text'|'file-video-o'|'file-word-o'|'film'|'filter'|'fire-extinguisher'|'firefox'|'fire'|'first-order'|'flag-checkered'|'flag-o'|'flag'|'flask'|'flickr'|'floppy-o'|'folder-open-o'|'folder-open'|'folder-o'|'folder'|'font-awesome'|'fonticons'|'font'|'fork-awesome'|'fort-awesome'|'forumbee'|'forward'|'foursquare'|'free-code-camp'|'freedombox'|'friendica'|'frown-o'|'funkwhale'|'futbol-o'|'gamepad'|'gavel'|'gbp'|'genderless'|'get-pocket'|'gg-circle'|'gg'|'gift'|'gimp'|'gitea'|'github-alt'|'github-square'|'github'|'gitlab'|'git-square'|'git'|'glass'|'glide-g'|'glide'|'globe-e'|'globe'|'globe-w'|'gnupg'|'gnu-social'|'google-plus-official'|'google-plus-square'|'google-plus'|'google'|'google-wallet'|'graduation-cap'|'gratipay'|'grav'|'hackaday'|'hacker-news'|'hackster'|'hal'|'hand-lizard-o'|'hand-o-down'|'hand-o-left'|'hand-o-right'|'hand-o-up'|'hand-paper-o'|'hand-peace-o'|'hand-pointer-o'|'hand-rock-o'|'hand-scissors-o'|'handshake-o'|'hand-spock-o'|'hashnode'|'hashtag'|'hdd-o'|'header'|'headphones'|'heartbeat'|'heart-o'|'heart'|'history'|'home'|'hospital-o'|'hourglass-end'|'hourglass-half'|'hourglass-o'|'hourglass-start'|'hourglass'|'houzz'|'h-square'|'html5'|'hubzilla'|'i-cursor'|'id-badge'|'id-card-o'|'id-card'|'ils'|'imdb'|'inbox'|'indent'|'industry'|'info-circle'|'info'|'inkscape'|'inr'|'instagram'|'internet-explorer'|'ioxhost'|'italic'|'jirafeau'|'joomla'|'joplin'|'jpy'|'jsfiddle'|'julia'|'jupyter'|'keybase'|'keyboard-o'|'key-modern'|'key'|'krw'|'language'|'laptop'|'laravel'|'lastfm-square'|'lastfm'|'leaf'|'leanpub'|'lemon-o'|'level-down'|'level-up'|'liberapay-square'|'liberapay'|'life-ring'|'lightbulb-o'|'line-chart'|'linkedin-square'|'linkedin'|'link'|'linode'|'linux'|'list-alt'|'list-ol'|'list'|'list-ul'|'location-arrow'|'lock'|'long-arrow-down'|'long-arrow-left'|'long-arrow-right'|'long-arrow-up'|'low-vision'|'magic'|'magnet'|'male'|'map-marker'|'map-o'|'map-pin'|'map-signs'|'map'|'mars-double'|'mars-stroke-h'|'mars-stroke'|'mars-stroke-v'|'mars'|'mastodon-alt'|'mastodon-square'|'mastodon'|'matrix-org'|'maxcdn'|'meanpath'|'medium-square'|'medium'|'medkit'|'meetup'|'meh-o'|'mercury'|'microchip'|'microphone-slash'|'microphone'|'minus-circle'|'minus-square-o'|'minus-square'|'minus'|'mixcloud'|'mobile'|'modx'|'money'|'moon-o'|'moon'|'motorcycle'|'mouse-pointer'|'music'|'neuter'|'newspaper-o'|'nextcloud-square'|'nextcloud'|'nodejs'|'object-group'|'object-ungroup'|'odnoklassniki-square'|'odnoklassniki'|'opencart'|'open-collective'|'openid'|'opera'|'optin-monster'|'orcid'|'outdent'|'pagelines'|'paint-brush'|'paperclip'|'paper-plane-o'|'paper-plane'|'paragraph'|'patreon'|'pause-circle-o'|'pause-circle'|'pause'|'paw'|'paypal'|'peertube'|'pencil-square-o'|'pencil-square'|'pencil'|'percent'|'phone-square'|'phone'|'php'|'picture-o'|'pie-chart'|'pinterest-p'|'pinterest-square'|'pinterest'|'pixelfed'|'plane'|'play-circle-o'|'play-circle'|'play'|'pleroma'|'plug'|'plus-circle'|'plus-square-o'|'plus-square'|'plus'|'podcast'|'power-off'|'print'|'product-hunt'|'puzzle-piece'|'python'|'qq'|'qrcode'|'question-circle-o'|'question-circle'|'question'|'quora'|'quote-left'|'quote-right'|'random'|'ravelry'|'react'|'rebel'|'recycle'|'reddit-alien'|'reddit-square'|'reddit'|'refresh'|'registered'|'renren'|'repeat'|'reply-all'|'reply'|'researchgate'|'retweet'|'road'|'rocket'|'rss-square'|'rss'|'rub'|'safari'|'scissors'|'scribd'|'scuttlebutt'|'search-minus'|'search-plus'|'search'|'sellsy'|'server'|'shaarli-o'|'shaarli'|'share-alt-square'|'share-alt'|'share-square-o'|'share-square'|'share'|'shield'|'ship'|'shirtsinbulk'|'shopping-bag'|'shopping-basket'|'shopping-cart'|'shower'|'signalapp'|'signal'|'sign-in'|'sign-language'|'sign-out'|'simplybuilt'|'sitemap'|'skyatlas'|'skype'|'slack'|'sliders'|'slideshare'|'smile-o'|'snapchat-ghost'|'snapchat-square'|'snapchat'|'snowdrift'|'snowflake-o'|'social-home'|'sort-alpha-asc'|'sort-alpha-desc'|'sort-amount-asc'|'sort-amount-desc'|'sort-asc'|'sort-desc'|'sort-numeric-asc'|'sort-numeric-desc'|'sort'|'soundcloud'|'space-shuttle'|'spell-check'|'spinner'|'spoon'|'spotify'|'square-o'|'square'|'stack-exchange'|'stack-overflow'|'star-half-o'|'star-half'|'star-o'|'star'|'steam-square'|'steam'|'step-backward'|'step-forward'|'stethoscope'|'sticky-note-o'|'sticky-note'|'stop-circle-o'|'stop-circle'|'stop'|'street-view'|'strikethrough'|'stumbleupon-circle'|'stumbleupon'|'subscript'|'subway'|'suitcase'|'sun-o'|'sun'|'superpowers'|'superscript'|'syncthing'|'table'|'tablet'|'tachometer'|'tags'|'tag'|'tasks'|'taxi'|'telegram'|'television'|'tencent-weibo'|'terminal'|'text-height'|'text-width'|'themeisle'|'thermometer-empty'|'thermometer-full'|'thermometer-half'|'thermometer-quarter'|'thermometer-three-quarters'|'th-large'|'th-list'|'th'|'thumbs-down'|'thumbs-o-down'|'thumbs-o-up'|'thumbs-up'|'thumb-tack'|'ticket'|'times-circle-o'|'times-circle'|'times'|'tint'|'tipeee'|'toggle-off'|'toggle-on'|'tor-onion'|'trademark'|'train'|'transgender-alt'|'transgender'|'trash-o'|'trash'|'tree'|'trello'|'tripadvisor'|'trophy'|'truck'|'try'|'tty'|'tumblr-square'|'tumblr'|'twitch'|'twitter-square'|'twitter'|'umbrella'|'underline'|'undo'|'universal-access'|'university'|'unlock-alt'|'unlock'|'unslpash'|'upload'|'usb'|'usd'|'user-circle-o'|'user-circle'|'user-md'|'user-o'|'user-plus'|'user-secret'|'users'|'user'|'user-times'|'venus-double'|'venus-mars'|'venus'|'viacoin'|'viadeo-square'|'viadeo'|'video-camera'|'vimeo-square'|'vimeo'|'vine'|'vk'|'volume-control-phone'|'volume-down'|'volume-mute'|'volume-off'|'volume-up'|'weibo'|'weixin'|'whatsapp'|'wheelchair-alt'|'wheelchair'|'wifi'|'wikidata'|'wikipedia-w'|'window-close-o'|'window-close'|'window-maximize'|'window-minimize'|'window-restore'|'windows'|'wire'|'wordpress'|'wpbeginner'|'wpexplorer'|'wpforms'|'wrench'|'xing-square'|'xing'|'xmpp'|'yahoo'|'y-combinator'|'yelp'|'yoast'|'youtube-play'|'youtube-square'|'youtube'|'zotero' -export type IconSize = '2x'|'3x'|'4x'|'5x' +export type IconName = '500px' | 'activitypub' | 'address-book-o' | 'address-book' | 'address-card-o' | 'address-card' + | 'adjust' | 'adn' | 'align-center' | 'align-justify' | 'align-left' | 'align-right' | 'amazon' + | 'ambulance' | 'american-sign-language-interpreting' | 'anchor' | 'android' | 'angellist' + | 'angle-double-down' | 'angle-double-left' | 'angle-double-right' | 'angle-double-up' + | 'angle-down' | 'angle-left' | 'angle-right' | 'angle-up' | 'apple' | 'archive-org' | 'archive' + | 'archlinux' | 'area-chart' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-o-down' + | 'arrow-circle-o-left' | 'arrow-circle-o-right' | 'arrow-circle-o-up' | 'arrow-circle-right' + | 'arrow-circle-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'arrows-h' + | 'arrows' | 'arrows-v' | 'arrow-up' | 'artstation' | 'assistive-listening-systems' | 'asterisk' + | 'at' | 'att' | 'audio-description' | 'backward' | 'balance-scale' | 'bandcamp' | 'ban' + | 'bar-chart' | 'barcode' | 'bars' | 'bath' | 'battery-empty' | 'battery-full' | 'battery-half' + | 'battery-quarter' | 'battery-three-quarters' | 'bed' | 'beer' | 'behance-square' | 'behance' + | 'bell-o' | 'bell-rigning-o' | 'bell-ringing' | 'bell-slash-o' | 'bell-slash' | 'bell' + | 'bicycle' | 'binoculars' | 'biometric' | 'birthday-cake' | 'bitbucket-square' | 'bitbucket' + | 'black-tie' | 'blind' | 'bluetooth-b' | 'bluetooth' | 'bold' | 'bolt' | 'bomb' | 'bookmark-o' + | 'bookmark' | 'book' | 'bootstrap' | 'braille' | 'briefcase' | 'btc' | 'bug' | 'building-o' + | 'building' | 'bullhorn' | 'bullseye' | 'bus' | 'buysellads' | 'calculator' | 'calendar-check-o' + | 'calendar-minus-o' | 'calendar-o' | 'calendar-plus-o' | 'calendar' | 'calendar-times-o' + | 'camera-retro' | 'camera' | 'caret-down' | 'caret-left' | 'caret-right' | 'caret-square-o-down' + | 'caret-square-o-left' | 'caret-square-o-right' | 'caret-square-o-up' | 'caret-up' | 'car' + | 'cart-arrow-down' | 'cart-plus' | 'cc-amex' | 'cc-diners-club' | 'cc-discover' | 'cc-jcb' + | 'cc-mastercard' | 'cc-paypal' | 'cc-stripe' | 'cc' | 'cc-visa' | 'certificate' | 'chain-broken' + | 'check-circle-o' | 'check-circle' | 'check-square-o' | 'check-square' | 'check' + | 'chevron-circle-down' | 'chevron-circle-left' | 'chevron-circle-right' | 'chevron-circle-up' + | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'chevron-up' | 'child' | 'chrome' + | 'circle-o-notch' | 'circle-o' | 'circle' | 'circle-thin' | 'classicpress-circle' + | 'classicpress' | 'clipboard' | 'clock-o' | 'clone' | 'cloud-download' | 'cloud' + | 'cloud-upload' | 'code-fork' | 'codepen' | 'code' | 'codiepie' | 'coffee' | 'cogs' | 'cog' + | 'columns' | 'commenting-o' | 'commenting' | 'comment-o' | 'comments-o' | 'comments' | 'comment' + | 'compass' | 'compress' | 'connectdevelop' | 'contao' | 'copyright' | 'creative-commons' + | 'credit-card-alt' | 'credit-card' | 'crop' | 'crosshairs' | 'css3' | 'c' | 'cubes' | 'cube' + | 'cutlery' | 'dashcube' | 'database' | 'deaf' | 'debian' | 'delicious' | 'desktop' + | 'deviantart' | 'dev-to' | 'diamond' | 'diaspora' | 'digg' | 'digitalocean' | 'discord-alt' + | 'discord' | 'dogmazic' | 'dot-circle-o' | 'download' | 'dribbble' | 'dropbox' | 'drupal' + | 'edge' | 'eercast' | 'eject' | 'ellipsis-h' | 'ellipsis-v' | 'emby' | 'empire' + | 'envelope-open-o' | 'envelope-open' | 'envelope-o' | 'envelope-square' | 'envelope' | 'envira' + | 'eraser' | 'ethereum' | 'etsy' | 'eur' | 'exchange' | 'exclamation-circle' | 'exclamation' + | 'exclamation-triangle' | 'expand' | 'expeditedssl' | 'external-link-square' | 'external-link' + | 'eyedropper' | 'eye-slash' | 'eye' | 'facebook-messenger' | 'facebook-official' + | 'facebook-square' | 'facebook' | 'fast-backward' | 'fast-forward' | 'fax' | 'f-droid' + | 'female' | 'ffmpeg' | 'fighter-jet' | 'file-archive-o' | 'file-audio-o' | 'file-code-o' + | 'file-epub' | 'file-excel-o' | 'file-image-o' | 'file-o' | 'file-pdf-o' | 'file-powerpoint-o' + | 'files-o' | 'file' | 'file-text-o' | 'file-text' | 'file-video-o' | 'file-word-o' | 'film' + | 'filter' | 'fire-extinguisher' | 'firefox' | 'fire' | 'first-order' | 'flag-checkered' + | 'flag-o' | 'flag' | 'flask' | 'flickr' | 'floppy-o' | 'folder-open-o' | 'folder-open' + | 'folder-o' | 'folder' | 'font-awesome' | 'fonticons' | 'font' | 'fork-awesome' | 'fort-awesome' + | 'forumbee' | 'forward' | 'foursquare' | 'free-code-camp' | 'freedombox' | 'friendica' + | 'frown-o' | 'funkwhale' | 'futbol-o' | 'gamepad' | 'gavel' | 'gbp' | 'genderless' + | 'get-pocket' | 'gg-circle' | 'gg' | 'gift' | 'gimp' | 'gitea' | 'github-alt' | 'github-square' + | 'github' | 'gitlab' | 'git-square' | 'git' | 'glass' | 'glide-g' | 'glide' | 'globe-e' + | 'globe' | 'globe-w' | 'gnupg' | 'gnu-social' | 'google-plus-official' | 'google-plus-square' + | 'google-plus' | 'google' | 'google-wallet' | 'graduation-cap' | 'gratipay' | 'grav' + | 'hackaday' | 'hacker-news' | 'hackster' | 'hal' | 'hand-lizard-o' | 'hand-o-down' + | 'hand-o-left' | 'hand-o-right' | 'hand-o-up' | 'hand-paper-o' | 'hand-peace-o' + | 'hand-pointer-o' | 'hand-rock-o' | 'hand-scissors-o' | 'handshake-o' | 'hand-spock-o' + | 'hashnode' | 'hashtag' | 'hdd-o' | 'header' | 'headphones' | 'heartbeat' | 'heart-o' | 'heart' + | 'history' | 'home' | 'hospital-o' | 'hourglass-end' | 'hourglass-half' | 'hourglass-o' + | 'hourglass-start' | 'hourglass' | 'houzz' | 'h-square' | 'html5' | 'hubzilla' | 'i-cursor' + | 'id-badge' | 'id-card-o' | 'id-card' | 'ils' | 'imdb' | 'inbox' | 'indent' | 'industry' + | 'info-circle' | 'info' | 'inkscape' | 'inr' | 'instagram' | 'internet-explorer' | 'ioxhost' + | 'italic' | 'jirafeau' | 'joomla' | 'joplin' | 'jpy' | 'jsfiddle' | 'julia' | 'jupyter' + | 'keybase' | 'keyboard-o' | 'key-modern' | 'key' | 'krw' | 'language' | 'laptop' | 'laravel' + | 'lastfm-square' | 'lastfm' | 'leaf' | 'leanpub' | 'lemon-o' | 'level-down' | 'level-up' + | 'liberapay-square' | 'liberapay' | 'life-ring' | 'lightbulb-o' | 'line-chart' + | 'linkedin-square' | 'linkedin' | 'link' | 'linode' | 'linux' | 'list-alt' | 'list-ol' | 'list' + | 'list-ul' | 'location-arrow' | 'lock' | 'long-arrow-down' | 'long-arrow-left' + | 'long-arrow-right' | 'long-arrow-up' | 'low-vision' | 'magic' | 'magnet' | 'male' + | 'map-marker' | 'map-o' | 'map-pin' | 'map-signs' | 'map' | 'mars-double' | 'mars-stroke-h' + | 'mars-stroke' | 'mars-stroke-v' | 'mars' | 'mastodon-alt' | 'mastodon-square' | 'mastodon' + | 'matrix-org' | 'maxcdn' | 'meanpath' | 'medium-square' | 'medium' | 'medkit' | 'meetup' + | 'meh-o' | 'mercury' | 'microchip' | 'microphone-slash' | 'microphone' | 'minus-circle' + | 'minus-square-o' | 'minus-square' | 'minus' | 'mixcloud' | 'mobile' | 'modx' | 'money' + | 'moon-o' | 'moon' | 'motorcycle' | 'mouse-pointer' | 'music' | 'neuter' | 'newspaper-o' + | 'nextcloud-square' | 'nextcloud' | 'nodejs' | 'object-group' | 'object-ungroup' + | 'odnoklassniki-square' | 'odnoklassniki' | 'opencart' | 'open-collective' | 'openid' | 'opera' + | 'optin-monster' | 'orcid' | 'outdent' | 'pagelines' | 'paint-brush' | 'paperclip' + | 'paper-plane-o' | 'paper-plane' | 'paragraph' | 'patreon' | 'pause-circle-o' | 'pause-circle' + | 'pause' | 'paw' | 'paypal' | 'peertube' | 'pencil-square-o' | 'pencil-square' | 'pencil' + | 'percent' | 'phone-square' | 'phone' | 'php' | 'picture-o' | 'pie-chart' | 'pinterest-p' + | 'pinterest-square' | 'pinterest' | 'pixelfed' | 'plane' | 'play-circle-o' | 'play-circle' + | 'play' | 'pleroma' | 'plug' | 'plus-circle' | 'plus-square-o' | 'plus-square' | 'plus' + | 'podcast' | 'power-off' | 'print' | 'product-hunt' | 'puzzle-piece' | 'python' | 'qq' + | 'qrcode' | 'question-circle-o' | 'question-circle' | 'question' | 'quora' | 'quote-left' + | 'quote-right' | 'random' | 'ravelry' | 'react' | 'rebel' | 'recycle' | 'reddit-alien' + | 'reddit-square' | 'reddit' | 'refresh' | 'registered' | 'renren' | 'repeat' | 'reply-all' + | 'reply' | 'researchgate' | 'retweet' | 'road' | 'rocket' | 'rss-square' | 'rss' | 'rub' + | 'safari' | 'scissors' | 'scribd' | 'scuttlebutt' | 'search-minus' | 'search-plus' | 'search' + | 'sellsy' | 'server' | 'shaarli-o' | 'shaarli' | 'share-alt-square' | 'share-alt' + | 'share-square-o' | 'share-square' | 'share' | 'shield' | 'ship' | 'shirtsinbulk' + | 'shopping-bag' | 'shopping-basket' | 'shopping-cart' | 'shower' | 'signalapp' | 'signal' + | 'sign-in' | 'sign-language' | 'sign-out' | 'simplybuilt' | 'sitemap' | 'skyatlas' | 'skype' + | 'slack' | 'sliders' | 'slideshare' | 'smile-o' | 'snapchat-ghost' | 'snapchat-square' + | 'snapchat' | 'snowdrift' | 'snowflake-o' | 'social-home' | 'sort-alpha-asc' | 'sort-alpha-desc' + | 'sort-amount-asc' | 'sort-amount-desc' | 'sort-asc' | 'sort-desc' | 'sort-numeric-asc' + | 'sort-numeric-desc' | 'sort' | 'soundcloud' | 'space-shuttle' | 'spell-check' | 'spinner' + | 'spoon' | 'spotify' | 'square-o' | 'square' | 'stack-exchange' | 'stack-overflow' + | 'star-half-o' | 'star-half' | 'star-o' | 'star' | 'steam-square' | 'steam' | 'step-backward' + | 'step-forward' | 'stethoscope' | 'sticky-note-o' | 'sticky-note' | 'stop-circle-o' + | 'stop-circle' | 'stop' | 'street-view' | 'strikethrough' | 'stumbleupon-circle' | 'stumbleupon' + | 'subscript' | 'subway' | 'suitcase' | 'sun-o' | 'sun' | 'superpowers' | 'superscript' + | 'syncthing' | 'table' | 'tablet' | 'tachometer' | 'tags' | 'tag' | 'tasks' | 'taxi' + | 'telegram' | 'television' | 'tencent-weibo' | 'terminal' | 'text-height' | 'text-width' + | 'themeisle' | 'thermometer-empty' | 'thermometer-full' | 'thermometer-half' + | 'thermometer-quarter' | 'thermometer-three-quarters' | 'th-large' | 'th-list' | 'th' + | 'thumbs-down' | 'thumbs-o-down' | 'thumbs-o-up' | 'thumbs-up' | 'thumb-tack' | 'ticket' + | 'times-circle-o' | 'times-circle' | 'times' | 'tint' | 'tipeee' | 'toggle-off' | 'toggle-on' + | 'tor-onion' | 'trademark' | 'train' | 'transgender-alt' | 'transgender' | 'trash-o' | 'trash' + | 'tree' | 'trello' | 'tripadvisor' | 'trophy' | 'truck' | 'try' | 'tty' | 'tumblr-square' + | 'tumblr' | 'twitch' | 'twitter-square' | 'twitter' | 'umbrella' | 'underline' | 'undo' + | 'universal-access' | 'university' | 'unlock-alt' | 'unlock' | 'unslpash' | 'upload' | 'usb' + | 'usd' | 'user-circle-o' | 'user-circle' | 'user-md' | 'user-o' | 'user-plus' | 'user-secret' + | 'users' | 'user' | 'user-times' | 'venus-double' | 'venus-mars' | 'venus' | 'viacoin' + | 'viadeo-square' | 'viadeo' | 'video-camera' | 'vimeo-square' | 'vimeo' | 'vine' | 'vk' + | 'volume-control-phone' | 'volume-down' | 'volume-mute' | 'volume-off' | 'volume-up' | 'weibo' + | 'weixin' | 'whatsapp' | 'wheelchair-alt' | 'wheelchair' | 'wifi' | 'wikidata' | 'wikipedia-w' + | 'window-close-o' | 'window-close' | 'window-maximize' | 'window-minimize' | 'window-restore' + | 'windows' | 'wire' | 'wordpress' | 'wpbeginner' | 'wpexplorer' | 'wpforms' | 'wrench' + | 'xing-square' | 'xing' | 'xmpp' | 'yahoo' | 'y-combinator' | 'yelp' | 'yoast' | 'youtube-play' + | 'youtube-square' | 'youtube' | 'zotero' +export type IconSize = '2x' | '3x' | '4x' | '5x' diff --git a/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx b/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx index 7eaea2153..b254e6175 100644 --- a/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx +++ b/src/components/common/hedge-doc-logo/hedge-doc-logo-with-text.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { ReactComponent as LogoBwHorizontal } from './logo_text_bw_horizontal.svg' @@ -12,7 +12,7 @@ import { ReactComponent as LogoWbHorizontal } from './logo_text_wb_horizontal.sv export enum HedgeDocLogoSize { SMALL = 32, MEDIUM = 64, - BIG= 256 + BIG = 256 } export interface HedgeDocLogoProps { @@ -29,11 +29,11 @@ export enum HedgeDocLogoType { export const HedgeDocLogoWithText: React.FC = ({ size = HedgeDocLogoSize.MEDIUM, logoType }) => { switch (logoType) { case HedgeDocLogoType.COLOR_VERTICAL: - return + return case HedgeDocLogoType.BW_HORIZONTAL: - return + return case HedgeDocLogoType.WB_HORIZONTAL: - return + return default: return null } diff --git a/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx b/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx index 242fd69e3..b5456f517 100644 --- a/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx +++ b/src/components/common/hedge-doc-logo/hedge-doc-logo.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { ReactComponent as LogoColor } from './logo_color.svg' @@ -18,5 +18,5 @@ export interface HedgeDocLogoProps { } export const HedgeDocLogo: React.FC = ({ size = HedgeDocLogoSize.MEDIUM }) => { - return + return } diff --git a/src/components/common/hedge-doc-logo/logo_color.svg b/src/components/common/hedge-doc-logo/logo_color.svg index fc3ffd3a9..a2940efdd 100644 --- a/src/components/common/hedge-doc-logo/logo_color.svg +++ b/src/components/common/hedge-doc-logo/logo_color.svg @@ -1 +1,29 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/src/components/common/hedge-doc-logo/logo_text_bw_horizontal.svg b/src/components/common/hedge-doc-logo/logo_text_bw_horizontal.svg index 8721be9e6..112f8ecd7 100644 --- a/src/components/common/hedge-doc-logo/logo_text_bw_horizontal.svg +++ b/src/components/common/hedge-doc-logo/logo_text_bw_horizontal.svg @@ -1 +1,21 @@ - + + + + + + + + + + + + diff --git a/src/components/common/hedge-doc-logo/logo_text_color_vertical.svg b/src/components/common/hedge-doc-logo/logo_text_color_vertical.svg index cd5f80101..ea6744847 100644 --- a/src/components/common/hedge-doc-logo/logo_text_color_vertical.svg +++ b/src/components/common/hedge-doc-logo/logo_text_color_vertical.svg @@ -1 +1,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/common/hedge-doc-logo/logo_text_wb_horizontal.svg b/src/components/common/hedge-doc-logo/logo_text_wb_horizontal.svg index 9c4500009..67c154e91 100644 --- a/src/components/common/hedge-doc-logo/logo_text_wb_horizontal.svg +++ b/src/components/common/hedge-doc-logo/logo_text_wb_horizontal.svg @@ -1 +1,24 @@ - + + + + + + + + + + + + + + diff --git a/src/components/common/hljs/hljs.ts b/src/components/common/hljs/hljs.ts index 2d01729de..9a62f3c51 100644 --- a/src/components/common/hljs/hljs.ts +++ b/src/components/common/hljs/hljs.ts @@ -1,9 +1,9 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ -import hljs from 'highlight.js/lib/core'; + SPDX-License-Identifier: AGPL-3.0-only + */ +import hljs from 'highlight.js/lib/core' import abnf from 'highlight.js/lib/languages/abnf' import accesslog from 'highlight.js/lib/languages/accesslog' import actionscript from 'highlight.js/lib/languages/actionscript' @@ -194,196 +194,196 @@ import xl from 'highlight.js/lib/languages/xl' import xquery from 'highlight.js/lib/languages/xquery' import zephir from 'highlight.js/lib/languages/zephir' -hljs.registerLanguage('abnf', abnf); -hljs.registerLanguage('accesslog', accesslog); -hljs.registerLanguage('actionscript', actionscript); -hljs.registerLanguage('ada', ada); -hljs.registerLanguage('angelscript', angelscript); -hljs.registerLanguage('apache', apache); -hljs.registerLanguage('applescript', applescript); -hljs.registerLanguage('arcade', arcade); -hljs.registerLanguage('arduino', arduino); -hljs.registerLanguage('armasm', armasm); -hljs.registerLanguage('xml', xml); -hljs.registerLanguage('asciidoc', asciidoc); -hljs.registerLanguage('aspectj', aspectj); -hljs.registerLanguage('autohotkey', autohotkey); -hljs.registerLanguage('autoit', autoit); -hljs.registerLanguage('avrasm', avrasm); -hljs.registerLanguage('awk', awk); -hljs.registerLanguage('axapta', axapta); -hljs.registerLanguage('bash', bash); -hljs.registerLanguage('basic', basic); -hljs.registerLanguage('bnf', bnf); -hljs.registerLanguage('brainfuck', brainfuck); -hljs.registerLanguage('c-like', c_like); -hljs.registerLanguage('c', c); -hljs.registerLanguage('cal', cal); -hljs.registerLanguage('capnproto', capnproto); -hljs.registerLanguage('ceylon', ceylon); -hljs.registerLanguage('clean', clean); -hljs.registerLanguage('clojure', clojure); -hljs.registerLanguage('clojure-repl', clojure_repl); -hljs.registerLanguage('cmake', cmake); -hljs.registerLanguage('coffeescript', coffeescript); -hljs.registerLanguage('coq', coq); -hljs.registerLanguage('cos', cos); -hljs.registerLanguage('cpp', cpp); -hljs.registerLanguage('crmsh', crmsh); -hljs.registerLanguage('crystal', crystal); -hljs.registerLanguage('csharp', csharp); -hljs.registerLanguage('csp', csp); -hljs.registerLanguage('css', css); -hljs.registerLanguage('d', d); -hljs.registerLanguage('markdown', markdown); -hljs.registerLanguage('dart', dart); -hljs.registerLanguage('delphi', delphi); -hljs.registerLanguage('diff', diff); -hljs.registerLanguage('django', django); -hljs.registerLanguage('dns', dns); -hljs.registerLanguage('dockerfile', dockerfile); -hljs.registerLanguage('dos', dos); -hljs.registerLanguage('dsconfig', dsconfig); -hljs.registerLanguage('dts', dts); -hljs.registerLanguage('dust', dust); -hljs.registerLanguage('ebnf', ebnf); -hljs.registerLanguage('elixir', elixir); -hljs.registerLanguage('elm', elm); -hljs.registerLanguage('ruby', ruby); -hljs.registerLanguage('erb', erb); -hljs.registerLanguage('erlang-repl', erlang_repl); -hljs.registerLanguage('erlang', erlang); -hljs.registerLanguage('excel', excel); -hljs.registerLanguage('fix', fix); -hljs.registerLanguage('flix', flix); -hljs.registerLanguage('fortran', fortran); -hljs.registerLanguage('fsharp', fsharp); -hljs.registerLanguage('gams', gams); -hljs.registerLanguage('gauss', gauss); -hljs.registerLanguage('gcode', gcode); -hljs.registerLanguage('gherkin', gherkin); -hljs.registerLanguage('glsl', glsl); -hljs.registerLanguage('gml', gml); -hljs.registerLanguage('go', go); -hljs.registerLanguage('golo', golo); -hljs.registerLanguage('gradle', gradle); -hljs.registerLanguage('groovy', groovy); -hljs.registerLanguage('haml', haml); -hljs.registerLanguage('handlebars', handlebars); -hljs.registerLanguage('haskell', haskell); -hljs.registerLanguage('haxe', haxe); -hljs.registerLanguage('hsp', hsp); -hljs.registerLanguage('html', xml); -hljs.registerLanguage('htmlbars', htmlbars); -hljs.registerLanguage('http', http); -hljs.registerLanguage('hy', hy); -hljs.registerLanguage('inform7', inform7); -hljs.registerLanguage('ini', ini); -hljs.registerLanguage('irpf90', irpf90); -hljs.registerLanguage('isbl', isbl); -hljs.registerLanguage('java', java); -hljs.registerLanguage('javascript', javascript); -hljs.registerLanguage('jboss-cli', jboss_cli); -hljs.registerLanguage('js', javascript); -hljs.registerLanguage('json', json); -hljs.registerLanguage('julia', julia); -hljs.registerLanguage('julia-repl', julia_repl); -hljs.registerLanguage('kotlin', kotlin); -hljs.registerLanguage('lasso', lasso); -hljs.registerLanguage('latex', latex); -hljs.registerLanguage('ldif', ldif); -hljs.registerLanguage('leaf', leaf); -hljs.registerLanguage('less', less); -hljs.registerLanguage('lisp', lisp); -hljs.registerLanguage('livecodeserver', livecodeserver); -hljs.registerLanguage('livescript', livescript); -hljs.registerLanguage('llvm', llvm); -hljs.registerLanguage('lsl', lsl); -hljs.registerLanguage('lua', lua); -hljs.registerLanguage('makefile', makefile); -hljs.registerLanguage('mathematica', mathematica); -hljs.registerLanguage('matlab', matlab); -hljs.registerLanguage('maxima', maxima); -hljs.registerLanguage('mel', mel); -hljs.registerLanguage('mercury', mercury); -hljs.registerLanguage('mipsasm', mipsasm); -hljs.registerLanguage('mizar', mizar); -hljs.registerLanguage('perl', perl); -hljs.registerLanguage('mojolicious', mojolicious); -hljs.registerLanguage('monkey', monkey); -hljs.registerLanguage('moonscript', moonscript); -hljs.registerLanguage('n1ql', n1ql); -hljs.registerLanguage('nginx', nginx); -hljs.registerLanguage('nim', nim); -hljs.registerLanguage('nix', nix); -hljs.registerLanguage('node-repl', node_repl); -hljs.registerLanguage('nsis', nsis); -hljs.registerLanguage('objectivec', objectivec); -hljs.registerLanguage('ocaml', ocaml); -hljs.registerLanguage('openscad', openscad); -hljs.registerLanguage('oxygene', oxygene); -hljs.registerLanguage('parser3', parser3); -hljs.registerLanguage('pf', pf); -hljs.registerLanguage('pgsql', pgsql); -hljs.registerLanguage('php', php); -hljs.registerLanguage('php-template', php_template); -hljs.registerLanguage('plaintext', plaintext); -hljs.registerLanguage('pony', pony); -hljs.registerLanguage('powershell', powershell); -hljs.registerLanguage('processing', processing); -hljs.registerLanguage('profile', profile); -hljs.registerLanguage('prolog', prolog); -hljs.registerLanguage('properties', properties); -hljs.registerLanguage('protobuf', protobuf); -hljs.registerLanguage('puppet', puppet); -hljs.registerLanguage('purebasic', purebasic); -hljs.registerLanguage('python', python); -hljs.registerLanguage('python-repl', python_repl); -hljs.registerLanguage('q', q); -hljs.registerLanguage('qml', qml); -hljs.registerLanguage('r', r); -hljs.registerLanguage('reasonml', reasonml); -hljs.registerLanguage('rib', rib); -hljs.registerLanguage('roboconf', roboconf); -hljs.registerLanguage('routeros', routeros); -hljs.registerLanguage('rsl', rsl); -hljs.registerLanguage('ruleslanguage', ruleslanguage); -hljs.registerLanguage('rust', rust); -hljs.registerLanguage('sas', sas); -hljs.registerLanguage('scala', scala); -hljs.registerLanguage('scheme', scheme); -hljs.registerLanguage('scilab', scilab); -hljs.registerLanguage('scss', scss); -hljs.registerLanguage('shell', shell); -hljs.registerLanguage('smali', smali); -hljs.registerLanguage('smalltalk', smalltalk); -hljs.registerLanguage('sml', sml); -hljs.registerLanguage('sqf', sqf); -hljs.registerLanguage('sql', sql); -hljs.registerLanguage('stan', stan); -hljs.registerLanguage('stata', stata); -hljs.registerLanguage('step21', step21); -hljs.registerLanguage('stylus', stylus); -hljs.registerLanguage('subunit', subunit); -hljs.registerLanguage('swift', swift); -hljs.registerLanguage('taggerscript', taggerscript); -hljs.registerLanguage('yaml', yaml); -hljs.registerLanguage('tap', tap); -hljs.registerLanguage('tcl', tcl); -hljs.registerLanguage('thrift', thrift); -hljs.registerLanguage('tp', tp); -hljs.registerLanguage('twig', twig); -hljs.registerLanguage('typescript', typescript); -hljs.registerLanguage('vala', vala); -hljs.registerLanguage('vbnet', vbnet); -hljs.registerLanguage('vbscript', vbscript); -hljs.registerLanguage('vbscript-html', vbscript_html); -hljs.registerLanguage('verilog', verilog); -hljs.registerLanguage('vhdl', vhdl); -hljs.registerLanguage('vim', vim); -hljs.registerLanguage('x86asm', x86asm); -hljs.registerLanguage('xl', xl); -hljs.registerLanguage('xquery', xquery); -hljs.registerLanguage('zephir', zephir); +hljs.registerLanguage('abnf', abnf) +hljs.registerLanguage('accesslog', accesslog) +hljs.registerLanguage('actionscript', actionscript) +hljs.registerLanguage('ada', ada) +hljs.registerLanguage('angelscript', angelscript) +hljs.registerLanguage('apache', apache) +hljs.registerLanguage('applescript', applescript) +hljs.registerLanguage('arcade', arcade) +hljs.registerLanguage('arduino', arduino) +hljs.registerLanguage('armasm', armasm) +hljs.registerLanguage('xml', xml) +hljs.registerLanguage('asciidoc', asciidoc) +hljs.registerLanguage('aspectj', aspectj) +hljs.registerLanguage('autohotkey', autohotkey) +hljs.registerLanguage('autoit', autoit) +hljs.registerLanguage('avrasm', avrasm) +hljs.registerLanguage('awk', awk) +hljs.registerLanguage('axapta', axapta) +hljs.registerLanguage('bash', bash) +hljs.registerLanguage('basic', basic) +hljs.registerLanguage('bnf', bnf) +hljs.registerLanguage('brainfuck', brainfuck) +hljs.registerLanguage('c-like', c_like) +hljs.registerLanguage('c', c) +hljs.registerLanguage('cal', cal) +hljs.registerLanguage('capnproto', capnproto) +hljs.registerLanguage('ceylon', ceylon) +hljs.registerLanguage('clean', clean) +hljs.registerLanguage('clojure', clojure) +hljs.registerLanguage('clojure-repl', clojure_repl) +hljs.registerLanguage('cmake', cmake) +hljs.registerLanguage('coffeescript', coffeescript) +hljs.registerLanguage('coq', coq) +hljs.registerLanguage('cos', cos) +hljs.registerLanguage('cpp', cpp) +hljs.registerLanguage('crmsh', crmsh) +hljs.registerLanguage('crystal', crystal) +hljs.registerLanguage('csharp', csharp) +hljs.registerLanguage('csp', csp) +hljs.registerLanguage('css', css) +hljs.registerLanguage('d', d) +hljs.registerLanguage('markdown', markdown) +hljs.registerLanguage('dart', dart) +hljs.registerLanguage('delphi', delphi) +hljs.registerLanguage('diff', diff) +hljs.registerLanguage('django', django) +hljs.registerLanguage('dns', dns) +hljs.registerLanguage('dockerfile', dockerfile) +hljs.registerLanguage('dos', dos) +hljs.registerLanguage('dsconfig', dsconfig) +hljs.registerLanguage('dts', dts) +hljs.registerLanguage('dust', dust) +hljs.registerLanguage('ebnf', ebnf) +hljs.registerLanguage('elixir', elixir) +hljs.registerLanguage('elm', elm) +hljs.registerLanguage('ruby', ruby) +hljs.registerLanguage('erb', erb) +hljs.registerLanguage('erlang-repl', erlang_repl) +hljs.registerLanguage('erlang', erlang) +hljs.registerLanguage('excel', excel) +hljs.registerLanguage('fix', fix) +hljs.registerLanguage('flix', flix) +hljs.registerLanguage('fortran', fortran) +hljs.registerLanguage('fsharp', fsharp) +hljs.registerLanguage('gams', gams) +hljs.registerLanguage('gauss', gauss) +hljs.registerLanguage('gcode', gcode) +hljs.registerLanguage('gherkin', gherkin) +hljs.registerLanguage('glsl', glsl) +hljs.registerLanguage('gml', gml) +hljs.registerLanguage('go', go) +hljs.registerLanguage('golo', golo) +hljs.registerLanguage('gradle', gradle) +hljs.registerLanguage('groovy', groovy) +hljs.registerLanguage('haml', haml) +hljs.registerLanguage('handlebars', handlebars) +hljs.registerLanguage('haskell', haskell) +hljs.registerLanguage('haxe', haxe) +hljs.registerLanguage('hsp', hsp) +hljs.registerLanguage('html', xml) +hljs.registerLanguage('htmlbars', htmlbars) +hljs.registerLanguage('http', http) +hljs.registerLanguage('hy', hy) +hljs.registerLanguage('inform7', inform7) +hljs.registerLanguage('ini', ini) +hljs.registerLanguage('irpf90', irpf90) +hljs.registerLanguage('isbl', isbl) +hljs.registerLanguage('java', java) +hljs.registerLanguage('javascript', javascript) +hljs.registerLanguage('jboss-cli', jboss_cli) +hljs.registerLanguage('js', javascript) +hljs.registerLanguage('json', json) +hljs.registerLanguage('julia', julia) +hljs.registerLanguage('julia-repl', julia_repl) +hljs.registerLanguage('kotlin', kotlin) +hljs.registerLanguage('lasso', lasso) +hljs.registerLanguage('latex', latex) +hljs.registerLanguage('ldif', ldif) +hljs.registerLanguage('leaf', leaf) +hljs.registerLanguage('less', less) +hljs.registerLanguage('lisp', lisp) +hljs.registerLanguage('livecodeserver', livecodeserver) +hljs.registerLanguage('livescript', livescript) +hljs.registerLanguage('llvm', llvm) +hljs.registerLanguage('lsl', lsl) +hljs.registerLanguage('lua', lua) +hljs.registerLanguage('makefile', makefile) +hljs.registerLanguage('mathematica', mathematica) +hljs.registerLanguage('matlab', matlab) +hljs.registerLanguage('maxima', maxima) +hljs.registerLanguage('mel', mel) +hljs.registerLanguage('mercury', mercury) +hljs.registerLanguage('mipsasm', mipsasm) +hljs.registerLanguage('mizar', mizar) +hljs.registerLanguage('perl', perl) +hljs.registerLanguage('mojolicious', mojolicious) +hljs.registerLanguage('monkey', monkey) +hljs.registerLanguage('moonscript', moonscript) +hljs.registerLanguage('n1ql', n1ql) +hljs.registerLanguage('nginx', nginx) +hljs.registerLanguage('nim', nim) +hljs.registerLanguage('nix', nix) +hljs.registerLanguage('node-repl', node_repl) +hljs.registerLanguage('nsis', nsis) +hljs.registerLanguage('objectivec', objectivec) +hljs.registerLanguage('ocaml', ocaml) +hljs.registerLanguage('openscad', openscad) +hljs.registerLanguage('oxygene', oxygene) +hljs.registerLanguage('parser3', parser3) +hljs.registerLanguage('pf', pf) +hljs.registerLanguage('pgsql', pgsql) +hljs.registerLanguage('php', php) +hljs.registerLanguage('php-template', php_template) +hljs.registerLanguage('plaintext', plaintext) +hljs.registerLanguage('pony', pony) +hljs.registerLanguage('powershell', powershell) +hljs.registerLanguage('processing', processing) +hljs.registerLanguage('profile', profile) +hljs.registerLanguage('prolog', prolog) +hljs.registerLanguage('properties', properties) +hljs.registerLanguage('protobuf', protobuf) +hljs.registerLanguage('puppet', puppet) +hljs.registerLanguage('purebasic', purebasic) +hljs.registerLanguage('python', python) +hljs.registerLanguage('python-repl', python_repl) +hljs.registerLanguage('q', q) +hljs.registerLanguage('qml', qml) +hljs.registerLanguage('r', r) +hljs.registerLanguage('reasonml', reasonml) +hljs.registerLanguage('rib', rib) +hljs.registerLanguage('roboconf', roboconf) +hljs.registerLanguage('routeros', routeros) +hljs.registerLanguage('rsl', rsl) +hljs.registerLanguage('ruleslanguage', ruleslanguage) +hljs.registerLanguage('rust', rust) +hljs.registerLanguage('sas', sas) +hljs.registerLanguage('scala', scala) +hljs.registerLanguage('scheme', scheme) +hljs.registerLanguage('scilab', scilab) +hljs.registerLanguage('scss', scss) +hljs.registerLanguage('shell', shell) +hljs.registerLanguage('smali', smali) +hljs.registerLanguage('smalltalk', smalltalk) +hljs.registerLanguage('sml', sml) +hljs.registerLanguage('sqf', sqf) +hljs.registerLanguage('sql', sql) +hljs.registerLanguage('stan', stan) +hljs.registerLanguage('stata', stata) +hljs.registerLanguage('step21', step21) +hljs.registerLanguage('stylus', stylus) +hljs.registerLanguage('subunit', subunit) +hljs.registerLanguage('swift', swift) +hljs.registerLanguage('taggerscript', taggerscript) +hljs.registerLanguage('yaml', yaml) +hljs.registerLanguage('tap', tap) +hljs.registerLanguage('tcl', tcl) +hljs.registerLanguage('thrift', thrift) +hljs.registerLanguage('tp', tp) +hljs.registerLanguage('twig', twig) +hljs.registerLanguage('typescript', typescript) +hljs.registerLanguage('vala', vala) +hljs.registerLanguage('vbnet', vbnet) +hljs.registerLanguage('vbscript', vbscript) +hljs.registerLanguage('vbscript-html', vbscript_html) +hljs.registerLanguage('verilog', verilog) +hljs.registerLanguage('vhdl', vhdl) +hljs.registerLanguage('vim', vim) +hljs.registerLanguage('x86asm', x86asm) +hljs.registerLanguage('xl', xl) +hljs.registerLanguage('xquery', xquery) +hljs.registerLanguage('zephir', zephir) -export default hljs; +export default hljs diff --git a/src/components/common/icon-button/icon-button.tsx b/src/components/common/icon-button/icon-button.tsx index 8d6075d51..e248d9ad9 100644 --- a/src/components/common/icon-button/icon-button.tsx +++ b/src/components/common/icon-button/icon-button.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Button, ButtonProps } from 'react-bootstrap' @@ -19,13 +19,14 @@ export interface IconButtonProps extends ButtonProps { export const IconButton: React.FC = ({ icon, children, border = false, ...props }) => { return ( - diff --git a/src/components/common/icon-button/translated-icon-button.tsx b/src/components/common/icon-button/translated-icon-button.tsx index c10af0fee..14972e28a 100644 --- a/src/components/common/icon-button/translated-icon-button.tsx +++ b/src/components/common/icon-button/translated-icon-button.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Trans } from 'react-i18next' @@ -14,8 +14,8 @@ export interface TranslatedIconButtonProps extends IconButtonProps { export const TranslatedIconButton: React.FC = ({ i18nKey, ...props }) => { return ( - - + + ) } diff --git a/src/components/common/links/external-link.tsx b/src/components/common/links/external-link.tsx index a46dd5fbe..1ac879fd3 100644 --- a/src/components/common/links/external-link.tsx +++ b/src/components/common/links/external-link.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon' @@ -12,18 +12,18 @@ import { LinkWithTextProps } from './types' export const ExternalLink: React.FC = ({ href, text, icon, id, className = 'text-light', title }) => { return ( - - -   + +   - {text} + { text } ) } diff --git a/src/components/common/links/internal-link.tsx b/src/components/common/links/internal-link.tsx index d82a8ae4b..5c17735ba 100644 --- a/src/components/common/links/internal-link.tsx +++ b/src/components/common/links/internal-link.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Link } from 'react-router-dom' @@ -13,15 +13,15 @@ import { LinkWithTextProps } from './types' export const InternalLink: React.FC = ({ href, text, icon, id, className = 'text-light', title }) => { return ( - - -   + +   - {text} + { text } ) } diff --git a/src/components/common/links/translated-external-link.tsx b/src/components/common/links/translated-external-link.tsx index e2d76f02d..3923ce9d6 100644 --- a/src/components/common/links/translated-external-link.tsx +++ b/src/components/common/links/translated-external-link.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { useTranslation } from 'react-i18next' @@ -12,6 +12,6 @@ import { TranslatedLinkProps } from './types' export const TranslatedExternalLink: React.FC = ({ i18nKey, i18nOption, ...props }) => { const { t } = useTranslation() return ( - + ) } diff --git a/src/components/common/links/translated-internal-link.tsx b/src/components/common/links/translated-internal-link.tsx index d0bc1fce3..5d7819cf2 100644 --- a/src/components/common/links/translated-internal-link.tsx +++ b/src/components/common/links/translated-internal-link.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { useTranslation } from 'react-i18next' @@ -12,6 +12,6 @@ import { TranslatedLinkProps } from './types' export const TranslatedInternalLink: React.FC = ({ i18nKey, i18nOption, ...props }) => { const { t } = useTranslation() return ( - + ) } diff --git a/src/components/common/links/types.d.ts b/src/components/common/links/types.d.ts index 6ef61f826..436db547e 100644 --- a/src/components/common/links/types.d.ts +++ b/src/components/common/links/types.d.ts @@ -19,7 +19,7 @@ export interface LinkWithTextProps extends GeneralLinkProp { text: string } -export interface TranslatedLinkProps extends GeneralLinkProp{ +export interface TranslatedLinkProps extends GeneralLinkProp { i18nKey: string i18nOption?: (TOptionsBase & StringMap) | string } diff --git a/src/components/common/lock-button/lock-button.tsx b/src/components/common/lock-button/lock-button.tsx index 88dcb75e6..8fc942f01 100644 --- a/src/components/common/lock-button/lock-button.tsx +++ b/src/components/common/lock-button/lock-button.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Button } from 'react-bootstrap' @@ -16,7 +16,7 @@ export interface LockButtonProps { export const LockButton: React.FC = ({ locked, onLockedChanged, title }) => { return ( - diff --git a/src/components/common/modals/error-modal.tsx b/src/components/common/modals/error-modal.tsx index 046da39d2..93ab40383 100644 --- a/src/components/common/modals/error-modal.tsx +++ b/src/components/common/modals/error-modal.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { Modal } from 'react-bootstrap' @@ -10,7 +10,7 @@ import { CommonModal, CommonModalProps } from './common-modal' export const ErrorModal: React.FC = ({ show, onHide, titleI18nKey, icon, children }) => { return ( - + { children } diff --git a/src/components/common/motd-banner/motd-banner.tsx b/src/components/common/motd-banner/motd-banner.tsx index 3793e6d18..50c808631 100644 --- a/src/components/common/motd-banner/motd-banner.tsx +++ b/src/components/common/motd-banner/motd-banner.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import equal from 'fast-deep-equal' import React from 'react' @@ -23,16 +23,16 @@ export const MotdBanner: React.FC = () => { } return ( - + - {bannerState.text} + { bannerState.text } diff --git a/src/components/common/number-range/number-range.ts b/src/components/common/number-range/number-range.ts index 82d781932..1d7e10907 100644 --- a/src/components/common/number-range/number-range.ts +++ b/src/components/common/number-range/number-range.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export const createNumberRangeArray = (length: number) : number[] => { - return Array.from(Array(length).keys()) +export const createNumberRangeArray = (length: number): number[] => { + return Array.from(Array(length) + .keys()) } diff --git a/src/components/common/pagination/pager-item.tsx b/src/components/common/pagination/pager-item.tsx index 7945d639e..80d5eebb3 100644 --- a/src/components/common/pagination/pager-item.tsx +++ b/src/components/common/pagination/pager-item.tsx @@ -1,21 +1,21 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' export interface PageItemProps { - onClick: (index: number) => void - index: number + onClick: (index: number) => void + index: number } export const PagerItem: React.FC = ({ index, onClick }) => { return (
  • - onClick(index)}> - {index + 1} + onClick(index) }> + { index + 1 }
  • ) diff --git a/src/components/common/pagination/pager-pagination.tsx b/src/components/common/pagination/pager-pagination.tsx index 822e776ec..f1a88bf91 100644 --- a/src/components/common/pagination/pager-pagination.tsx +++ b/src/components/common/pagination/pager-pagination.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { useEffect, useState } from 'react' import { Pagination } from 'react-bootstrap' @@ -53,28 +53,31 @@ export const PagerPagination: React.FC = ({ numberOfPageButtons 0 ) - const paginationItemsBefore = Array.from(new Array(correctedPageIndex - correctedLowerPageIndex)).map((k, index) => { - const itemIndex = correctedLowerPageIndex + index - return - }) + const paginationItemsBefore = Array.from(new Array(correctedPageIndex - correctedLowerPageIndex)) + .map((k, index) => { + const itemIndex = correctedLowerPageIndex + index + return + }) - const paginationItemsAfter = Array.from(new Array(correctedUpperPageIndex - correctedPageIndex)).map((k, index) => { - const itemIndex = correctedPageIndex + index + 1 - return - }) + const paginationItemsAfter = Array.from(new Array(correctedUpperPageIndex - correctedPageIndex)) + .map((k, index) => { + const itemIndex = correctedPageIndex + index + 1 + return + }) return ( - 0}> - + 0 }> + - {paginationItemsBefore} - {correctedPageIndex + 1} - {paginationItemsAfter} - + { paginationItemsBefore } + { correctedPageIndex + 1 } + { paginationItemsAfter } + - + ) diff --git a/src/components/common/pagination/pager.tsx b/src/components/common/pagination/pager.tsx index 0953e2e54..bc5ff8e29 100644 --- a/src/components/common/pagination/pager.tsx +++ b/src/components/common/pagination/pager.tsx @@ -1,15 +1,15 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { Fragment, useEffect } from 'react' export interface PagerPageProps { - pageIndex: number - numberOfElementsPerPage: number - onLastPageIndexChange: (lastPageIndex: number) => void + pageIndex: number + numberOfElementsPerPage: number + onLastPageIndexChange: (lastPageIndex: number) => void } export const Pager: React.FC = ({ children, numberOfElementsPerPage, pageIndex, onLastPageIndexChange }) => { @@ -22,10 +22,11 @@ export const Pager: React.FC = ({ children, numberOfElementsPerP return { - React.Children.toArray(children).filter((value, index) => { - const pageOfElement = Math.floor((index) / numberOfElementsPerPage) - return (pageOfElement === correctedPageIndex) - }) + React.Children.toArray(children) + .filter((value, index) => { + const pageOfElement = Math.floor((index) / numberOfElementsPerPage) + return (pageOfElement === correctedPageIndex) + }) } } diff --git a/src/components/common/routing/not-found-error-screen.tsx b/src/components/common/routing/not-found-error-screen.tsx index 8fda40955..9b7078940 100644 --- a/src/components/common/routing/not-found-error-screen.tsx +++ b/src/components/common/routing/not-found-error-screen.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { LandingLayout } from '../../landing-layout/landing-layout' diff --git a/src/components/common/routing/redirector.tsx b/src/components/common/routing/redirector.tsx index 83cce4970..9cf5582c8 100644 --- a/src/components/common/routing/redirector.tsx +++ b/src/components/common/routing/redirector.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { useEffect, useState } from 'react' import { Redirect } from 'react-router' @@ -27,7 +27,7 @@ export const Redirector: React.FC = () => { if (error) { return () } else if (!error && error != null) { - return () + return () } else { return (Loading) } diff --git a/src/components/common/show-if/show-if.tsx b/src/components/common/show-if/show-if.tsx index 43e140a22..9a2ecd184 100644 --- a/src/components/common/show-if/show-if.tsx +++ b/src/components/common/show-if/show-if.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React, { Fragment } from 'react' @@ -11,5 +11,5 @@ export interface ShowIfProps { } export const ShowIf: React.FC = ({ children, condition }) => { - return condition ? {children} : null + return condition ? { children } : null } diff --git a/src/components/common/user-avatar/user-avatar.tsx b/src/components/common/user-avatar/user-avatar.tsx index 28a11b703..100d50928 100644 --- a/src/components/common/user-avatar/user-avatar.tsx +++ b/src/components/common/user-avatar/user-avatar.tsx @@ -1,8 +1,8 @@ /* -SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) -SPDX-License-Identifier: AGPL-3.0-only -*/ + SPDX-License-Identifier: AGPL-3.0-only + */ import React from 'react' import { useTranslation } from 'react-i18next' @@ -21,15 +21,15 @@ const UserAvatar: React.FC = ({ name, photo, size, additionalCl const { t } = useTranslation() return ( - + {t('common.avatarOf', - - {name} + + { name } ) diff --git a/src/components/document-read-only-page/ErrorWhileLoadingNoteAlert.tsx b/src/components/document-read-only-page/ErrorWhileLoadingNoteAlert.tsx index 7ddbf2de3..c24d5c777 100644 --- a/src/components/document-read-only-page/ErrorWhileLoadingNoteAlert.tsx +++ b/src/components/document-read-only-page/ErrorWhileLoadingNoteAlert.tsx @@ -17,11 +17,11 @@ export const ErrorWhileLoadingNoteAlert: React.FC - - + + +
    - +
    ) diff --git a/src/components/document-read-only-page/LoadingNoteAlert.tsx b/src/components/document-read-only-page/LoadingNoteAlert.tsx index 47a8d6328..2886094af 100644 --- a/src/components/document-read-only-page/LoadingNoteAlert.tsx +++ b/src/components/document-read-only-page/LoadingNoteAlert.tsx @@ -15,9 +15,9 @@ export interface LoadingNoteAlertProps { export const LoadingNoteAlert: React.FC = ({ show }) => { return ( - - - + + + ) diff --git a/src/components/document-read-only-page/document-infobar.tsx b/src/components/document-read-only-page/document-infobar.tsx index f73dae3df..72dd2e7ce 100644 --- a/src/components/document-read-only-page/document-infobar.tsx +++ b/src/components/document-read-only-page/document-infobar.tsx @@ -37,30 +37,32 @@ export const DocumentInfobar: React.FC = ({ const { t } = useTranslation() return ( -
    -
     
    -
    -
    +
    +
     
    +
    +
    + mode={ DocumentInfoLineWithTimeMode.CREATED } + time={ createdTime } + userName={ createdAuthor } + profileImageSrc={ '/img/avatar.png' }/> + mode={ DocumentInfoLineWithTimeMode.EDITED } + time={ changedTime } + userName={ changedAuthor } + profileImageSrc={ '/img/avatar.png' }/>
    - - { viewCount } - - + + { viewCount } + +
    -
     
    +
     
    ) } diff --git a/src/components/document-read-only-page/document-read-only-page.tsx b/src/components/document-read-only-page/document-read-only-page.tsx index e088bf33b..dffd34623 100644 --- a/src/components/document-read-only-page/document-read-only-page.tsx +++ b/src/components/document-read-only-page/document-read-only-page.tsx @@ -38,27 +38,27 @@ export const DocumentReadOnlyPage: React.FC = () => { const noteDetails = useSelector((state: ApplicationState) => state.noteDetails) return ( -
    +
    - -
    - - + +
    + +
    - + - +
    ) diff --git a/src/components/editor-page/app-bar/app-bar.tsx b/src/components/editor-page/app-bar/app-bar.tsx index 3829c9600..32045a8e0 100644 --- a/src/components/editor-page/app-bar/app-bar.tsx +++ b/src/components/editor-page/app-bar/app-bar.tsx @@ -37,20 +37,21 @@ export const AppBar: React.FC = ({ mode }) => { const userExists = useSelector((state: ApplicationState) => !!state.user) return ( - + @@ -58,11 +59,11 @@ export const AppBar: React.FC = ({ mode }) => { - - + + - - + + diff --git a/src/components/editor-page/app-bar/dark-mode-button.tsx b/src/components/editor-page/app-bar/dark-mode-button.tsx index a648d33b2..2a39d8b1f 100644 --- a/src/components/editor-page/app-bar/dark-mode-button.tsx +++ b/src/components/editor-page/app-bar/dark-mode-button.tsx @@ -24,22 +24,22 @@ const DarkModeButton: React.FC = () => { setDarkMode(true)} + title={ t('editor.darkMode.switchToDark') } + onChange={ () => setDarkMode(true) } > setDarkMode(false)} + title={ t('editor.darkMode.switchToLight') } + onChange={ () => setDarkMode(false) } > diff --git a/src/components/editor-page/app-bar/editor-view-mode.tsx b/src/components/editor-page/app-bar/editor-view-mode.tsx index 55f8af414..6d02813fb 100644 --- a/src/components/editor-page/app-bar/editor-view-mode.tsx +++ b/src/components/editor-page/app-bar/editor-view-mode.tsx @@ -25,17 +25,17 @@ export const EditorViewMode: React.FC = () => { { + value={ editorMode } + onChange={ (value: EditorMode) => { setEditorMode(value) - }}> - + } }> + - + - + diff --git a/src/components/editor-page/app-bar/help-button/cheatsheet.tsx b/src/components/editor-page/app-bar/help-button/cheatsheet.tsx index 9326c99c5..850dce7b7 100644 --- a/src/components/editor-page/app-bar/help-button/cheatsheet.tsx +++ b/src/components/editor-page/app-bar/help-button/cheatsheet.tsx @@ -15,24 +15,24 @@ import './cheatsheet.scss' export const Cheatsheet: React.FC = () => { const { t } = useTranslation() const codes = [ - `**${t('editor.editorToolbar.bold')}**`, - `*${t('editor.editorToolbar.italic')}*`, - `++${t('editor.editorToolbar.underline')}++`, - `~~${t('editor.editorToolbar.strikethrough')}~~`, + `**${ t('editor.editorToolbar.bold') }**`, + `*${ t('editor.editorToolbar.italic') }*`, + `++${ t('editor.editorToolbar.underline') }++`, + `~~${ t('editor.editorToolbar.strikethrough') }~~`, 'H~2~O', '19^th^', - `==${t('editor.help.cheatsheet.highlightedText')}==`, - `# ${t('editor.editorToolbar.header')}`, - `\`${t('editor.editorToolbar.code')}\``, + `==${ t('editor.help.cheatsheet.highlightedText') }==`, + `# ${ t('editor.editorToolbar.header') }`, + `\`${ t('editor.editorToolbar.code') }\``, '```javascript=\nvar x = 5;\n```', - `> ${t('editor.editorToolbar.blockquote')}`, - `- ${t('editor.editorToolbar.unorderedList')}`, - `1. ${t('editor.editorToolbar.orderedList')}`, - `- [ ] ${t('editor.editorToolbar.checkList')}`, - `[${t('editor.editorToolbar.link')}](https://example.com)`, - `![${t('editor.editorToolbar.image')}](/icons/mstile-70x70.png)`, + `> ${ t('editor.editorToolbar.blockquote') }`, + `- ${ t('editor.editorToolbar.unorderedList') }`, + `1. ${ t('editor.editorToolbar.orderedList') }`, + `- [ ] ${ t('editor.editorToolbar.checkList') }`, + `[${ t('editor.editorToolbar.link') }](https://example.com)`, + `![${ t('editor.editorToolbar.image') }](/icons/mstile-70x70.png)`, ':smile:', - `:::info\n${t('editor.help.cheatsheet.exampleAlert')}\n:::` + `:::info\n${ t('editor.help.cheatsheet.exampleAlert') }\n:::` ] const markdownIt = useMemo(() => { @@ -43,26 +43,26 @@ export const Cheatsheet: React.FC = () => { return ( - - - - + + + + - {codes.map((code, key) => { - return ( - - - - - ) - })} + { codes.map((code, key) => { + return ( + + + + + ) + }) }
    - - - -
    + + + +
    ) diff --git a/src/components/editor-page/app-bar/help-button/help-button.tsx b/src/components/editor-page/app-bar/help-button/help-button.tsx index 05889486f..3084c306d 100644 --- a/src/components/editor-page/app-bar/help-button/help-button.tsx +++ b/src/components/editor-page/app-bar/help-button/help-button.tsx @@ -13,9 +13,9 @@ import { Links } from './links' import { Shortcut } from './shortcuts' export enum HelpTabStatus { - Cheatsheet='cheatsheet.title', - Shortcuts='shortcuts.title', - Links='links.title' + Cheatsheet = 'cheatsheet.title', + Shortcuts = 'shortcuts.title', + Links = 'links.title' } export const HelpButton: React.FC = () => { @@ -36,35 +36,39 @@ export const HelpButton: React.FC = () => { return ( - - setShow(false)} animation={true} className='text-dark' size='lg'> + setShow(false) } animation={ true } className='text-dark' size='lg'> - + - {tabContent()} + { tabContent() } diff --git a/src/components/editor-page/app-bar/help-button/links.tsx b/src/components/editor-page/app-bar/help-button/links.tsx index 97e98e5cd..7d42930ab 100644 --- a/src/components/editor-page/app-bar/help-button/links.tsx +++ b/src/components/editor-page/app-bar/help-button/links.tsx @@ -18,15 +18,15 @@ export const Links: React.FC = () => { const backendIssueTracker = useSelector((state: ApplicationState) => state.config.version.issueTrackerUrl) return ( - - + +

    • @@ -34,8 +34,8 @@ export const Links: React.FC = () => {
    • @@ -43,7 +43,7 @@ export const Links: React.FC = () => {
    • @@ -51,7 +51,7 @@ export const Links: React.FC = () => {
    • @@ -59,7 +59,7 @@ export const Links: React.FC = () => {
    - +

      diff --git a/src/components/editor-page/app-bar/help-button/shortcuts.tsx b/src/components/editor-page/app-bar/help-button/shortcuts.tsx index 815f1931a..b3420ee5e 100644 --- a/src/components/editor-page/app-bar/help-button/shortcuts.tsx +++ b/src/components/editor-page/app-bar/help-button/shortcuts.tsx @@ -13,7 +13,7 @@ export const Shortcut: React.FC = () => { const modifierKey = isMac ? : Ctrl const altKey = isMac ? : Alt - const shortcutMap: {[category: string]: { [functionName: string]: JSX.Element[] }} = { + const shortcutMap: { [category: string]: { [functionName: string]: JSX.Element[] } } = { 'View Mode': { 'editor.help.shortcuts.view': [Ctrl, <> + , altKey, <> + , V], 'editor.help.shortcuts.both': [Ctrl, <> + , altKey, <> + , B], @@ -29,28 +29,30 @@ export const Shortcut: React.FC = () => { } } return ( - - {Object.keys(shortcutMap).map(category => { - return ( - - {category} - - {Object.entries(shortcutMap[category]).map(([functionName, shortcuts]) => { + + { Object.keys(shortcutMap) + .map(category => { return ( - - - + + { category } + + { Object.entries(shortcutMap[category]) + .map(([functionName, shortcuts]) => { + return ( + + + { shortcuts.map((shortcut, shortcutIndex) => - {shortcut}) + { shortcut }) } - - ) - })} - - ) - }) + + ) + }) } + + ) + }) } ) diff --git a/src/components/editor-page/app-bar/navbar-branding.tsx b/src/components/editor-page/app-bar/navbar-branding.tsx index 4e21689ec..a1641fc07 100644 --- a/src/components/editor-page/app-bar/navbar-branding.tsx +++ b/src/components/editor-page/app-bar/navbar-branding.tsx @@ -22,9 +22,9 @@ export const NavbarBranding: React.FC = () => { - + logoType={ darkModeActivated ? HedgeDocLogoType.WB_HORIZONTAL : HedgeDocLogoType.BW_HORIZONTAL } + size={ HedgeDocLogoSize.SMALL }/> + ) diff --git a/src/components/editor-page/app-bar/sync-scroll-buttons/buttonIcon.svg b/src/components/editor-page/app-bar/sync-scroll-buttons/buttonIcon.svg index a4ccb32c5..5295e64b6 100644 --- a/src/components/editor-page/app-bar/sync-scroll-buttons/buttonIcon.svg +++ b/src/components/editor-page/app-bar/sync-scroll-buttons/buttonIcon.svg @@ -3,9 +3,9 @@ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 135.46666 135.46666" @@ -13,75 +13,75 @@ id="svg8" inkscape:version="1.0 (4035a4fb49, 2020-05-01)" sodipodi:docname="buttonIcon.svg"> - - - - - - image/svg+xml - - - - - - - - - + + + + + + image/svg+xml + + + + + - - + transform="translate(253.17277,890.86874)" + inkscape:label="Ebene 1" + inkscape:groupmode="layer" + id="layer1"> + + + + + + + - diff --git a/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.scss b/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.scss index a16d67295..615f2e0a7 100644 --- a/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.scss +++ b/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.scss @@ -9,6 +9,7 @@ width: 20px; height: 20px; } + .btn { svg g { @import "../../../../style/variables.light"; diff --git a/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.tsx b/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.tsx index 74296f641..bb50b5ea7 100644 --- a/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.tsx +++ b/src/components/editor-page/app-bar/sync-scroll-buttons/sync-scroll-buttons.tsx @@ -24,21 +24,21 @@ export const SyncScrollButtons: React.FC = () => { const { t } = useTranslation() return ( - + setEditorSyncScroll(true)} - value={SyncScrollState.SYNCED} + variant={ 'outline-secondary' } + title={ t('editor.appBar.syncScroll.enable') } + onChange={ () => setEditorSyncScroll(true) } + value={ SyncScrollState.SYNCED } > setEditorSyncScroll(false)} - value={SyncScrollState.UNSYNCED} + variant={ 'outline-secondary' } + title={ t('editor.appBar.syncScroll.disable') } + onChange={ () => setEditorSyncScroll(false) } + value={ SyncScrollState.UNSYNCED } > diff --git a/src/components/editor-page/document-bar/document-info/document-info-line.tsx b/src/components/editor-page/document-bar/document-info/document-info-line.tsx index 41413c4db..a9a569a83 100644 --- a/src/components/editor-page/document-bar/document-info/document-info-line.tsx +++ b/src/components/editor-page/document-bar/document-info/document-info-line.tsx @@ -15,10 +15,10 @@ export interface DocumentInfoLineProps { export const DocumentInfoLine: React.FC = ({ icon, size, children }) => { return ( - - - - {children} + + + + { children } ) diff --git a/src/components/editor-page/document-bar/document-info/document-info-modal.tsx b/src/components/editor-page/document-bar/document-info/document-info-modal.tsx index 363512f88..7b0f61bbb 100644 --- a/src/components/editor-page/document-bar/document-info/document-info-modal.tsx +++ b/src/components/editor-page/document-bar/document-info/document-info-modal.tsx @@ -18,47 +18,49 @@ export interface DocumentInfoModalProps { onHide: () => void } -export const DocumentInfoModal: React.FC = ({show, onHide}) => { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); +export const DocumentInfoModal: React.FC = ({ show, onHide }) => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } diff --git a/src/components/editor-page/document-bar/document-info/document-info-time-line.tsx b/src/components/editor-page/document-bar/document-info/document-info-time-line.tsx index adb5c0dc7..a9340fbee 100644 --- a/src/components/editor-page/document-bar/document-info/document-info-time-line.tsx +++ b/src/components/editor-page/document-bar/document-info/document-info-time-line.tsx @@ -32,10 +32,11 @@ export const DocumentInfoTimeLine: React.FC = ({ const icon: IconName = mode === DocumentInfoLineWithTimeMode.CREATED ? 'plus' : 'pencil' return ( - - - - + + + + ) diff --git a/src/components/editor-page/document-bar/document-info/time-from-now.tsx b/src/components/editor-page/document-bar/document-info/time-from-now.tsx index b9feebb2a..60b649a69 100644 --- a/src/components/editor-page/document-bar/document-info/time-from-now.tsx +++ b/src/components/editor-page/document-bar/document-info/time-from-now.tsx @@ -14,6 +14,7 @@ export interface TimeFromNowProps { export const TimeFromNow: React.FC = ({ time }) => { return ( - + ) } diff --git a/src/components/editor-page/document-bar/document-info/unitalic-bold-text.tsx b/src/components/editor-page/document-bar/document-info/unitalic-bold-text.tsx index 7fe6a30a0..da40c1496 100644 --- a/src/components/editor-page/document-bar/document-info/unitalic-bold-text.tsx +++ b/src/components/editor-page/document-bar/document-info/unitalic-bold-text.tsx @@ -7,9 +7,9 @@ import React from 'react' export interface UnitalicBoldTextProps { - text: string ; + text: string; } export const UnitalicBoldText: React.FC = ({ text }) => { - return {text} + return { text } } diff --git a/src/components/editor-page/document-bar/permissions/permission-group-entry.tsx b/src/components/editor-page/document-bar/permissions/permission-group-entry.tsx index 49a781e50..7b564d89b 100644 --- a/src/components/editor-page/document-bar/permissions/permission-group-entry.tsx +++ b/src/components/editor-page/document-bar/permissions/permission-group-entry.tsx @@ -25,35 +25,35 @@ export const PermissionGroupEntry: React.FC = ({ titl const { t } = useTranslation() return ( -
    • - +
    • + diff --git a/src/components/editor-page/document-bar/permissions/permission-list.tsx b/src/components/editor-page/document-bar/permissions/permission-list.tsx index faf6930fc..9a5b35e74 100644 --- a/src/components/editor-page/document-bar/permissions/permission-list.tsx +++ b/src/components/editor-page/document-bar/permissions/permission-list.tsx @@ -37,64 +37,64 @@ export const PermissionList: React.FC = ({ list, identifier } return ( -
        - {list.map(entry => ( -
      • - {identifier(entry)} +
          + { list.map(entry => ( +
        • + { identifier(entry) }
          changeEditMode(entry.id, value === EditMode.EDIT)} + value={ entry.canEdit ? EditMode.EDIT : EditMode.VIEW } + onChange={ (value: EditMode) => changeEditMode(entry.id, value === EditMode.EDIT) } >
        • - ))} -
        • -
          { + )) } +
        • + { event.preventDefault() addEntry() - }}> - + } }> + setNewEntry(event.currentTarget.value)} + value={ newEntry } + placeholder={ t(addI18nKey) } + aria-label={ t(addI18nKey) } + onChange={ event => setNewEntry(event.currentTarget.value) } /> diff --git a/src/components/editor-page/document-bar/permissions/permission-modal.tsx b/src/components/editor-page/document-bar/permissions/permission-modal.tsx index db9d29ceb..b5b9be530 100644 --- a/src/components/editor-page/document-bar/permissions/permission-modal.tsx +++ b/src/components/editor-page/document-bar/permissions/permission-modal.tsx @@ -69,22 +69,26 @@ export const PermissionModal: React.FC = ({ show, onHide useEffect(() => { // set owner - getUserById(permissionsApiResponse.owner).then(response => { - setOwner({ - name: response.name, - photo: response.photo + getUserById(permissionsApiResponse.owner) + .then(response => { + setOwner({ + name: response.name, + photo: response.photo + }) }) - }).catch(() => setError(true)) + .catch(() => setError(true)) // set user List permissionsApiResponse.sharedTo.forEach(shareUser => { - getUserById(shareUser.username).then(response => { - setUserList(list => list.concat([{ - id: response.id, - name: response.name, - photo: response.photo, - canEdit: shareUser.canEdit - }])) - }).catch(() => setError(true)) + getUserById(shareUser.username) + .then(response => { + setUserList(list => list.concat([{ + id: response.id, + name: response.name, + photo: response.photo, + canEdit: shareUser.canEdit + }])) + }) + .catch(() => setError(true)) }) // set group List permissionsApiResponse.sharedToGroup.forEach(sharedGroup => { @@ -122,45 +126,45 @@ export const PermissionModal: React.FC = ({ show, onHide return ( + show={ show } + onHide={ onHide } + closeButton={ true } + titleI18nKey={ 'editor.modal.permissions.title' }> -
          - +
          + -
            -
          • - +
              +
            • +
            -
            +
            ()} - changeEditMode={changeUserMode} - removeEntry={removeUser} - createEntry={addUser} - editI18nKey={'editor.modal.permissions.editUser'} - viewI18nKey={'editor.modal.permissions.viewOnlyUser'} - removeI18nKey={'editor.modal.permissions.removeUser'} - addI18nKey={'editor.modal.permissions.addUser'} + list={ userList } + identifier={ entry => () } + changeEditMode={ changeUserMode } + removeEntry={ removeUser } + createEntry={ addUser } + editI18nKey={ 'editor.modal.permissions.editUser' } + viewI18nKey={ 'editor.modal.permissions.viewOnlyUser' } + removeI18nKey={ 'editor.modal.permissions.removeUser' } + addI18nKey={ 'editor.modal.permissions.addUser' } /> -
            -
              +
              +
              diff --git a/src/components/editor-page/document-bar/revisions/revision-modal-list-entry.tsx b/src/components/editor-page/document-bar/revisions/revision-modal-list-entry.tsx index 3399dc213..ab4919644 100644 --- a/src/components/editor-page/document-bar/revisions/revision-modal-list-entry.tsx +++ b/src/components/editor-page/document-bar/revisions/revision-modal-list-entry.tsx @@ -23,26 +23,29 @@ export interface RevisionModalListEntryProps { export const RevisionModalListEntry: React.FC = ({ active, onClick, revision, revisionAuthorListMap }) => ( - - {DateTime.fromMillis(revision.timestamp * 1000).toFormat('DDDD T')} + + { DateTime.fromMillis(revision.timestamp * 1000) + .toFormat('DDDD T') } - - : {revision.length} + + : { revision.length } - - + + { - revisionAuthorListMap.get(revision.timestamp)?.map((user, index) => { - return ( - - ) - }) + revisionAuthorListMap.get(revision.timestamp) + ?.map((user, index) => { + return ( + + ) + }) } diff --git a/src/components/editor-page/document-bar/revisions/revision-modal.tsx b/src/components/editor-page/document-bar/revisions/revision-modal.tsx index 58f4fc1cf..042dec2b5 100644 --- a/src/components/editor-page/document-bar/revisions/revision-modal.tsx +++ b/src/components/editor-page/document-bar/revisions/revision-modal.tsx @@ -36,61 +36,66 @@ export const RevisionModal: React.FC = ({ show, onHide }) const { id } = useParams<{ id: string }>() useEffect(() => { - getAllRevisions(id).then(fetchedRevisions => { - fetchedRevisions.forEach(revision => { - const authorData = getUserDataForRevision(revision.authors) - revisionAuthorListMap.current.set(revision.timestamp, authorData) + getAllRevisions(id) + .then(fetchedRevisions => { + fetchedRevisions.forEach(revision => { + const authorData = getUserDataForRevision(revision.authors) + revisionAuthorListMap.current.set(revision.timestamp, authorData) + }) + setRevisions(fetchedRevisions) + if (fetchedRevisions.length >= 1) { + setSelectedRevisionTimestamp(fetchedRevisions[0].timestamp) + } }) - setRevisions(fetchedRevisions) - if (fetchedRevisions.length >= 1) { - setSelectedRevisionTimestamp(fetchedRevisions[0].timestamp) - } - }).catch(() => setError(true)) + .catch(() => setError(true)) }, [setRevisions, setError, id]) useEffect(() => { if (selectedRevisionTimestamp === null) { return } - getRevision(id, selectedRevisionTimestamp).then(fetchedRevision => { - setSelectedRevision(fetchedRevision) - }).catch(() => setError(true)) + getRevision(id, selectedRevisionTimestamp) + .then(fetchedRevision => { + setSelectedRevision(fetchedRevision) + }) + .catch(() => setError(true)) }, [selectedRevisionTimestamp, id]) const markdownContent = useNoteMarkdownContent() return ( - + - + { revisions.map((revision, revisionIndex) => ( setSelectedRevisionTimestamp(revision.timestamp)} + key={ revisionIndex } + active={ selectedRevisionTimestamp === revision.timestamp } + revision={ revision } + revisionAuthorListMap={ revisionAuthorListMap.current } + onClick={ () => setSelectedRevisionTimestamp(revision.timestamp) } /> )) } - - + + - + @@ -99,20 +104,20 @@ export const RevisionModal: React.FC = ({ show, onHide }) diff --git a/src/components/editor-page/document-bar/revisions/utils.ts b/src/components/editor-page/document-bar/revisions/utils.ts index 7f7be02c2..4943cb40d 100644 --- a/src/components/editor-page/document-bar/revisions/utils.ts +++ b/src/components/editor-page/document-bar/revisions/utils.ts @@ -13,7 +13,7 @@ export const downloadRevision = (noteId: string, revision: Revision | null): voi if (!revision) { return } - download(revision.content, `${noteId}-${revision.timestamp}.md`, 'text/markdown') + download(revision.content, `${ noteId }-${ revision.timestamp }.md`, 'text/markdown') } export const getUserDataForRevision = (authors: string[]): UserResponse[] => { diff --git a/src/components/editor-page/document-bar/share/share-modal.tsx b/src/components/editor-page/document-bar/share/share-modal.tsx index 5474da2d8..043376d65 100644 --- a/src/components/editor-page/document-bar/share/share-modal.tsx +++ b/src/components/editor-page/document-bar/share/share-modal.tsx @@ -31,21 +31,23 @@ export const ShareModal: React.FC = ({ show, onHide }) => { return ( + show={ show } + onHide={ onHide } + closeButton={ true } + titleI18nKey={ 'editor.modal.shareLink.title' }> - - - - - + + + + + - - - + + + diff --git a/src/components/editor-page/document-renderer-pane/hooks/use-adapted-line-markers-callback.ts b/src/components/editor-page/document-renderer-pane/hooks/use-adapted-line-markers-callback.ts index de5b7f9db..9f3b7ab05 100644 --- a/src/components/editor-page/document-renderer-pane/hooks/use-adapted-line-markers-callback.ts +++ b/src/components/editor-page/document-renderer-pane/hooks/use-adapted-line-markers-callback.ts @@ -8,8 +8,8 @@ import { RefObject, useCallback } from 'react' import { LineMarkerPosition } from '../../../markdown-renderer/types' export const useAdaptedLineMarkerCallback = (documentRenderPaneRef: RefObject | undefined, - rendererRef: RefObject, - onLineMarkerPositionChanged: ((lineMarkerPosition: LineMarkerPosition[]) => void) | undefined): ((lineMarkerPosition: LineMarkerPosition[]) => void) => { + rendererRef: RefObject, + onLineMarkerPositionChanged: ((lineMarkerPosition: LineMarkerPosition[]) => void) | undefined): ((lineMarkerPosition: LineMarkerPosition[]) => void) => { return useCallback((linkMarkerPositions) => { if (!onLineMarkerPositionChanged || !documentRenderPaneRef || !documentRenderPaneRef.current || !rendererRef.current) { return diff --git a/src/components/editor-page/document-renderer-pane/hooks/use-on-iframe-load.ts b/src/components/editor-page/document-renderer-pane/hooks/use-on-iframe-load.ts index edb8ddaa5..8d4e3f7df 100644 --- a/src/components/editor-page/document-renderer-pane/hooks/use-on-iframe-load.ts +++ b/src/components/editor-page/document-renderer-pane/hooks/use-on-iframe-load.ts @@ -8,7 +8,7 @@ import { RefObject, useCallback, useRef } from 'react' import { IframeEditorToRendererCommunicator } from '../../../render-page/iframe-editor-to-renderer-communicator' export const useOnIframeLoad = (frameReference: RefObject, iframeCommunicator: IframeEditorToRendererCommunicator, - rendererOrigin: string, renderPageUrl: string, onNavigateAway: () => void): () => void => { + rendererOrigin: string, renderPageUrl: string, onNavigateAway: () => void): () => void => { const sendToRenderPage = useRef(true) return useCallback(() => { @@ -24,7 +24,7 @@ export const useOnIframeLoad = (frameReference: RefObject, if return } else { onNavigateAway() - console.error("Navigated away from unknown URL") + console.error('Navigated away from unknown URL') frame.src = renderPageUrl sendToRenderPage.current = true } diff --git a/src/components/editor-page/document-renderer-pane/show-on-prop-change-image-lightbox.tsx b/src/components/editor-page/document-renderer-pane/show-on-prop-change-image-lightbox.tsx index 4f84b63b2..255652c64 100644 --- a/src/components/editor-page/document-renderer-pane/show-on-prop-change-image-lightbox.tsx +++ b/src/components/editor-page/document-renderer-pane/show-on-prop-change-image-lightbox.tsx @@ -26,7 +26,7 @@ export const ShowOnPropChangeImageLightbox: React.FC + ) } diff --git a/src/components/editor-page/editor-modals/max-length-warning-modal.tsx b/src/components/editor-page/editor-modals/max-length-warning-modal.tsx index e696396fa..1f31544f1 100644 --- a/src/components/editor-page/editor-modals/max-length-warning-modal.tsx +++ b/src/components/editor-page/editor-modals/max-length-warning-modal.tsx @@ -19,13 +19,14 @@ export const MaxLengthWarningModal: React.FC = ({ sh useTranslation() return ( - + - - + + - + ) diff --git a/src/components/editor-page/editor-page.tsx b/src/components/editor-page/editor-page.tsx index f2efefc6b..44fb47ca2 100644 --- a/src/components/editor-page/editor-page.tsx +++ b/src/components/editor-page/editor-page.tsx @@ -58,7 +58,8 @@ export const EditorPage: React.FC = () => { useEffect(() => { const requestedMode = search.substr(1) - const mode = Object.values(EditorMode).find(mode => mode === requestedMode) + const mode = Object.values(EditorMode) + .find(mode => mode === requestedMode) if (mode) { setEditorMode(mode) } @@ -92,37 +93,37 @@ export const EditorPage: React.FC = () => { return ( -
              - +
              + -
              - - +
              + +
              - -
              + +
              + onContentChange={ setNoteMarkdownContent } + content={ markdownContent } + scrollState={ scrollState.editorScrollState } + onScroll={ onEditorScroll } + onMakeScrollSource={ setEditorToScrollSource }/> } - showRight={editorMode === EditorMode.PREVIEW || editorMode === EditorMode.BOTH} + showRight={ editorMode === EditorMode.PREVIEW || editorMode === EditorMode.BOTH } right={ + markdownContent={ markdownContent } + onMakeScrollSource={ setRendererToScrollSource } + onFirstHeadingChange={ updateNoteTitleByFirstHeading } + onTaskCheckedChange={ SetCheckboxInMarkdownContent } + onFrontmatterChange={ setNoteFrontmatter } + onScroll={ onMarkdownRendererScroll } + scrollState={ scrollState.rendererScrollState }/> } - containerClassName={'overflow-hidden'}/> + containerClassName={ 'overflow-hidden' }/>
              diff --git a/src/components/editor-page/editor-pane/autocompletion/code-block.ts b/src/components/editor-page/editor-pane/autocompletion/code-block.ts index 2b4e1148d..70280b12f 100644 --- a/src/components/editor-page/editor-pane/autocompletion/code-block.ts +++ b/src/components/editor-page/editor-pane/autocompletion/code-block.ts @@ -10,7 +10,7 @@ import { findWordAtCursor, Hinter, search } from './index' const wordRegExp = /^```((\w|-|_|\+)*)$/ let allSupportedLanguages: string[] = [] -const codeBlockHint = (editor: Editor): Promise< Hints| null > => { +const codeBlockHint = (editor: Editor): Promise => { return import(/* webpackChunkName: "highlight.js" */ '../../../common/hljs/hljs').then((hljs) => new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) @@ -21,7 +21,8 @@ const codeBlockHint = (editor: Editor): Promise< Hints| null > => { } const term = searchResult[1] if (allSupportedLanguages.length === 0) { - allSupportedLanguages = hljs.default.listLanguages().concat('csv', 'flow', 'html', 'js', 'markmap', 'abc', 'graphviz', 'mermaid', 'vega-lite') + allSupportedLanguages = hljs.default.listLanguages() + .concat('csv', 'flow', 'html', 'js', 'markmap', 'abc', 'graphviz', 'mermaid', 'vega-lite') } const suggestions = search(term, allSupportedLanguages) const cursor = editor.getCursor() diff --git a/src/components/editor-page/editor-pane/autocompletion/collapsable-block.ts b/src/components/editor-page/editor-pane/autocompletion/collapsable-block.ts index b1ef862aa..839ef92c6 100644 --- a/src/components/editor-page/editor-pane/autocompletion/collapsable-block.ts +++ b/src/components/editor-page/editor-pane/autocompletion/collapsable-block.ts @@ -9,7 +9,7 @@ import { findWordAtCursor, Hinter } from './index' const wordRegExp = /^( => { +const collapsableBlockHint = (editor: Editor): Promise => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = wordRegExp.exec(searchTerm.text) diff --git a/src/components/editor-page/editor-pane/autocompletion/container.ts b/src/components/editor-page/editor-pane/autocompletion/container.ts index 6a8c732da..9fdba0749 100644 --- a/src/components/editor-page/editor-pane/autocompletion/container.ts +++ b/src/components/editor-page/editor-pane/autocompletion/container.ts @@ -16,7 +16,8 @@ const spoilerSuggestion: Hint = { const suggestions = validAlertLevels.map((suggestion: string): Hint => ({ text: ':::' + suggestion + '\n\n::: \n', displayText: suggestion -})).concat(spoilerSuggestion) +})) + .concat(spoilerSuggestion) const containerHint = (editor: Editor): Promise => { return new Promise((resolve) => { diff --git a/src/components/editor-page/editor-pane/autocompletion/emoji.ts b/src/components/editor-page/editor-pane/autocompletion/emoji.ts index b5105a8a1..d778ab73a 100644 --- a/src/components/editor-page/editor-pane/autocompletion/emoji.ts +++ b/src/components/editor-page/editor-pane/autocompletion/emoji.ts @@ -31,7 +31,7 @@ const findEmojiInDatabase = async (emojiIndex: Database, term: string): Promise< } } -const convertEmojiEventToHint = (emojiData:EmojiClickEventDetail): Hint | undefined => { +const convertEmojiEventToHint = (emojiData: EmojiClickEventDetail): Hint | undefined => { const shortCode = getEmojiShortCode(emojiData) if (!shortCode) { return undefined @@ -40,7 +40,7 @@ const convertEmojiEventToHint = (emojiData:EmojiClickEventDetail): Hint | undefi text: shortCode, render: (parent: HTMLLIElement) => { const wrapper = document.createElement('div') - wrapper.innerHTML = `${getEmojiIcon(emojiData)} ${shortCode}` + wrapper.innerHTML = `${ getEmojiIcon(emojiData) } ${ shortCode }` parent.appendChild(wrapper) } } diff --git a/src/components/editor-page/editor-pane/autocompletion/header.ts b/src/components/editor-page/editor-pane/autocompletion/header.ts index f9d1e6a01..ff51c45e5 100644 --- a/src/components/editor-page/editor-pane/autocompletion/header.ts +++ b/src/components/editor-page/editor-pane/autocompletion/header.ts @@ -11,7 +11,7 @@ const wordRegExp = /^(\s{0,3})(#{1,6})$/ const allSupportedHeaders = ['# h1', '## h2', '### h3', '#### h4', '##### h5', '###### h6', '###### tags: `example`'] const allSupportedHeadersTextToInsert = ['# ', '## ', '### ', '#### ', '##### ', '###### ', '###### tags: `example`'] -const headerHint = (editor: Editor): Promise< Hints| null > => { +const headerHint = (editor: Editor): Promise => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = wordRegExp.exec(searchTerm.text) diff --git a/src/components/editor-page/editor-pane/autocompletion/image.ts b/src/components/editor-page/editor-pane/autocompletion/image.ts index 750f03919..485f7f81e 100644 --- a/src/components/editor-page/editor-pane/autocompletion/image.ts +++ b/src/components/editor-page/editor-pane/autocompletion/image.ts @@ -14,7 +14,7 @@ const allSupportedImages = [ '![image alt][reference]' ] -const imageHint = (editor: Editor): Promise< Hints| null > => { +const imageHint = (editor: Editor): Promise => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = wordRegExp.exec(searchTerm.text) diff --git a/src/components/editor-page/editor-pane/autocompletion/index.ts b/src/components/editor-page/editor-pane/autocompletion/index.ts index 3c8f3d492..694142ba2 100644 --- a/src/components/editor-page/editor-pane/autocompletion/index.ts +++ b/src/components/editor-page/editor-pane/autocompletion/index.ts @@ -22,7 +22,7 @@ interface findWordAtCursorResponse { export interface Hinter { wordRegExp: RegExp, - hint: (editor: Editor) => Promise< Hints| null > + hint: (editor: Editor) => Promise } const allowedChars = /[^\s]/ @@ -40,7 +40,8 @@ export const findWordAtCursor = (editor: Editor): findWordAtCursorResponse => { } return { - text: line.slice(start, end).toLowerCase(), + text: line.slice(start, end) + .toLowerCase(), start: start, end: end } @@ -49,7 +50,8 @@ export const findWordAtCursor = (editor: Editor): findWordAtCursorResponse => { export const search = (term: string, list: string[]): string[] => { const suggestions: string[] = [] list.forEach(item => { - if (item.toLowerCase().startsWith(term.toLowerCase())) { + if (item.toLowerCase() + .startsWith(term.toLowerCase())) { suggestions.push(item) } }) @@ -64,5 +66,5 @@ export const allHinters: Hinter[] = [ ImageHinter, LinkAndExtraTagHinter, PDFHinter, - CollapsableBlockHinter, + CollapsableBlockHinter ] diff --git a/src/components/editor-page/editor-pane/autocompletion/link-and-extra-tag.ts b/src/components/editor-page/editor-pane/autocompletion/link-and-extra-tag.ts index 13f63c390..23c1bd7c4 100644 --- a/src/components/editor-page/editor-pane/autocompletion/link-and-extra-tag.ts +++ b/src/components/editor-page/editor-pane/autocompletion/link-and-extra-tag.ts @@ -25,7 +25,7 @@ const allSupportedLinks = [ ] -const linkAndExtraTagHint = (editor: Editor): Promise< Hints| null > => { +const linkAndExtraTagHint = (editor: Editor): Promise => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = wordRegExp.exec(searchTerm.text) @@ -46,12 +46,13 @@ const linkAndExtraTagHint = (editor: Editor): Promise< Hints| null > => { case 'name': // Get the user when a completion happens, this prevents to early calls resulting in 'Anonymous' return { - text: `[name=${userName}]` + text: `[name=${ userName }]` } case 'time': // show the current time when the autocompletion is opened and not when the function is loaded return { - text: `[time=${DateTime.local().toFormat('DDDD T')}]` + text: `[time=${ DateTime.local() + .toFormat('DDDD T') }]` } default: return { diff --git a/src/components/editor-page/editor-pane/autocompletion/pdf.ts b/src/components/editor-page/editor-pane/autocompletion/pdf.ts index 8503199dc..c9843801b 100644 --- a/src/components/editor-page/editor-pane/autocompletion/pdf.ts +++ b/src/components/editor-page/editor-pane/autocompletion/pdf.ts @@ -9,7 +9,7 @@ import { findWordAtCursor, Hinter } from './index' const wordRegExp = /^({[%}]?)$/ -const pdfHint = (editor: Editor): Promise< Hints| null > => { +const pdfHint = (editor: Editor): Promise => { return new Promise((resolve) => { const searchTerm = findWordAtCursor(editor) const searchResult = wordRegExp.exec(searchTerm.text) diff --git a/src/components/editor-page/editor-pane/editor-pane.scss b/src/components/editor-page/editor-pane/editor-pane.scss index cefcf41b9..35dd04e7e 100644 --- a/src/components/editor-page/editor-pane/editor-pane.scss +++ b/src/components/editor-page/editor-pane/editor-pane.scss @@ -30,6 +30,7 @@ .CodeMirror-line, .CodeMirror-line-like { font-feature-settings: inherit; } + .CodeMirror-line, .CodeMirror-line-like { font-variant-ligatures: none; } diff --git a/src/components/editor-page/editor-pane/editor-pane.tsx b/src/components/editor-page/editor-pane/editor-pane.tsx index 9e06e63b2..4a527d29f 100644 --- a/src/components/editor-page/editor-pane/editor-pane.tsx +++ b/src/components/editor-page/editor-pane/editor-pane.tsx @@ -83,9 +83,9 @@ interface DropEvent { pageX: number, pageY: number, dataTransfer: { - files: FileList - effectAllowed: string - } | null + files: FileList + effectAllowed: string + } | null preventDefault: () => void } @@ -201,22 +201,22 @@ export const EditorPane: React.FC = ({ onContentC }), [t, editorPreferences]) return ( -
              - - +
              + + - +
              ) } diff --git a/src/components/editor-page/editor-pane/hints.scss b/src/components/editor-page/editor-pane/hints.scss index 5fd9ad364..77fa7865e 100644 --- a/src/components/editor-page/editor-pane/hints.scss +++ b/src/components/editor-page/editor-pane/hints.scss @@ -13,7 +13,7 @@ margin: 0; padding: 4px; - box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); border-radius: 3px; border: 1px solid silver; diff --git a/src/components/editor-page/editor-pane/key-map.ts b/src/components/editor-page/editor-pane/key-map.ts index 124478c1a..423c5df66 100644 --- a/src/components/editor-page/editor-pane/key-map.ts +++ b/src/components/editor-page/editor-pane/key-map.ts @@ -30,7 +30,8 @@ const tab = (editor: Editor) => { const tab = '\t' // contruct x length spaces - const spaces = Array((editor.getOption('indentUnit') ?? 0) + 1).join(' ') + const spaces = Array((editor.getOption('indentUnit') ?? 0) + 1) + .join(' ') // auto indent whole line when in list or blockquote const cursor = editor.getCursor() @@ -43,7 +44,8 @@ const tab = (editor: Editor) => { const regex = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))/ let match - const multiple = editor.getSelection().split('\n').length > 1 || + const multiple = editor.getSelection() + .split('\n').length > 1 || editor.getSelections().length > 1 if (multiple) { @@ -70,35 +72,35 @@ const tab = (editor: Editor) => { export const defaultKeyMap: KeyMap = !isMac ? { - F9: suppressKey, - F10: f10, - Esc: esc, - 'Ctrl-S': suppressKey, - Enter: 'newlineAndIndentContinueMarkdownList', - Tab: tab, - Home: 'goLineLeftSmart', - End: 'goLineRight', - 'Ctrl-I': makeSelectionItalic, - 'Ctrl-B': makeSelectionBold, - 'Ctrl-U': underlineSelection, - 'Ctrl-D': strikeThroughSelection, - 'Ctrl-M': markSelection, - 'Ctrl-K': addLink - } + F9: suppressKey, + F10: f10, + Esc: esc, + 'Ctrl-S': suppressKey, + Enter: 'newlineAndIndentContinueMarkdownList', + Tab: tab, + Home: 'goLineLeftSmart', + End: 'goLineRight', + 'Ctrl-I': makeSelectionItalic, + 'Ctrl-B': makeSelectionBold, + 'Ctrl-U': underlineSelection, + 'Ctrl-D': strikeThroughSelection, + 'Ctrl-M': markSelection, + 'Ctrl-K': addLink + } : { - F9: suppressKey, - F10: f10, - Esc: esc, - 'Cmd-S': suppressKey, - Enter: 'newlineAndIndentContinueMarkdownList', - Tab: tab, - 'Cmd-Left': 'goLineLeftSmart', - 'Cmd-Right': 'goLineRight', - Home: 'goLineLeftSmart', - End: 'goLineRight', - 'Cmd-I': makeSelectionItalic, - 'Cmd-B': makeSelectionBold, - 'Cmd-U': underlineSelection, - 'Cmd-D': strikeThroughSelection, - 'Cmd-M': markSelection - } + F9: suppressKey, + F10: f10, + Esc: esc, + 'Cmd-S': suppressKey, + Enter: 'newlineAndIndentContinueMarkdownList', + Tab: tab, + 'Cmd-Left': 'goLineLeftSmart', + 'Cmd-Right': 'goLineRight', + Home: 'goLineLeftSmart', + End: 'goLineRight', + 'Cmd-I': makeSelectionItalic, + 'Cmd-B': makeSelectionBold, + 'Cmd-U': underlineSelection, + 'Cmd-D': strikeThroughSelection, + 'Cmd-M': markSelection + } diff --git a/src/components/editor-page/editor-pane/one-dark.scss b/src/components/editor-page/editor-pane/one-dark.scss index 04f288994..32839f304 100644 --- a/src/components/editor-page/editor-pane/one-dark.scss +++ b/src/components/editor-page/editor-pane/one-dark.scss @@ -15,207 +15,254 @@ borrow some color from tomorrow-night-eighties /* Editor */ .dark .panel, .dark #main-toolbar { - background: #1d222a; + background: #1d222a; } + .dark #working-set-list-container, .dark #editor-holder .pane-header { - background: #15181e; + background: #15181e; } + .dark .working-set-header, .dark #project-files-header .btn-alt-quiet { - background: rgba(204, 217, 255, 0.05); + background: rgba(204, 217, 255, 0.05); } + .dark .working-set-header > span { - background: transparent; + background: transparent; } + .dark .sidebar-selection, .dark .filetree-selection, .dark .sidebar-selection-extension, .dark .filetree-selection-extension { - background: #282c34; + background: #282c34; } + .dark #status-bar, .dark #status-indicators { - background: #15181e; - border-top-color: #1d222a; + background: #15181e; + border-top-color: #1d222a; } + .dark a, .dark .open-files-container li.selected a { - color: #528bff; + color: #528bff; } + /* Code Styling */ .cm-s-one-dark.CodeMirror, .cm-s-one-dark .CodeMirror-scroll { - /* background-color: #282c34;*/ - background-color: #1e2126; - color: #abb2bf; + /* background-color: #282c34;*/ + background-color: #1e2126; + color: #abb2bf; } + .cm-s-one-dark .CodeMirror-activeline-background { - background: transparent; + background: transparent; } + .cm-s-one-dark.CodeMirror-focused .CodeMirror-activeline-background { - background: rgba(204, 217, 255, 0.05); + background: rgba(204, 217, 255, 0.05); } + .show-line-padding .cm-s-one-dark.CodeMirror-focused .CodeMirror-activeline-background { - box-shadow: inset 15px 0 0 0 #000; + box-shadow: inset 15px 0 0 0 #000; } + .cm-s-one-dark.CodeMirror-focused .CodeMirror-activeline .CodeMirror-gutter-elt { - background: transparent; - color: #5c6370; + background: transparent; + color: #5c6370; } + .cm-s-one-dark.CodeMirror-focused .CodeMirror-activeline .inline-widget .CodeMirror-gutter-elt { - color: red; + color: red; } + .cm-s-one-dark .cm-string-2, .cm-s-one-dark .cm-hr { - color: #56b6c2; + color: #56b6c2; } + .cm-s-one-dark .cm-number, .cm-s-one-dark .cm-attribute, .cm-s-one-dark .cm-qualifier, .cm-s-one-dark .cm-plus, .cm-s-one-dark .cm-atom { - color: #eda35e; + color: #eda35e; } + .cm-s-one-dark .cm-def { - color: #c678dd; + color: #c678dd; } + .cm-s-one-dark .cm-property, .cm-s-one-dark .cm-variable, .cm-s-one-dark .cm-variable-2, .cm-s-one-dark .cm-variable-3, .cm-s-one-dark .cm-operator, - /*.cm-meta,*/ + /*.cm-meta,*/ .cm-s-one-dark .cm-bracket { - color: #f76e79; + color: #f76e79; } + /*borrow from tomorrow-night-eighties*/ .cm-s-one-dark .cm-variable { - color: #99cc99; + color: #99cc99; } + .cm-s-one-dark .cm-variable-2 { - color: #6699cc; + color: #6699cc; } .cm-s-one-dark .cm-comment { - color: #5c6370; - font-style: italic; + color: #5c6370; + font-style: italic; } + .cm-s-one-dark .cm-error, .cm-s-one-dark .cm-minus { - color: #be5046; + color: #be5046; } + .cm-s-one-dark .cm-header { - color: #eda35e; + color: #eda35e; } + .cm-s-one-dark .cm-link { - color: #98c379; - text-decoration: none; + color: #98c379; + text-decoration: none; } + .cm-s-one-dark .cm-rangeinfo { - color: #c678dd; + color: #c678dd; } + .cm-s-one-dark .cm-keyword, .cm-s-one-dark .cm-builtin, .cm-s-one-dark .cm-tag { - color: #e06c75; + color: #e06c75; } + .cm-s-one-dark .cm-m-markdown.cm-keyword, .cm-s-one-dark .cm-m-markdown.cm-builtin, .cm-s-one-dark .cm-m-markdown.cm-tag { - color: #98c379; + color: #98c379; } + .cm-s-one-dark .cm-string { - /* color: #98c379;*/ - color: #6699cc; + /* color: #98c379;*/ + color: #6699cc; } + /* Extra CSS */ .cm-s-one-dark .CodeMirror-searching { - color: #fff !important; - border: 1px solid #528bff; - margin: 0 -1px; - background-color: rgba(204, 217, 255, 0.09); - box-shadow: 0px 0px 6px rgba(66, 133, 244, 0.4); + color: #fff !important; + border: 1px solid #528bff; + margin: 0 -1px; + background-color: rgba(204, 217, 255, 0.09); + box-shadow: 0px 0px 6px rgba(66, 133, 244, 0.4); } + .cm-s-one-dark .CodeMirror-searching.searching-current-match { - color: #fff; - background-color: #528bff; - box-shadow: 0px 0px 6px rgba(66, 133, 244, 0.8); + color: #fff; + background-color: #528bff; + box-shadow: 0px 0px 6px rgba(66, 133, 244, 0.8); } + .cm-s-one-dark .CodeMirror-cursor { - border-left: 2px solid #528bff !important; + border-left: 2px solid #528bff !important; } + .cm-fat-cursor .CodeMirror-cursor { - border-left: 2px solid #3C5B9E !important; - background: #3C5B9E; + border-left: 2px solid #3C5B9E !important; + background: #3C5B9E; } + .cm-s-one-dark .CodeMirror-gutters { - /* background-color: #282c34;*/ - background-color: #1e2126; - border-right: 1px solid rgba(204, 217, 255, 0.05); + /* background-color: #282c34;*/ + background-color: #1e2126; + border-right: 1px solid rgba(204, 217, 255, 0.05); } + .cm-s-one-dark .CodeMirror-linenumber { - color: #393e46; + color: #393e46; } + .cm-s-one-dark.CodeMirror .CodeMirror-selected { - background: rgba(204, 217, 255, 0.05); + background: rgba(204, 217, 255, 0.05); } + .cm-s-one-dark.CodeMirror-focused .CodeMirror-selected { - background: rgba(204, 217, 255, 0.09); + background: rgba(204, 217, 255, 0.09); } + .cm-s-one-dark .CodeMirror-matchingbracket, .cm-s-one-dark .CodeMirror-matchingtag { - /* Ensure visibility against gray inline editor background */ - background-color: rgba(204, 217, 255, 0.09); - color: #abb2bf !important; - border-bottom: 1px solid #528bff; + /* Ensure visibility against gray inline editor background */ + background-color: rgba(204, 217, 255, 0.09); + color: #abb2bf !important; + border-bottom: 1px solid #528bff; } + .cm-s-one-dark .CodeMirror-overwrite .CodeMirror-cursor { - border-left: none !important; - border-bottom: 1px solid #fff; - width: 0.5em; + border-left: none !important; + border-bottom: 1px solid #fff; + width: 0.5em; } + .cm-s-one-dark.CodeMirror .CodeMirror { - background: transparent; + background: transparent; } + .cm-s-one-dark.CodeMirror .CodeMirror .CodeMirror-gutters { - background: transparent; - border-right: none; + background: transparent; + border-right: none; } + .cm-s-one-dark.CodeMirror .CodeMirror .CodeMirror-activeline-background { - background: transparent; + background: transparent; } + .cm-s-one-dark.CodeMirror .CodeMirror .CodeMirror-activeline .CodeMirror-gutter-elt { - background: transparent; - color: #5c6370; + background: transparent; + color: #5c6370; } + .cm-s-one-dark.CodeMirror .CodeMirror-focused .CodeMirror-activeline-background { - background: #000; + background: #000; } + .cm-s-one-dark.CodeMirror .CodeMirror-focused .CodeMirror-activeline .CodeMirror-gutter-elt { - background: rgba(204, 217, 255, 0.05); - color: #fff; + background: rgba(204, 217, 255, 0.05); + color: #fff; } + .cm-s-one-dark .CodeMirror-foldgutter-open:after { - color: #393e46; + color: #393e46; } + .cm-s-one-dark .CodeMirror-foldgutter-folded:after { - color: #5c6370; + color: #5c6370; } + .cm-s-one-dark .CodeMirror.over-gutter .CodeMirror-foldgutter-open:after, .cm-s-one-dark.CodeMirror-focused .CodeMirror-activeline .CodeMirror-foldgutter-open:after { - color: #5c6370; + color: #5c6370; } + .cm-s-one-dark .CodeMirror-foldmarker { - border-color: #393e46; - color: #abb2bf; - background: rgba(204, 217, 255, 0.05); + border-color: #393e46; + color: #abb2bf; + background: rgba(204, 217, 255, 0.05); } + /* Non-editor styling */ .image-view, .not-editor { - background-color: #282c34; + background-color: #282c34; } + .view-pane .image-view { - color: #abb2bf; + color: #abb2bf; } diff --git a/src/components/editor-page/editor-pane/status-bar/status-bar.tsx b/src/components/editor-page/editor-pane/status-bar/status-bar.tsx index 42d2c089d..0b1f6ac41 100644 --- a/src/components/editor-page/editor-pane/status-bar/status-bar.tsx +++ b/src/components/editor-page/editor-pane/status-bar/status-bar.tsx @@ -34,7 +34,8 @@ export const createStatusInfo = (editor: Editor, maxDocumentLength: number): Sta remainingCharacters: maxDocumentLength - editor.getValue().length, linesInDocument: editor.lineCount(), selectedColumns: editor.getSelection().length, - selectedLines: editor.getSelection().split('\n').length + selectedLines: editor.getSelection() + .split('\n').length }) export const StatusBar: React.FC = ({ position, selectedColumns, selectedLines, charactersInDocument, linesInDocument, remainingCharacters }) => { @@ -53,25 +54,25 @@ export const StatusBar: React.FC = ({ position, selectedColumns, return (
              - {t('editor.statusBar.cursor', { line: position.line + 1, columns: position.ch + 1 })} - - -  – {t('editor.statusBar.selection.column', { count: selectedColumns })} + { t('editor.statusBar.cursor', { line: position.line + 1, columns: position.ch + 1 }) } + + +  – { t('editor.statusBar.selection.column', { count: selectedColumns }) } - 1}> -  – {t('editor.statusBar.selection.line', { count: selectedLines })} + 1 }> +  – { t('editor.statusBar.selection.line', { count: selectedLines }) }
              - {t('editor.statusBar.lines', { lines: linesInDocument })} + { t('editor.statusBar.lines', { lines: linesInDocument }) }  –  - {t('editor.statusBar.length', { length: charactersInDocument })} + { t('editor.statusBar.length', { length: charactersInDocument }) }
              diff --git a/src/components/editor-page/editor-pane/tool-bar/editor-preferences/editor-preference-boolean-property.tsx b/src/components/editor-page/editor-pane/tool-bar/editor-preferences/editor-preference-boolean-property.tsx index 00300a12a..e3e5710a4 100644 --- a/src/components/editor-page/editor-pane/tool-bar/editor-preferences/editor-preference-boolean-property.tsx +++ b/src/components/editor-page/editor-pane/tool-bar/editor-preferences/editor-preference-boolean-property.tsx @@ -5,7 +5,7 @@ */ import { EditorConfiguration } from 'codemirror' -import equal from "fast-deep-equal" +import equal from 'fast-deep-equal' import React, { ChangeEvent, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' @@ -30,15 +30,16 @@ export const EditorPreferenceBooleanProperty: React.FC -