@shzlx/ui-default 4.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/api.ts +61 -0
- package/backendlib/builder.ts +182 -0
- package/backendlib/markdown-it-imsize.ts +235 -0
- package/backendlib/markdown-it-katex.ts +139 -0
- package/backendlib/markdown-it-media.ts +163 -0
- package/backendlib/markdown-it-xss.ts +200 -0
- package/backendlib/markdown.js +64 -0
- package/backendlib/misc.ts +54 -0
- package/backendlib/template.ts +279 -0
- package/breakpoints.json +5 -0
- package/components/DOMAttachedObject.ts +128 -0
- package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
- package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
- package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
- package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
- package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
- package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
- package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
- package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
- package/components/autocomplete/index.tsx +110 -0
- package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
- package/components/autocomplete/userselectautocomplete.page.styl +6 -0
- package/components/browser-update.page.ts +27 -0
- package/components/calendar/calendar.page.styl +129 -0
- package/components/calendar/index.js +367 -0
- package/components/clipboard.page.ts +23 -0
- package/components/contest/contest.page.styl +119 -0
- package/components/contest/contest.page.ts +23 -0
- package/components/contest/contest_sidebar.page.styl +21 -0
- package/components/contest/problem-contest-bg.png +0 -0
- package/components/contest/problem-contest-bg@2x.png +0 -0
- package/components/customFont.page.tsx +90 -0
- package/components/datepicker/datepicker.page.tsx +94 -0
- package/components/dialog/DomDialog.ts +145 -0
- package/components/dialog/dialog.page.styl +40 -0
- package/components/dialog/index.tsx +285 -0
- package/components/discussion/CommentBox.js +103 -0
- package/components/discussion/collapsible.page.styl +40 -0
- package/components/discussion/collapsible.page.tsx +62 -0
- package/components/discussion/comments.page.styl +142 -0
- package/components/discussion/comments.page.tsx +192 -0
- package/components/discussion/discussion.page.styl +17 -0
- package/components/discussion/history.page.tsx +81 -0
- package/components/discussion/reaction.page.styl +30 -0
- package/components/discussion/reaction.page.tsx +103 -0
- package/components/drop/drop.page.styl +40 -0
- package/components/dropdown/Dropdown.js +50 -0
- package/components/dropdown/dropdown.page.styl +33 -0
- package/components/dropdown/dropdown.page.ts +8 -0
- package/components/editor/cmeditor.page.ts +23 -0
- package/components/editor/cmeditor.styl +10 -0
- package/components/editor/index.tsx +293 -0
- package/components/editor/mdeditor.ts +60 -0
- package/components/editor/textareaHandler.ts +29 -0
- package/components/footer/footer.page.styl +94 -0
- package/components/footer/footer.page.ts +26 -0
- package/components/form/button.page.default.styl +59 -0
- package/components/form/button.page.styl +36 -0
- package/components/form/checkbox.page.styl +89 -0
- package/components/form/form.page.styl +200 -0
- package/components/form/form.page.ts +20 -0
- package/components/form/multiSelectCheckbox.page.js +46 -0
- package/components/form/radiobox.page.styl +62 -0
- package/components/form/select.page.styl +29 -0
- package/components/form/textbox.page.styl +79 -0
- package/components/form/textbox.page.ts +21 -0
- package/components/form/var.inc.styl +14 -0
- package/components/header/header.page.styl +79 -0
- package/components/highlighter/code-example.js +111 -0
- package/components/highlighter/highlighter.page.styl +99 -0
- package/components/highlighter/highlighter.page.ts +72 -0
- package/components/highlighter/meta.js +15 -0
- package/components/highlighter/prismjs.js +122 -0
- package/components/hint.page.styl +9 -0
- package/components/hint.ts +19 -0
- package/components/hitokoto/index.page.js +21 -0
- package/components/hotkey/hotkey.page.js +83 -0
- package/components/katex/katex.page.js +26 -0
- package/components/katex/katex.page.styl +2 -0
- package/components/languageselect.tsx +94 -0
- package/components/loader/loader.page.styl +40 -0
- package/components/mantine.page.tsx +39 -0
- package/components/marker/Marker.js +192 -0
- package/components/marker/MarkerReactive.js +55 -0
- package/components/marker/marker.page.js +8 -0
- package/components/marker/marker.page.styl +57 -0
- package/components/media/media.page.js +46 -0
- package/components/menu/menu-heading.page.js +28 -0
- package/components/menu/menu.page.js +18 -0
- package/components/menu/menu.page.styl +68 -0
- package/components/message/index.page.ts +166 -0
- package/components/message/worker.ts +110 -0
- package/components/messagepad/DialogueListItem.page.styl +28 -0
- package/components/messagepad/DialogueListItemComponent.jsx +39 -0
- package/components/messagepad/Message.page.styl +64 -0
- package/components/messagepad/MessageComponent.jsx +33 -0
- package/components/messagepad/MessagePad.page.styl +99 -0
- package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
- package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
- package/components/messagepad/MessagePadInputContainer.jsx +100 -0
- package/components/messagepad/index.jsx +49 -0
- package/components/messagepad/reducers/activeId.ts +36 -0
- package/components/messagepad/reducers/dialogues.js +53 -0
- package/components/messagepad/reducers/index.ts +14 -0
- package/components/messagepad/reducers/inputs.js +43 -0
- package/components/messagepad/reducers/isPosting.ts +49 -0
- package/components/monaco/index.ts +178 -0
- package/components/monaco/languages/markdown.ts +97 -0
- package/components/monaco/languages/typescript.ts +45 -0
- package/components/monaco/languages/yaml.ts +22 -0
- package/components/monaco/loader.ts +96 -0
- package/components/monaco/monaco.styl +30 -0
- package/components/monaco/nls.js +31 -0
- package/components/monaco/schema/problemconfig.ts +123 -0
- package/components/navigation/hamburgers.page.styl +87 -0
- package/components/navigation/nav-logo-small_dark.png +0 -0
- package/components/navigation/navigation.page.js +203 -0
- package/components/navigation/navigation.page.styl +211 -0
- package/components/notification/index.ts +105 -0
- package/components/notification/notification.page.js +14 -0
- package/components/notification/notification.page.styl +84 -0
- package/components/nprogress.page.styl +50 -0
- package/components/omnisearch/index.page.tsx +124 -0
- package/components/omnisearch/omnibar.page.styl +138 -0
- package/components/pager/pager.page.styl +57 -0
- package/components/preview/preview.page.ts +187 -0
- package/components/problem/create.page.js +12 -0
- package/components/problem/list.page.js +9 -0
- package/components/problem/rp.page.styl +4 -0
- package/components/problem/tag.page.styl +84 -0
- package/components/problemconfig/BasicForm.tsx +92 -0
- package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
- package/components/problemconfig/ProblemConfigForm.tsx +140 -0
- package/components/problemconfig/ProblemConfigTree.tsx +163 -0
- package/components/problemconfig/ProblemType.tsx +165 -0
- package/components/problemconfig/index.tsx +91 -0
- package/components/problemconfig/reducer/config.ts +173 -0
- package/components/problemconfig/reducer/index.ts +11 -0
- package/components/problemconfig/reducer/testdata.ts +16 -0
- package/components/problemconfig/tree/AddTestcase.tsx +137 -0
- package/components/problemconfig/tree/SelectionManager.tsx +140 -0
- package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
- package/components/problemconfig/tree/Testcase.tsx +98 -0
- package/components/profile/backgrounds/1.jpg +0 -0
- package/components/profile/backgrounds/10.jpg +0 -0
- package/components/profile/backgrounds/11.jpg +0 -0
- package/components/profile/backgrounds/12.jpg +0 -0
- package/components/profile/backgrounds/13.jpg +0 -0
- package/components/profile/backgrounds/14.jpg +0 -0
- package/components/profile/backgrounds/15.jpg +0 -0
- package/components/profile/backgrounds/16.jpg +0 -0
- package/components/profile/backgrounds/17.jpg +0 -0
- package/components/profile/backgrounds/18.jpg +0 -0
- package/components/profile/backgrounds/19.jpg +0 -0
- package/components/profile/backgrounds/2.jpg +0 -0
- package/components/profile/backgrounds/20.jpg +0 -0
- package/components/profile/backgrounds/21.jpg +0 -0
- package/components/profile/backgrounds/3.jpg +0 -0
- package/components/profile/backgrounds/4.jpg +0 -0
- package/components/profile/backgrounds/5.jpg +0 -0
- package/components/profile/backgrounds/6.jpg +0 -0
- package/components/profile/backgrounds/7.jpg +0 -0
- package/components/profile/backgrounds/8.jpg +0 -0
- package/components/profile/backgrounds/9.jpg +0 -0
- package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
- package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
- package/components/profile/profile.page.styl +23 -0
- package/components/react/DomComponent.tsx +14 -0
- package/components/react/IconComponent.tsx +20 -0
- package/components/record/record.page.styl +26 -0
- package/components/rotator/index.js +75 -0
- package/components/rotator/rotator.page.styl +20 -0
- package/components/scratchpad/DataInput.page.styl +17 -0
- package/components/scratchpad/DataInputComponent.jsx +45 -0
- package/components/scratchpad/Editor.page.styl +13 -0
- package/components/scratchpad/Panel.page.styl +18 -0
- package/components/scratchpad/PanelButton.page.styl +15 -0
- package/components/scratchpad/PanelButtonComponent.jsx +19 -0
- package/components/scratchpad/PanelComponent.jsx +25 -0
- package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
- package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
- package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
- package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
- package/components/scratchpad/ScratchpadSettings.tsx +48 -0
- package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
- package/components/scratchpad/Tab.page.styl +24 -0
- package/components/scratchpad/Toolbar.page.styl +53 -0
- package/components/scratchpad/ToolbarComponent.jsx +85 -0
- package/components/scratchpad/index.tsx +132 -0
- package/components/scratchpad/reducers/editor.ts +24 -0
- package/components/scratchpad/reducers/index.ts +17 -0
- package/components/scratchpad/reducers/pretest.ts +34 -0
- package/components/scratchpad/reducers/records.ts +40 -0
- package/components/scratchpad/reducers/state.ts +10 -0
- package/components/scratchpad/reducers/ui.ts +152 -0
- package/components/scratchpad/scratchpad.page.styl +55 -0
- package/components/scratchpad/var.inc.styl +2 -0
- package/components/selectUser.tsx +16 -0
- package/components/signin/signInDialog.page.js +84 -0
- package/components/signin/signin_dialog.page.styl +57 -0
- package/components/smoothscroll/smoothscroll.page.js +44 -0
- package/components/socket/index.ts +68 -0
- package/components/star/star.page.styl +20 -0
- package/components/star/star.page.ts +58 -0
- package/components/sticky/sticky.page.js +66 -0
- package/components/tab/Tab.js +168 -0
- package/components/tab/tab.page.js +9 -0
- package/components/tab/tab.page.styl +105 -0
- package/components/tab/var.inc.styl +3 -0
- package/components/table/StyledTable.js +51 -0
- package/components/table/styledTable.page.js +8 -0
- package/components/table/table.page.styl +73 -0
- package/components/time/time.page.js +47 -0
- package/components/tooltip/Tooltip.js +49 -0
- package/components/tooltip/tooltip.page.js +29 -0
- package/components/tooltip/tooltip.page.styl +69 -0
- package/components/training/training.page.styl +25 -0
- package/components/upload.tsx +103 -0
- package/components/vote/vote.page.js +43 -0
- package/components/zipDownloader/index.ts +157 -0
- package/constant/domain.js +21 -0
- package/constant/message.js +5 -0
- package/constant/record.js +52 -0
- package/context.ts +11 -0
- package/entry.js +72 -0
- package/hydro.ts +112 -0
- package/index.ts +226 -0
- package/lazyload.ts +69 -0
- package/locales/en.yaml +71 -0
- package/locales/ko.yaml +823 -0
- package/locales/zh.yaml +1137 -0
- package/locales/zh_TW.yaml +1133 -0
- package/misc/Page.ts +49 -0
- package/misc/PageLoader.js +31 -0
- package/misc/float.styl +14 -0
- package/misc/grid.styl +1048 -0
- package/misc/immersive-background.jpg +0 -0
- package/misc/immersive-background@2x.jpg +0 -0
- package/misc/immersive.styl +23 -0
- package/misc/nothing.styl +13 -0
- package/misc/puzzled_twd2.svg +1 -0
- package/misc/section.styl +105 -0
- package/misc/slideout.styl +46 -0
- package/misc/structure.styl +158 -0
- package/misc/textalign.styl +11 -0
- package/misc/typography.styl +485 -0
- package/package.json +148 -0
- package/polyfill.ts +90 -0
- package/postcss.config.js +15 -0
- package/sentry.ts +26 -0
- package/service-worker.ts +265 -0
- package/setting.yaml +98 -0
- package/templates/about.html +14 -0
- package/templates/bsod.html +35 -0
- package/templates/components/comments_discussion.html +165 -0
- package/templates/components/comments_solution.html +171 -0
- package/templates/components/contest.html +12 -0
- package/templates/components/form.html +214 -0
- package/templates/components/home.html +20 -0
- package/templates/components/homework.html +8 -0
- package/templates/components/md_hint.html +39 -0
- package/templates/components/noscript_note.html +15 -0
- package/templates/components/nothing.html +6 -0
- package/templates/components/paginator.html +25 -0
- package/templates/components/problem.html +33 -0
- package/templates/components/record.html +21 -0
- package/templates/components/sidemenu.html +11 -0
- package/templates/components/user.html +49 -0
- package/templates/contest_balloon.html +48 -0
- package/templates/contest_clarification.html +103 -0
- package/templates/contest_detail.html +56 -0
- package/templates/contest_edit.html +259 -0
- package/templates/contest_main.html +146 -0
- package/templates/contest_manage.html +80 -0
- package/templates/contest_print.html +27 -0
- package/templates/contest_problemlist.html +231 -0
- package/templates/contest_scoreboard.html +46 -0
- package/templates/contest_scoreboard_download_html.html +71 -0
- package/templates/contest_user.html +47 -0
- package/templates/discussion_create.html +28 -0
- package/templates/discussion_detail.html +149 -0
- package/templates/discussion_edit.html +30 -0
- package/templates/discussion_main_or_node.html +47 -0
- package/templates/domain_base.html +26 -0
- package/templates/domain_create.html +55 -0
- package/templates/domain_dashboard.html +45 -0
- package/templates/domain_edit.html +6 -0
- package/templates/domain_group.html +51 -0
- package/templates/domain_join.html +47 -0
- package/templates/domain_join_applications.html +67 -0
- package/templates/domain_permission.html +66 -0
- package/templates/domain_role.html +71 -0
- package/templates/domain_user.html +86 -0
- package/templates/domain_user_raw.html +5 -0
- package/templates/error.html +25 -0
- package/templates/home_domain.html +64 -0
- package/templates/home_files.html +16 -0
- package/templates/home_messages.html +9 -0
- package/templates/home_security.html +224 -0
- package/templates/home_settings.html +21 -0
- package/templates/homework_detail.html +82 -0
- package/templates/homework_edit.html +138 -0
- package/templates/homework_files.html +24 -0
- package/templates/homework_main.html +76 -0
- package/templates/layout/basic.html +27 -0
- package/templates/layout/home_base.html +13 -0
- package/templates/layout/html5.html +74 -0
- package/templates/layout/immersive.html +22 -0
- package/templates/layout/mail.html +31 -0
- package/templates/layout/simple.html +4 -0
- package/templates/layout/wiki_base.html +16 -0
- package/templates/main.html +22 -0
- package/templates/manage_base.html +24 -0
- package/templates/manage_config.html +6 -0
- package/templates/manage_dashboard.html +27 -0
- package/templates/manage_script.html +56 -0
- package/templates/manage_setting.html +6 -0
- package/templates/manage_user_import.html +23 -0
- package/templates/manage_user_priv.html +76 -0
- package/templates/partials/category.html +19 -0
- package/templates/partials/contest.html +3 -0
- package/templates/partials/contest_balloon.html +37 -0
- package/templates/partials/contest_sidebar.html +150 -0
- package/templates/partials/contest_sidebar_management.html +56 -0
- package/templates/partials/contest_user.html +19 -0
- package/templates/partials/discussion_edit_form.html +45 -0
- package/templates/partials/discussion_list.html +50 -0
- package/templates/partials/discussion_nodes_widget.html +17 -0
- package/templates/partials/files.html +49 -0
- package/templates/partials/footer.html +108 -0
- package/templates/partials/hamburger.html +7 -0
- package/templates/partials/header_mobile.html +12 -0
- package/templates/partials/homepage/bulletin.html +7 -0
- package/templates/partials/homepage/contest.html +48 -0
- package/templates/partials/homepage/discussion.html +13 -0
- package/templates/partials/homepage/discussion_nodes.html +4 -0
- package/templates/partials/homepage/error.html +5 -0
- package/templates/partials/homepage/hitokoto.html +6 -0
- package/templates/partials/homepage/homework.html +45 -0
- package/templates/partials/homepage/problem_search.html +13 -0
- package/templates/partials/homepage/ranking.html +39 -0
- package/templates/partials/homepage/recent_problems.html +17 -0
- package/templates/partials/homepage/starred_problems.html +15 -0
- package/templates/partials/homepage/suggestion.html +34 -0
- package/templates/partials/homepage/training.html +50 -0
- package/templates/partials/homework.html +3 -0
- package/templates/partials/homework_default_penalty_rules.yaml +6 -0
- package/templates/partials/homework_sidebar.html +93 -0
- package/templates/partials/login_dialog.html +56 -0
- package/templates/partials/manage_user_priv.html +78 -0
- package/templates/partials/nav.html +138 -0
- package/templates/partials/problem-sidebar-information.html +25 -0
- package/templates/partials/problem.html +2 -0
- package/templates/partials/problem_category_dialog.html +43 -0
- package/templates/partials/problem_default.md +26 -0
- package/templates/partials/problem_description.html +33 -0
- package/templates/partials/problem_files.html +63 -0
- package/templates/partials/problem_list.html +68 -0
- package/templates/partials/problem_lucky.html +10 -0
- package/templates/partials/problem_sidebar.html +14 -0
- package/templates/partials/problem_sidebar_contest.html +43 -0
- package/templates/partials/problem_sidebar_homework.html +42 -0
- package/templates/partials/problem_sidebar_normal.html +152 -0
- package/templates/partials/problem_stat.html +3 -0
- package/templates/partials/scoreboard.html +79 -0
- package/templates/partials/setting.html +92 -0
- package/templates/partials/training_default.json +14 -0
- package/templates/partials/training_detail.html +153 -0
- package/templates/partials/user.html +2 -0
- package/templates/partials/user_detail/activity.html +18 -0
- package/templates/partials/user_detail/solution.html +29 -0
- package/templates/problem_config.html +39 -0
- package/templates/problem_detail.html +150 -0
- package/templates/problem_edit.html +111 -0
- package/templates/problem_files.html +91 -0
- package/templates/problem_hack.html +41 -0
- package/templates/problem_import.html +58 -0
- package/templates/problem_main.html +100 -0
- package/templates/problem_solution.html +55 -0
- package/templates/problem_statistics.html +96 -0
- package/templates/problem_submit.html +40 -0
- package/templates/ranking.html +81 -0
- package/templates/record_detail.html +134 -0
- package/templates/record_detail_status.html +93 -0
- package/templates/record_detail_summary.html +19 -0
- package/templates/record_main.html +142 -0
- package/templates/record_main_tr.html +35 -0
- package/templates/status.html +75 -0
- package/templates/training_detail.html +120 -0
- package/templates/training_edit.html +68 -0
- package/templates/training_files.html +64 -0
- package/templates/training_main.html +107 -0
- package/templates/user_changemail_mail.html +6 -0
- package/templates/user_changemail_mail_sent.html +9 -0
- package/templates/user_delete_pending.html +10 -0
- package/templates/user_detail.html +181 -0
- package/templates/user_login.html +46 -0
- package/templates/user_logout.html +13 -0
- package/templates/user_lostpass.html +27 -0
- package/templates/user_lostpass_mail.html +6 -0
- package/templates/user_lostpass_mail_sent.html +9 -0
- package/templates/user_lostpass_with_code.html +29 -0
- package/templates/user_register.html +22 -0
- package/templates/user_register_mail.html +6 -0
- package/templates/user_register_mail_sent.html +9 -0
- package/templates/user_register_with_code.html +35 -0
- package/templates/user_sudo.html +54 -0
- package/templates/user_sudo_redirect.html +18 -0
- package/templates/wiki_help.html +189 -0
- package/theme/bp6-compat.css +48 -0
- package/theme/dark.styl +397 -0
- package/theme/default.js +33 -0
- package/typed.d.ts +20 -0
- package/utils/base.ts +209 -0
- package/utils/base64.js +104 -0
- package/utils/db.ts +32 -0
- package/utils/index.ts +73 -0
- package/utils/loadReactRedux.ts +32 -0
- package/utils/mediaQuery.ts +13 -0
- package/utils/pjax.js +148 -0
- package/utils/slide.ts +57 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import Drop from 'tether-drop';
|
|
2
|
+
import responsiveCutoff from 'vj/breakpoints.json';
|
|
3
|
+
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
|
4
|
+
import { mediaQuery, zIndexManager } from 'vj/utils';
|
|
5
|
+
|
|
6
|
+
export default class Dropdown extends DOMAttachedObject {
|
|
7
|
+
static DOMAttachKey = 'vjDropdownInstance';
|
|
8
|
+
|
|
9
|
+
static DOMAttachSelector = '[data-dropdown-target]';
|
|
10
|
+
|
|
11
|
+
constructor($dom, options = {}) {
|
|
12
|
+
if ($dom.attr('data-dropdown-trigger-desktop-only') !== undefined) {
|
|
13
|
+
if (mediaQuery.isBelow(responsiveCutoff.mobile)) {
|
|
14
|
+
super(null);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
super($dom);
|
|
19
|
+
this.options = {
|
|
20
|
+
target: null,
|
|
21
|
+
position: $dom.attr('data-dropdown-pos') || 'bottom left',
|
|
22
|
+
...options,
|
|
23
|
+
};
|
|
24
|
+
this.dropInstance = new Drop({
|
|
25
|
+
target: $dom[0],
|
|
26
|
+
classes: `dropdown ${$dom.attr('data-dropdown-custom-class') || ''}`,
|
|
27
|
+
content: this.options.target || $.find($dom.attr('data-dropdown-target'))[0],
|
|
28
|
+
position: this.options.position,
|
|
29
|
+
openOn: 'hover',
|
|
30
|
+
constrainToWindow: $dom.attr('data-dropdown-disabledconstrainToWindow') === undefined,
|
|
31
|
+
constrainToScrollParent: false,
|
|
32
|
+
});
|
|
33
|
+
this.dropInstance.on('open', this.onDropOpen.bind(this));
|
|
34
|
+
this.dropInstance.on('close', this.onDropClose.bind(this));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
detach() {
|
|
38
|
+
super.detach();
|
|
39
|
+
this.dropInstance.destroy();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onDropOpen() {
|
|
43
|
+
$(this.dropInstance.drop).css('z-index', zIndexManager.getNext());
|
|
44
|
+
this.$dom.trigger('vjDropdownShow');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onDropClose() {
|
|
48
|
+
this.$dom.trigger('vjDropdownHide');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.dropdown-target
|
|
2
|
+
display: none
|
|
3
|
+
|
|
4
|
+
.drop .dropdown-target
|
|
5
|
+
display: block
|
|
6
|
+
|
|
7
|
+
.drop.nav__dropdown
|
|
8
|
+
max-height: calc(100% - 60px)
|
|
9
|
+
overflow-x: hidden
|
|
10
|
+
overflow-y: auto
|
|
11
|
+
box-shadow: 0rem 0.125rem 0.4375rem rgba(0 0 0 , 30%);
|
|
12
|
+
|
|
13
|
+
.drop.nav__dropdown.drop-open
|
|
14
|
+
overflow-x: auto
|
|
15
|
+
|
|
16
|
+
.dropdown
|
|
17
|
+
.menu
|
|
18
|
+
min-width: rem(150px)
|
|
19
|
+
box-shadow: $menu-drop-shadow
|
|
20
|
+
background: $menu-drop-bg-color
|
|
21
|
+
font-size: rem($font-size-small)
|
|
22
|
+
|
|
23
|
+
.menu__link
|
|
24
|
+
padding: rem(8px 10px)
|
|
25
|
+
|
|
26
|
+
.dropdown
|
|
27
|
+
.drop-content
|
|
28
|
+
transition: transform .1s ease-in-out
|
|
29
|
+
transform: scale(0.9) translateZ(0)
|
|
30
|
+
|
|
31
|
+
&.drop-after-open
|
|
32
|
+
.drop-content
|
|
33
|
+
transform: scale(1) translateZ(0)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AutoloadPage } from 'vj/misc/Page';
|
|
2
|
+
import { delay } from 'vj/utils';
|
|
3
|
+
import CmEditor from '.';
|
|
4
|
+
|
|
5
|
+
function runSubstitute($container: JQuery<Document | HTMLElement>) {
|
|
6
|
+
for (const language of ['markdown', 'yaml', 'json', 'plain']) {
|
|
7
|
+
$container.find(`textarea[data-${language}]`).get().forEach((element) => {
|
|
8
|
+
const config: any = { language };
|
|
9
|
+
if ($(element).data('model')) config.model = $(element).data('model');
|
|
10
|
+
CmEditor.getOrConstruct($(element), config);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const cmEditorPage = new AutoloadPage('cmEditorPage', () => {
|
|
16
|
+
runSubstitute($('body'));
|
|
17
|
+
$(document).on('vjContentNew', async (e) => {
|
|
18
|
+
await delay(0);
|
|
19
|
+
runSubstitute($(e.target));
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default cmEditorPage;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import { debounce } from 'lodash';
|
|
3
|
+
import { nanoid } from 'nanoid';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom/client';
|
|
6
|
+
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
|
7
|
+
import { getTheme, i18n } from 'vj/utils';
|
|
8
|
+
import uploadFiles from '../upload';
|
|
9
|
+
|
|
10
|
+
interface MonacoOptions {
|
|
11
|
+
language?: string;
|
|
12
|
+
onChange?: (val: string) => any;
|
|
13
|
+
theme?: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
autoResize?: boolean;
|
|
16
|
+
autoLayout?: boolean;
|
|
17
|
+
value?: string;
|
|
18
|
+
hide?: string[];
|
|
19
|
+
lineNumbers?: 'on' | 'off' | 'relative' | 'interval';
|
|
20
|
+
}
|
|
21
|
+
type Options = MonacoOptions;
|
|
22
|
+
|
|
23
|
+
export default class Editor extends DOMAttachedObject {
|
|
24
|
+
static DOMAttachKey = 'vjEditorInstance';
|
|
25
|
+
model: import('../monaco').default.editor.IModel;
|
|
26
|
+
editor: import('../monaco').default.editor.IStandaloneCodeEditor;
|
|
27
|
+
markdownEditor: any;
|
|
28
|
+
valueCache?: string;
|
|
29
|
+
setMarkdownEditorValue?: (v: string) => void;
|
|
30
|
+
reactRoot?: ReactDOM.Root;
|
|
31
|
+
isValid: boolean;
|
|
32
|
+
|
|
33
|
+
constructor($dom, public options: Options = {}) {
|
|
34
|
+
super($dom);
|
|
35
|
+
if (UserContext.preferredEditorType === 'monaco') this.initMonaco();
|
|
36
|
+
else if (options.language && options.language !== 'markdown') this.initMonaco();
|
|
37
|
+
else this.initMarkdownEditor();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async initMonaco() {
|
|
41
|
+
const { load } = await import('vj/components/monaco/loader');
|
|
42
|
+
const {
|
|
43
|
+
onChange, language = 'markdown',
|
|
44
|
+
theme = `vs-${getTheme()}`,
|
|
45
|
+
model = `file://model-${Math.random().toString(16)}`,
|
|
46
|
+
autoResize = true, autoLayout = true,
|
|
47
|
+
hide = [], lineNumbers = 'on',
|
|
48
|
+
} = this.options;
|
|
49
|
+
const { monaco, registerAction } = await load([language]);
|
|
50
|
+
const { $dom } = this;
|
|
51
|
+
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
|
|
52
|
+
const origin = $dom.get(0);
|
|
53
|
+
const ele = document.createElement('div');
|
|
54
|
+
$(ele).width('100%').addClass('textbox');
|
|
55
|
+
if (!autoResize && $dom.height()) $(ele).height($dom.height());
|
|
56
|
+
$dom.hide();
|
|
57
|
+
origin.parentElement.appendChild(ele);
|
|
58
|
+
const value = this.options.value || $dom.val();
|
|
59
|
+
this.model = typeof model === 'string'
|
|
60
|
+
? monaco.editor.getModel(monaco.Uri.parse(model))
|
|
61
|
+
|| monaco.editor.createModel(value, language === 'auto' ? undefined : language, monaco.Uri.parse(model))
|
|
62
|
+
: model;
|
|
63
|
+
if (!this.options.model) this.model.setValue(value);
|
|
64
|
+
const cfg: import('../monaco').default.editor.IStandaloneEditorConstructionOptions = {
|
|
65
|
+
theme,
|
|
66
|
+
lineNumbers,
|
|
67
|
+
glyphMargin: true,
|
|
68
|
+
lightbulb: { enabled: monaco.editor.ShowLightbulbIconMode.On },
|
|
69
|
+
model: this.model,
|
|
70
|
+
minimap: { enabled: false },
|
|
71
|
+
hideCursorInOverviewRuler: true,
|
|
72
|
+
overviewRulerLanes: 0,
|
|
73
|
+
overviewRulerBorder: false,
|
|
74
|
+
fontFamily: UserContext.codeFontFamily,
|
|
75
|
+
fontLigatures: '',
|
|
76
|
+
unicodeHighlight: {
|
|
77
|
+
ambiguousCharacters: language !== 'markdown',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
if (autoLayout) cfg.automaticLayout = true;
|
|
81
|
+
let prevHeight = 0;
|
|
82
|
+
const updateEditorHeight = () => {
|
|
83
|
+
const editorElement = this.editor.getDomNode();
|
|
84
|
+
if (!editorElement) return;
|
|
85
|
+
const lineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
|
|
86
|
+
const lineCount = this.editor.getModel()?.getLineCount() || 1;
|
|
87
|
+
let height = this.editor.getTopForLineNumber(lineCount + 1) + lineHeight;
|
|
88
|
+
if (prevHeight !== height) {
|
|
89
|
+
if (window.innerHeight * 1.5 < height) {
|
|
90
|
+
height = window.innerHeight;
|
|
91
|
+
this.editor.updateOptions({
|
|
92
|
+
scrollbar: {
|
|
93
|
+
vertical: 'auto',
|
|
94
|
+
horizontal: 'auto',
|
|
95
|
+
handleMouseWheel: true,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
this.editor.updateOptions({
|
|
100
|
+
scrollbar: {
|
|
101
|
+
vertical: 'hidden',
|
|
102
|
+
horizontal: 'hidden',
|
|
103
|
+
handleMouseWheel: false,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
prevHeight = height;
|
|
108
|
+
editorElement.style.height = `${height}px`;
|
|
109
|
+
this.editor.layout();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
if (autoResize) {
|
|
113
|
+
cfg.wordWrap = 'bounded';
|
|
114
|
+
cfg.scrollBeyondLastLine = false;
|
|
115
|
+
}
|
|
116
|
+
this.editor = monaco.editor.create(ele, cfg);
|
|
117
|
+
if (hide.length) {
|
|
118
|
+
const ranges = [];
|
|
119
|
+
for (const text of hide) {
|
|
120
|
+
const found = this.model.findMatches(text, true, false, true, '', true);
|
|
121
|
+
ranges.push(...found.map((i) => i.range));
|
|
122
|
+
}
|
|
123
|
+
this.editor.deltaDecorations([], ranges.map((range) => ({ range, options: { inlineClassName: 'decoration-hide' } })));
|
|
124
|
+
}
|
|
125
|
+
registerAction(this.editor, this.model, this.$dom);
|
|
126
|
+
if (autoResize) {
|
|
127
|
+
this.editor.onDidChangeModelDecorations(() => {
|
|
128
|
+
updateEditorHeight(); // typing
|
|
129
|
+
requestAnimationFrame(updateEditorHeight); // folding
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
this.editor.onDidChangeModelContent(() => {
|
|
133
|
+
const val = this.editor.getValue({ lineEnding: '\n', preserveBOM: false });
|
|
134
|
+
$dom.val(val);
|
|
135
|
+
$dom.text(val);
|
|
136
|
+
if (onChange) onChange(val);
|
|
137
|
+
});
|
|
138
|
+
this.isValid = true;
|
|
139
|
+
if (hasFocus) this.focus();
|
|
140
|
+
if (autoResize) updateEditorHeight();
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
window.model = this.model;
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
window.editor = this.editor;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async initMarkdownEditor() {
|
|
148
|
+
const pagename = document.documentElement.getAttribute('data-page');
|
|
149
|
+
const pageUploadConfig: Record<string, { endpoint: string, type?: string }> = {
|
|
150
|
+
problem_edit: { endpoint: './files', type: 'additional_file' },
|
|
151
|
+
homework_edit: { endpoint: './file' },
|
|
152
|
+
contest_edit: { endpoint: './management', type: 'public' },
|
|
153
|
+
};
|
|
154
|
+
const uploadCfg = pageUploadConfig[pagename];
|
|
155
|
+
const useFileProtocol = !!uploadCfg || ['problem_create', 'homework_create', 'contest_create'].includes(pagename);
|
|
156
|
+
const that = this;
|
|
157
|
+
const { $dom } = this;
|
|
158
|
+
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
|
|
159
|
+
const origin = $dom.get(0);
|
|
160
|
+
const ele = document.createElement('div');
|
|
161
|
+
const value = $dom.val();
|
|
162
|
+
const { onChange } = this.options;
|
|
163
|
+
const { MdEditor } = await import('./mdeditor');
|
|
164
|
+
|
|
165
|
+
const debouncedTrigger = debounce(() => {
|
|
166
|
+
$(document.querySelector('.md-editor-preview')).trigger('vjContentNew');
|
|
167
|
+
}, 500, { trailing: true });
|
|
168
|
+
const renderCallback = (ref) => {
|
|
169
|
+
this.markdownEditor = ref;
|
|
170
|
+
setTimeout(debouncedTrigger, 200);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
function EditorComponent() {
|
|
174
|
+
const [val, setVal] = React.useState(value);
|
|
175
|
+
that.setMarkdownEditorValue = setVal;
|
|
176
|
+
return <MdEditor
|
|
177
|
+
className="textbox"
|
|
178
|
+
autoFocus={hasFocus}
|
|
179
|
+
codeTheme="github"
|
|
180
|
+
codeStyleReverse={false}
|
|
181
|
+
ref={renderCallback}
|
|
182
|
+
value={val}
|
|
183
|
+
theme={getTheme()}
|
|
184
|
+
language={UserContext.viewLang === 'zh' ? 'zh-CN' : UserContext.viewLang?.replace('_', '-')}
|
|
185
|
+
noMermaid
|
|
186
|
+
noPrettier
|
|
187
|
+
noKatex
|
|
188
|
+
noHighlight
|
|
189
|
+
autoDetectCode
|
|
190
|
+
toolbarsExclude={[
|
|
191
|
+
// 'bold',
|
|
192
|
+
// 'underline',
|
|
193
|
+
// 'italic',
|
|
194
|
+
// '-',
|
|
195
|
+
// 'strikeThrough',
|
|
196
|
+
// 'title',
|
|
197
|
+
'sub',
|
|
198
|
+
'sup',
|
|
199
|
+
// 'quote',
|
|
200
|
+
// 'unorderedList',
|
|
201
|
+
// 'orderedList',
|
|
202
|
+
// 'task',
|
|
203
|
+
// '-',
|
|
204
|
+
// 'codeRow',
|
|
205
|
+
// 'code',
|
|
206
|
+
// 'link',
|
|
207
|
+
// 'image',
|
|
208
|
+
// 'table',
|
|
209
|
+
'mermaid',
|
|
210
|
+
// 'katex',
|
|
211
|
+
// '-',
|
|
212
|
+
// 'revoke',
|
|
213
|
+
// 'next',
|
|
214
|
+
'save',
|
|
215
|
+
// '=',
|
|
216
|
+
'pageFullscreen',
|
|
217
|
+
'fullscreen',
|
|
218
|
+
// 'preview',
|
|
219
|
+
'previewOnly',
|
|
220
|
+
'htmlPreview',
|
|
221
|
+
// 'catalog',
|
|
222
|
+
'github',
|
|
223
|
+
]}
|
|
224
|
+
onChange={(v) => {
|
|
225
|
+
that.valueCache = v;
|
|
226
|
+
setVal(v);
|
|
227
|
+
$dom.val(v);
|
|
228
|
+
$dom.text(v);
|
|
229
|
+
onChange?.(v);
|
|
230
|
+
setTimeout(debouncedTrigger, 100);
|
|
231
|
+
}}
|
|
232
|
+
onUploadImg={async (files, callback) => {
|
|
233
|
+
let ext: string;
|
|
234
|
+
const matches = files[0].type.match(/^image\/(png|jpg|jpeg|gif)$/i);
|
|
235
|
+
if (matches) {
|
|
236
|
+
[, ext] = matches;
|
|
237
|
+
} else if (files[0].type === 'application/x-zip-compressed') {
|
|
238
|
+
ext = 'zip';
|
|
239
|
+
}
|
|
240
|
+
if (!ext) return i18n('No Supported file type.');
|
|
241
|
+
const filename = `${nanoid()}.${ext}`;
|
|
242
|
+
await uploadFiles(uploadCfg?.endpoint || '/file', [files[0]], {
|
|
243
|
+
type: uploadCfg?.type,
|
|
244
|
+
filenameCallback: () => filename,
|
|
245
|
+
}).then(() => {
|
|
246
|
+
callback([`${useFileProtocol ? 'file://' : `/file/${UserContext._id}/`}${filename}`]);
|
|
247
|
+
}).catch(() => {
|
|
248
|
+
callback([]);
|
|
249
|
+
});
|
|
250
|
+
return null;
|
|
251
|
+
}}
|
|
252
|
+
/>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
this.valueCache = value;
|
|
256
|
+
|
|
257
|
+
this.reactRoot = ReactDOM.createRoot(ele);
|
|
258
|
+
this.reactRoot.render(<EditorComponent />);
|
|
259
|
+
$dom.hide();
|
|
260
|
+
origin.parentElement.appendChild(ele);
|
|
261
|
+
this.isValid = true;
|
|
262
|
+
if (hasFocus) this.focus();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
destroy() {
|
|
266
|
+
this.detach();
|
|
267
|
+
if (this.reactRoot) this.reactRoot.unmount();
|
|
268
|
+
else if (this.editor?.dispose) this.editor.dispose();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
ensureValid() {
|
|
272
|
+
if (!this.isValid) throw new Error('Editor is not loaded');
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
value(val?: string) {
|
|
276
|
+
this.ensureValid();
|
|
277
|
+
if (typeof val === 'string') {
|
|
278
|
+
if (this.editor) return this.editor.setValue(val);
|
|
279
|
+
this.setMarkdownEditorValue?.(val);
|
|
280
|
+
this.markdownEditor?.resetHistory?.();
|
|
281
|
+
}
|
|
282
|
+
if (this.editor) return this.editor.getValue({ lineEnding: '\n', preserveBOM: false });
|
|
283
|
+
return this.valueCache;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
focus() {
|
|
287
|
+
this.ensureValid();
|
|
288
|
+
if (!this.editor || !this.model) return;
|
|
289
|
+
this.editor.focus();
|
|
290
|
+
const range = this.model.getFullModelRange();
|
|
291
|
+
this.editor.setPosition({ lineNumber: range.endLineNumber, column: range.endColumn });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'md-editor-rt/lib/style.css';
|
|
2
|
+
|
|
3
|
+
import zh_TW from '@vavt/cm-extension/dist/locale/zh-TW';
|
|
4
|
+
import Anchor from 'markdown-it-anchor';
|
|
5
|
+
import Footnote from 'markdown-it-footnote';
|
|
6
|
+
import Mark from 'markdown-it-mark';
|
|
7
|
+
import MergeCells from 'markdown-it-merge-cells';
|
|
8
|
+
import TOC from 'markdown-it-table-of-contents';
|
|
9
|
+
import { config, MdEditor } from 'md-editor-rt';
|
|
10
|
+
import Imsize from '../../backendlib/markdown-it-imsize';
|
|
11
|
+
import katex from '../../backendlib/markdown-it-katex';
|
|
12
|
+
import { Media } from '../../backendlib/markdown-it-media';
|
|
13
|
+
import { xssProtector } from '../../backendlib/markdown-it-xss';
|
|
14
|
+
|
|
15
|
+
const pagename = document.documentElement.getAttribute('data-page');
|
|
16
|
+
const previewConfig: Record<string, string> = {
|
|
17
|
+
problem_edit: './file/',
|
|
18
|
+
homework_edit: './file/public/',
|
|
19
|
+
contest_edit: './file/public/',
|
|
20
|
+
};
|
|
21
|
+
const isCreatePage = ['problem_create', 'homework_create', 'contest_create'].includes(pagename);
|
|
22
|
+
const filePreviewPrefix = previewConfig[pagename] || (isCreatePage ? `/file/${UserContext._id}/` : null);
|
|
23
|
+
|
|
24
|
+
config({
|
|
25
|
+
markdownItConfig(mdit) {
|
|
26
|
+
mdit.options.html = true;
|
|
27
|
+
mdit.options.linkify = true;
|
|
28
|
+
mdit.linkify.tlds('.py', false);
|
|
29
|
+
mdit.linkify.tlds('.zip', false);
|
|
30
|
+
mdit.linkify.tlds('.mov', false);
|
|
31
|
+
mdit.use(Media);
|
|
32
|
+
mdit.use(Footnote);
|
|
33
|
+
mdit.use(Mark);
|
|
34
|
+
mdit.use(Imsize);
|
|
35
|
+
mdit.use(Anchor);
|
|
36
|
+
mdit.use(TOC);
|
|
37
|
+
mdit.use(MergeCells);
|
|
38
|
+
mdit.use(xssProtector);
|
|
39
|
+
mdit.use(katex);
|
|
40
|
+
if (filePreviewPrefix) {
|
|
41
|
+
mdit.core.ruler.before('normalize', 'xss', (state) => {
|
|
42
|
+
state.src = state.src.replace(/file:\/\//g, filePreviewPrefix);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
markdownItPlugins() {
|
|
47
|
+
// disable all default plugins
|
|
48
|
+
return [];
|
|
49
|
+
},
|
|
50
|
+
codeMirrorExtensions(extensions) {
|
|
51
|
+
return extensions.filter((i) => i.type !== 'linkShortener');
|
|
52
|
+
},
|
|
53
|
+
editorConfig: {
|
|
54
|
+
languageUserDefined: {
|
|
55
|
+
'zh-TW': zh_TW,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export { MdEditor };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
|
2
|
+
import Editor from './index';
|
|
3
|
+
|
|
4
|
+
export default class TextareaHandler extends DOMAttachedObject {
|
|
5
|
+
static DOMAttachKey = 'vjTextareaHandlerInstance';
|
|
6
|
+
|
|
7
|
+
getCmEditor() {
|
|
8
|
+
return Editor.get(this.$dom);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
isCmEditor() {
|
|
12
|
+
const editor = this.getCmEditor();
|
|
13
|
+
return !!(editor && editor.isValid);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
val(...argv) {
|
|
17
|
+
if (this.isCmEditor()) {
|
|
18
|
+
return this.getCmEditor().value(...argv);
|
|
19
|
+
}
|
|
20
|
+
return this.$dom.val(...argv);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
focus() {
|
|
24
|
+
if (this.isCmEditor()) {
|
|
25
|
+
this.getCmEditor().focus();
|
|
26
|
+
}
|
|
27
|
+
this.$dom.focus();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
$footer-extra-link-gap = 20px
|
|
2
|
+
|
|
3
|
+
.footer
|
|
4
|
+
background: $footer-bg-color
|
|
5
|
+
color: $text-1-color
|
|
6
|
+
|
|
7
|
+
h1
|
|
8
|
+
font-size: rem($font-size-title)
|
|
9
|
+
|
|
10
|
+
+mobile()
|
|
11
|
+
padding: rem($grid-padding)
|
|
12
|
+
cursor: pointer
|
|
13
|
+
font-size: rem($font-size-secondary)
|
|
14
|
+
|
|
15
|
+
.footer__category
|
|
16
|
+
padding-top: rem(30px)
|
|
17
|
+
padding-bottom: rem(50px)
|
|
18
|
+
|
|
19
|
+
+mobile()
|
|
20
|
+
padding-top: rem($grid-padding)
|
|
21
|
+
padding-bottom: rem($grid-padding)
|
|
22
|
+
border-bottom: 1px solid darken($footer-bg-color, 5%)
|
|
23
|
+
|
|
24
|
+
&.expandable
|
|
25
|
+
padding: 0
|
|
26
|
+
|
|
27
|
+
.expand-icon
|
|
28
|
+
display: none
|
|
29
|
+
|
|
30
|
+
+mobile()
|
|
31
|
+
display: inline-block
|
|
32
|
+
|
|
33
|
+
&.expanded .expand-icon
|
|
34
|
+
transform: rotate(180deg)
|
|
35
|
+
|
|
36
|
+
.footer__category__list
|
|
37
|
+
margin-top: rem(10px)
|
|
38
|
+
margin-bottom: rem(10px)
|
|
39
|
+
font-size: rem($font-size-small)
|
|
40
|
+
line-height: 2
|
|
41
|
+
|
|
42
|
+
+mobile()
|
|
43
|
+
margin-top: 0
|
|
44
|
+
padding-left: rem($grid-padding)
|
|
45
|
+
padding-right: rem($grid-padding)
|
|
46
|
+
|
|
47
|
+
.footer__category__expander
|
|
48
|
+
+mobile()
|
|
49
|
+
display: none
|
|
50
|
+
|
|
51
|
+
+above(rupture.mobile-cutoff)
|
|
52
|
+
display: block !important
|
|
53
|
+
|
|
54
|
+
.footer__extra-left
|
|
55
|
+
float: left
|
|
56
|
+
|
|
57
|
+
.footer__extra-right
|
|
58
|
+
float: right
|
|
59
|
+
|
|
60
|
+
.footer__extra-link
|
|
61
|
+
padding: rem(20px 0)
|
|
62
|
+
font-size: rem($font-size-small)
|
|
63
|
+
|
|
64
|
+
.footer__extra-link-item
|
|
65
|
+
float: left
|
|
66
|
+
line-height: 2
|
|
67
|
+
|
|
68
|
+
.footer__extra-left .footer__extra-link-item
|
|
69
|
+
margin-right: rem($footer-extra-link-gap)
|
|
70
|
+
|
|
71
|
+
.footer__extra-right .footer__extra-link-item
|
|
72
|
+
margin-left: rem($footer-extra-link-gap)
|
|
73
|
+
|
|
74
|
+
.layout--immersive
|
|
75
|
+
.footer
|
|
76
|
+
background: none
|
|
77
|
+
color: #FFF
|
|
78
|
+
|
|
79
|
+
a, a:visited, a:active
|
|
80
|
+
color: #FFF
|
|
81
|
+
|
|
82
|
+
a:hover
|
|
83
|
+
color: #FFF
|
|
84
|
+
|
|
85
|
+
+mobile()
|
|
86
|
+
.footer__extra-left, .footer__extra-right
|
|
87
|
+
float: none
|
|
88
|
+
display: block
|
|
89
|
+
|
|
90
|
+
.footer__extra-link-item
|
|
91
|
+
float: none
|
|
92
|
+
display: inline-block
|
|
93
|
+
margin-left: 0
|
|
94
|
+
margin-right: $footer-extra-link-gap
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import responsiveCutoff from 'vj/breakpoints.json';
|
|
3
|
+
import { AutoloadPage } from 'vj/misc/Page';
|
|
4
|
+
import { isBelow } from 'vj/utils/mediaQuery';
|
|
5
|
+
import { slideDown, slideUp } from 'vj/utils/slide';
|
|
6
|
+
|
|
7
|
+
const footerPage = new AutoloadPage('footerPage', () => {
|
|
8
|
+
if (!$('.footer').length) return;
|
|
9
|
+
$('.footer__category.expandable > h1').on('click', async (ev) => {
|
|
10
|
+
if (!isBelow(responsiveCutoff.mobile)) return;
|
|
11
|
+
const $category = $(ev.currentTarget).closest('.footer__category');
|
|
12
|
+
const $list = $category.find('.footer__category__expander');
|
|
13
|
+
if ($category.hasClass('animating')) return;
|
|
14
|
+
$category.addClass('animating');
|
|
15
|
+
if ($category.hasClass('expanded')) {
|
|
16
|
+
$category.removeClass('expanded');
|
|
17
|
+
await slideUp($list, 300, { opacity: 1 }, { opacity: 0 });
|
|
18
|
+
} else {
|
|
19
|
+
$category.addClass('expanded');
|
|
20
|
+
await slideDown($list, 300, { opacity: 0 }, { opacity: 1 });
|
|
21
|
+
}
|
|
22
|
+
$category.removeClass('animating');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default footerPage;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import './var.inc.styl'
|
|
2
|
+
|
|
3
|
+
.button
|
|
4
|
+
&:not(.codicon)
|
|
5
|
+
background-color: lighten($default-color, 50%)
|
|
6
|
+
border: 1px solid $default-color
|
|
7
|
+
transition: background-color .2s, box-shadow .5s
|
|
8
|
+
transition-timing-function: ease-out-sine
|
|
9
|
+
|
|
10
|
+
&, &:visited, &:hover
|
|
11
|
+
&, .typo &
|
|
12
|
+
color: $text-1-color
|
|
13
|
+
|
|
14
|
+
&:not(.disabled)
|
|
15
|
+
&:hover, &:focus
|
|
16
|
+
background-color: darken($default-color, 5%)
|
|
17
|
+
border-color: darken($default-color, 5%)
|
|
18
|
+
box-shadow: 0 4px 15px rgba(darken($default-color, 10%), 0.5)
|
|
19
|
+
|
|
20
|
+
&:focus
|
|
21
|
+
border-color: $input-focus-color
|
|
22
|
+
|
|
23
|
+
&.rounded
|
|
24
|
+
border-radius: rem($form-control-height / 2)
|
|
25
|
+
|
|
26
|
+
&.primary
|
|
27
|
+
border-color: $primary-color
|
|
28
|
+
background-color: $primary-color
|
|
29
|
+
|
|
30
|
+
&, &:visited, &:hover
|
|
31
|
+
&, .typo &
|
|
32
|
+
color: #FFF
|
|
33
|
+
|
|
34
|
+
&:not(.disabled)
|
|
35
|
+
&:hover
|
|
36
|
+
background-color: lighten(saturate($primary-color, 30%), 10%)
|
|
37
|
+
border-color: saturate($primary-color, 70%)
|
|
38
|
+
box-shadow: 0 4px 15px rgba(saturate($primary-color, 70%), 0.3)
|
|
39
|
+
|
|
40
|
+
&.disabled
|
|
41
|
+
cursor: default
|
|
42
|
+
opacity: 0.5
|
|
43
|
+
|
|
44
|
+
.button.inverse
|
|
45
|
+
line-height: rem($form-control-height - 4)
|
|
46
|
+
border: 2px solid #FFF
|
|
47
|
+
background: none
|
|
48
|
+
|
|
49
|
+
&, &:visited
|
|
50
|
+
&, .typo &
|
|
51
|
+
color: #FFF
|
|
52
|
+
|
|
53
|
+
&:not(.disabled)
|
|
54
|
+
&:hover, &:focus
|
|
55
|
+
border-color: $immersive-primary-color
|
|
56
|
+
background: none
|
|
57
|
+
box-shadow: none
|
|
58
|
+
&, .typo &
|
|
59
|
+
color: $immersive-primary-color
|