From 1d874aa1891f6845b08ccd29e8471ffa72e4975f Mon Sep 17 00:00:00 2001 From: reiji-h Date: Thu, 28 Nov 2024 09:43:50 +0000 Subject: [PATCH 01/46] change className to class --- apps/app/public/static/locales/en_US/translation.json | 4 ++-- apps/app/public/static/locales/fr_FR/translation.json | 4 ++-- apps/app/public/static/locales/ja_JP/translation.json | 4 ++-- apps/app/public/static/locales/zh_CN/translation.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/app/public/static/locales/en_US/translation.json b/apps/app/public/static/locales/en_US/translation.json index 9481d802cbf..91e5c88482c 100644 --- a/apps/app/public/static/locales/en_US/translation.json +++ b/apps/app/public/static/locales/en_US/translation.json @@ -117,7 +117,7 @@ "Create under": "Create page under below:", "V5 Page Migration": "Convert To V5 Compatibility", "GROWI.5.0_new_schema": "GROWI.5.0 new schema", - "See_more_detail_on_new_schema": "See more detail on {{title}} external_link ", + "See_more_detail_on_new_schema": "See more detail on {{title}} external_link ", "external_account_management": "External Account Management", "UserGroup": "UserGroup", "Basic Settings": "Basic Settings", @@ -615,7 +615,7 @@ "alert_desc1": "On this page, you can select pages with the checkbox and batch convert to the new v5 compatible format from the \"Bulk operation\" button at the top of the screen.", "nopages_title": "Congratulations. Ready to use GROWI v5!", "nopages_desc1": "Now all the pages you can manage seem to be in v5 compatible format.", - "detail_info": "See the detail information from Upgrading GROWI to v5.0.x external_link.", + "detail_info": "See the detail information from Upgrading GROWI to v5.0.x external_link.", "modal": { "title": "Convert to new v5 compatible format", "converting_pages": "Converting pages", diff --git a/apps/app/public/static/locales/fr_FR/translation.json b/apps/app/public/static/locales/fr_FR/translation.json index bb0d0686ba2..d753fb02981 100644 --- a/apps/app/public/static/locales/fr_FR/translation.json +++ b/apps/app/public/static/locales/fr_FR/translation.json @@ -117,7 +117,7 @@ "Create under": "Créer la page sous:", "V5 Page Migration": "Convertir vers la V5", "GROWI.5.0_new_schema": "Nouveau schéma GROWI.5.0", - "See_more_detail_on_new_schema": "Plus de détails sur {{title}} ", + "See_more_detail_on_new_schema": "Plus de détails sur {{title}}external_link ", "external_account_management": "Gestion des comptes externes", "UserGroup": "Groupe utilisateur", "Basic Settings": "Paramètres de base", @@ -608,7 +608,7 @@ "alert_desc1": "Sélectionner les pages à convertir vers le format V5 avec le bouton \"Opération de masse\".", "nopages_title": "GROWI V5 est maintenant utilisable!", "nopages_desc1": "Toutes les pages ont été converties au format V5.", - "detail_info": "Pour plus de détails, voir Convertir vers GROWI v5.0.x external_link.", + "detail_info": "Pour plus de détails, voir Convertir vers GROWI v5.0.x external_link.", "modal": { "title": "Convertir au format V5", "converting_pages": "Conversion des pages", diff --git a/apps/app/public/static/locales/ja_JP/translation.json b/apps/app/public/static/locales/ja_JP/translation.json index dc7c3021ed9..89e6bd0b190 100644 --- a/apps/app/public/static/locales/ja_JP/translation.json +++ b/apps/app/public/static/locales/ja_JP/translation.json @@ -116,7 +116,7 @@ "Create under": "ページを以下に作成", "V5 Page Migration": "V5 互換形式 への変換", "GROWI.5.0_new_schema": "GROWI.5.0における新スキーマについて", - "See_more_detail_on_new_schema": "詳しくは{{title}}external_linkを参照ください。", + "See_more_detail_on_new_schema": "詳しくは{{title}}external_linkを参照ください。", "external_account_management": "外部アカウント管理", "UserGroup": "グループ", "Basic Settings": "基本設定", @@ -647,7 +647,7 @@ "alert_desc1": "このページでは、チェックボックスでページを選択し、画面上部の「一括操作」ボタンから新しい v5 互換形式に一括変換できます。", "nopages_title": "おめでとうございます。GROWI v5 を使う準備が完了しました!", "nopages_desc1": "今あなたが管理可能なページはすべて v5 互換形式になっているようです。", - "detail_info": "詳しくは GROWI v5.0.x へのアップグレード external_link を参照ください。", + "detail_info": "詳しくは GROWI v5.0.x へのアップグレード external_link を参照ください。", "modal": { "title": "新しい v5 互換形式への変換", "converting_pages": "以下のページを変換します", diff --git a/apps/app/public/static/locales/zh_CN/translation.json b/apps/app/public/static/locales/zh_CN/translation.json index 3a3fb1e8e42..b64af72f5b1 100644 --- a/apps/app/public/static/locales/zh_CN/translation.json +++ b/apps/app/public/static/locales/zh_CN/translation.json @@ -122,7 +122,7 @@ "Create under": "Create page under below:", "V5 Page Migration": "转换为V5的兼容性", "GROWI.5.0_new_schema": "GROWI.5.0 new schema", - "See_more_detail_on_new_schema": "更多详情请见 {{title}} external_link ", + "See_more_detail_on_new_schema": "更多详情请见 {{title}} external_link ", "Markdown Settings": "Markdown设置", "external_account_management": "外部账户管理", "UserGroup": "用户组", @@ -617,7 +617,7 @@ "alert_desc1": "在这一页,你可以用复选框选择页面,并通过屏幕上方的批量操作按钮批量转换为新的v5兼容格式。", "nopages_title": "恭喜你。准备使用GROWI v5!", "nopages_desc1": "现在你能管理的所有页面似乎都是v5兼容的格式。", - "detail_info": "请参见 升级GROWI到v5.0.x external_link.的详细内容。", + "detail_info": "请参见 升级GROWI到v5.0.x external_link.的详细内容。", "modal": { "title": "转换为新的v5兼容格式", "converting_pages": "转换页面", From 1e0c75d4da595732651a51c1568b0b3f76af5b48 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 01:50:00 +0000 Subject: [PATCH 02/46] Install rehype-stringify --- apps/app/package.json | 1 + pnpm-lock.yaml | 106 +++++++++++++++++++++++++++--------------- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/apps/app/package.json b/apps/app/package.json index ffbd501e4dd..44ddf9ec064 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -200,6 +200,7 @@ "rehype-raw": "^7.0.0", "rehype-sanitize": "^6.0.0", "rehype-slug": "^6.0.0", + "rehype-stringify": "^10.0.1", "rehype-toc": "^3.0.2", "remark-breaks": "^4.0.0", "remark-directive": "^3.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77af8f0cea0..6f96108f05e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -606,6 +606,9 @@ importers: rehype-slug: specifier: ^6.0.0 version: 6.0.0 + rehype-stringify: + specifier: ^10.0.1 + version: 10.0.1 rehype-toc: specifier: ^3.0.2 version: 3.0.2 @@ -7292,6 +7295,9 @@ packages: hast-util-select@6.0.2: resolution: {integrity: sha512-hT/SD/d/Meu+iobvgkffo1QecV8WeKWxwsNMzcTJsKw1cKTQKSR/7ArJeURLNJF9HDjp9nVoORyNNJxrvBye8Q==} + hast-util-to-html@9.0.3: + resolution: {integrity: sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==} + hast-util-to-jsx-runtime@2.3.0: resolution: {integrity: sha512-H/y0+IWPdsLLS738P8tDnrQ8Z+dj12zQQ6WC11TIM21C8WFVoIxcqWXf2H3hiTVZjF1AWqoimGwrTWecWrnmRQ==} @@ -10229,6 +10235,9 @@ packages: rehype-slug@6.0.0: resolution: {integrity: sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A==} + rehype-stringify@10.0.1: + resolution: {integrity: sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==} + rehype-toc@3.0.2: resolution: {integrity: sha512-DMt376+4i1KJGgHJL7Ezd65qKkJ7Eqp6JSB47BJ90ReBrohI9ufrornArM6f4oJjP2E2DVZZHufWucv/9t7GUQ==} engines: {node: '>=10'} @@ -12268,6 +12277,9 @@ packages: zwitch@2.0.2: resolution: {integrity: sha512-JZxotl7SxAJH0j7dN4pxsTV6ZLXoLdGME+PsjkL/DaBrVryK9kTGq06GfKrwcSOqypP+fdXGoCHE36b99fWVoA==} + zwitch@2.0.4: + resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} + snapshots: '@adobe/css-tools@4.4.0': {} @@ -13389,7 +13401,7 @@ snapshots: '@babel/traverse': 7.24.6 '@babel/types': 7.25.6 convert-source-map: 2.0.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -13580,7 +13592,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.6 '@babel/parser': 7.25.6 '@babel/types': 7.25.6 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -14085,7 +14097,7 @@ snapshots: '@elastic/elasticsearch@7.17.13': dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) hpagent: 0.1.2 ms: 2.1.3 secure-json-parse: 2.7.0 @@ -14101,7 +14113,7 @@ snapshots: '@elastic/transport@8.6.1': dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) hpagent: 1.2.0 ms: 2.1.3 secure-json-parse: 2.7.0 @@ -14212,7 +14224,7 @@ snapshots: '@eslint/eslintrc@2.0.3': dependencies: ajv: 6.12.6 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.1 @@ -14285,7 +14297,7 @@ snapshots: '@humanwhocodes/config-array@0.11.8': dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -14301,7 +14313,7 @@ snapshots: '@antfu/install-pkg': 0.4.1 '@antfu/utils': 0.7.10 '@iconify/types': 2.0.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.5.0 mlly: 1.7.1 @@ -15760,7 +15772,7 @@ snapshots: '@swc-node/sourcemap-support': 0.5.0 '@swc/core': 1.5.25(@swc/helpers@0.5.11) colorette: 2.0.20 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) pirates: 4.0.6 tslib: 2.8.0 typescript: 5.4.2 @@ -16361,7 +16373,7 @@ snapshots: '@typescript-eslint/scope-manager': 5.59.7 '@typescript-eslint/type-utils': 5.59.7(eslint@8.41.0)(typescript@5.4.2) '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@5.4.2) - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) eslint: 8.41.0 grapheme-splitter: 1.0.4 ignore: 5.3.1 @@ -16391,7 +16403,7 @@ snapshots: '@typescript-eslint/scope-manager': 5.59.7 '@typescript-eslint/types': 5.59.7 '@typescript-eslint/typescript-estree': 5.59.7(typescript@5.4.2) - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) eslint: 8.41.0 optionalDependencies: typescript: 5.4.2 @@ -16420,7 +16432,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 5.59.7(typescript@5.4.2) '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@5.4.2) - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) eslint: 8.41.0 tsutils: 3.21.0(typescript@5.4.2) optionalDependencies: @@ -16449,7 +16461,7 @@ snapshots: dependencies: '@typescript-eslint/types': 5.59.7 '@typescript-eslint/visitor-keys': 5.59.7 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.3 @@ -16835,13 +16847,13 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color agent-base@7.1.1: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -17915,7 +17927,7 @@ snapshots: connect-mongo@4.6.0(express-session@1.18.0)(mongodb@4.17.2(@aws-sdk/client-sso-oidc@3.600.0)): dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) express-session: 1.18.0 kruptein: 3.0.6 mongodb: 4.17.2(@aws-sdk/client-sso-oidc@3.600.0) @@ -18395,10 +18407,6 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.3.7: - dependencies: - ms: 2.1.3 - debug@4.3.7(supports-color@5.5.0): dependencies: ms: 2.1.3 @@ -18693,7 +18701,7 @@ snapshots: engine.io-client@6.6.2: dependencies: '@socket.io/component-emitter': 3.1.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) engine.io-parser: 5.2.3 ws: 8.17.1 xmlhttprequest-ssl: 2.1.2 @@ -18713,7 +18721,7 @@ snapshots: base64id: 2.0.0 cookie: 0.7.2 cors: 2.8.5 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) engine.io-parser: 5.2.3 ws: 8.17.1 transitivePeerDependencies: @@ -19159,7 +19167,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.0 @@ -19499,7 +19507,7 @@ snapshots: follow-redirects@1.15.9(debug@4.3.7): optionalDependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) follow-redirects@1.5.10: dependencies: @@ -20005,6 +20013,20 @@ snapshots: unist-util-visit: 5.0.0 zwitch: 2.0.2 + hast-util-to-html@9.0.3: + dependencies: + '@types/hast': 3.0.4 + '@types/unist': 3.0.3 + ccount: 2.0.1 + comma-separated-tokens: 2.0.2 + hast-util-whitespace: 3.0.0 + html-void-elements: 3.0.0 + mdast-util-to-hast: 13.2.0 + property-information: 6.1.1 + space-separated-tokens: 2.0.1 + stringify-entities: 4.0.4 + zwitch: 2.0.4 + hast-util-to-jsx-runtime@2.3.0: dependencies: '@types/estree': 1.0.6 @@ -20147,14 +20169,14 @@ snapshots: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.1 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -20177,14 +20199,14 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color https-proxy-agent@7.0.5: dependencies: agent-base: 7.1.1 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -20543,7 +20565,7 @@ snapshots: istanbul-lib-source-maps@4.0.1: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -21942,7 +21964,7 @@ snapshots: micromark@4.0.0: dependencies: '@types/debug': 4.1.7 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.1 @@ -22105,7 +22127,7 @@ snapshots: dependencies: async-mutex: 0.4.1 camelcase: 6.3.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) find-cache-dir: 3.3.2 follow-redirects: 1.15.9(debug@4.3.7) https-proxy-agent: 7.0.5 @@ -22213,7 +22235,7 @@ snapshots: mquery@4.0.3: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -22303,7 +22325,7 @@ snapshots: new-find-package-json@2.0.0: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -22834,7 +22856,7 @@ snapshots: passport-saml@3.2.4: dependencies: '@xmldom/xmldom': 0.7.13 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) passport-strategy: 1.0.0 xml-crypto: 2.1.5 xml-encryption: 2.0.0 @@ -23640,6 +23662,12 @@ snapshots: hast-util-to-string: 3.0.1 unist-util-visit: 5.0.0 + rehype-stringify@10.0.1: + dependencies: + '@types/hast': 3.0.4 + hast-util-to-html: 9.0.3 + unified: 11.0.5 + rehype-toc@3.0.2: dependencies: '@jsdevtools/rehype-toc': 3.0.2 @@ -23821,7 +23849,7 @@ snapshots: retry-request@4.2.2: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) extend: 3.0.2 transitivePeerDependencies: - supports-color @@ -24211,7 +24239,7 @@ snapshots: socket.io-adapter@2.5.5: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) ws: 8.17.1 transitivePeerDependencies: - bufferutil @@ -24221,7 +24249,7 @@ snapshots: socket.io-client@4.8.1: dependencies: '@socket.io/component-emitter': 3.1.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) engine.io-client: 6.6.2 socket.io-parser: 4.2.4 transitivePeerDependencies: @@ -24232,7 +24260,7 @@ snapshots: socket.io-parser@4.2.4: dependencies: '@socket.io/component-emitter': 3.1.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -24241,7 +24269,7 @@ snapshots: accepts: 1.3.8 base64id: 2.0.0 cors: 2.8.5 - debug: 4.3.7 + debug: 4.3.7(supports-color@5.5.0) engine.io: 6.6.2 socket.io-adapter: 2.5.5 socket.io-parser: 4.2.4 @@ -26037,3 +26065,5 @@ snapshots: zwitch@1.0.5: {} zwitch@2.0.2: {} + + zwitch@2.0.4: {} From 95eb6ec6ccb5e079b4db68abf4a315fa663724d7 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 01:50:38 +0000 Subject: [PATCH 03/46] Install rehype-meta --- apps/app/package.json | 1 + pnpm-lock.yaml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/apps/app/package.json b/apps/app/package.json index 44ddf9ec064..592d97fd22c 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -197,6 +197,7 @@ "reconnecting-websocket": "^4.4.0", "redis": "^3.0.2", "rehype-katex": "^7.0.1", + "rehype-meta": "^4.0.1", "rehype-raw": "^7.0.0", "rehype-sanitize": "^6.0.0", "rehype-slug": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6f96108f05e..40507391d88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -597,6 +597,9 @@ importers: rehype-katex: specifier: ^7.0.1 version: 7.0.1 + rehype-meta: + specifier: ^4.0.1 + version: 4.0.1 rehype-raw: specifier: ^7.0.0 version: 7.0.0 @@ -7271,6 +7274,9 @@ packages: hast-util-from-parse5@8.0.1: resolution: {integrity: sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==} + hast-util-from-selector@3.0.1: + resolution: {integrity: sha512-CA2dwcsAS6a7DNZq8HT5fNP4FzUq2PUpQpKnAtOCmfTk429jR0RtasLSMlFA1FNKd8lgfeCIAFl3/vD95be8Lg==} + hast-util-has-property@3.0.0: resolution: {integrity: sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==} @@ -7319,6 +7325,9 @@ packages: hastscript@8.0.0: resolution: {integrity: sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==} + hastscript@9.0.0: + resolution: {integrity: sha512-jzaLBGavEDKHrc5EfFImKN7nZKKBdSLIdGvCwDZ9TfzbF2ffXiov8CKE445L2Z1Ek2t/m4SKQ2j6Ipv7NyUolw==} + he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true @@ -10222,6 +10231,9 @@ packages: rehype-katex@7.0.1: resolution: {integrity: sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==} + rehype-meta@4.0.1: + resolution: {integrity: sha512-nLwA17+GbtBYi3C1KSrFR8JlqXv76mz185U//xDEAYgzE3g/bSD6WKSXva1W95ttzouUCJwA09X3AQZIi3R+Nw==} + rehype-raw@7.0.0: resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==} @@ -19954,6 +19966,13 @@ snapshots: vfile-location: 5.0.3 web-namespaces: 2.0.1 + hast-util-from-selector@3.0.1: + dependencies: + '@types/hast': 3.0.4 + css-selector-parser: 3.0.5 + devlop: 1.1.0 + hastscript: 9.0.0 + hast-util-has-property@3.0.0: dependencies: '@types/hast': 3.0.4 @@ -20088,6 +20107,14 @@ snapshots: property-information: 6.1.1 space-separated-tokens: 2.0.1 + hastscript@9.0.0: + dependencies: + '@types/hast': 3.0.4 + comma-separated-tokens: 2.0.2 + hast-util-parse-selector: 4.0.0 + property-information: 6.1.1 + space-separated-tokens: 2.0.1 + he@1.2.0: {} header-case@2.0.4: @@ -23637,6 +23664,14 @@ snapshots: unist-util-visit-parents: 6.0.1 vfile: 6.0.3 + rehype-meta@4.0.1: + dependencies: + '@types/hast': 3.0.4 + hast-util-from-selector: 3.0.1 + hast-util-select: 6.0.2 + hastscript: 9.0.0 + vfile: 6.0.3 + rehype-raw@7.0.0: dependencies: '@types/hast': 3.0.4 From f87304f15b7e243c94daf9b6b7acd84a9ad09bad Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 02:46:47 +0000 Subject: [PATCH 04/46] Modified markdown to html conversion logic --- .../features/openai/server/services/openai.ts | 16 +++-- .../openai/server/utils/sanitize-markdown.ts | 65 +++++++++++++++---- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/apps/app/src/features/openai/server/services/openai.ts b/apps/app/src/features/openai/server/services/openai.ts index 608f6576278..ecd3d0ed9c3 100644 --- a/apps/app/src/features/openai/server/services/openai.ts +++ b/apps/app/src/features/openai/server/services/openai.ts @@ -2,6 +2,7 @@ import assert from 'node:assert'; import { Readable, Transform } from 'stream'; import { pipeline } from 'stream/promises'; +import type { IPagePopulatedToShowRevision } from '@growi/core'; import { PageGrant, isPopulated } from '@growi/core'; import type { HydratedDocument, Types } from 'mongoose'; import mongoose from 'mongoose'; @@ -20,7 +21,7 @@ import { createBatchStream } from '~/server/util/batch-stream'; import loggerFactory from '~/utils/logger'; import { OpenaiServiceTypes } from '../../interfaces/ai'; -import { sanitizeMarkdown } from '../utils/sanitize-markdown'; +import { convertMarkdownToHtml } from '../utils/sanitize-markdown'; import { getClient } from './client-delegator'; // import { splitMarkdownIntoChunks } from './markdown-splitter/markdown-token-splitter'; @@ -157,9 +158,10 @@ class OpenaiService implements IOpenaiService { // } // } - private async uploadFile(pageId: Types.ObjectId, body: string): Promise { - const sanitizedMarkdown = await sanitizeMarkdown(body); - const file = await toFile(Readable.from(sanitizedMarkdown), `${pageId}.md`); + private async uploadFile(page: HydratedDocument | IPagePopulatedToShowRevision): Promise { + const convertedHtml = await convertMarkdownToHtml(page); + console.log('convertedHtml', convertedHtml); + const file = await toFile(Readable.from(convertedHtml), `${page._id}.html`); const uploadedFile = await this.client.uploadFile(file); return uploadedFile; } @@ -183,17 +185,17 @@ class OpenaiService implements IOpenaiService { async createVectorStoreFile(pages: Array>): Promise { const vectorStore = await this.getOrCreateVectorStoreForPublicScope(); const vectorStoreFileRelationsMap: VectorStoreFileRelationsMap = new Map(); - const processUploadFile = async(page: PageDocument) => { + const processUploadFile = async(page: HydratedDocument) => { if (page._id != null && page.grant === PageGrant.GRANT_PUBLIC && page.revision != null) { if (isPopulated(page.revision) && page.revision.body.length > 0) { - const uploadedFile = await this.uploadFile(page._id, page.revision.body); + const uploadedFile = await this.uploadFile(page); prepareVectorStoreFileRelations(vectorStore._id, page._id, uploadedFile.id, vectorStoreFileRelationsMap); return; } const pagePopulatedToShowRevision = await page.populateDataToShowRevision(); if (pagePopulatedToShowRevision.revision != null && pagePopulatedToShowRevision.revision.body.length > 0) { - const uploadedFile = await this.uploadFile(page._id, pagePopulatedToShowRevision.revision.body); + const uploadedFile = await this.uploadFile(pagePopulatedToShowRevision); prepareVectorStoreFileRelations(vectorStore._id, page._id, uploadedFile.id, vectorStoreFileRelationsMap); } } diff --git a/apps/app/src/features/openai/server/utils/sanitize-markdown.ts b/apps/app/src/features/openai/server/utils/sanitize-markdown.ts index f604be5e058..8cea762d2c4 100644 --- a/apps/app/src/features/openai/server/utils/sanitize-markdown.ts +++ b/apps/app/src/features/openai/server/utils/sanitize-markdown.ts @@ -1,48 +1,82 @@ import { dynamicImport } from '@cspell/dynamic-import'; +import { isPopulated } from '@growi/core'; +import type { IPagePopulatedToShowRevision } from '@growi/core/dist/interfaces'; import type { Root, Code } from 'mdast'; +import type { HydratedDocument } from 'mongoose'; +import type * as RehypeMeta from 'rehype-meta'; +import type * as RehypeStringify from 'rehype-stringify'; import type * as RemarkParse from 'remark-parse'; -import type * as RemarkStringify from 'remark-stringify'; +import type * as RemarkRehype from 'remark-rehype'; import type * as Unified from 'unified'; import type * as UnistUtilVisit from 'unist-util-visit'; +import type { PageDocument } from '~/server/models/page'; + + interface ModuleCache { remarkParse?: typeof RemarkParse.default; - remarkStringify?: typeof RemarkStringify.default; unified?: typeof Unified.unified; visit?: typeof UnistUtilVisit.visit; + remarkRehype?: typeof RemarkRehype.default; + rehypeMeta?: typeof RehypeMeta.default; + rehypeStringify?: typeof RehypeStringify.default; } let moduleCache: ModuleCache = {}; const initializeModules = async(): Promise => { - if (moduleCache.remarkParse != null && moduleCache.remarkStringify != null && moduleCache.unified != null && moduleCache.visit != null) { + if (moduleCache.remarkParse != null + && moduleCache.unified != null + && moduleCache.visit != null + && moduleCache.remarkRehype != null + && moduleCache.rehypeMeta != null + && moduleCache.rehypeStringify != null + ) { return; } - const [{ default: remarkParse }, { default: remarkStringify }, { unified }, { visit }] = await Promise.all([ + const [ + { default: remarkParse }, + { unified }, { visit }, + { default: remarkRehype }, + { default: rehypeMeta }, + { default: rehypeStringify }, + ] = await Promise.all([ dynamicImport('remark-parse', __dirname), - dynamicImport('remark-stringify', __dirname), dynamicImport('unified', __dirname), dynamicImport('unist-util-visit', __dirname), + dynamicImport('remark-rehype', __dirname), + dynamicImport('rehype-meta', __dirname), + dynamicImport('rehype-stringify', __dirname), ]); moduleCache = { remarkParse, - remarkStringify, unified, visit, + remarkRehype, + rehypeMeta, + rehypeStringify, }; }; -export const sanitizeMarkdown = async(markdown: string): Promise => { +export const convertMarkdownToHtml = async(page: HydratedDocument | IPagePopulatedToShowRevision): Promise => { await initializeModules(); const { - remarkParse, remarkStringify, unified, visit, + remarkParse, + unified, visit, + remarkRehype, + rehypeMeta, + rehypeStringify, } = moduleCache; - - if (remarkParse == null || remarkStringify == null || unified == null || visit == null) { + if (remarkParse == null + || unified == null + || visit == null + || remarkRehype == null + || rehypeMeta == null + || rehypeStringify == null) { throw new Error('Failed to initialize required modules'); } @@ -56,10 +90,17 @@ export const sanitizeMarkdown = async(markdown: string): Promise => { }; }; + + const revisionBody = page.revision != null && isPopulated(page.revision) ? page.revision.body : undefined; + const processor = unified() .use(remarkParse) .use(sanitize) - .use(remarkStringify); + .use(remarkRehype) + .use(rehypeMeta, { + title: page.path, + }) + .use(rehypeStringify); - return processor.processSync(markdown).toString(); + return processor.processSync(revisionBody).toString(); }; From 1b05ae3b1b601c12d6725b572faa354b6cac7e02 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 02:50:17 +0000 Subject: [PATCH 05/46] sanitize-markdown.ts -> convert-markdown-to-html.ts --- apps/app/src/features/openai/server/services/openai.ts | 2 +- .../utils/{sanitize-markdown.ts => convert-markdown-to-html.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename apps/app/src/features/openai/server/utils/{sanitize-markdown.ts => convert-markdown-to-html.ts} (100%) diff --git a/apps/app/src/features/openai/server/services/openai.ts b/apps/app/src/features/openai/server/services/openai.ts index ecd3d0ed9c3..7b38351f063 100644 --- a/apps/app/src/features/openai/server/services/openai.ts +++ b/apps/app/src/features/openai/server/services/openai.ts @@ -21,7 +21,7 @@ import { createBatchStream } from '~/server/util/batch-stream'; import loggerFactory from '~/utils/logger'; import { OpenaiServiceTypes } from '../../interfaces/ai'; -import { convertMarkdownToHtml } from '../utils/sanitize-markdown'; +import { convertMarkdownToHtml } from '../utils/convert-markdown-to-html'; import { getClient } from './client-delegator'; // import { splitMarkdownIntoChunks } from './markdown-splitter/markdown-token-splitter'; diff --git a/apps/app/src/features/openai/server/utils/sanitize-markdown.ts b/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts similarity index 100% rename from apps/app/src/features/openai/server/utils/sanitize-markdown.ts rename to apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts From 20ecef066bfa0d03604ab30d1244968fc96e2f23 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 07:29:44 +0000 Subject: [PATCH 06/46] sanitize -> sanitizeMarkdown --- .../features/openai/server/utils/convert-markdown-to-html.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts b/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts index 8cea762d2c4..42e1965b596 100644 --- a/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts +++ b/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts @@ -80,7 +80,7 @@ export const convertMarkdownToHtml = async(page: HydratedDocument throw new Error('Failed to initialize required modules'); } - const sanitize = () => { + const sanitizeMarkdown = () => { return (tree: Root) => { visit(tree, 'code', (node: Code) => { if (node.lang === 'drawio') { @@ -95,7 +95,7 @@ export const convertMarkdownToHtml = async(page: HydratedDocument const processor = unified() .use(remarkParse) - .use(sanitize) + .use(sanitizeMarkdown) .use(remarkRehype) .use(rehypeMeta, { title: page.path, From 23c9dbd4f1655ccbfb9265a827313b2d06e64e9e Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 07:38:00 +0000 Subject: [PATCH 07/46] clean code --- .../server/utils/convert-markdown-to-html.ts | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts b/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts index 42e1965b596..531099402e9 100644 --- a/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts +++ b/apps/app/src/features/openai/server/utils/convert-markdown-to-html.ts @@ -12,11 +12,10 @@ import type * as UnistUtilVisit from 'unist-util-visit'; import type { PageDocument } from '~/server/models/page'; - interface ModuleCache { - remarkParse?: typeof RemarkParse.default; unified?: typeof Unified.unified; visit?: typeof UnistUtilVisit.visit; + remarkParse?: typeof RemarkParse.default; remarkRehype?: typeof RemarkRehype.default; rehypeMeta?: typeof RehypeMeta.default; rehypeStringify?: typeof RehypeStringify.default; @@ -25,9 +24,9 @@ interface ModuleCache { let moduleCache: ModuleCache = {}; const initializeModules = async(): Promise => { - if (moduleCache.remarkParse != null - && moduleCache.unified != null + if (moduleCache.unified != null && moduleCache.visit != null + && moduleCache.remarkParse != null && moduleCache.remarkRehype != null && moduleCache.rehypeMeta != null && moduleCache.rehypeStringify != null @@ -36,24 +35,25 @@ const initializeModules = async(): Promise => { } const [ + { unified }, + { visit }, { default: remarkParse }, - { unified }, { visit }, { default: remarkRehype }, { default: rehypeMeta }, { default: rehypeStringify }, ] = await Promise.all([ - dynamicImport('remark-parse', __dirname), dynamicImport('unified', __dirname), dynamicImport('unist-util-visit', __dirname), + dynamicImport('remark-parse', __dirname), dynamicImport('remark-rehype', __dirname), dynamicImport('rehype-meta', __dirname), dynamicImport('rehype-stringify', __dirname), ]); moduleCache = { - remarkParse, unified, visit, + remarkParse, remarkRehype, rehypeMeta, rehypeStringify, @@ -64,19 +64,10 @@ export const convertMarkdownToHtml = async(page: HydratedDocument await initializeModules(); const { - remarkParse, - unified, visit, - remarkRehype, - rehypeMeta, - rehypeStringify, + unified, visit, remarkParse, remarkRehype, rehypeMeta, rehypeStringify, } = moduleCache; - if (remarkParse == null - || unified == null - || visit == null - || remarkRehype == null - || rehypeMeta == null - || rehypeStringify == null) { + if (unified == null || visit == null || remarkParse == null || remarkRehype == null || rehypeMeta == null || rehypeStringify == null) { throw new Error('Failed to initialize required modules'); } @@ -90,8 +81,9 @@ export const convertMarkdownToHtml = async(page: HydratedDocument }; }; - - const revisionBody = page.revision != null && isPopulated(page.revision) ? page.revision.body : undefined; + const revisionBody = page.revision != null && isPopulated(page.revision) + ? page.revision.body + : undefined; const processor = unified() .use(remarkParse) From 621907ae24d079908f60bbe9f0afa18f821306cf Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Mon, 2 Dec 2024 12:48:36 +0000 Subject: [PATCH 08/46] rm debug log --- apps/app/src/features/openai/server/services/openai.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/app/src/features/openai/server/services/openai.ts b/apps/app/src/features/openai/server/services/openai.ts index 7b38351f063..f9dfa82e1de 100644 --- a/apps/app/src/features/openai/server/services/openai.ts +++ b/apps/app/src/features/openai/server/services/openai.ts @@ -160,7 +160,6 @@ class OpenaiService implements IOpenaiService { private async uploadFile(page: HydratedDocument | IPagePopulatedToShowRevision): Promise { const convertedHtml = await convertMarkdownToHtml(page); - console.log('convertedHtml', convertedHtml); const file = await toFile(Readable.from(convertedHtml), `${page._id}.html`); const uploadedFile = await this.client.uploadFile(file); return uploadedFile; From e5b767144dfa4bf2476a4f74fd42f20126a08623 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Thu, 5 Dec 2024 06:14:31 +0000 Subject: [PATCH 09/46] limit creatable page path --- packages/core/src/utils/page-path-utils/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/utils/page-path-utils/index.ts b/packages/core/src/utils/page-path-utils/index.ts index 6c400a9d5ac..1b1ba7bbd5f 100644 --- a/packages/core/src/utils/page-path-utils/index.ts +++ b/packages/core/src/utils/page-path-utils/index.ts @@ -1,6 +1,6 @@ import escapeStringRegexp from 'escape-string-regexp'; -import { IUser } from '~/interfaces'; +import type { IUser } from '~/interfaces'; import { isValidObjectId } from '../objectid-utils'; import { addTrailingSlash } from '../path-utils'; @@ -117,6 +117,7 @@ const restrictedPatternsToCreate: Array = [ /^\/(_search|_private-legacy-pages)(\/.*|$)/, /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/, /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1 + /^.{2000000,}$/, // avoid very long path. see: https://regex101.com/r/s9cCdf/1 ]; export const isCreatablePage = (path: string): boolean => { return !restrictedPatternsToCreate.some(pattern => path.match(pattern)); From d0a80e6a7b69447c3ea1d6fcbade16ad253a4e3b Mon Sep 17 00:00:00 2001 From: reiji-h Date: Thu, 5 Dec 2024 06:19:47 +0000 Subject: [PATCH 10/46] use javascript length --- packages/core/src/utils/page-path-utils/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/utils/page-path-utils/index.ts b/packages/core/src/utils/page-path-utils/index.ts index 1b1ba7bbd5f..7efcaa9222e 100644 --- a/packages/core/src/utils/page-path-utils/index.ts +++ b/packages/core/src/utils/page-path-utils/index.ts @@ -117,10 +117,9 @@ const restrictedPatternsToCreate: Array = [ /^\/(_search|_private-legacy-pages)(\/.*|$)/, /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/, /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1 - /^.{2000000,}$/, // avoid very long path. see: https://regex101.com/r/s9cCdf/1 ]; export const isCreatablePage = (path: string): boolean => { - return !restrictedPatternsToCreate.some(pattern => path.match(pattern)); + return !restrictedPatternsToCreate.some(pattern => path.match(pattern)) && path.length <= 2_000_000; }; /** From 307a6573c934afdb394760ad79ed24f90a222c18 Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Tue, 10 Dec 2024 04:33:45 +0000 Subject: [PATCH 11/46] Wider-clipboard-area --- .../Common/PagePathNavTitle/PagePathNavTitle.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index a4dac0678a3..4145c95f6df 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -1,6 +1,6 @@ @use '@growi/core-styles/scss/bootstrap/init' as bs; .grw-page-path-nav-title :global { - min-width: 300px; min-height: 75px; + padding-right: 70px; } From 0e46e2b74c4c3db8e521be5cf08efe100dede49a Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Thu, 12 Dec 2024 09:04:29 +0000 Subject: [PATCH 12/46] Resolve conflicts --- .../PagePathNavSticky.module.scss | 2 ++ .../components/PagePresentationModal.tsx | 3 ++- .../PagePathNav/PagePathNav.module.scss | 7 +++-- .../Common/PagePathNav/PagePathNavLayout.tsx | 26 ++++++++++++++++--- .../PagePathNavTitle.module.scss | 4 +++ apps/app/src/pages/[[...path]].page.tsx | 2 +- apps/app/src/stores-universal/context.tsx | 1 + apps/app/src/stores/renderer.tsx | 5 ++++ 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss b/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss index 2948618afcb..9dd96f4284d 100644 --- a/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss +++ b/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss @@ -1,6 +1,8 @@ @use '@growi/core-styles/scss/bootstrap/init' as bs; .grw-page-path-nav-sticky :global { + // width: 100%; + .sticky-inner-wrapper { z-index: bs.$zindex-sticky; } diff --git a/apps/app/src/client/components/PagePresentationModal.tsx b/apps/app/src/client/components/PagePresentationModal.tsx index 7796841113c..51468e781eb 100644 --- a/apps/app/src/client/components/PagePresentationModal.tsx +++ b/apps/app/src/client/components/PagePresentationModal.tsx @@ -67,7 +67,8 @@ const PagePresentationModal = (): JSX.Element => { if (!isOpen) { return <>; } - + console.log(isEnabledMarp, 'Marp'); + console.log(rendererOptions, 'renderOption'); return ( import('~/client/components/Common/CopyDropdown').then(mod => mod.CopyDropdown), { ssr: false }); @@ -40,6 +41,19 @@ export const PagePathNavLayout = (props: Props): JSX.Element => { const copyDropdownId = `copydropdown-${pageId}`; + const [, setIsHovered] = useState(false); + const [hideTimeout, setHideTimeout] = useState(null); + + const handleMouseEnter = () => { + if (hideTimeout) clearTimeout(hideTimeout); // 非表示タイマーをリセット + setIsHovered(true); // ボタンを表示 + }; + + const handleMouseLeave = () => { + const timeout = setTimeout(() => setIsHovered(false), 3000); // 3秒後にボタンを非表示 + setHideTimeout(timeout); + }; + return (
{ { isWipPage && ( WIP )} - + content_paste diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 3c62f47ea35..4d4fc899da1 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -3,3 +3,7 @@ .grw-page-path-nav-title :global { min-height: 75px; } + +.grw-page-path-nav-title:hover { + background-color: rgba(0, 0, 0, 0.05); /* ホバー範囲を視覚的に確認したい場合の背景 */ +} diff --git a/apps/app/src/pages/[[...path]].page.tsx b/apps/app/src/pages/[[...path]].page.tsx index d26fb5e22d1..e8e4b7c4d9c 100644 --- a/apps/app/src/pages/[[...path]].page.tsx +++ b/apps/app/src/pages/[[...path]].page.tsx @@ -237,7 +237,7 @@ const Page: NextPageWithLayout = (props: Props) => { useDefaultIndentSize(props.adminPreferredIndentSize); useIsIndentSizeForced(props.isIndentSizeForced); useDisableLinkSharing(props.disableLinkSharing); - useRendererConfig(props.rendererConfig); + // useRendererConfig(props.rendererConfig); useIsEnabledMarp(props.rendererConfig.isEnabledMarp); // useRendererSettings(props.rendererSettingsStr != null ? JSON.parse(props.rendererSettingsStr) : undefined); // useGrowiRendererConfig(props.growiRendererConfigStr != null ? JSON.parse(props.growiRendererConfigStr) : undefined); diff --git a/apps/app/src/stores-universal/context.tsx b/apps/app/src/stores-universal/context.tsx index a62586dacc7..e29ada8d300 100644 --- a/apps/app/src/stores-universal/context.tsx +++ b/apps/app/src/stores-universal/context.tsx @@ -147,6 +147,7 @@ export const useIsEnabledStaleNotification = (initialData?: boolean): SWRRespons }; export const useRendererConfig = (initialData?: RendererConfig): SWRResponse => { + console.log(initialData, 'undifined or null'); return useContextSWR('growiRendererConfig', initialData); }; diff --git a/apps/app/src/stores/renderer.tsx b/apps/app/src/stores/renderer.tsx index bd4a4776bd3..97dd1cfa748 100644 --- a/apps/app/src/stores/renderer.tsx +++ b/apps/app/src/stores/renderer.tsx @@ -171,6 +171,11 @@ export const useCustomSidebarOptions = (config?: SWRConfiguration): SWRResponse< export const usePresentationViewOptions = (): SWRResponse => { const { data: currentPagePath } = useCurrentPagePath(); const { data: rendererConfig } = useRendererConfig(); + console.log(rendererConfig, 'rendererconfig'); + if (!rendererConfig) { + console.log('RendererConfig is missing.'); + } + const isAllDataValid = currentPagePath != null && rendererConfig != null; From 719e2f37498041f28b9e88cbfcfd97cb23fa7b7a Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Thu, 12 Dec 2024 09:06:08 +0000 Subject: [PATCH 13/46] Resolve conflicts --- .../Common/PagePathNavTitle/PagePathNavTitle.module.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 4d4fc899da1..9b2828798b7 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -2,6 +2,10 @@ .grw-page-path-nav-title :global { min-height: 75px; +<<<<<<< Updated upstream +======= + // padding-right: 70px; +>>>>>>> Stashed changes } .grw-page-path-nav-title:hover { From 0948c30cb887392824853f4799a93a62c2061f6a Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Thu, 12 Dec 2024 09:07:15 +0000 Subject: [PATCH 14/46] Resolve conflicts --- .../Common/PagePathNavTitle/PagePathNavTitle.module.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 9b2828798b7..4d4fc899da1 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -2,10 +2,6 @@ .grw-page-path-nav-title :global { min-height: 75px; -<<<<<<< Updated upstream -======= - // padding-right: 70px; ->>>>>>> Stashed changes } .grw-page-path-nav-title:hover { From ee1380f9cd1b3d7c0a551ed6e3b5033d44331d65 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 22:59:25 +0900 Subject: [PATCH 15/46] add component for bulk export settings and add donwload period configuration form --- .../public/static/locales/en_US/admin.json | 9 +- .../public/static/locales/fr_FR/admin.json | 9 +- .../public/static/locales/ja_JP/admin.json | 10 +- .../public/static/locales/zh_CN/admin.json | 9 +- .../components/Admin/App/AppSetting.jsx | 48 ------ .../Admin/App/AppSettingsPageContents.tsx | 8 + .../Admin/App/PageBulkExportSettings.tsx | 140 ++++++++++++++++++ .../src/client/services/AdminAppContainer.js | 9 +- .../src/interfaces/res/admin/app-settings.ts | 5 + .../src/server/routes/apiv3/app-settings.js | 39 ++++- 10 files changed, 217 insertions(+), 69 deletions(-) create mode 100644 apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx diff --git a/apps/app/public/static/locales/en_US/admin.json b/apps/app/public/static/locales/en_US/admin.json index b0c5430e59a..49baf7fbeaa 100644 --- a/apps/app/public/static/locales/en_US/admin.json +++ b/apps/app/public/static/locales/en_US/admin.json @@ -362,9 +362,12 @@ "file_uploading": "File uploading", "enable_files_except_image": "Enabling this option will allow upload of any file type. Without this option, only image file upload is supported.", "attach_enable": "You can attach files other than image files if you enable this option.", - "enable_page_bulk_export": "Enable bulk exporting a page and it's child pages", - "page_bulk_export_explanation": "When enabled, users will be able to bulk export from the page menu.", - "page_bulk_export_warning": "The download period for exported results is 24 hours, and they will be deleted after that. During this period, running multiple large exports consecutively can fill up the file system.", + "page_bulk_export_settings": "Page Bulk Export Settings", + "enable_page_bulk_export": "Enable bulk export", + "page_bulk_export_execute_explanation": "Users will be able to bulk export from the page menu.", + "page_bulk_export_explanation": "Below are settings for exporting a page and all of its child pages. Exported results will be deleted from the file system and cannot be downloaded when the configured storage period passes.", + "page_bulk_export_warning": "Running multiple large exports consecutively can fill up the file system.", + "page_bulk_export_storage_period": "Storage period", "update": "Update", "mail_settings": "E-mail Settings", "mailer_is_not_set_up": "E-mail setting is not set up.", diff --git a/apps/app/public/static/locales/fr_FR/admin.json b/apps/app/public/static/locales/fr_FR/admin.json index b9a90105174..07fc4acbdb8 100644 --- a/apps/app/public/static/locales/fr_FR/admin.json +++ b/apps/app/public/static/locales/fr_FR/admin.json @@ -362,9 +362,12 @@ "file_uploading": "Téléversement de fichiers", "enable_files_except_image": "Autorise le téléversement de fichiers de n'importe quel type. Lorsque désactivé, seul les fichiers de type image sont autorisés.", "attach_enable": "Autorise le téléversement de fichiers de n'importe quel type", - "enable_page_bulk_export": "Autoriser l'exportation groupée de pages et de leurs pages subordonnées", - "page_bulk_export_explanation": "Si autorisé, l'exportation groupée sera possible à partir du menu de la page.", - "page_bulk_export_warning": "La période de téléchargement des résultats exportés est de 24 heures, après quoi ils seront supprimés. Pendant cette période, l’exécution consécutive de plusieurs exportations volumineuses peut remplir le système de fichiers.", + "page_bulk_export_settings": "Paramètres d'exportation de pages par lots", + "enable_page_bulk_export": "Activer l'exportation groupée", + "page_bulk_export_execute_explanation": "Il peut être exécuté à partir du menu des pages individuelles.", + "page_bulk_export_explanation": "Configurez les paramètres pour l'exportation groupée de pages et de leurs pages subordonnées. Les résultats de l'exportation seront supprimés du système de fichiers après la période de conservation définie et ne seront plus disponibles au téléchargement.", + "page_bulk_export_warning": "Les exportations continues comportant un grand nombre de pages peuvent surcharger le système de fichiers.", + "page_bulk_export_storage_period": "Date limite de téléchargement", "update": "Sauvegarder", "mail_settings": "Configuration e-mail", "mailer_is_not_set_up": "Paramètres e-mail non configurés.", diff --git a/apps/app/public/static/locales/ja_JP/admin.json b/apps/app/public/static/locales/ja_JP/admin.json index d350895d528..0cfc0f42454 100644 --- a/apps/app/public/static/locales/ja_JP/admin.json +++ b/apps/app/public/static/locales/ja_JP/admin.json @@ -19,6 +19,7 @@ "only_me": "自分のみ", "only_inside_the_group": "特定グループのみ", "optional": "オプション", + "days": "日", "security_settings": { "security_settings": "セキュリティ設定", "scope_of_page_disclosure": "ページの公開範囲", @@ -371,9 +372,12 @@ "file_uploading": "ファイルアップロード", "enable_files_except_image": "画像以外のファイルアップロードを許可", "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。", - "enable_page_bulk_export": "ページとその配下のページの一括エクスポートを許可", - "page_bulk_export_explanation": "許可している場合、個別ページのメニューから一括エクスポートが可能になります。", - "page_bulk_export_warning": "エクスポート結果のダウンロード期限は24時間で、それを過ぎるとファイルシステムから削除されます。この間にページ数の多いエクスポートを連続で実行すると、ファイルシステムを圧迫する可能性があります。", + "page_bulk_export_settings": "ページ一括エクスポート設定", + "enable_page_bulk_export": "一括エクスポートを有効にする", + "page_bulk_export_execute_explanation": "個別ページのメニューから実行可能になります。", + "page_bulk_export_explanation": "ページとその配下ページの一括エクスポートの設定を行います。エクスポート結果は設定された保存期間を過ぎるとファイルシステムから削除され、ダウンロードできなくなります。", + "page_bulk_export_warning": "ページ数の多いエクスポートを連続で実行すると、ファイルシステムを圧迫する可能性があります。", + "page_bulk_export_storage_period": "保存期間", "update": "更新", "mail_settings": "メールの設定", "mailer_is_not_set_up": "メール設定がセットアップされていません。", diff --git a/apps/app/public/static/locales/zh_CN/admin.json b/apps/app/public/static/locales/zh_CN/admin.json index 25f3afdde56..68217175f58 100644 --- a/apps/app/public/static/locales/zh_CN/admin.json +++ b/apps/app/public/static/locales/zh_CN/admin.json @@ -371,9 +371,12 @@ "file_uploading": "文件上传", "enable_files_except_image": "启用此选项将允许上传任何文件类型。如果没有此选项,则仅支持图像文件上载。", "attach_enable": "如果启用此选项,则可以附加图像文件以外的文件。", - "enable_page_bulk_export": "允许批量导出页面及其子页面", - "page_bulk_export_explanation": "如果允许,可以从各个页面的菜单中批量导出。", - "page_bulk_export_warning": "导出结果的下载期限为24小时,下载期限过后将被删除。在此期间,连续运行多个大导出可能会填满文件系统。", + "page_bulk_export_settings": "页面批量导出设置", + "enable_page_bulk_export": "启用批量导出", + "page_bulk_export_execute_explanation": "用户将能够从页面菜单批量导出。", + "page_bulk_export_explanation": "以下是导出页面及其所有子页面的设置。当配置的存储期限过后,导出的结果将从文件系统中删除,并且无法下载。", + "page_bulk_export_warning": "连续运行多个大型导出可能会填满文件系统。", + "page_bulk_export_storage_period": "储存期限", "update": "更新", "mail_settings": "邮件设置", "mailer_is_not_set_up": "邮件设置尚未完成。", diff --git a/apps/app/src/client/components/Admin/App/AppSetting.jsx b/apps/app/src/client/components/Admin/App/AppSetting.jsx index 0f66f660849..f6da00f70b7 100644 --- a/apps/app/src/client/components/Admin/App/AppSetting.jsx +++ b/apps/app/src/client/components/Admin/App/AppSetting.jsx @@ -170,54 +170,6 @@ const AppSetting = (props) => {
-
- -
-
- { - adminAppContainer.changeIsPageBulkExportEnabled(e.target.checked); - }} - /> - -
- -

- {t('admin:app_setting.page_bulk_export_explanation')} -

- -

- {t('admin:app_setting.page_bulk_export_warning')} -

- - {adminAppContainer.state.isFixedIsBulkExportPagesEnabled && ( -

- help - FIXED
- {/* eslint-disable-next-line react/no-danger */} - -

- )} -
-
- ); diff --git a/apps/app/src/client/components/Admin/App/AppSettingsPageContents.tsx b/apps/app/src/client/components/Admin/App/AppSettingsPageContents.tsx index 13729252d23..68b9713a2d2 100644 --- a/apps/app/src/client/components/Admin/App/AppSettingsPageContents.tsx +++ b/apps/app/src/client/components/Admin/App/AppSettingsPageContents.tsx @@ -14,6 +14,7 @@ import AppSetting from './AppSetting'; import FileUploadSetting from './FileUploadSetting'; import MailSetting from './MailSetting'; import { MaintenanceMode } from './MaintenanceMode'; +import PageBulkExportSettings from './PageBulkExportSettings'; import QuestionnaireSettings from './QuestionnaireSettings'; import SiteUrlSetting from './SiteUrlSetting'; import V5PageMigration from './V5PageMigration'; @@ -108,6 +109,13 @@ const AppSettingsPageContents = (props: Props) => { +
+
+

{t('admin:app_setting.page_bulk_export_settings')}

+ +
+
+

{t('admin:app_setting.questionnaire_settings')}

diff --git a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx new file mode 100644 index 00000000000..a4dbc3d3184 --- /dev/null +++ b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx @@ -0,0 +1,140 @@ +import { + useState, useCallback, useEffect, +} from 'react'; + +import { LoadingSpinner } from '@growi/ui/dist/components'; +import { useTranslation } from 'next-i18next'; + +import { apiv3Put } from '~/client/util/apiv3-client'; +import { toastSuccess, toastError } from '~/client/util/toastr'; +import { useSWRxAppSettings } from '~/stores/admin/app-settings'; + +import AdminUpdateButtonRow from '../Common/AdminUpdateButtonRow'; + +const PageBulkExportSettings = (): JSX.Element => { + const { t } = useTranslation(['admin', 'commons']); + + const { data, error, mutate } = useSWRxAppSettings(); + + const [isBulkExportPagesEnabled, setIsBulkExportPagesEnabled] = useState(data?.isBulkExportPagesEnabled); + const [bulkExportDownloadExpirationSeconds, setBulkExportDownloadExpirationSeconds] = useState(data?.bulkExportDownloadExpirationSeconds); + + const changeBulkExportDownloadExpirationSeconds = (bulkExportDownloadExpirationDays: number) => { + const bulkExportDownloadExpirationSeconds = bulkExportDownloadExpirationDays * 24 * 60 * 60; + setBulkExportDownloadExpirationSeconds(bulkExportDownloadExpirationSeconds); + }; + + const onSubmitHandler = useCallback(async() => { + try { + await apiv3Put('/app-settings/page-bulk-export-settings', { + isBulkExportPagesEnabled, + bulkExportDownloadExpirationSeconds, + }); + toastSuccess(t('commons:toaster.update_successed', { target: t('app_setting.questionnaire_settings') })); + } + catch (err) { + toastError(err); + } + mutate(); + }, [isBulkExportPagesEnabled, bulkExportDownloadExpirationSeconds, mutate, t]); + + useEffect(() => { + setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled); + setBulkExportDownloadExpirationSeconds(data?.bulkExportDownloadExpirationSeconds); + }, [data, data?.isBulkExportPagesEnabled, data?.bulkExportDownloadExpirationSeconds]); + + const isLoading = data === undefined && error === undefined; + + return ( + <> + {isLoading && ( +
+ +
+ )} + + {!isLoading && ( + <> +

+ {t('admin:app_setting.page_bulk_export_explanation')}
+ + {t('admin:app_setting.page_bulk_export_warning')} + +

+ +
+ + +
+
+ setIsBulkExportPagesEnabled(e.target.checked)} + /> + + +

+ {t('app_setting.page_bulk_export_execute_explanation')} +

+
+
+
+ +
+
+
+ + +
+ +
+
+
+ + {data?.isFixedIsBulkExportPagesEnabled && ( +

+ help + FIXED
+ {/* eslint-disable-next-line react/no-danger */} + +

+ )} +
+ + + + )} + + ); +}; + +export default PageBulkExportSettings; diff --git a/apps/app/src/client/services/AdminAppContainer.js b/apps/app/src/client/services/AdminAppContainer.js index 05f78993620..167eed8aae2 100644 --- a/apps/app/src/client/services/AdminAppContainer.js +++ b/apps/app/src/client/services/AdminAppContainer.js @@ -25,6 +25,7 @@ export default class AdminAppContainer extends Container { fileUpload: '', isBulkExportPagesEnabled: false, isFixedIsBulkExportPagesEnabled: false, + bulkExportDownloadExpirationSeconds: 86400, isV5Compatible: null, siteUrl: '', @@ -103,6 +104,7 @@ export default class AdminAppContainer extends Container { isEmailPublishedForNewUser: appSettingsParams.isEmailPublishedForNewUser, fileUpload: appSettingsParams.fileUpload, isBulkExportPagesEnabled: appSettingsParams.isBulkExportPagesEnabled, + bulkExportDownloadExpirationSeconds: appSettingsParams.bulkExportDownloadExpirationSeconds, isV5Compatible: appSettingsParams.isV5Compatible, siteUrl: appSettingsParams.siteUrl, siteUrlUseOnlyEnvVars: appSettingsParams.siteUrlUseOnlyEnvVars, @@ -203,13 +205,6 @@ export default class AdminAppContainer extends Container { this.setState({ fileUpload }); } - /** - * Change isBulkExportPagesEnabled - */ - changeIsPageBulkExportEnabled(isBulkExportPagesEnabled) { - this.setState({ isBulkExportPagesEnabled }); - } - /** * Change site url */ diff --git a/apps/app/src/interfaces/res/admin/app-settings.ts b/apps/app/src/interfaces/res/admin/app-settings.ts index 4eb118ec02b..909ec915e2c 100644 --- a/apps/app/src/interfaces/res/admin/app-settings.ts +++ b/apps/app/src/interfaces/res/admin/app-settings.ts @@ -59,4 +59,9 @@ export type IResAppSettings = { isAppSiteUrlHashed: boolean, isMaintenanceMode: boolean, + + isBulkExportPagesEnabled: boolean, + envIsBulkExportPagesEnabled: boolean, + bulkExportDownloadExpirationSeconds: number, + isFixedIsBulkExportPagesEnabled: boolean, } diff --git a/apps/app/src/server/routes/apiv3/app-settings.js b/apps/app/src/server/routes/apiv3/app-settings.js index d1a476efce5..36e16b2b404 100644 --- a/apps/app/src/server/routes/apiv3/app-settings.js +++ b/apps/app/src/server/routes/apiv3/app-settings.js @@ -401,6 +401,10 @@ module.exports = (crowi) => { body('isQuestionnaireEnabled').isBoolean(), body('isAppSiteUrlHashed').isBoolean(), ], + pageBulkExportSettings: [ + body('isBulkExportPagesEnabled').isBoolean(), + body('bulkExportDownloadExpirationSeconds').isInt(), + ], maintenanceMode: [ body('flag').isBoolean(), ], @@ -435,8 +439,6 @@ module.exports = (crowi) => { globalLang: crowi.configManager.getConfig('crowi', 'app:globalLang'), isEmailPublishedForNewUser: crowi.configManager.getConfig('crowi', 'customize:isEmailPublishedForNewUser'), fileUpload: crowi.configManager.getConfig('crowi', 'app:fileUpload'), - isBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'app:isBulkExportPagesEnabled'), - envIsBulkExportPagesEnabled: crowi.configManager.getConfigFromEnvVars('crowi', 'app:isBulkExportPagesEnabled'), useOnlyEnvVarsForIsBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'env:useOnlyEnvVars:app:isBulkExportPagesEnabled'), isV5Compatible: crowi.configManager.getConfig('crowi', 'app:isV5Compatible'), siteUrl: crowi.configManager.getConfig('crowi', 'app:siteUrl'), @@ -493,6 +495,10 @@ module.exports = (crowi) => { isAppSiteUrlHashed: crowi.configManager.getConfig('crowi', 'questionnaire:isAppSiteUrlHashed'), isMaintenanceMode: crowi.configManager.getConfig('crowi', 'app:isMaintenanceMode'), + + isBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'app:isBulkExportPagesEnabled'), + envIsBulkExportPagesEnabled: crowi.configManager.getConfigFromEnvVars('crowi', 'app:isBulkExportPagesEnabled'), + bulkExportDownloadExpirationSeconds: crowi.configManager.getConfig('crowi', 'app:bulkExportDownloadExpirationSeconds'), }; return res.apiv3({ appSettingsParams }); @@ -535,6 +541,7 @@ module.exports = (crowi) => { 'customize:isEmailPublishedForNewUser': req.body.isEmailPublishedForNewUser, 'app:fileUpload': req.body.fileUpload, 'app:isBulkExportPagesEnabled': req.body.isBulkExportPagesEnabled, + 'app:bulkExportDownloadExpirationSeconds': req.body.bulkExportDownloadExpirationSeconds, }; try { @@ -546,6 +553,7 @@ module.exports = (crowi) => { isEmailPublishedForNewUser: crowi.configManager.getConfig('crowi', 'customize:isEmailPublishedForNewUser'), fileUpload: crowi.configManager.getConfig('crowi', 'app:fileUpload'), isBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'app:isBulkExportPagesEnabled'), + bulkExportDownloadExpirationSeconds: crowi.configManager.getConfig('crowi', 'app:bulkExportDownloadExpirationSeconds'), }; const parameters = { action: SupportedAction.ACTION_ADMIN_APP_SETTINGS_UPDATE }; @@ -1023,6 +1031,33 @@ module.exports = (crowi) => { }); + router.put('/page-bulk-export-settings', loginRequiredStrictly, adminRequired, addActivity, validator.pageBulkExportSettings, apiV3FormValidator, + async(req, res) => { + const requestParams = { + 'app:isBulkExportPagesEnabled': req.body.isBulkExportPagesEnabled, + 'app:bulkExportDownloadExpirationSeconds': req.body.bulkExportDownloadExpirationSeconds, + }; + + try { + await crowi.configManager.updateConfigsInTheSameNamespace('crowi', requestParams, true); + const responseParams = { + isBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'app:isBulkExportPagesEnabled'), + bulkExportDownloadExpirationSeconds: crowi.configManager.getConfig('crowi', 'app:bulkExportDownloadExpirationSeconds'), + }; + + const parameters = { action: SupportedAction.ACTION_ADMIN_APP_SETTINGS_UPDATE }; + activityEvent.emit('update', res.locals.activity._id, parameters); + + return res.apiv3({ responseParams }); + } + catch (err) { + const msg = 'Error occurred in updating page bulk export settings'; + logger.error('Error', err); + return res.apiv3Err(new ErrorV3(msg, 'update-page-bulk-export-settings-failed')); + } + + }); + /** * @swagger * From 05c9efa6d72a0f586e58c82f91ff03bda372e9dc Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 23:15:20 +0900 Subject: [PATCH 16/46] improve page bulk export settings translation --- apps/app/public/static/locales/en_US/admin.json | 3 +-- apps/app/public/static/locales/fr_FR/admin.json | 3 +-- apps/app/public/static/locales/ja_JP/admin.json | 3 +-- apps/app/public/static/locales/zh_CN/admin.json | 3 +-- .../components/Admin/App/PageBulkExportSettings.tsx | 8 ++------ 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/apps/app/public/static/locales/en_US/admin.json b/apps/app/public/static/locales/en_US/admin.json index 49baf7fbeaa..a1a0e54e305 100644 --- a/apps/app/public/static/locales/en_US/admin.json +++ b/apps/app/public/static/locales/en_US/admin.json @@ -364,8 +364,7 @@ "attach_enable": "You can attach files other than image files if you enable this option.", "page_bulk_export_settings": "Page Bulk Export Settings", "enable_page_bulk_export": "Enable bulk export", - "page_bulk_export_execute_explanation": "Users will be able to bulk export from the page menu.", - "page_bulk_export_explanation": "Below are settings for exporting a page and all of its child pages. Exported results will be deleted from the file system and cannot be downloaded when the configured storage period passes.", + "page_bulk_export_explanation": "When bulk export is enabled, users will be able to export a page and it's child pages from the page menu. Exported results will be deleted from the file system and cannot be downloaded when the configured storage period passes.", "page_bulk_export_warning": "Running multiple large exports consecutively can fill up the file system.", "page_bulk_export_storage_period": "Storage period", "update": "Update", diff --git a/apps/app/public/static/locales/fr_FR/admin.json b/apps/app/public/static/locales/fr_FR/admin.json index 07fc4acbdb8..11ba2885964 100644 --- a/apps/app/public/static/locales/fr_FR/admin.json +++ b/apps/app/public/static/locales/fr_FR/admin.json @@ -364,8 +364,7 @@ "attach_enable": "Autorise le téléversement de fichiers de n'importe quel type", "page_bulk_export_settings": "Paramètres d'exportation de pages par lots", "enable_page_bulk_export": "Activer l'exportation groupée", - "page_bulk_export_execute_explanation": "Il peut être exécuté à partir du menu des pages individuelles.", - "page_bulk_export_explanation": "Configurez les paramètres pour l'exportation groupée de pages et de leurs pages subordonnées. Les résultats de l'exportation seront supprimés du système de fichiers après la période de conservation définie et ne seront plus disponibles au téléchargement.", + "page_bulk_export_explanation": "Lorsque l'exportation groupée est activée, les utilisateurs pourront exporter une page et ses pages enfants à partir du menu des pages. Les résultats exportés seront supprimés du système de fichiers et ne pourront pas être téléchargés une fois la période de stockage configurée écoulée.", "page_bulk_export_warning": "Les exportations continues comportant un grand nombre de pages peuvent surcharger le système de fichiers.", "page_bulk_export_storage_period": "Date limite de téléchargement", "update": "Sauvegarder", diff --git a/apps/app/public/static/locales/ja_JP/admin.json b/apps/app/public/static/locales/ja_JP/admin.json index 0cfc0f42454..8611bede0a2 100644 --- a/apps/app/public/static/locales/ja_JP/admin.json +++ b/apps/app/public/static/locales/ja_JP/admin.json @@ -374,8 +374,7 @@ "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。", "page_bulk_export_settings": "ページ一括エクスポート設定", "enable_page_bulk_export": "一括エクスポートを有効にする", - "page_bulk_export_execute_explanation": "個別ページのメニューから実行可能になります。", - "page_bulk_export_explanation": "ページとその配下ページの一括エクスポートの設定を行います。エクスポート結果は設定された保存期間を過ぎるとファイルシステムから削除され、ダウンロードできなくなります。", + "page_bulk_export_explanation": "一括エクスポートを有効にすると、ページメニューからそのページと配下ページのエクスポートが可能になります。エクスポート結果は設定された保存期間を過ぎるとファイルシステムから削除され、ダウンロードできなくなります。", "page_bulk_export_warning": "ページ数の多いエクスポートを連続で実行すると、ファイルシステムを圧迫する可能性があります。", "page_bulk_export_storage_period": "保存期間", "update": "更新", diff --git a/apps/app/public/static/locales/zh_CN/admin.json b/apps/app/public/static/locales/zh_CN/admin.json index 68217175f58..5351517e5de 100644 --- a/apps/app/public/static/locales/zh_CN/admin.json +++ b/apps/app/public/static/locales/zh_CN/admin.json @@ -373,8 +373,7 @@ "attach_enable": "如果启用此选项,则可以附加图像文件以外的文件。", "page_bulk_export_settings": "页面批量导出设置", "enable_page_bulk_export": "启用批量导出", - "page_bulk_export_execute_explanation": "用户将能够从页面菜单批量导出。", - "page_bulk_export_explanation": "以下是导出页面及其所有子页面的设置。当配置的存储期限过后,导出的结果将从文件系统中删除,并且无法下载。", + "page_bulk_export_explanation": "启用批量导出后,用户将能够从页面菜单导出页面及其子页面。当配置的存储期限过后,导出的结果将从文件系统中删除,并且无法下载。", "page_bulk_export_warning": "连续运行多个大型导出可能会填满文件系统。", "page_bulk_export_storage_period": "储存期限", "update": "更新", diff --git a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx index a4dbc3d3184..6c3afb4d3a6 100644 --- a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx +++ b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx @@ -41,7 +41,7 @@ const PageBulkExportSettings = (): JSX.Element => { useEffect(() => { setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled); setBulkExportDownloadExpirationSeconds(data?.bulkExportDownloadExpirationSeconds); - }, [data, data?.isBulkExportPagesEnabled, data?.bulkExportDownloadExpirationSeconds]); + }, [data]); const isLoading = data === undefined && error === undefined; @@ -81,10 +81,6 @@ const PageBulkExportSettings = (): JSX.Element => { - -

- {t('app_setting.page_bulk_export_execute_explanation')} -

@@ -95,7 +91,7 @@ const PageBulkExportSettings = (): JSX.Element => {
From 7ff1523f2cdc389fae27c0ed325cb53defd9fd3b Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 23:18:55 +0900 Subject: [PATCH 17/46] modify questionnaire settings form to follow other setting forms --- .../Admin/App/PageBulkExportSettings.tsx | 38 +++++----- .../Admin/App/QuestionnaireSettings.tsx | 70 +++++++++++-------- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx index 6c3afb4d3a6..0a10bce98aa 100644 --- a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx +++ b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx @@ -86,27 +86,25 @@ const PageBulkExportSettings = (): JSX.Element => {
-
-
-
diff --git a/apps/app/src/client/components/Admin/App/QuestionnaireSettings.tsx b/apps/app/src/client/components/Admin/App/QuestionnaireSettings.tsx index e3162f75d1d..fc94985b5f6 100644 --- a/apps/app/src/client/components/Admin/App/QuestionnaireSettings.tsx +++ b/apps/app/src/client/components/Admin/App/QuestionnaireSettings.tsx @@ -72,37 +72,51 @@ const QuestionnaireSettings = (): JSX.Element => { {!isLoading && ( <> -
-
- - +
+ + +
+
+ + +
-
-
- - -

- {t('app_setting.url_anonymization_explanation')} -

+
+ + +
+
+ + +

+ {t('app_setting.url_anonymization_explanation')} +

+
From 4ff11e2323a3fbc96b0db5bd8d0c318ac86eef67 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 23:29:31 +0900 Subject: [PATCH 18/46] remove unnecessary response and add translations --- apps/app/public/static/locales/en_US/admin.json | 3 ++- apps/app/public/static/locales/fr_FR/admin.json | 3 ++- apps/app/public/static/locales/ja_JP/admin.json | 3 ++- apps/app/public/static/locales/zh_CN/admin.json | 3 ++- apps/app/src/client/services/AdminAppContainer.js | 2 -- apps/app/src/interfaces/activity.ts | 3 +++ apps/app/src/server/routes/apiv3/app-settings.js | 4 ---- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/app/public/static/locales/en_US/admin.json b/apps/app/public/static/locales/en_US/admin.json index a1a0e54e305..69e4664eddb 100644 --- a/apps/app/public/static/locales/en_US/admin.json +++ b/apps/app/public/static/locales/en_US/admin.json @@ -1068,7 +1068,8 @@ "ADMIN_USER_GROUP_ADD_USER": "Add User to User Group", "ADMIN_SEARCH_CONNECTION": "Attempting to reconnect to Elasticsearch", "ADMIN_SEARCH_INDICES_NORMALIZE": "Normalize of Elasticsearch indexes", - "ADMIN_SEARCH_INDICES_REBUILD": "Rebuild Elasticsearch indexes" + "ADMIN_SEARCH_INDICES_REBUILD": "Rebuild Elasticsearch indexes", + "ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE": "Update Page Bulk Export Settings" }, "g2g": { "transfer_success": "Completed GROWI to GROWI transfer successfully", diff --git a/apps/app/public/static/locales/fr_FR/admin.json b/apps/app/public/static/locales/fr_FR/admin.json index 11ba2885964..f02449ae409 100644 --- a/apps/app/public/static/locales/fr_FR/admin.json +++ b/apps/app/public/static/locales/fr_FR/admin.json @@ -1067,7 +1067,8 @@ "ADMIN_USER_GROUP_ADD_USER": "Ajouter l'utilisateur au groupe", "ADMIN_SEARCH_CONNECTION": "Essai de reconnexion Elasticsearch", "ADMIN_SEARCH_INDICES_NORMALIZE": "Nomarliser l'index Elasticsearch", - "ADMIN_SEARCH_INDICES_REBUILD": "Reconstruire l'index Elasticsearch" + "ADMIN_SEARCH_INDICES_REBUILD": "Reconstruire l'index Elasticsearch", + "ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE": "Mettre à jour les paramètres d'exportation groupée de la page" }, "g2g": { "transfer_success": "Transfert de GROWI vers GROWI complété!", diff --git a/apps/app/public/static/locales/ja_JP/admin.json b/apps/app/public/static/locales/ja_JP/admin.json index 8611bede0a2..9c70bd26d0d 100644 --- a/apps/app/public/static/locales/ja_JP/admin.json +++ b/apps/app/public/static/locales/ja_JP/admin.json @@ -1079,7 +1079,8 @@ "ADMIN_USER_GROUP_ADD_USER": "ユーザーグループにユーザーを追加", "ADMIN_SEARCH_CONNECTION": "Elasticsearch の再接続の試行", "ADMIN_SEARCH_INDICES_NORMALIZE": "Elasticsearch のインデックスの正規化", - "ADMIN_SEARCH_INDICES_REBUILD": "Elasticsearch のインデックスのリビルド" + "ADMIN_SEARCH_INDICES_REBUILD": "Elasticsearch のインデックスのリビルド", + "ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE": "ページ一括エクスポート設定の更新" }, "g2g": { "transfer_success": "G2G移行が完了しました", diff --git a/apps/app/public/static/locales/zh_CN/admin.json b/apps/app/public/static/locales/zh_CN/admin.json index 5351517e5de..b244798cdfc 100644 --- a/apps/app/public/static/locales/zh_CN/admin.json +++ b/apps/app/public/static/locales/zh_CN/admin.json @@ -1077,7 +1077,8 @@ "ADMIN_USER_GROUP_ADD_USER": "添加用户到用户组", "ADMIN_SEARCH_CONNECTION": "重试Elasticsearch连接", "ADMIN_SEARCH_INDICES_NORMALIZE": "试图重新连接Elasticsearch", - "ADMIN_SEARCH_INDICES_REBUILD": "重建 Elasticsearch 索引" + "ADMIN_SEARCH_INDICES_REBUILD": "重建 Elasticsearch 索引", + "ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE": "更新页面批量导出设置" }, "g2g": { "transfer_success": "Completed GROWI to GROWI transfer successfully", diff --git a/apps/app/src/client/services/AdminAppContainer.js b/apps/app/src/client/services/AdminAppContainer.js index 167eed8aae2..0ad1836f659 100644 --- a/apps/app/src/client/services/AdminAppContainer.js +++ b/apps/app/src/client/services/AdminAppContainer.js @@ -25,7 +25,6 @@ export default class AdminAppContainer extends Container { fileUpload: '', isBulkExportPagesEnabled: false, isFixedIsBulkExportPagesEnabled: false, - bulkExportDownloadExpirationSeconds: 86400, isV5Compatible: null, siteUrl: '', @@ -104,7 +103,6 @@ export default class AdminAppContainer extends Container { isEmailPublishedForNewUser: appSettingsParams.isEmailPublishedForNewUser, fileUpload: appSettingsParams.fileUpload, isBulkExportPagesEnabled: appSettingsParams.isBulkExportPagesEnabled, - bulkExportDownloadExpirationSeconds: appSettingsParams.bulkExportDownloadExpirationSeconds, isV5Compatible: appSettingsParams.isV5Compatible, siteUrl: appSettingsParams.siteUrl, siteUrlUseOnlyEnvVars: appSettingsParams.siteUrlUseOnlyEnvVars, diff --git a/apps/app/src/interfaces/activity.ts b/apps/app/src/interfaces/activity.ts index 5671cca3966..70cbc8450b3 100644 --- a/apps/app/src/interfaces/activity.ts +++ b/apps/app/src/interfaces/activity.ts @@ -79,6 +79,7 @@ const ACTION_ADMIN_MAIL_SES_UPDATE = 'ADMIN_MAIL_SES_UPDATE'; const ACTION_ADMIN_MAIL_TEST_SUBMIT = 'ADMIN_MAIL_TEST_SUBMIT'; const ACTION_ADMIN_FILE_UPLOAD_CONFIG_UPDATE = 'ADMIN_FILE_UPLOAD_CONFIG_UPDATE'; const ACTION_ADMIN_QUESTIONNAIRE_SETTINGS_UPDATE = 'ACTION_ADMIN_QUESTIONNAIRE_SETTINGS_UPDATE'; +const ACTION_ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE = 'ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE'; const ACTION_ADMIN_MAINTENANCEMODE_ENABLED = 'ADMIN_MAINTENANCEMODE_ENABLED'; const ACTION_ADMIN_MAINTENANCEMODE_DISABLED = 'ADMIN_MAINTENANCEMODE_DISABLED'; const ACTION_ADMIN_SECURITY_SETTINGS_UPDATE = 'ADMIN_SECURITY_SETTINGS_UPDATE'; @@ -259,6 +260,7 @@ export const SupportedAction = { ACTION_ADMIN_MAIL_TEST_SUBMIT, ACTION_ADMIN_FILE_UPLOAD_CONFIG_UPDATE, ACTION_ADMIN_QUESTIONNAIRE_SETTINGS_UPDATE, + ACTION_ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE, ACTION_ADMIN_MAINTENANCEMODE_ENABLED, ACTION_ADMIN_MAINTENANCEMODE_DISABLED, ACTION_ADMIN_SECURITY_SETTINGS_UPDATE, @@ -452,6 +454,7 @@ export const LargeActionGroup = { ACTION_ADMIN_MAIL_TEST_SUBMIT, ACTION_ADMIN_FILE_UPLOAD_CONFIG_UPDATE, ACTION_ADMIN_QUESTIONNAIRE_SETTINGS_UPDATE, + ACTION_ADMIN_PAGE_BULK_EXPORT_SETTINGS_UPDATE, ACTION_ADMIN_MAINTENANCEMODE_ENABLED, ACTION_ADMIN_MAINTENANCEMODE_DISABLED, ACTION_ADMIN_SECURITY_SETTINGS_UPDATE, diff --git a/apps/app/src/server/routes/apiv3/app-settings.js b/apps/app/src/server/routes/apiv3/app-settings.js index 36e16b2b404..f073fe0dee8 100644 --- a/apps/app/src/server/routes/apiv3/app-settings.js +++ b/apps/app/src/server/routes/apiv3/app-settings.js @@ -540,8 +540,6 @@ module.exports = (crowi) => { 'app:globalLang': req.body.globalLang, 'customize:isEmailPublishedForNewUser': req.body.isEmailPublishedForNewUser, 'app:fileUpload': req.body.fileUpload, - 'app:isBulkExportPagesEnabled': req.body.isBulkExportPagesEnabled, - 'app:bulkExportDownloadExpirationSeconds': req.body.bulkExportDownloadExpirationSeconds, }; try { @@ -552,8 +550,6 @@ module.exports = (crowi) => { globalLang: crowi.configManager.getConfig('crowi', 'app:globalLang'), isEmailPublishedForNewUser: crowi.configManager.getConfig('crowi', 'customize:isEmailPublishedForNewUser'), fileUpload: crowi.configManager.getConfig('crowi', 'app:fileUpload'), - isBulkExportPagesEnabled: crowi.configManager.getConfig('crowi', 'app:isBulkExportPagesEnabled'), - bulkExportDownloadExpirationSeconds: crowi.configManager.getConfig('crowi', 'app:bulkExportDownloadExpirationSeconds'), }; const parameters = { action: SupportedAction.ACTION_ADMIN_APP_SETTINGS_UPDATE }; From 0de01373e828c8dbaca9dcbd145b283553592b76 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 23:51:07 +0900 Subject: [PATCH 19/46] fix useOnlyEnvVarsForIsBulkExportPagesEnabled usage in PageBulkExportSettings --- .../Admin/App/PageBulkExportSettings.tsx | 36 ++++++++++--------- .../src/client/services/AdminAppContainer.js | 10 ------ .../src/interfaces/res/admin/app-settings.ts | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx index 0a10bce98aa..9875b039f7e 100644 --- a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx +++ b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx @@ -39,7 +39,12 @@ const PageBulkExportSettings = (): JSX.Element => { }, [isBulkExportPagesEnabled, bulkExportDownloadExpirationSeconds, mutate, t]); useEffect(() => { - setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled); + if (data?.useOnlyEnvVarForFileUploadType) { + setIsBulkExportPagesEnabled(data?.envIsBulkExportPagesEnabled); + } + else { + setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled); + } setBulkExportDownloadExpirationSeconds(data?.bulkExportDownloadExpirationSeconds); }, [data]); @@ -75,13 +80,25 @@ const PageBulkExportSettings = (): JSX.Element => { className="form-check-input" id="cbIsPageBulkExportEnabled" checked={isBulkExportPagesEnabled} - disabled={data?.isFixedIsBulkExportPagesEnabled} + disabled={data?.useOnlyEnvVarsForIsBulkExportPagesEnabled} onChange={e => setIsBulkExportPagesEnabled(e.target.checked)} />
+ {data?.useOnlyEnvVarsForIsBulkExportPagesEnabled && ( +

+ {/* eslint-disable-next-line react/no-danger */} + +

