小编Sta*_*low的帖子

React Monaco Editor 没有语法高亮

刚刚安装了React Monaco Editor,除了没有语法高亮外,似乎运行正常。我正在尝试使用“python”作为语言,但字体保持相同的灰色默认颜色:

在此处输入图片说明

关于如何纠正问题的任何想法?

这是我运行 Monaco 编辑器的 Code.js:

import React from "react";
import MonacoEditor from "react-monaco-editor";

class Code extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      code: 'print("Hello, World!")'
    };
  }
  editorDidMount(editor, monaco) {
    console.log("editorDidMount", editor);
    editor.focus();
  }
  onChange(newValue, e) {
    console.log("onChange", newValue, e);
  }
  render() {
    const code = this.state.code;
    const options = {
      selectOnLineNumbers: true,
      fontSize: 18,
      colorDecorators: true
    };
    return (
      <MonacoEditor
        width="800"
        height="600"
        language="python"
        theme="vs-dark"
        value={code}
        options={options}
        onChange={this.onChange}
        editorDidMount={this.editorDidMount}
      />
    );
  }
} …
Run Code Online (Sandbox Code Playgroud)

reactjs monaco-editor

6
推荐指数
2
解决办法
4600
查看次数

Stripe - PHP错误 - Stripe不再支持使用TLS 1.0发出的API请求

是否可以在没有HTTPS页面的情况下运行条带测试?我似乎在我的localhost上收到以下错误.有没有办法纠正它?

这在提交付款信息后发生.

致命错误:未捕获异常'Stripe\Error\Authentication',消息'Stripe不再支持使用TLS 1.0发出的API请求.请使用TLS 1.2或更高版本启动HTTPS连接.您可以访问https://stripe.com/blog/upgrading-tls了解有关此内容的更多信息.在/Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php:110来自API请求'req_9AwHIpLsRiWhRz'堆栈跟踪:#0/Applications/MAMP/htdocs/composer/vendor/stripe/stripe -php/lib/ApiRequestor.php(227):Stripe\ApiRequestor-> handleApiError('{\ ​​n"error":{\n ...',401,Array,Array)#1/Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php(65):Stripe\ApiRequestor - > _ interpretResponse('{\ ​​n"error":{\n ...',401,Array)#2/Applications /MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(120):Stripe\ApiRequestor-> request('post','/ v1/customers',Array,Array)#3/Applications /MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(160):Stripe\ApiResource :: _ staticRequest('post','/ v1/custom in/Applications/MAMP/htdocs/composer /第110行的vendor/stripe/stripe-php/lib/ApiRequestor.php

php ssl https stripe-payments

2
推荐指数
1
解决办法
4862
查看次数

如何在 React 中更改摩纳哥编辑器背景颜色

我正在寻找更改摩纳哥编辑器的背景颜色。我将以下 monaco npm 包与 React 一起使用:Monaco React

有没有办法在下面的编辑器组件中执行此操作?我下面的选项对象工作得很好,所以希望对编辑器背景颜色做类似的事情。

我应该为此使用DefineTheme 函数吗?

这是我正在尝试运行的编辑器代码:

<Editor
        height="90vh"
        width="870px"
        language="javascript"
        line="2"
        options={{
          minimap: {
            enabled: false,
          },
          fontSize: 18,
          cursorStyle: "block",
          wordWrap: "on",
        }}
        defineTheme={{
          themeName: "my-theme",
          themeData: {
            colors: {
              "editor.background": "#000000",
            },
          },
        }}
        value={"// write your code here"}
        editorDidMount={handleEditorDidMount}
      />
Run Code Online (Sandbox Code Playgroud)

reactjs monaco-editor

2
推荐指数
1
解决办法
9544
查看次数

链接悬停不起作用 - CSS

我试图通过将鼠标悬停在一个框上来缩放它,但似乎没有用。悬停时我可以设置 href 的样式以进行缩放吗?

得到了我在下面使用的代码以及一个 jsfiddle:https ://jsfiddle.net/695e7ca9/

HTML:

<div class="window">
  <div class="col">
    <a href="google.com" class="box">
      <span class="title-label">window title </span>
      <span class="content"></span>
    </a>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.col {
  max-width: 50%;
}

.title-label {
  display: block;
  padding: 20px;
  margin-bottom: 0;
  color: #fff;
  font-weight: 700;
  background: #0176ff;
  -moz-border-radius: 4px 4px 0 0;
  -webkit-border-radius: 4px;
  border-radius: 4px 4px 0 0;
}

.content {
  margin-top: -1px;
  box-shadow: inset 0 0 0 1px #0176ff;
  border-top: 0;
  padding: 25px;
  min-height: 235px;
  display: block;
}

.window .col .box:hover …
Run Code Online (Sandbox Code Playgroud)

html css

1
推荐指数
1
解决办法
1256
查看次数

如何在firebase数据库中查询反应?

我在firebase中将以下数据结构作为实时数据库:

{
  "react" : {
    "url_01" : "https://stackoverflow.com/",
    "url_02" : "https://google.com/",
    "url_03" : "https://www.youtube.com/"
  }
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试查询React中的数据库以显示以下组件中的所有URL.

到目前为止,我得到它正确显示数据库中的第一个URL,但现在尝试将它们全部显示在div中<h1>.

class FirebaseDB extends React.Component {
  constructor() {
    super();
    this.state = {
      speed: [],
    };
  }

  componentDidMount() {
    const rootRef = firebase.database().ref().child('react');
    const speedRef = rootRef.child('url_01');
    speedRef.on('value', snap => {
      this.setState({
        speed: snap.val()
      });
    });
  }

  render() {
    return (

        <div>
          <h1>URL: {this.state.speed}</h1>
        </div>


    );
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript firebase reactjs firebase-realtime-database

0
推荐指数
1
解决办法
859
查看次数