소스 검색

Migrate "Manage Template" in editor left menu to react (#10609)

This feature is only available on server pro

GitOrigin-RevId: 7fc508c8039c2e3afd1a5fca469fce411e9d913a
M Fahru 3 년 전
부모
커밋
5ae698ec6c

+ 3 - 0
services/web/app/src/Features/Project/ProjectController.js

@@ -1314,6 +1314,9 @@ const ProjectController = {
               gitBridgePublicBaseUrl: Settings.gitBridgePublicBaseUrl,
               gitBridgePublicBaseUrl: Settings.gitBridgePublicBaseUrl,
               wsUrl,
               wsUrl,
               showSupport: Features.hasFeature('support'),
               showSupport: Features.hasFeature('support'),
+              showTemplatesServerPro: Features.hasFeature(
+                'templates-server-pro'
+              ),
               pdfjsVariant: pdfjsAssignment.variant,
               pdfjsVariant: pdfjsAssignment.variant,
               debugPdfDetach,
               debugPdfDetach,
               showLegacySourceEditor,
               showLegacySourceEditor,

+ 1 - 0
services/web/app/views/project/editor/meta.pug

@@ -36,6 +36,7 @@ meta(name="ol-legacyEditorThemes" data-type="json" content=legacyEditorThemes)
 meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
 meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
 meta(name="ol-useOpenTelemetry" data-type="boolean" content=useOpenTelemetry)
 meta(name="ol-useOpenTelemetry" data-type="boolean" content=useOpenTelemetry)
 meta(name="ol-showSupport", data-type="boolean" content=showSupport)
 meta(name="ol-showSupport", data-type="boolean" content=showSupport)
+meta(name="ol-showTemplatesServerPro", data-type="boolean" content=showTemplatesServerPro)
 meta(name="ol-showCM6SwitchAwaySurvey", data-type="boolean" content=showCM6SwitchAwaySurvey)
 meta(name="ol-showCM6SwitchAwaySurvey", data-type="boolean" content=showCM6SwitchAwaySurvey)
 meta(name="ol-richTextVariant" content=richTextVariant)
 meta(name="ol-richTextVariant" content=richTextVariant)
 meta(name="ol-showOnboardingVideoTour", data-type="boolean" content=showOnboardingVideoTour)
 meta(name="ol-showOnboardingVideoTour", data-type="boolean" content=showOnboardingVideoTour)

+ 1 - 0
services/web/config/settings.defaults.js

@@ -794,6 +794,7 @@ module.exports = {
     importProjectFromGithubModalWrapper: [],
     importProjectFromGithubModalWrapper: [],
     importProjectFromGithubMenu: [],
     importProjectFromGithubMenu: [],
     editorLeftMenuSync: [],
     editorLeftMenuSync: [],
+    editorLeftMenuManageTemplate: [],
   },
   },
 
 
   moduleImportSequence: [
   moduleImportSequence: [

+ 11 - 0
services/web/frontend/extracted-translations.json

@@ -600,6 +600,7 @@
   "priority_support": "",
   "priority_support": "",
   "privacy_policy": "",
   "privacy_policy": "",
   "private": "",
   "private": "",
+  "problem_talking_to_publishing_service": "",
   "problem_with_subscription_contact_us": "",
   "problem_with_subscription_contact_us": "",
   "proceed_to_paypal": "",
   "proceed_to_paypal": "",
   "proceeding_to_paypal_takes_you_to_the_paypal_site_to_pay": "",
   "proceeding_to_paypal_takes_you_to_the_paypal_site_to_pay": "",
@@ -610,6 +611,7 @@
   "project_approaching_file_limit": "",
   "project_approaching_file_limit": "",
   "project_flagged_too_many_compiles": "",
   "project_flagged_too_many_compiles": "",
   "project_has_too_many_files": "",
   "project_has_too_many_files": "",
+  "project_last_published_at": "",
   "project_layout_sharing_submission": "",
   "project_layout_sharing_submission": "",
   "project_name": "",
   "project_name": "",
   "project_not_linked_to_github": "",
   "project_not_linked_to_github": "",
@@ -629,7 +631,10 @@
   "projects": "",
   "projects": "",
   "projects_list": "",
   "projects_list": "",
   "public": "",
   "public": "",
+  "publish": "",
+  "publish_as_template": "",
   "publisher_account": "",
   "publisher_account": "",
+  "publishing": "",
   "pull_github_changes_into_sharelatex": "",
   "pull_github_changes_into_sharelatex": "",
   "push_sharelatex_changes_to_github": "",
   "push_sharelatex_changes_to_github": "",
   "raw_logs": "",
   "raw_logs": "",
@@ -672,6 +677,7 @@
   "rename_project": "",
   "rename_project": "",
   "renaming": "",
   "renaming": "",
   "repository_name": "",
   "repository_name": "",
+  "republish": "",
   "resend": "",
   "resend": "",
   "resend_confirmation_email": "",
   "resend_confirmation_email": "",
   "resending_confirmation_email": "",
   "resending_confirmation_email": "",
@@ -799,6 +805,8 @@
   "tags_slash_folders": "",
   "tags_slash_folders": "",
   "take_short_survey": "",
   "take_short_survey": "",
   "template_approved_by_publisher": "",
   "template_approved_by_publisher": "",
+  "template_description": "",
+  "template_title_taken_from_project_title": "",
   "templates": "",
   "templates": "",
   "terminated": "",
   "terminated": "",
   "tex_live_version": "",
   "tex_live_version": "",
@@ -885,6 +893,8 @@
   "unlink_reference": "",
   "unlink_reference": "",
   "unlink_warning_reference": "",
   "unlink_warning_reference": "",
   "unlinking": "",
   "unlinking": "",
+  "unpublish": "",
+  "unpublishing": "",
   "unsubscribe": "",
   "unsubscribe": "",
   "untrash": "",
   "untrash": "",
   "update": "",
   "update": "",
@@ -911,6 +921,7 @@
   "vat_number": "",
   "vat_number": "",
   "view_all": "",
   "view_all": "",
   "view_hub": "",
   "view_hub": "",
+  "view_in_template_gallery": "",
   "view_logs": "",
   "view_logs": "",
   "view_metrics": "",
   "view_metrics": "",
   "view_pdf": "",
   "view_pdf": "",

+ 12 - 0
services/web/frontend/js/features/editor-left-menu/components/actions-menu.tsx

@@ -1,8 +1,15 @@
+import { ElementType } from 'react'
 import { useTranslation } from 'react-i18next'
 import { useTranslation } from 'react-i18next'
 import getMeta from '../../../utils/meta'
 import getMeta from '../../../utils/meta'
+import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
 import ActionsCopyProject from './actions-copy-project'
 import ActionsCopyProject from './actions-copy-project'
 import ActionsWordCount from './actions-word-count'
 import ActionsWordCount from './actions-word-count'
 
 
+const components = importOverleafModules('editorLeftMenuManageTemplate') as {
+  import: { default: ElementType }
+  path: string
+}[]
+
 export default function ActionsMenu() {
 export default function ActionsMenu() {
   const { t } = useTranslation()
   const { t } = useTranslation()
   const anonymous = getMeta('ol-anonymous') as boolean | undefined
   const anonymous = getMeta('ol-anonymous') as boolean | undefined
@@ -18,6 +25,11 @@ export default function ActionsMenu() {
         <li>
         <li>
           <ActionsCopyProject />
           <ActionsCopyProject />
         </li>
         </li>
+        {components.map(({ import: { default: Component }, path }) => (
+          <li key={path}>
+            <Component />
+          </li>
+        ))}
         <li>
         <li>
           <ActionsWordCount />
           <ActionsWordCount />
         </li>
         </li>