Home / Function/ ActualOpenInEditorButton() — react Function Reference

ActualOpenInEditorButton() — react Function Reference

Architecture documentation for the ActualOpenInEditorButton() function in OpenInEditorButton.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  23b98639_67b7_42eb_07be_4e589eb76dda["ActualOpenInEditorButton()"]
  5eb75744_619e_d7d3_c988_8d5803563f16["OpenInEditorButton.js"]
  23b98639_67b7_42eb_07be_4e589eb76dda -->|defined in| 5eb75744_619e_d7d3_c988_8d5803563f16
  3c81519b_a855_b45e_b91b_c1dcaaf5d5b9["checkConditions()"]
  23b98639_67b7_42eb_07be_4e589eb76dda -->|calls| 3c81519b_a855_b45e_b91b_c1dcaaf5d5b9
  style 23b98639_67b7_42eb_07be_4e589eb76dda fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Editor/OpenInEditorButton.js lines 27–73

function ActualOpenInEditorButton({
  editorURL,
  source,
  className,
}: Props): React.Node {
  let disable;
  if (source == null) {
    disable = true;
  } else {
    const staleLocation: ReactFunctionLocation = [
      '',
      source.url,
      // This is not live but we just use any line/column to validate whether this can be opened.
      // We'll call checkConditions again when we click it to get the latest line number.
      source.selectionRef.line,
      source.selectionRef.column,
    ];
    disable = checkConditions(editorURL, staleLocation).shouldDisableButton;
  }
  return (
    <Button
      disabled={disable}
      className={className}
      onClick={() => {
        if (source == null) {
          return;
        }
        const latestLocation: ReactFunctionLocation = [
          '',
          source.url,
          // These might have changed since we last read it.
          source.selectionRef.line,
          source.selectionRef.column,
        ];
        const {url, shouldDisableButton} = checkConditions(
          editorURL,
          latestLocation,
        );
        if (!shouldDisableButton) {
          window.open(url);
        }
      }}>
      <ButtonIcon type="editor" />
      <ButtonLabel>Open in editor</ButtonLabel>
    </Button>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does ActualOpenInEditorButton() do?
ActualOpenInEditorButton() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Editor/OpenInEditorButton.js.
Where is ActualOpenInEditorButton() defined?
ActualOpenInEditorButton() is defined in packages/react-devtools-shared/src/devtools/views/Editor/OpenInEditorButton.js at line 27.
What does ActualOpenInEditorButton() call?
ActualOpenInEditorButton() calls 1 function(s): checkConditions.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free