Przeglądaj źródła

Merge branch 'master' into feat/gw7925-normalize-cypress-test

ryoji-s 3 lat temu
rodzic
commit
7b09989164

+ 18 - 1
CHANGELOG.md

@@ -1,9 +1,26 @@
 # Changelog
 
-## [Unreleased](https://github.com/weseek/growi/compare/v6.0.9...HEAD)
+## [Unreleased](https://github.com/weseek/growi/compare/v6.0.10...HEAD)
 
 *Please do not manually update this file. We've automated the process.*
 
+## [v6.0.10](https://github.com/weseek/growi/compare/v6.0.9...v6.0.10) - 2023-03-23
+
+### 🚀 Improvement
+
+- imprv: Reverse switch for display or hidden page settings (#7483) @yuki-takei
+
+### 🐛 Bug Fixes
+
+- fix: CodeBlock string is be `[object Object]` if searched (#7484) @jam411
+- fix: Show handsontable edit modal color in dark theme  (#7497) @yukendev
+- fix: Error when transitioning to a user home page where creator does not exist (#7499) @miya
+- fix: Attachment links do not work correctly (#7498) @jam411
+- fix: Language selection dropdown in installer does not reflect browser language setting (#7494) @miya
+- fix:  Search results are not highlighted when searching for quoteted words (PageListItemL) (#7491) @miya
+- fix: Responses 500 status code when invalid regular expressions are inputted to lsx's execpt option (#7488) @jam411
+- fix: Page paths in search results are not displayed correctly (#7463) @miya
+
 ## [v6.0.9](https://github.com/weseek/growi/compare/v6.0.8...v6.0.9) - 2023-03-14
 
 ### 💎 Features

+ 1 - 1
lerna.json

@@ -1,7 +1,7 @@
 {
   "npmClient": "yarn",
   "useWorkspaces": true,
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "packages": [
     "packages/*"
   ]

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "growi",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "Team collaboration software using markdown",
   "tags": [
     "wiki",

+ 1 - 1
packages/app/docker/README.md

@@ -10,7 +10,7 @@ GROWI Official docker image
 Supported tags and respective Dockerfile links
 ------------------------------------------------
 
-* [`6.0.9`, `6.0`, `6`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v6.0.9/packages/app/docker/Dockerfile)
+* [`6.0.10`, `6.0`, `6`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v6.0.10/packages/app/docker/Dockerfile)
 * [`5.1.7`, `5.1`, `5`](https://github.com/weseek/growi/blob/v5.1.7/packages/app/docker/Dockerfile)
 * [`5.1.7-nocdn`, `5.1-nocdn`, `5-nocdn`](https://github.com/weseek/growi/blob/v5.1.7/packages/app/docker/Dockerfile)
 * [`4.5.23`, `4.5`, `4`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v4.5.23/packages/app/docker/Dockerfile)

+ 11 - 11
packages/app/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/app",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "license": "MIT",
   "scripts": {
     "//// for production": "",
@@ -66,14 +66,14 @@
     "@elastic/elasticsearch7": "npm:@elastic/elasticsearch@^7.17.0",
     "@godaddy/terminus": "^4.9.0",
     "@google-cloud/storage": "^5.8.5",
-    "@growi/codemirror-textlint": "^6.0.10-RC.0",
-    "@growi/core": "^6.0.10-RC.0",
-    "@growi/hackmd": "^6.0.10-RC.0",
-    "@growi/preset-themes": "^6.0.10-RC.0",
-    "@growi/remark-drawio": "^6.0.10-RC.0",
-    "@growi/remark-growi-directive": "^6.0.10-RC.0",
-    "@growi/remark-lsx": "^6.0.10-RC.0",
-    "@growi/slack": "^6.0.10-RC.0",
+    "@growi/codemirror-textlint": "^6.0.11-RC.0",
+    "@growi/core": "^6.0.11-RC.0",
+    "@growi/hackmd": "^6.0.11-RC.0",
+    "@growi/preset-themes": "^6.0.11-RC.0",
+    "@growi/remark-drawio": "^6.0.11-RC.0",
+    "@growi/remark-growi-directive": "^6.0.11-RC.0",
+    "@growi/remark-lsx": "^6.0.11-RC.0",
+    "@growi/slack": "^6.0.11-RC.0",
     "@promster/express": "^7.0.6",
     "@promster/server": "^7.0.8",
     "@slack/web-api": "^6.2.4",
@@ -205,8 +205,8 @@
     "handsontable": "v7.0.0 or above is no loger MIT lisence."
   },
   "devDependencies": {
-    "@growi/presentation": "^6.0.10-RC.0",
-    "@growi/ui": "^6.0.10-RC.0",
+    "@growi/presentation": "^6.0.11-RC.0",
+    "@growi/ui": "^6.0.11-RC.0",
     "@handsontable/react": "=2.1.0",
     "@icon/themify-icons": "1.0.1-alpha.3",
     "@next/bundle-analyzer": "^13.2.3",

+ 2 - 2
packages/app/src/components/Page/PageView.tsx

@@ -124,7 +124,7 @@ export const PageView = (props: Props): JSX.Element => {
         <div id="comments-container" ref={commentsContainerRef}>
           <Comments pageId={page._id} pagePath={pagePath} revision={page.revision} onLoaded={() => setCommentsLoaded(true)} />
         </div>
-        { isUsersHomePagePath && (
+        { (isUsersHomePagePath && page.creator != null) && (
           <UsersHomePageFooter creatorId={page.creator._id}/>
         ) }
         <PageContentFooter page={page} />
@@ -158,7 +158,7 @@ export const PageView = (props: Props): JSX.Element => {
       { specialContents }
       { specialContents == null && (
         <>
-          { isUsersHomePagePath && <UserInfo author={page?.creator} /> }
+          { (isUsersHomePagePath && page?.creator != null) && <UserInfo author={page.creator} /> }
           <div className={`mb-5 ${isMobile ? `page-mobile ${styles['page-mobile']}` : ''}`}>
             <Contents />
           </div>

+ 1 - 1
packages/app/src/components/PageAccessoriesModal.tsx

@@ -114,7 +114,7 @@ const PageAccessoriesModal = (): JSX.Element => {
     </div>
   ), [close, isWindowExpanded]);
 
-  if (status == null) {
+  if (status == null || activeTab == null) {
     return <></>;
   }
 

+ 57 - 8
packages/app/src/components/ReactMarkdownComponents/CodeBlock.tsx

@@ -1,3 +1,5 @@
+import { ReactNode } from 'react';
+
 import type { CodeComponent } from 'react-markdown/lib/ast-to-react';
 import { PrismAsyncLight } from 'react-syntax-highlighter';
 import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
@@ -5,6 +7,60 @@ import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
 import styles from './CodeBlock.module.scss';
 
 
+function extractChildrenToIgnoreReactNode(children: ReactNode): ReactNode {
+
+  if (children == null) {
+    return children;
+  }
+
+  // Single element array
+  if (Array.isArray(children) && children.length === 1) {
+    return extractChildrenToIgnoreReactNode(children[0]);
+  }
+
+  // Multiple element array
+  if (Array.isArray(children) && children.length > 1) {
+    return children.map(node => extractChildrenToIgnoreReactNode(node)).join('');
+  }
+
+  // object
+  if (typeof children === 'object') {
+    const grandChildren = (children as any).children ?? (children as any).props.children;
+    return extractChildrenToIgnoreReactNode(grandChildren);
+  }
+
+  return String(children).replace(/\n$/, '');
+}
+
+function CodeBlockSubstance({ lang, children }: { lang: string, children: ReactNode }): JSX.Element {
+  // return alternative element
+  //   in order to fix "CodeBlock string is be [object Object] if searched"
+  // see: https://github.com/weseek/growi/pull/7484
+  //
+  // Note: You can also remove this code if the user requests to see the code highlighted in Prism as-is.
+  const isSimpleString = Array.isArray(children) && children.length === 1 && typeof children[0] === 'string';
+  if (!isSimpleString) {
+    return (
+      <div className="code-highlighted" style={oneDark['pre[class*="language-"]']}>
+        <code className={`language-${lang}`} style={oneDark['code[class*="language-"]']}>
+          {children}
+        </code>
+      </div>
+    );
+  }
+
+  return (
+    <PrismAsyncLight
+      className="code-highlighted"
+      PreTag="div"
+      style={oneDark}
+      language={lang}
+    >
+      {extractChildrenToIgnoreReactNode(children)}
+    </PrismAsyncLight>
+  );
+}
+
 export const CodeBlock: CodeComponent = ({ inline, className, children }) => {
 
   if (inline) {
@@ -22,14 +78,7 @@ export const CodeBlock: CodeComponent = ({ inline, className, children }) => {
       {name != null && (
         <cite className={`code-highlighted-title ${styles['code-highlighted-title']}`}>{name}</cite>
       )}
-      <PrismAsyncLight
-        className="code-highlighted"
-        PreTag="div"
-        style={oneDark}
-        language={lang}
-      >
-        {String(children).replace(/\n$/, '')}
-      </PrismAsyncLight>
+      <CodeBlockSubstance lang={lang}>{children}</CodeBlockSubstance>
     </>
   );
 };

+ 17 - 0
packages/app/src/components/ReactMarkdownComponents/NextLink.tsx

@@ -22,6 +22,10 @@ const isExternalLink = (href: string, siteUrl: string | undefined): boolean => {
   }
 };
 
+const isAttached = (href: string): boolean => {
+  return href.startsWith('/attachment/');
+};
+
 type Props = Omit<LinkProps, 'href'> & {
   children: React.ReactNode,
   href?: string,
@@ -59,6 +63,19 @@ export const NextLink = (props: Props): JSX.Element => {
     );
   }
 
+  // when href is an attachment file
+  if (isAttached(href)) {
+    const dlhref = href.replace('/attachment/', '/download/');
+    return (
+      <span>
+        <a href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
+          {children}
+        </a>&nbsp;
+        <a href={dlhref} className="attachment-download"><i className='icon-cloud-download'></i></a>
+      </span>
+    );
+  }
+
   return (
     <Link {...rest} href={href} prefetch={false} legacyBehavior>
       <a href={href} className={className} {...dataAttributes}>{children}</a>

+ 5 - 0
packages/app/src/styles/theme/_apply-colors-dark.scss

@@ -580,6 +580,11 @@
   /*
   * GROWI HandsontableModal
   */
+
+  .handsontable td {
+    color: black;
+  }
+
   .grw-hot-modal-navbar {
     background-color: var(--dark);
   }

+ 1 - 1
packages/codemirror-textlint/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/codemirror-textlint",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "license": "MIT",
   "main": "dist/index.js",
   "scripts": {

+ 1 - 1
packages/core/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/core",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "GROWI Core Libraries",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/core/src/interfaces/page.ts

@@ -40,7 +40,7 @@ export type IPagePopulatedToList = Omit<IPageHasId, 'lastUpdateUser'> & {
 
 export type IPagePopulatedToShowRevision = Omit<IPageHasId, 'lastUpdateUser'|'creator'|'deleteUser'|'grantedGroup'|'revision'|'author'> & {
   lastUpdateUser: IUserHasId,
-  creator: IUserHasId,
+  creator: IUserHasId | null,
   deleteUser: IUserHasId,
   grantedGroup: IUserGroupHasId,
   revision: IRevisionHasId,

+ 1 - 1
packages/hackmd/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/hackmd",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "GROWI js and css files to use hackmd",
   "license": "MIT",
   "main": "dist/index.js",

+ 2 - 2
packages/presentation/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/presentation",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "GROWI plugin for presentation",
   "license": "MIT",
   "keywords": ["growi", "growi-plugin"],
@@ -15,7 +15,7 @@
     "test": ""
   },
   "dependencies": {
-    "@growi/core": "^6.0.10-RC.0"
+    "@growi/core": "^6.0.11-RC.0"
   },
   "devDependencies": {
     "@marp-team/marp-core": "^3.4.2",

+ 1 - 1
packages/preset-themes/package.json

@@ -1,7 +1,7 @@
 {
   "name": "@growi/preset-themes",
   "description": "GROWI preset themes",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "license": "MIT",
   "main": "dist/libs/index.js",
   "files": [

+ 1 - 1
packages/remark-drawio/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-drawio",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "remark plugin to draw diagrams with draw.io (diagrams.net)",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/remark-growi-directive/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-growi-directive",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "remark plugin to support GROWI plugin (forked from remark-directive@2.0.1)",
   "license": "MIT",
   "keywords": [

+ 4 - 4
packages/remark-lsx/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-lsx",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "GROWI plugin to list pages",
   "license": "MIT",
   "keywords": ["growi", "growi-plugin"],
@@ -20,9 +20,9 @@
     "test": ""
   },
   "dependencies": {
-    "@growi/core": "^6.0.10-RC.0",
-    "@growi/remark-growi-directive": "^6.0.10-RC.0",
-    "@growi/ui": "^6.0.10-RC.0",
+    "@growi/core": "^6.0.11-RC.0",
+    "@growi/remark-growi-directive": "^6.0.11-RC.0",
+    "@growi/ui": "^6.0.11-RC.0",
     "swr": "^2.0.3"
   },
   "devDependencies": {

+ 1 - 1
packages/slack/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/slack",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "license": "MIT",
   "main": "dist/index.js",
   "typings": "dist/index.d.ts",

+ 2 - 2
packages/slackbot-proxy/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/slackbot-proxy",
-  "version": "6.0.10-slackbot-proxy.0",
+  "version": "6.0.11-slackbot-proxy.0",
   "license": "MIT",
   "scripts": {
     "build": "yarn tsc && tsc-alias -p tsconfig.build.json",
@@ -26,7 +26,7 @@
   },
   "dependencies": {
     "@godaddy/terminus": "^4.9.0",
-    "@growi/slack": "^6.0.10-RC.0",
+    "@growi/slack": "^6.0.11-RC.0",
     "@slack/oauth": "^2.0.1",
     "@slack/web-api": "^6.2.4",
     "@tsed/common": "^6.43.0",

+ 2 - 2
packages/ui/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/ui",
-  "version": "6.0.10-RC.0",
+  "version": "6.0.11-RC.0",
   "description": "GROWI UI Libraries",
   "license": "MIT",
   "keywords": ["growi"],
@@ -17,7 +17,7 @@
     "test": "jest --verbose"
   },
   "dependencies": {
-    "@growi/core": "^6.0.10-RC.0"
+    "@growi/core": "^6.0.11-RC.0"
   },
   "devDependencies": {
     "eslint-plugin-regex": "^1.8.0",