Просмотр исходного кода

remove feature convert to pdf file

yusuketk 5 лет назад
Родитель
Сommit
d816c6213b

+ 5 - 20
src/client/js/components/Page/PageShareManagement.jsx

@@ -26,25 +26,14 @@ const PageShareManagement = (props) => {
     setIsOutsideShareLinkModalShown(false);
   }
 
-  async function exportPageHundler(type) {
+  async function exportPageHundler() {
     const { pageId, revisionId } = pageContainer.state;
     try {
-      const axios = require('axios').create({
-        responseType: 'arraybuffer',
-      });
-
-      const { data } = await axios.get('/_api/v3/page/export', {
-        params:
-          {
-            pageId,
-            revisionId,
-            type,
-          },
-      });
-      const blob = new Blob([data]);
+      const { data } = await appContainer.apiv3Get('/page/export', { pageId, revisionId });
+      const blob = new Blob([data.markdown]);
       const link = document.createElement('a');
       link.href = window.URL.createObjectURL(blob);
-      link.download = `${revisionId}.${type}`;
+      link.download = `${revisionId}.md`;
       link.click();
       link.remove();
     }
@@ -68,7 +57,6 @@ const PageShareManagement = (props) => {
     );
   }
 
-
   function renderCurrentUser() {
     return (
       <>
@@ -108,12 +96,9 @@ const PageShareManagement = (props) => {
           <i className="icon-fw icon-link"></i>{t('share_links.Shere this page link to public')}
           <span className="ml-2 badge badge-info badge-pill">{pageContainer.state.shareLinksNumber}</span>
         </button>
-        <button type="button" className="dropdown-item" onClick={() => { exportPageHundler('md') }}>
+        <button type="button" className="dropdown-item" onClick={() => { exportPageHundler() }}>
           <span>{t('export_bulk.export_page_markdown')}</span>
         </button>
-        <button type="button" className="dropdown-item" onClick={() => { exportPageHundler('pdf') }}>
-          <span>{t('export_bulk.export_page_pdf')}</span>
-        </button>
       </div>
       {renderModals()}
     </>

+ 2 - 0
src/server/routes/apiv3/page.js

@@ -215,6 +215,7 @@ module.exports = (crowi) => {
         return res.apiv3Err(new ErrorV3(`Haven't the right to see the page ${pageId}.`), 403);
       }
 
+
       let revisionIdForFind;
       if (revisionId == null) {
         const Page = crowi.model('Page');
@@ -227,6 +228,7 @@ module.exports = (crowi) => {
 
       const Revision = crowi.model('Revision');
       const revision = await Revision.findById(revisionIdForFind);
+      
       const markdown = revision.body;
 
       return res.apiv3({ markdown });