+ )}
@@ -107,21 +124,6 @@ const PageBulkExportSettings = (): JSX.Element => {
- - {data?.isFixedIsBulkExportPagesEnabled && ( -

- help - FIXED
- {/* eslint-disable-next-line react/no-danger */} - -

- )} diff --git a/apps/app/src/client/services/AdminAppContainer.js b/apps/app/src/client/services/AdminAppContainer.js index 0ad1836f659..6edddffe915 100644 --- a/apps/app/src/client/services/AdminAppContainer.js +++ b/apps/app/src/client/services/AdminAppContainer.js @@ -23,8 +23,6 @@ export default class AdminAppContainer extends Container { globalLang: '', isEmailPublishedForNewUser: true, fileUpload: '', - isBulkExportPagesEnabled: false, - isFixedIsBulkExportPagesEnabled: false, isV5Compatible: null, siteUrl: '', @@ -102,7 +100,6 @@ export default class AdminAppContainer extends Container { globalLang: appSettingsParams.globalLang, isEmailPublishedForNewUser: appSettingsParams.isEmailPublishedForNewUser, fileUpload: appSettingsParams.fileUpload, - isBulkExportPagesEnabled: appSettingsParams.isBulkExportPagesEnabled, isV5Compatible: appSettingsParams.isV5Compatible, siteUrl: appSettingsParams.siteUrl, siteUrlUseOnlyEnvVars: appSettingsParams.siteUrlUseOnlyEnvVars, @@ -160,12 +157,6 @@ export default class AdminAppContainer extends Container { this.setState({ fileUploadType: appSettingsParams.envFileUploadType }); this.setState({ isFixedFileUploadByEnvVar: true }); } - - if (appSettingsParams.useOnlyEnvVarsForIsBulkExportPagesEnabled) { - this.setState({ isBulkExportPagesEnabled: appSettingsParams.envIsBulkExportPagesEnabled }); - this.setState({ isFixedIsBulkExportPagesEnabled: true }); - } - } /** @@ -405,7 +396,6 @@ export default class AdminAppContainer extends Container { globalLang: this.state.globalLang, isEmailPublishedForNewUser: this.state.isEmailPublishedForNewUser, fileUpload: this.state.fileUpload, - isBulkExportPagesEnabled: this.state.isBulkExportPagesEnabled, }); const { appSettingParams } = response.data; return appSettingParams; diff --git a/apps/app/src/interfaces/res/admin/app-settings.ts b/apps/app/src/interfaces/res/admin/app-settings.ts index 909ec915e2c..01145fa44d4 100644 --- a/apps/app/src/interfaces/res/admin/app-settings.ts +++ b/apps/app/src/interfaces/res/admin/app-settings.ts @@ -63,5 +63,5 @@ export type IResAppSettings = { isBulkExportPagesEnabled: boolean, envIsBulkExportPagesEnabled: boolean, bulkExportDownloadExpirationSeconds: number, - isFixedIsBulkExportPagesEnabled: boolean, + useOnlyEnvVarsForIsBulkExportPagesEnabled: boolean, } From b58b59f9170f171e55e9f38179f1d0401afcb199 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Thu, 12 Dec 2024 23:59:03 +0900 Subject: [PATCH 20/46] change default value of bulkExportDownloadExpirationSeconds --- apps/app/src/server/service/config-loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/src/server/service/config-loader.ts b/apps/app/src/server/service/config-loader.ts index 03b21e15f4d..1c25b72877e 100644 --- a/apps/app/src/server/service/config-loader.ts +++ b/apps/app/src/server/service/config-loader.ts @@ -761,7 +761,7 @@ const ENV_VAR_NAME_TO_CONFIG_INFO: Record = { ns: 'crowi', key: 'app:bulkExportDownloadExpirationSeconds', type: ValueType.NUMBER, - default: 86400, // 1 day + default: 259200, // 3 days }, BULK_EXPORT_JOB_CRON_SCHEDULE: { ns: 'crowi', From ef8978dd3b33c2215301d2dcea4063d618ee8b86 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Fri, 13 Dec 2024 02:35:15 +0000 Subject: [PATCH 21/46] add slash limit pattern --- packages/core/src/utils/page-path-utils/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/utils/page-path-utils/index.ts b/packages/core/src/utils/page-path-utils/index.ts index 7efcaa9222e..c501aa0ee68 100644 --- a/packages/core/src/utils/page-path-utils/index.ts +++ b/packages/core/src/utils/page-path-utils/index.ts @@ -117,9 +117,10 @@ const restrictedPatternsToCreate: Array = [ /^\/(_search|_private-legacy-pages)(\/.*|$)/, /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/, /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1 + /^(\/.+){500,}$/, // avoid deep layer path. see: https://regex101.com/r/s9cCdf/1 ]; export const isCreatablePage = (path: string): boolean => { - return !restrictedPatternsToCreate.some(pattern => path.match(pattern)) && path.length <= 2_000_000; + return !restrictedPatternsToCreate.some(pattern => path.match(pattern)); }; /** From 0f759044c7306b4b8ed221d6cb9fb5c8d1b32041 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Fri, 13 Dec 2024 03:08:08 +0000 Subject: [PATCH 22/46] add regex example --- packages/core/src/utils/page-path-utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/utils/page-path-utils/index.ts b/packages/core/src/utils/page-path-utils/index.ts index c501aa0ee68..b970deddcce 100644 --- a/packages/core/src/utils/page-path-utils/index.ts +++ b/packages/core/src/utils/page-path-utils/index.ts @@ -117,7 +117,7 @@ const restrictedPatternsToCreate: Array = [ /^\/(_search|_private-legacy-pages)(\/.*|$)/, /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/, /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1 - /^(\/.+){500,}$/, // avoid deep layer path. see: https://regex101.com/r/s9cCdf/1 + /^(\/.+){500,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1 ]; export const isCreatablePage = (path: string): boolean => { return !restrictedPatternsToCreate.some(pattern => path.match(pattern)); From 2a99b278e9a5992022733dd17dcbab4d3560fba9 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Fri, 13 Dec 2024 07:30:52 +0000 Subject: [PATCH 23/46] change create error message --- apps/app/public/static/locales/en_US/translation.json | 2 +- apps/app/public/static/locales/fr_FR/translation.json | 2 +- apps/app/public/static/locales/ja_JP/translation.json | 2 +- apps/app/public/static/locales/zh_CN/translation.json | 2 +- .../components/TreeItem/NewPageInput/use-new-page-input.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/app/public/static/locales/en_US/translation.json b/apps/app/public/static/locales/en_US/translation.json index 9481d802cbf..a999a171337 100644 --- a/apps/app/public/static/locales/en_US/translation.json +++ b/apps/app/public/static/locales/en_US/translation.json @@ -157,7 +157,7 @@ "duplicated_path": "Duplicated path", "Link sharing is disabled": "Link sharing is disabled", "successfully_saved_the_page": "Successfully saved the page", - "you_can_not_create_page_with_this_name": "You can not create page with this name", + "you_can_not_create_page_with_this_name_or_hierarchy": "You can not create page with this name or page hierarchy", "not_allowed_to_see_this_page": "You cannot see this page", "Confirm": "Confirm", "Successfully requested": "Successfully requested.", diff --git a/apps/app/public/static/locales/fr_FR/translation.json b/apps/app/public/static/locales/fr_FR/translation.json index bb0d0686ba2..8c2de3482e1 100644 --- a/apps/app/public/static/locales/fr_FR/translation.json +++ b/apps/app/public/static/locales/fr_FR/translation.json @@ -157,7 +157,7 @@ "duplicated_path": "Chemin dupliqué", "Link sharing is disabled": "Le partage est désactivé", "successfully_saved_the_page": "Page sauvegardée", - "you_can_not_create_page_with_this_name": "Vous ne pouvez pas créer cette page", + "you_can_not_create_page_with_this_name_or_hierarchy": "Vous ne pouvez pas créer de page avec ce nom ou cette hiérarchie de pages", "not_allowed_to_see_this_page": "Vous ne pouvez pas voir cette page", "Confirm": "Confirmer", "Successfully requested": "Demande envoyée.", diff --git a/apps/app/public/static/locales/ja_JP/translation.json b/apps/app/public/static/locales/ja_JP/translation.json index dc7c3021ed9..49fecc4b3fa 100644 --- a/apps/app/public/static/locales/ja_JP/translation.json +++ b/apps/app/public/static/locales/ja_JP/translation.json @@ -158,7 +158,7 @@ "duplicated_path": "重複したパス", "Link sharing is disabled": "リンクのシェアは無効化されています", "successfully_saved_the_page": "ページが正常に保存されました", - "you_can_not_create_page_with_this_name": "この名前でページを作成することはできません", + "you_can_not_create_page_with_this_name_or_hierarchy": "この名前、または階層でページを作成することはできません", "not_allowed_to_see_this_page": "このページは閲覧できません", "Confirm": "確認", "Successfully requested": "正常に処理を受け付けました", diff --git a/apps/app/public/static/locales/zh_CN/translation.json b/apps/app/public/static/locales/zh_CN/translation.json index 3a3fb1e8e42..beff5df7b3a 100644 --- a/apps/app/public/static/locales/zh_CN/translation.json +++ b/apps/app/public/static/locales/zh_CN/translation.json @@ -163,7 +163,7 @@ "duplicated_path": "Duplicated path", "Link sharing is disabled": "你不允许分享该链接", "successfully_saved_the_page": "成功地保存了该页面", - "you_can_not_create_page_with_this_name": "您无法使用此名称创建页面", + "you_can_not_create_page_with_this_name_or_hierarchy": "您無法使用此名稱或頁面層級建立頁面", "not_allowed_to_see_this_page": "你不能看到这个页面", "Confirm": "确定", "Successfully requested": "进程成功接受", diff --git a/apps/app/src/client/components/TreeItem/NewPageInput/use-new-page-input.tsx b/apps/app/src/client/components/TreeItem/NewPageInput/use-new-page-input.tsx index cd86eaf517b..e3053fcf19b 100644 --- a/apps/app/src/client/components/TreeItem/NewPageInput/use-new-page-input.tsx +++ b/apps/app/src/client/components/TreeItem/NewPageInput/use-new-page-input.tsx @@ -99,7 +99,7 @@ export const useNewPageInput = (): UseNewPageInput => { const isCreatable = pagePathUtils.isCreatablePage(newPagePath); if (!isCreatable) { - toastWarning(t('you_can_not_create_page_with_this_name')); + toastWarning(t('you_can_not_create_page_with_this_name_or_hierarchy')); return; } From 2a5d6ea33fabadc587bdd966db90f4b3ae8f6c77 Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Fri, 13 Dec 2024 07:42:07 +0000 Subject: [PATCH 24/46] hit area expanded, leaving the elements --- .../Common/PagePathNav/PagePathNav.module.scss | 7 ++----- .../Common/PagePathNav/PagePathNavLayout.tsx | 16 ++++++++++------ .../PagePathNavTitle.module.scss | 5 ----- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/app/src/components/Common/PagePathNav/PagePathNav.module.scss b/apps/app/src/components/Common/PagePathNav/PagePathNav.module.scss index 35c0a52fe6c..34a506a19d8 100644 --- a/apps/app/src/components/Common/PagePathNav/PagePathNav.module.scss +++ b/apps/app/src/components/Common/PagePathNav/PagePathNav.module.scss @@ -4,8 +4,7 @@ .grw-page-path-nav-layout :global { .grw-page-path-nav-copydropdown { - visibility: hidden; /* 通常時は非表示(スペースは維持) */ - // display: none; + visibility: hidden; @include bs.media-breakpoint-down(md) { display: block; } @@ -16,9 +15,7 @@ &:global { &:hover { .grw-page-path-nav-copydropdown { - visibility: visible; /* ホバー時に表示 */ - // opacity: 1; - // display: block; + visibility: visible; } } } diff --git a/apps/app/src/components/Common/PagePathNav/PagePathNavLayout.tsx b/apps/app/src/components/Common/PagePathNav/PagePathNavLayout.tsx index 0a86eb5dc20..dcfd45c769c 100644 --- a/apps/app/src/components/Common/PagePathNav/PagePathNavLayout.tsx +++ b/apps/app/src/components/Common/PagePathNav/PagePathNavLayout.tsx @@ -1,4 +1,3 @@ -// import type { ReactNode } from 'react'; import React, { useState } from 'react'; import dynamic from 'next/dynamic'; @@ -41,16 +40,21 @@ export const PagePathNavLayout = (props: Props): JSX.Element => { const copyDropdownId = `copydropdown-${pageId}`; - const [, setIsHovered] = useState(false); + const [isHovered, setIsHovered] = useState(false); const [hideTimeout, setHideTimeout] = useState(null); const handleMouseEnter = () => { - if (hideTimeout) clearTimeout(hideTimeout); // 非表示タイマーをリセット - setIsHovered(true); // ボタンを表示 + if (hideTimeout) { + clearTimeout(hideTimeout); + setHideTimeout(null); + } + setIsHovered(true); }; const handleMouseLeave = () => { - const timeout = setTimeout(() => setIsHovered(false), 3000); // 3秒後にボタンを非表示 + const timeout = setTimeout(() => { + setIsHovered(false); + }, 1000); setHideTimeout(timeout); }; @@ -70,7 +74,7 @@ export const PagePathNavLayout = (props: Props): JSX.Element => { WIP )} diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 6db80e65813..3c62f47ea35 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -2,9 +2,4 @@ .grw-page-path-nav-title :global { min-height: 75px; - padding-right: 70px; -} - -.grw-page-path-nav-title:hover { - background-color: rgba(0, 0, 0, 0.05); /* ホバー範囲を視覚的に確認したい場合の背景 */ } From e702b2e1ac37505ffc2dd9cbffc5125154eb1f82 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Fri, 13 Dec 2024 07:57:57 +0000 Subject: [PATCH 25/46] remove unused import --- apps/app/src/server/models/page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/src/server/models/page.ts b/apps/app/src/server/models/page.ts index 30684de2b25..48c2d812c1c 100644 --- a/apps/app/src/server/models/page.ts +++ b/apps/app/src/server/models/page.ts @@ -9,7 +9,7 @@ import { } from '@growi/core'; import type { IPagePopulatedToShowRevision } from '@growi/core/dist/interfaces'; import { getIdForRef, isPopulated } from '@growi/core/dist/interfaces'; -import { isTopPage, hasSlash } from '@growi/core/dist/utils/page-path-utils'; +import { isTopPage, hasSlash, isCreatablePage } from '@growi/core/dist/utils/page-path-utils'; import { addTrailingSlash, normalizePath } from '@growi/core/dist/utils/path-utils'; import escapeStringRegexp from 'escape-string-regexp'; import type { From 84362eabcd81ff408a20a676378f7c4d49d03940 Mon Sep 17 00:00:00 2001 From: reiji-h Date: Fri, 13 Dec 2024 07:58:14 +0000 Subject: [PATCH 26/46] remove unused import --- apps/app/src/server/models/page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/src/server/models/page.ts b/apps/app/src/server/models/page.ts index 48c2d812c1c..30684de2b25 100644 --- a/apps/app/src/server/models/page.ts +++ b/apps/app/src/server/models/page.ts @@ -9,7 +9,7 @@ import { } from '@growi/core'; import type { IPagePopulatedToShowRevision } from '@growi/core/dist/interfaces'; import { getIdForRef, isPopulated } from '@growi/core/dist/interfaces'; -import { isTopPage, hasSlash, isCreatablePage } from '@growi/core/dist/utils/page-path-utils'; +import { isTopPage, hasSlash } from '@growi/core/dist/utils/page-path-utils'; import { addTrailingSlash, normalizePath } from '@growi/core/dist/utils/path-utils'; import escapeStringRegexp from 'escape-string-regexp'; import type { From fb24cb9e00ed0da2f8831099da8e81cb34ceceb4 Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Fri, 13 Dec 2024 07:59:16 +0000 Subject: [PATCH 27/46] Revert "Resolve conflicts" This reverts commit 0948c30cb887392824853f4799a93a62c2061f6a. --- .../Common/PagePathNavTitle/PagePathNavTitle.module.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 3c62f47ea35..777fbad5be2 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -2,4 +2,8 @@ .grw-page-path-nav-title :global { min-height: 75px; +<<<<<<< Updated upstream +======= + // padding-right: 70px; +>>>>>>> Stashed changes } From d69cd8952e4a5567eea142dddcd90514bd8aa344 Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Fri, 13 Dec 2024 08:08:07 +0000 Subject: [PATCH 28/46] fix file --- .../Common/PagePathNavTitle/PagePathNavTitle.module.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss index 777fbad5be2..3c62f47ea35 100644 --- a/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss +++ b/apps/app/src/components/Common/PagePathNavTitle/PagePathNavTitle.module.scss @@ -2,8 +2,4 @@ .grw-page-path-nav-title :global { min-height: 75px; -<<<<<<< Updated upstream -======= - // padding-right: 70px; ->>>>>>> Stashed changes } From 7d283e64efa33ad5602835b493ef93d32f4239f8 Mon Sep 17 00:00:00 2001 From: ryosei-f Date: Fri, 13 Dec 2024 08:24:16 +0000 Subject: [PATCH 29/46] Revert "Resolve conflicts" This reverts commit 0e46e2b74c4c3db8e521be5cf08efe100dede49a. --- .../PagePathNavSticky/PagePathNavSticky.module.scss | 2 -- apps/app/src/client/components/PagePresentationModal.tsx | 3 +-- apps/app/src/pages/[[...path]].page.tsx | 2 +- apps/app/src/stores-universal/context.tsx | 1 - apps/app/src/stores/renderer.tsx | 5 ----- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss b/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss index 9dd96f4284d..2948618afcb 100644 --- a/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss +++ b/apps/app/src/client/components/PagePathNavSticky/PagePathNavSticky.module.scss @@ -1,8 +1,6 @@ @use '@growi/core-styles/scss/bootstrap/init' as bs; .grw-page-path-nav-sticky :global { - // width: 100%; - .sticky-inner-wrapper { z-index: bs.$zindex-sticky; } diff --git a/apps/app/src/client/components/PagePresentationModal.tsx b/apps/app/src/client/components/PagePresentationModal.tsx index 51468e781eb..7796841113c 100644 --- a/apps/app/src/client/components/PagePresentationModal.tsx +++ b/apps/app/src/client/components/PagePresentationModal.tsx @@ -67,8 +67,7 @@ const PagePresentationModal = (): JSX.Element => { if (!isOpen) { return <>; } - console.log(isEnabledMarp, 'Marp'); - console.log(rendererOptions, 'renderOption'); + return ( = (props: Props) => { useDefaultIndentSize(props.adminPreferredIndentSize); useIsIndentSizeForced(props.isIndentSizeForced); useDisableLinkSharing(props.disableLinkSharing); - // useRendererConfig(props.rendererConfig); + useRendererConfig(props.rendererConfig); useIsEnabledMarp(props.rendererConfig.isEnabledMarp); // useRendererSettings(props.rendererSettingsStr != null ? JSON.parse(props.rendererSettingsStr) : undefined); // useGrowiRendererConfig(props.growiRendererConfigStr != null ? JSON.parse(props.growiRendererConfigStr) : undefined); diff --git a/apps/app/src/stores-universal/context.tsx b/apps/app/src/stores-universal/context.tsx index e29ada8d300..a62586dacc7 100644 --- a/apps/app/src/stores-universal/context.tsx +++ b/apps/app/src/stores-universal/context.tsx @@ -147,7 +147,6 @@ export const useIsEnabledStaleNotification = (initialData?: boolean): SWRRespons }; export const useRendererConfig = (initialData?: RendererConfig): SWRResponse => { - console.log(initialData, 'undifined or null'); return useContextSWR('growiRendererConfig', initialData); }; diff --git a/apps/app/src/stores/renderer.tsx b/apps/app/src/stores/renderer.tsx index 97dd1cfa748..bd4a4776bd3 100644 --- a/apps/app/src/stores/renderer.tsx +++ b/apps/app/src/stores/renderer.tsx @@ -171,11 +171,6 @@ export const useCustomSidebarOptions = (config?: SWRConfiguration): SWRResponse< export const usePresentationViewOptions = (): SWRResponse => { const { data: currentPagePath } = useCurrentPagePath(); const { data: rendererConfig } = useRendererConfig(); - console.log(rendererConfig, 'rendererconfig'); - if (!rendererConfig) { - console.log('RendererConfig is missing.'); - } - const isAllDataValid = currentPagePath != null && rendererConfig != null; From be3f45c24ef7742c4dc4f786b12f97b3e2441f5d Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Mon, 16 Dec 2024 21:56:49 +0900 Subject: [PATCH 30/46] improve page bulk export config explanation --- apps/app/public/static/locales/en_US/admin.json | 4 ++-- apps/app/public/static/locales/fr_FR/admin.json | 4 ++-- apps/app/public/static/locales/ja_JP/admin.json | 4 ++-- apps/app/public/static/locales/zh_CN/admin.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/app/public/static/locales/en_US/admin.json b/apps/app/public/static/locales/en_US/admin.json index 69e4664eddb..23b83e7a3ac 100644 --- a/apps/app/public/static/locales/en_US/admin.json +++ b/apps/app/public/static/locales/en_US/admin.json @@ -364,8 +364,8 @@ "attach_enable": "You can attach files other than image files if you enable this option.", "page_bulk_export_settings": "Page Bulk Export Settings", "enable_page_bulk_export": "Enable bulk export", - "page_bulk_export_explanation": "When bulk export is enabled, users will be able to export a page and it's child pages from the page menu. Exported results will be deleted from the file system and cannot be downloaded when the configured storage period passes.", - "page_bulk_export_warning": "Running multiple large exports consecutively can fill up the file system.", + "page_bulk_export_explanation": "Enables a feature that allows all users to export a page and all it's child pages at once from the menu. Exported data will be automatically deleted after the storage period has passed.", + "page_bulk_export_warning": "The bulk page export feature is available to all users. In order to maintain system resources, we ask for your cooperation in using the minimum amount necessary. If you are an administrator, please inform all users of this.", "page_bulk_export_storage_period": "Storage period", "update": "Update", "mail_settings": "E-mail Settings", diff --git a/apps/app/public/static/locales/fr_FR/admin.json b/apps/app/public/static/locales/fr_FR/admin.json index f02449ae409..deb23ca98d2 100644 --- a/apps/app/public/static/locales/fr_FR/admin.json +++ b/apps/app/public/static/locales/fr_FR/admin.json @@ -364,8 +364,8 @@ "attach_enable": "Autorise le téléversement de fichiers de n'importe quel type", "page_bulk_export_settings": "Paramètres d'exportation de pages par lots", "enable_page_bulk_export": "Activer l'exportation groupée", - "page_bulk_export_explanation": "Lorsque l'exportation groupée est activée, les utilisateurs pourront exporter une page et ses pages enfants à partir du menu des pages. Les résultats exportés seront supprimés du système de fichiers et ne pourront pas être téléchargés une fois la période de stockage configurée écoulée.", - "page_bulk_export_warning": "Les exportations continues comportant un grand nombre de pages peuvent surcharger le système de fichiers.", + "page_bulk_export_explanation": "Active une fonctionnalité qui permet à tous les utilisateurs d'exporter simultanément toutes les pages sélectionnées dans le menu des pages et leurs pages subordonnées. Les données exportées seront automatiquement supprimées une fois la période de conservation écoulée.", + "page_bulk_export_warning": "La fonctionnalité d’exportation de pages en masse est disponible pour tous les utilisateurs. Afin de maintenir les ressources du système, nous demandons votre coopération pour utiliser le montant minimum nécessaire. Si vous êtes administrateur, veuillez en informer tous les utilisateurs.", "page_bulk_export_storage_period": "Date limite de téléchargement", "update": "Sauvegarder", "mail_settings": "Configuration e-mail", diff --git a/apps/app/public/static/locales/ja_JP/admin.json b/apps/app/public/static/locales/ja_JP/admin.json index 9c70bd26d0d..30f5fa1bee7 100644 --- a/apps/app/public/static/locales/ja_JP/admin.json +++ b/apps/app/public/static/locales/ja_JP/admin.json @@ -374,8 +374,8 @@ "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。", "page_bulk_export_settings": "ページ一括エクスポート設定", "enable_page_bulk_export": "一括エクスポートを有効にする", - "page_bulk_export_explanation": "一括エクスポートを有効にすると、ページメニューからそのページと配下ページのエクスポートが可能になります。エクスポート結果は設定された保存期間を過ぎるとファイルシステムから削除され、ダウンロードできなくなります。", - "page_bulk_export_warning": "ページ数の多いエクスポートを連続で実行すると、ファイルシステムを圧迫する可能性があります。", + "page_bulk_export_explanation": "すべてのユーザーが、ページメニューから選択したページとその配下ページをまとめてエクスポートできる機能を有効化します。エクスポートされたデータは保存期間経過後に自動的に削除されます。", + "page_bulk_export_warning": "ページ一括エクスポート機能は全ユーザーが利用可能です。システムリソースの維持のため、必要最小限の利用にご協力をお願いいたします。管理者の方は、この旨をユーザーの皆様にご周知ください。", "page_bulk_export_storage_period": "保存期間", "update": "更新", "mail_settings": "メールの設定", diff --git a/apps/app/public/static/locales/zh_CN/admin.json b/apps/app/public/static/locales/zh_CN/admin.json index b244798cdfc..79452d43038 100644 --- a/apps/app/public/static/locales/zh_CN/admin.json +++ b/apps/app/public/static/locales/zh_CN/admin.json @@ -373,8 +373,8 @@ "attach_enable": "如果启用此选项,则可以附加图像文件以外的文件。", "page_bulk_export_settings": "页面批量导出设置", "enable_page_bulk_export": "启用批量导出", - "page_bulk_export_explanation": "启用批量导出后,用户将能够从页面菜单导出页面及其子页面。当配置的存储期限过后,导出的结果将从文件系统中删除,并且无法下载。", - "page_bulk_export_warning": "连续运行多个大型导出可能会填满文件系统。", + "page_bulk_export_explanation": "启用一项功能,允许所有用户一次性导出从页面菜单中选择的所有页面及其下级页面。保留期限过后,导出的数据将自动删除。", + "page_bulk_export_warning": "批量页面导出功能可供所有用户使用。为了维护系统资源,请您配合使用最低限度的资源。如果您是管理员,请将此事实告知所有用户。", "page_bulk_export_storage_period": "储存期限", "update": "更新", "mail_settings": "邮件设置", From dc81278e831e928700240cbdb730454d6899fa90 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Mon, 16 Dec 2024 23:56:35 +0900 Subject: [PATCH 31/46] add days translation --- apps/app/public/static/locales/en_US/admin.json | 1 + apps/app/public/static/locales/fr_FR/admin.json | 1 + apps/app/public/static/locales/zh_CN/admin.json | 1 + .../src/client/components/Admin/App/PageBulkExportSettings.tsx | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/app/public/static/locales/en_US/admin.json b/apps/app/public/static/locales/en_US/admin.json index 23b83e7a3ac..920129084fa 100644 --- a/apps/app/public/static/locales/en_US/admin.json +++ b/apps/app/public/static/locales/en_US/admin.json @@ -10,6 +10,7 @@ "only_me": "Only me", "only_inside_the_group": "Only inside the group", "optional": "Optional", + "days": "days", "security_settings": { "security_settings": "Security Settings", "scope_of_page_disclosure": "Scope of page disclosure", diff --git a/apps/app/public/static/locales/fr_FR/admin.json b/apps/app/public/static/locales/fr_FR/admin.json index deb23ca98d2..3d560185990 100644 --- a/apps/app/public/static/locales/fr_FR/admin.json +++ b/apps/app/public/static/locales/fr_FR/admin.json @@ -10,6 +10,7 @@ "only_me": "Seulement moi", "only_inside_the_group": "Utilisateurs du groupe", "optional": "Optionnel", + "days": "jours", "security_settings": { "security_settings": "Paramètres de sécurité", "scope_of_page_disclosure": "Confidentialité de la page", diff --git a/apps/app/public/static/locales/zh_CN/admin.json b/apps/app/public/static/locales/zh_CN/admin.json index 79452d43038..4e0d660a7d7 100644 --- a/apps/app/public/static/locales/zh_CN/admin.json +++ b/apps/app/public/static/locales/zh_CN/admin.json @@ -19,6 +19,7 @@ "only_me": "只有我", "only_inside_the_group": "仅组内", "optional": "可选的", + "days": "天", "security_settings": { "security_settings": "安全设置", "scope_of_page_disclosure": "页面公开范围", diff --git a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx index 9875b039f7e..e4e815da9ae 100644 --- a/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx +++ b/apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx @@ -118,7 +118,7 @@ const PageBulkExportSettings = (): JSX.Element => { > {Array.from({ length: 7 }, (_, i) => i + 1).map(number => ( ))} From d61529404e42ee0b1cfc6e0b0c81f98ebe9800d1 Mon Sep 17 00:00:00 2001 From: Futa Arai Date: Tue, 17 Dec 2024 00:55:27 +0900 Subject: [PATCH 32/46] add page bulk export warning --- .../static/locales/en_US/translation.json | 3 ++- .../static/locales/fr_FR/translation.json | 3 ++- .../static/locales/ja_JP/translation.json | 3 ++- .../static/locales/zh_CN/translation.json | 3 ++- .../components/PageBulkExportSelectModal.tsx | 17 ++++++++++------- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/app/public/static/locales/en_US/translation.json b/apps/app/public/static/locales/en_US/translation.json index 6f15105fc78..466860bdcdc 100644 --- a/apps/app/public/static/locales/en_US/translation.json +++ b/apps/app/public/static/locales/en_US/translation.json @@ -660,7 +660,8 @@ "export_page_markdown": "Export page as Markdown", "export_page_pdf": "Export page as PDF", "bulk_export": "Export page and all child pages", - "bulk_export_notice": "Once a download link is ready, a notification will be sent. If the number of pages is large, it may take a while for preparation.", + "bulk_export_exec_time_warning": "If the number of pages is large, it may take a while for preparation", + "large_bulk_export_warning": "To conserve system resources, please refrain from exporting a large number of pages consecutively", "markdown": "Markdown", "choose_export_format": "Select export format", "bulk_export_started": "Please wait a moment...", diff --git a/apps/app/public/static/locales/fr_FR/translation.json b/apps/app/public/static/locales/fr_FR/translation.json index 914a989153c..aec970ae2a9 100644 --- a/apps/app/public/static/locales/fr_FR/translation.json +++ b/apps/app/public/static/locales/fr_FR/translation.json @@ -653,7 +653,8 @@ "export_page_markdown": "Exporter la page en Markdown", "export_page_pdf": "Exporter la page en PDF", "bulk_export": "Exporter la page et toutes les pages enfants", - "bulk_export_notice": "Une fois qu'un lien de téléchargement est prêt, une notification sera envoyée. Si le nombre de pages est important, la préparation peut prendre un certain temps.", + "bulk_export_exec_time_warning": "Si le nombre de pages est important, la préparation peut prendre un certain temps", + "large_bulk_export_warning": "Pour préserver les ressources du système, veuillez éviter d'exporter un grand nombre de pages consécutivement", "markdown": "Markdown", "choose_export_format": "Sélectionnez le format d'exportation", "bulk_export_started": "Patientez s'il-vous-plait...", diff --git a/apps/app/public/static/locales/ja_JP/translation.json b/apps/app/public/static/locales/ja_JP/translation.json index 73ff28aedb3..a3ffd6fdeda 100644 --- a/apps/app/public/static/locales/ja_JP/translation.json +++ b/apps/app/public/static/locales/ja_JP/translation.json @@ -692,7 +692,8 @@ "export_page_markdown": "マークダウン形式でページをエクスポート", "export_page_pdf": "PDF形式でページをエクスポート", "bulk_export": "ページとその配下のページを全てエクスポート", - "bulk_export_notice": "ダウンロードの準備が完了すると、通知が届きます。ページ数が多いと、準備に時間がかかる場合があります。", + "bulk_export_exec_time_warning": "ページ数が多いと、準備に時間がかかる場合があります", + "large_bulk_export_warning": "システムリソースの維持のため、大量のページを連続してエクスポートすることはご遠慮ください", "markdown": "マークダウン", "choose_export_format": "エクスポート形式を選択してください", "bulk_export_started": "ただいま準備中です...", diff --git a/apps/app/public/static/locales/zh_CN/translation.json b/apps/app/public/static/locales/zh_CN/translation.json index 38fc6bbe03d..63644fe1c0c 100644 --- a/apps/app/public/static/locales/zh_CN/translation.json +++ b/apps/app/public/static/locales/zh_CN/translation.json @@ -662,7 +662,8 @@ "export_page_markdown": "以Markdown格式导出页面", "export_page_pdf": "以PDF格式导出页面", "bulk_export": "导出页面及其下的所有页面", - "bulk_export_notice": "下载链接准备好后,将发送通知。如果页数较多,则可能需要一段时间准备。", + "bulk_export_exec_time_warning": "如果页数较多,则可能需要一段时间准备", + "large_bulk_export_warning": "为了节省系统资源,请避免连续导出大量页面", "markdown": "Markdown", "choose_export_format": "选择导出格式", "bulk_export_started": "目前我们正在准备...", diff --git a/apps/app/src/features/page-bulk-export/client/components/PageBulkExportSelectModal.tsx b/apps/app/src/features/page-bulk-export/client/components/PageBulkExportSelectModal.tsx index 7676736e1dc..833d7a0f8ff 100644 --- a/apps/app/src/features/page-bulk-export/client/components/PageBulkExportSelectModal.tsx +++ b/apps/app/src/features/page-bulk-export/client/components/PageBulkExportSelectModal.tsx @@ -54,17 +54,20 @@ const PageBulkExportSelectModal = (): JSX.Element => { return ( <> {status != null && ( - + {t('page_export.bulk_export')} - {t('page_export.choose_export_format')} -
- - {t('page_export.bulk_export_notice')} - -
+

+ warning{t('Warning')} +

    +
  • {t('page_export.bulk_export_exec_time_warning')}
  • +
  • {t('page_export.large_bulk_export_warning')}
  • +
+

+ + {t('page_export.choose_export_format')}: