Skip to content

Commit

Permalink
Merge pull request #8785 from weseek/master
Browse files Browse the repository at this point in the history
Release v7.0.4
  • Loading branch information
yuki-takei committed May 13, 2024
2 parents 71d59f9 + 48ab3f3 commit a5f1896
Show file tree
Hide file tree
Showing 138 changed files with 2,296 additions and 1,785 deletions.
16 changes: 16 additions & 0 deletions apps/app/config/i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { Lang, AllLang } = require('@growi/core');

/** @type {Lang} */
const defaultLang = Lang.en_US;

/** @type {import('i18next').InitOptions} */
const initOptions = {
fallbackLng: defaultLang.toString(),
supportedLngs: AllLang,
defaultNS: 'translation',
};

module.exports = {
defaultLang,
initOptions,
};
29 changes: 20 additions & 9 deletions apps/app/config/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,47 @@ const isDev = process.env.NODE_ENV === 'development';

const path = require('path');

const { AllLang, Lang } = require('@growi/core');
const { AllLang } = require('@growi/core');
const { isServer } = require('@growi/core/dist/utils');
const I18nextChainedBackend = isDev ? require('i18next-chained-backend').default : undefined;
const I18NextHttpBackend = require('i18next-http-backend').default;
const I18NextLocalStorageBackend = require('i18next-localstorage-backend').default;

const { defaultLang } = require('./i18next.config');

const HMRPlugin = isDev ? require('i18next-hmr/plugin').HMRPlugin : undefined;

/** @type {import('next-i18next').UserConfig} */
module.exports = {
defaultLang: Lang.en_US,
...require('./i18next.config').initOptions,

i18n: {
defaultLocale: Lang.en_US,
defaultLocale: defaultLang.toString(),
locales: AllLang,
},
defaultNS: 'translation',

localePath: path.resolve('./public/static/locales'),
serializeConfig: false,

// eslint-disable-next-line no-nested-ternary
use: isDev
? isServer()
? [new HMRPlugin({ webpack: { server: true } })]
: [I18nextChainedBackend, new HMRPlugin({ webpack: { client: true } })]
: [
require('i18next-chained-backend').default,
new HMRPlugin({ webpack: { client: true } }),
]
: [],
backend: {
backends: isServer() ? [] : [I18NextLocalStorageBackend, I18NextHttpBackend],
backends: isServer()
? []
: [
require('i18next-localstorage-backend').default,
require('i18next-http-backend').default,
],
backendOptions: [
// options for i18next-localstorage-backend
{ expirationTime: isDev ? 0 : 24 * 60 * 60 * 1000 }, // 1 day in production
// options for i18next-http-backend
{ loadPath: '/static/locales/{{lng}}/{{ns}}.json' },
],
},

};
13 changes: 8 additions & 5 deletions apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@growi/app",
"version": "7.0.3",
"version": "7.0.4-RC.0",
"license": "MIT",
"scripts": {
"//// for production": "",
Expand Down Expand Up @@ -108,7 +108,7 @@
"detect-indent": "^7.0.0",
"diff": "^5.0.0",
"diff_match_patch": "^0.1.1",
"ejs": "^3.1.8",
"ejs": "^3.1.10",
"esa-node": "^0.2.2",
"escape-string-regexp": "^4.0.0",
"eslint-plugin-regex": "^1.8.0",
Expand All @@ -125,9 +125,7 @@
"helmet": "^4.6.0",
"http-errors": "^2.0.0",
"i18next": "^23.10.1",
"i18next-chained-backend": "^4.6.2",
"i18next-http-backend": "^2.5.0",
"i18next-localstorage-backend": "^4.2.0",
"i18next-resources-to-backend": "^1.2.1",
"is-absolute-url": "^4.0.1",
"is-iso-date": "^0.0.1",
"ldapjs": "^3.0.2",
Expand Down Expand Up @@ -233,6 +231,7 @@
"@testing-library/user-event": "^14.5.2",
"@types/express": "^4.17.11",
"@types/jest": "^29.5.2",
"@types/react-input-autosize": "^2.2.4",
"@types/react-scroll": "^1.8.4",
"@types/react-stickynode": "^4.0.3",
"@types/throttle-debounce": "^5.0.1",
Expand All @@ -244,6 +243,7 @@
"babel-loader": "^8.2.5",
"bootstrap": "^5.3.1",
"connect-browser-sync": "^2.1.0",
"cypress-real-events": "^1.12.0",
"diff2html": "^3.4.47",
"downshift": "^8.2.3",
"eazy-logger": "^3.1.0",
Expand All @@ -253,7 +253,10 @@
"fslightbox-react": "^1.7.6",
"handsontable": "=6.2.2",
"happy-dom": "^13.2.0",
"i18next-chained-backend": "^4.6.2",
"i18next-hmr": "^3.0.4",
"i18next-http-backend": "^2.5.0",
"i18next-localstorage-backend": "^4.2.0",
"jest": "^29.5.0",
"jest-date-mock": "^1.0.8",
"jest-localstorage-mock": "^2.4.14",
Expand Down
1 change: 1 addition & 0 deletions apps/app/public/static/locales/en_US/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

"create_page_dropdown": {
"new_page": "Create New Page",
"open_page_create_modal": "Open new page create modal",
"todays": {
"desc": "Create today's memo",
"memo": "memo"
Expand Down
27 changes: 17 additions & 10 deletions apps/app/public/static/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,20 @@
"not_allowed_to_see_this_page": "You cannot see this page",
"Confirm": "Confirm",
"Successfully requested": "Successfully requested.",
"form_validation": {
"error_message": "Some values ​​are incorrect",
"required": "%s is required",
"invalid_syntax": "The syntax of %s is invalid.",
"title_required": "Title is required.",
"field_required": "{{target}} is required"
},
"page_name": "Page name",
"folder_name": "Folder name",
"field": "field",
"input_validation": {
"target": {
"page_name": "Page name",
"folder_name": "Folder name",
"field": "field"
},
"message": {
"error_message": "Some values ​​are incorrect",
"required": "%s is required",
"invalid_syntax": "The syntax of %s is invalid.",
"title_required": "Title is required.",
"field_required": "{{target}} is required"
}
},
"not_creatable_page": {
"message": "Page contents cannot be created in this path."
},
Expand Down Expand Up @@ -863,5 +867,8 @@
"show_wip_page": "Show WIP",
"size_s": "Size: S",
"size_l": "Size: L"
},
"create_page": {
"untitled": "Untitled"
}
}
1 change: 1 addition & 0 deletions apps/app/public/static/locales/fr_FR/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

"create_page_dropdown": {
"new_page": "Créer nouvelle page",
"open_page_create_modal": "Ouvrir une nouvelle page créer une fenêtre modale",
"todays": {
"desc": "Créer le mémo du jour",
"memo": "mémo"
Expand Down
24 changes: 14 additions & 10 deletions apps/app/public/static/locales/fr_FR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,20 @@
"not_allowed_to_see_this_page": "Vous ne pouvez pas voir cette page",
"Confirm": "Confirmer",
"Successfully requested": "Demande envoyée.",
"form_validation": {
"error_message": "Des champs sont invalides",
"required": "%s est requis",
"invalid_syntax": "La syntaxe de %s est invalide.",
"title_required": "Titre requis.",
"field_required": "{{target}} est requis"
},
"page_name": "Nom de la page",
"folder_name": "Nom du dossier",
"field": "champ",
"input_validation": {
"target": {
"page_name": "Nom de la page",
"folder_name": "Nom du dossier",
"field": "champ"
},
"message": {
"error_message": "Des champs sont invalides",
"required": "%s est requis",
"invalid_syntax": "La syntaxe de %s est invalide.",
"title_required": "Titre requis.",
"field_required": "{{target}} est requis"
}
},
"not_creatable_page": {
"message": "Vous ne pouvez pas créer cette page dans ce chemin."
},
Expand Down
1 change: 1 addition & 0 deletions apps/app/public/static/locales/ja_JP/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

"create_page_dropdown": {
"new_page": "新規ページ作成",
"open_page_create_modal": "新規ページ作成モーダルを表示",
"todays": {
"desc": "今日のメモを作成",
"memo": "メモ"
Expand Down
27 changes: 17 additions & 10 deletions apps/app/public/static/locales/ja_JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,20 @@
"not_allowed_to_see_this_page": "このページは閲覧できません",
"Confirm": "確認",
"Successfully requested": "正常に処理を受け付けました",
"form_validation": {
"error_message": "いくつかの値が設定されていません",
"required": "%sに値を入力してください",
"invalid_syntax": "%sの構文が不正です",
"title_required": "タイトルを入力してください",
"field_required": "{{target}}に値を入力してください"
},
"page_name": "ページ名",
"folder_name": "フォルダ名",
"field": "フィールド",
"input_validation": {
"target": {
"page_name": "ページ名",
"folder_name": "フォルダ名",
"field": "フィールド"
},
"message": {
"error_message": "いくつかの値が設定されていません",
"required": "%sに値を入力してください",
"invalid_syntax": "%sの構文が不正です",
"title_required": "タイトルを入力してください",
"field_required": "{{target}}に値を入力してください"
}
},
"not_creatable_page": {
"message": "このパスではページ コンテンツを作成できません。"
},
Expand Down Expand Up @@ -896,5 +900,8 @@
"show_wip_page": "WIP を表示",
"size_s": "サイズ: S",
"size_l": "サイズ: L"
},
"create_page": {
"untitled": "無題のページ"
}
}
1 change: 1 addition & 0 deletions apps/app/public/static/locales/zh_CN/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

"create_page_dropdown": {
"new_page": "新页面",
"open_page_create_modal": "打开新页面创建模式",
"todays": {
"desc": "Create today's memo",
"memo": "memo"
Expand Down
27 changes: 17 additions & 10 deletions apps/app/public/static/locales/zh_CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,20 @@
"Confirm": "确定",
"Successfully requested": "进程成功接受",
"copied_to_clipboard": "它已复制到剪贴板。",
"form_validation": {
"error_message": "有些值不正确",
"required": "%s 是必需的",
"invalid_syntax": "%s的语法无效。",
"title_required": "标题是必需的。",
"field_required": "{{target}} 是必需的"
},
"page_name": "页面名称",
"folder_name": "文件夹名称",
"field": "字段",
"input_validation": {
"target": {
"page_name": "页面名称",
"folder_name": "文件夹名称",
"field": "字段"
},
"message": {
"error_message": "有些值不正确",
"required": "%s 是必需的",
"invalid_syntax": "%s的语法无效。",
"title_required": "标题是必需的。",
"field_required": "{{target}} 是必需的"
}
},
"not_creatable_page": {
"message": "无法在此路径中创建页面内容。"
},
Expand Down Expand Up @@ -866,5 +870,8 @@
"show_wip_page": "显示 WIP",
"size_s": "尺寸: S",
"size_l": "尺寸: L"
},
"create_page": {
"untitled": "Untitled"
}
}
23 changes: 15 additions & 8 deletions apps/app/src/client/services/renderer/renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import assert from 'assert';

import { isClient } from '@growi/core/dist/utils/browser-utils';
import * as slides from '@growi/presentation';
import * as refsGrowiDirective from '@growi/remark-attachment-refs/dist/client';
import * as drawio from '@growi/remark-drawio';
// eslint-disable-next-line import/extensions
Expand All @@ -19,7 +18,6 @@ import { DrawioViewerWithEditButton } from '~/components/ReactMarkdownComponents
import { Header } from '~/components/ReactMarkdownComponents/Header';
import { LightBox } from '~/components/ReactMarkdownComponents/LightBox';
import { RichAttachment } from '~/components/ReactMarkdownComponents/RichAttachment';
import { SlideViewer } from '~/components/ReactMarkdownComponents/SlideViewer';
import { TableWithEditButton } from '~/components/ReactMarkdownComponents/TableWithEditButton';
import * as mermaid from '~/features/mermaid';
import { RehypeSanitizeOption } from '~/interfaces/rehype';
Expand Down Expand Up @@ -68,7 +66,6 @@ export const generateViewOptions = (
attachment.remarkPlugin,
lsxGrowiDirective.remarkPlugin,
refsGrowiDirective.remarkPlugin,
[slides.remarkPlugin, { isEnabledMarp: config.isEnabledMarp }],
);
if (config.isEnabledLinebreaks) {
remarkPlugins.push(breaks);
Expand All @@ -84,7 +81,6 @@ export const generateViewOptions = (
drawio.sanitizeOption,
mermaid.sanitizeOption,
attachment.sanitizeOption,
slides.sanitizeOption,
lsxGrowiDirective.sanitizeOption,
refsGrowiDirective.sanitizeOption,
)]
Expand Down Expand Up @@ -119,7 +115,6 @@ export const generateViewOptions = (
components.mermaid = mermaid.MermaidViewer;
components.attachment = RichAttachment;
components.img = LightBox;
components.slide = SlideViewer;
}

if (config.isEnabledXssPrevention) {
Expand Down Expand Up @@ -241,6 +236,21 @@ export const generatePresentationViewOptions = (
// based on simple view options
const options = generateSimpleViewOptions(config, pagePath);

const { rehypePlugins } = options;


const rehypeSanitizePlugin: Pluggable<any[]> | (() => void) = config.isEnabledXssPrevention
? [sanitize, deepmerge(
addLineNumberAttribute.sanitizeOption,
)]
: () => {};

// add rehype plugins
rehypePlugins.push(
addLineNumberAttribute.rehypePlugin,
rehypeSanitizePlugin,
);

if (config.isEnabledXssPrevention) {
verifySanitizePlugin(options, false);
}
Expand All @@ -262,7 +272,6 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
attachment.remarkPlugin,
lsxGrowiDirective.remarkPlugin,
refsGrowiDirective.remarkPlugin,
[slides.remarkPlugin, { isEnabledMarp: config.isEnabledMarp }],
);
if (config.isEnabledLinebreaks) {
remarkPlugins.push(breaks);
Expand All @@ -281,7 +290,6 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
lsxGrowiDirective.sanitizeOption,
refsGrowiDirective.sanitizeOption,
addLineNumberAttribute.sanitizeOption,
slides.sanitizeOption,
)]
: () => {};

Expand All @@ -306,7 +314,6 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
components.mermaid = mermaid.MermaidViewer;
components.attachment = RichAttachment;
components.img = LightBox;
components.slide = SlideViewer;
}

if (config.isEnabledXssPrevention) {
Expand Down

0 comments on commit a5f1896

Please sign in to comment.