From 444fda2bd03768dd84c893946a34f2e4324f6067 Mon Sep 17 00:00:00 2001 From: ruihong Date: Fri, 26 Jun 2020 13:46:46 +0800 Subject: [PATCH 1/2] fix toolbar visible when readonly --- packages/renderer/renderer/src/components/imageContainer.js | 2 +- packages/renderer/renderer/src/videoNode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/renderer/renderer/src/components/imageContainer.js b/packages/renderer/renderer/src/components/imageContainer.js index 0ca2c618..6e29e53b 100644 --- a/packages/renderer/renderer/src/components/imageContainer.js +++ b/packages/renderer/renderer/src/components/imageContainer.js @@ -39,7 +39,7 @@ export default class ImageContainer extends React.Component { isEditing } = this.props; const src = getSrc(node); - const active = isSelected || readOnly; + const active = isSelected && !readOnly; return ( diff --git a/packages/renderer/renderer/src/videoNode.js b/packages/renderer/renderer/src/videoNode.js index b797dc39..6a51ed4b 100644 --- a/packages/renderer/renderer/src/videoNode.js +++ b/packages/renderer/renderer/src/videoNode.js @@ -100,7 +100,7 @@ class VideoNode extends React.Component { const id = getId(node); const width = this.state.width || getWidth(node) || 560; const height = this.state.height || getHeight(node) || 315; - const active = isSelected || readOnly; + const active = isSelected && !readOnly; if (type === "youtube") { link = `https://www.youtube.com/embed/${id}`; } else if (type === "dailymotion") { From 98e750a99d16623e103d9dd96b43861a0f1e23ba Mon Sep 17 00:00:00 2001 From: ruihong Date: Sat, 27 Jun 2020 10:03:18 +0800 Subject: [PATCH 2/2] Fix bug: code block can change syntax when readOnly --- packages/renderer/renderer/src/codeBlockNode.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/renderer/renderer/src/codeBlockNode.js b/packages/renderer/renderer/src/codeBlockNode.js index a4ab458e..875b603b 100644 --- a/packages/renderer/renderer/src/codeBlockNode.js +++ b/packages/renderer/renderer/src/codeBlockNode.js @@ -26,6 +26,7 @@ export const codeBlockNode = options => { attributes, children, node, + readOnly, editor }: nodeProps) => { const syntax = options.getSyntax(node); @@ -45,6 +46,7 @@ export const codeBlockNode = options => { style={{ minWidth: "80px" }} defaultValue={syntax || "TXT"} size="small" + disabled={readOnly} > {Object.keys(languages) .filter(lang => {