Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into mikan/auth
Browse files Browse the repository at this point in the history
  • Loading branch information
haritopitya committed Dec 20, 2021
2 parents 89ec007 + ada1e62 commit c0aa553
Show file tree
Hide file tree
Showing 56 changed files with 731 additions and 541 deletions.
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
# Changelog

## [Unreleased](https://github.com/weseek/growi/compare/v4.5.2...HEAD)
## [Unreleased](https://github.com/weseek/growi/compare/v4.5.3...HEAD)

*Please do not manually update this file. We've automated the process.*

## [v4.5.3](https://github.com/weseek/growi/compare/v4.5.2...v4.5.3) - 2021-12-17

### 💎 Features

- feat: user activation by email (#4862) @kaoritokashiki

### 🚀 Improvement

- imprv: Use SWR for isSlackEnabled (#4827) @stevenfukase
- imprv: Disable rubber band scroll for Mac & iOS users (#4834) @hakumizuki
- imprv: Omit atlaskit and implement sidebar only with original codes (#4598) @yuki-takei

### 🐛 Bug Fixes

- fix: GROWI Bot search command after transplanting search service from dev/5.0.x (#4916) @hakumizuki
- fix: Set min-height to sidebar scroll target (#4884) @yuki-takei

### 🧰 Maintenance

- support: fix dependabot alert for kind-of (#4891) @LuqmanHakim-Grune
- support: fix dependabot alert for ini (#4892) @LuqmanHakim-Grune
- support: fix and debug mixin-deep dependabot alert (#4867) @LuqmanHakim-Grune
- support: dependabot alert xmlhttprequest-ssl (#4878) @mudana-grune
- support: Transplant search service from dev/5.0.x (#4869) @hakumizuki
- support: dependabot alert set-value (#4864) @LuqmanHakim-Grune
- ci(deps): bump aws-sdk from 2.179.0 to 2.1044.0 (#4821) @dependabot

## [v4.5.2](https://github.com/weseek/growi/compare/v4.5.1...v4.5.2) - 2021-12-06

### 🐛 Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "4.5.3-RC.0",
"version": "4.5.4-RC.0",
"packages": [
"packages/*"
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "growi",
"version": "4.5.3-RC.0",
"version": "4.5.4-RC.0",
"description": "Team collaboration software using markdown",
"tags": [
"wiki",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/bin/download-cdn-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @author Yuki Takei <yuki@weseek.co.jp>
*/
import { envUtils } from 'growi-commons';
import { envUtils } from '@growi/core';

import CdnResourcesDownloader from './cdn/cdn-resources-downloader';
import loggerFactory from '../src/utils/logger';
Expand Down
2 changes: 0 additions & 2 deletions packages/app/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ module.exports = (options) => {
exclude: {
test: /node_modules/,
exclude: [ // include as a result
{ test: /node_modules\/growi-plugin-/ },
/node_modules\/growi-commons/,
/node_modules\/codemirror/,
],
},
Expand Down
1 change: 0 additions & 1 deletion packages/app/config/webpack.dev.dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
'diff2html',
'debug',
'entities',
'growi-commons',
'i18next', 'i18next-browser-languagedetector',
'jquery-slimscroll',
'lodash', 'pako',
Expand Down
4 changes: 2 additions & 2 deletions packages/app/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ GROWI Official docker image
Supported tags and respective Dockerfile links
------------------------------------------------

* [`4.5.2`, `4.5`, `4`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v4.5.2/docker/Dockerfile)
* [`4.5.2-nocdn`, `4.5-nocdn`, `4-nocdn`, `latest-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.5.2/docker/Dockerfile)
* [`4.5.3`, `4.5`, `4`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v4.5.3/docker/Dockerfile)
* [`4.5.3-nocdn`, `4.5-nocdn`, `4-nocdn`, `latest-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.5.3/docker/Dockerfile)
* [`4.4.13`, `4.4` (Dockerfile)](https://github.com/weseek/growi/blob/v4.4.13/docker/Dockerfile)
* [`4.4.13-nocdn`, `4.4-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.4.13/docker/Dockerfile)

Expand Down
21 changes: 10 additions & 11 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@growi/app",
"version": "4.5.3-RC.0",
"version": "4.5.4-RC.0",
"license": "MIT",
"scripts": {
"//// for production": "",
Expand Down Expand Up @@ -58,11 +58,11 @@
"@browser-bunyan/console-formatted-stream": "^1.6.2",
"@godaddy/terminus": "^4.9.0",
"@google-cloud/storage": "^5.8.5",
"@growi/codemirror-textlint": "^4.5.3-RC.0",
"@growi/plugin-attachment-refs": "^4.5.3-RC.0",
"@growi/plugin-lsx": "^4.5.3-RC.0",
"@growi/plugin-pukiwiki-like-linker": "^4.5.3-RC.0",
"@growi/slack": "^4.5.3-RC.0",
"@growi/codemirror-textlint": "^4.5.4-RC.0",
"@growi/plugin-attachment-refs": "^4.5.4-RC.0",
"@growi/plugin-lsx": "^4.5.4-RC.0",
"@growi/plugin-pukiwiki-like-linker": "^4.5.4-RC.0",
"@growi/slack": "^4.5.4-RC.0",
"@promster/express": "^5.1.0",
"@promster/server": "^6.0.3",
"@slack/events-api": "^3.0.0",
Expand Down Expand Up @@ -99,12 +99,11 @@
"express-validator": "^6.1.1",
"express-webpack-assets": "^0.1.0",
"graceful-fs": "^4.1.11",
"growi-commons": "^5.0.4",
"helmet": "^4.6.0",
"http-errors": "~1.8.0",
"i18next": "^20.3.2",
"i18next-express-middleware": "^2.0.0",
"i18next-node-fs-backend": "^2.1.0",
"i18next-node-fs-backend": "^2.1.3",
"i18next-sprintf-postprocessor": "^0.2.2",
"is-iso-date": "^0.0.1",
"lucene-query-parser": "^1.2.0",
Expand Down Expand Up @@ -148,7 +147,7 @@
"unzipper": "^0.10.5",
"url-join": "^4.0.0",
"validator": "^13.6.0",
"ws": "^7.4.6",
"ws": "^8.3.0",
"xss": "^1.0.6"
},
"// comments for defDependencies": {
Expand All @@ -157,8 +156,8 @@
"ts-loader": "v9 is not compatible with webpack@5"
},
"devDependencies": {
"@alienfast/i18next-loader": "^1.0.16",
"@growi/ui": "^4.5.3-RC.0",
"@alienfast/i18next-loader": "^1.1.4",
"@growi/ui": "^4.5.4-RC.0",
"@handsontable/react": "=2.1.0",
"@types/compression": "^1.7.0",
"@types/express": "^4.17.11",
Expand Down
47 changes: 47 additions & 0 deletions packages/app/src/client/util/codemirror/drawio-fold.ext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable */

import mdu from '../../../components/PageEditor/MarkdownDrawioUtil.js';

(function(mod) {
mod(require("codemirror"));
})(function(CodeMirror) {
"use strict"

CodeMirror.registerGlobalHelper('fold', 'drawio', function (mode, cm) {
return true;
}, function(cm, start) {
function isBeginningOfDrawio(lineNo) {
let line = cm.getLine(lineNo);
let match = mdu.lineBeginPartOfDrawioRE.exec(line);
if (match) {
return true;
}
return false;
}
function isEndOfDrawio(lineNo) {
let line = cm.getLine(lineNo);
let match = mdu.lineEndPartOfDrawioRE.exec(line);
if (match) {
return true;
}
return false;
}

let drawio = isBeginningOfDrawio(start.line);
if (drawio === false) { return; }

let lastLine = cm.lastLine();
let end = start.line;
while(end < lastLine) {
end += 1;
if (isEndOfDrawio(end)) {
break;
}
}

return {
from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
to: CodeMirror.Pos(end, cm.getLine(end).length)
};
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BasicInterceptor } from 'growi-commons';
import { BasicInterceptor } from '@growi/core';

import loggerFactory from '~/utils/logger';

Expand Down
19 changes: 17 additions & 2 deletions packages/app/src/client/util/interceptor/drawio-interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'unstated';
import { BasicInterceptor } from 'growi-commons';
import { BasicInterceptor } from '@growi/core';

import Drawio from '~/components/Drawio';

Expand Down Expand Up @@ -103,11 +103,18 @@ export class DrawioInterceptor extends BasicInterceptor {
*/
drawioPostRender(contextName, context) {
const isPreview = (contextName === 'postRenderPreviewHtml');
const editorContainer = this.appContainer.getContainer('EditorContainer');
const renderDrawioInRealtime = editorContainer.state.previewOptions.renderDrawioInRealtime;

Object.keys(context.DrawioMap).forEach((domId) => {
const elem = document.getElementById(domId);
if (elem) {
this.renderReactDOM(context.DrawioMap[domId], elem, isPreview);
if (isPreview && !renderDrawioInRealtime) {
this.renderDisabledDrawioReactDOM(context.DrawioMap[domId], elem, isPreview);
}
else {
this.renderReactDOM(context.DrawioMap[domId], elem, isPreview);
}
}
});
}
Expand All @@ -129,6 +136,14 @@ export class DrawioInterceptor extends BasicInterceptor {
);
}

renderDisabledDrawioReactDOM(drawioMapEntry, elem, isPreview) {
ReactDOM.render(
// eslint-disable-next-line react/jsx-filename-extension
<div className="alert alert-light text-dark">Rendering of draw.io is disabled.</div>,
elem,
);
}

/**
* @inheritdoc
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/PageEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import detectIndent from 'detect-indent';

import { throttle, debounce } from 'throttle-debounce';
import { envUtils } from 'growi-commons';
import { envUtils } from '@growi/core';
import loggerFactory from '~/utils/logger';

import AppContainer from '~/client/services/AppContainer';
Expand Down
28 changes: 27 additions & 1 deletion packages/app/src/components/PageEditor/CodeMirrorEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ require('codemirror/addon/display/placeholder');
require('codemirror/addon/lint/lint');
require('codemirror/addon/lint/lint.css');
require('~/client/util/codemirror/autorefresh.ext');
require('~/client/util/codemirror/drawio-fold.ext');
require('~/client/util/codemirror/gfm-growi.mode');
// import modes to highlight
require('codemirror/mode/clike/clike');
Expand Down Expand Up @@ -149,6 +150,9 @@ export default class CodeMirrorEditor extends AbstractEditor {
this.showLinkEditHandler = this.showLinkEditHandler.bind(this);
this.showHandsonTableHandler = this.showHandsonTableHandler.bind(this);
this.showDrawioHandler = this.showDrawioHandler.bind(this);

this.foldDrawioSection = this.foldDrawioSection.bind(this);
this.onSaveForDrawio = this.onSaveForDrawio.bind(this);
}

init() {
Expand Down Expand Up @@ -185,6 +189,9 @@ export default class CodeMirrorEditor extends AbstractEditor {
// set keymap
const keymapMode = this.props.editorOptions.keymapMode;
this.setKeymapMode(keymapMode);

// fold drawio section
this.foldDrawioSection();
}

componentWillReceiveProps(nextProps) {
Expand All @@ -195,6 +202,9 @@ export default class CodeMirrorEditor extends AbstractEditor {
// set keymap
const keymapMode = nextProps.editorOptions.keymapMode;
this.setKeymapMode(keymapMode);

// fold drawio section
this.foldDrawioSection();
}

async initializeTextlint() {
Expand Down Expand Up @@ -741,6 +751,22 @@ export default class CodeMirrorEditor extends AbstractEditor {
this.drawioModal.current.show(mdu.getMarkdownDrawioMxfile(this.getCodeMirror()));
}

// fold draw.io section (::: drawio ~ :::)
foldDrawioSection() {
const editor = this.getCodeMirror();
const lineNumbers = mdu.findAllDrawioSection(editor);
lineNumbers.forEach((lineNumber) => {
editor.foldCode({ line: lineNumber, ch: 0 }, { scanUp: false }, 'fold');
});
}

onSaveForDrawio(drawioData) {
const range = mdu.replaceFocusedDrawioWithEditor(this.getCodeMirror(), drawioData);
// Fold the section after the drawio section (:::drawio) has been updated.
this.foldDrawioSection();
return range;
}

getNavbarItems() {
return [
<Button
Expand Down Expand Up @@ -974,7 +1000,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
/>
<DrawioModal
ref={this.drawioModal}
onSave={(drawioData) => { return mdu.replaceFocusedDrawioWithEditor(this.getCodeMirror(), drawioData) }}
onSave={this.onSaveForDrawio}
/>

</React.Fragment>
Expand Down
16 changes: 16 additions & 0 deletions packages/app/src/components/PageEditor/MarkdownDrawioUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ class MarkdownDrawioUtil {
return newMarkdown;
}

/**
* return an array of the starting line numbers of the drawio sections found in markdown
*/
findAllDrawioSection(editor) {
const lineNumbers = [];
// refs: https://github.com/codemirror/CodeMirror/blob/5.64.0/addon/fold/foldcode.js#L106-L111
for (let i = editor.firstLine(), e = editor.lastLine(); i <= e; i++) {
const line = editor.getLine(i);
const match = this.lineBeginPartOfDrawioRE.exec(line);
if (match) {
lineNumbers.push(i);
}
}
return lineNumbers;
}

}

// singleton pattern
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BasicInterceptor } from 'growi-commons';
import { BasicInterceptor } from '@growi/core';

import mtu from './MarkdownTableUtil';
import MarkdownTable from '~/client/models/MarkdownTable';
Expand Down
Loading

0 comments on commit c0aa553

Please sign in to comment.