Yuki Takei 3 лет назад
Родитель
Сommit
e6b73cd344

+ 1 - 1
packages/app/src/client/util/interceptor/drawio-interceptor.js

@@ -104,7 +104,7 @@ export class DrawioInterceptor extends BasicInterceptor {
    */
   drawioPostRender(contextName, context) {
     const isPreview = (contextName === 'postRenderPreviewHtml');
-    const renderDrawioInRealtime = context.editorSettings?.renderDrawioInRealtime;
+    const renderDrawioInRealtime = context.renderDrawioInRealtime;
 
     Object.keys(context.DrawioMap).forEach((domId) => {
       const elem = document.getElementById(domId);

+ 3 - 3
packages/app/src/components/Page/RevisionRenderer.jsx

@@ -33,8 +33,8 @@ class LegacyRevisionRenderer extends React.PureComponent {
     this.currentRenderingContext = {
       markdown: this.props.markdown,
       pagePath: this.props.pagePath,
-      // -- prevent memory leak temporary -- 2022.05.25 Yuki Takei
-      // editorSettings: this.editorSettings,
+      renderMathJaxInRealtime: this.props.editorSettings.renderMathJaxInRealtime,
+      renderDrawioInRealtime: this.props.editorSettings.renderDrawioInRealtime,
       currentPathname: decodeURIComponent(window.location.pathname),
     };
   }
@@ -179,7 +179,7 @@ LegacyRevisionRenderer.propTypes = {
   pagePath: PropTypes.string.isRequired,
   highlightKeywords: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
   additionalClassName: PropTypes.string,
-  editorSettings: PropTypes.any,
+  editorSettings: PropTypes.any.isRequired,
 };
 
 /**

+ 1 - 1
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -514,7 +514,7 @@ class CodeMirrorEditor extends AbstractEditor {
     const context = {
       handlers: [], // list of handlers which process enter key
       editor: this,
-      editorSettings: this.props.editorSettings,
+      autoFormatMarkdownTable: this.props.editorSettings.autoFormatMarkdownTable,
     };
 
     const interceptorManager = this.interceptorManager;

+ 1 - 1
packages/app/src/components/PageEditor/MarkdownTableInterceptor.js

@@ -58,7 +58,7 @@ export default class MarkdownTableInterceptor extends BasicInterceptor {
     const context = Object.assign(args[0]); // clone
     const editor = context.editor; // AbstractEditor instance
     // "autoFormatMarkdownTable" may be undefined, so it is compared to true and converted to bool.
-    const noIntercept = (context.editorSettings?.autoFormatMarkdownTable === false);
+    const noIntercept = (context.autoFormatMarkdownTable === false);
 
     // do nothing if editor is not a CodeMirrorEditor or no intercept
     if (editor == null || editor.getCodeMirror() == null || noIntercept) {

+ 2 - 3
packages/app/src/components/PageEditor/Preview.tsx

@@ -42,12 +42,11 @@ const Preview = (props: Props): JSX.Element => {
     return {
       markdown,
       pagePath,
-      // -- prevent memory leak temporary -- 2022.05.25 Yuki Takei
-      // editorSettings,
+      renderDrawioInRealtime: editorSettings?.renderDrawioInRealtime,
       currentPathname: decodeURIComponent(window.location.pathname),
       parsedHTML: null,
     };
-  }, [markdown, pagePath]);
+  }, [markdown, pagePath, editorSettings?.renderDrawioInRealtime]);
 
   const renderPreview = useCallback(async() => {
     if (interceptorManager != null) {