小编Pra*_*thi的帖子

如何使用 codemirror 启用代码提示?

我正在使用 codemirror 允许用户输入任何代码,如 css/html/js。

如果用户输入类似 css 模式的内容,我需要启用

div {
 padding-
}
Run Code Online (Sandbox Code Playgroud)

它应该提示用户从列表中选择可用的选项,如

div {
padding-top
padding-left
padding-right
padding-bottom
}
Run Code Online (Sandbox Code Playgroud)

类似于使用 codemirror 的 sublime 编辑器。Sublime 自动提示的演示请参见附图

在此处输入图片说明

这是我的代码:

 <script src="codemirror-5.4/mode/javascript/javascript.js"></script>
  <script src="codemirror-5.4/mode/css/css.js"></script>
  <script src="codemirror-5.4/mode/htmlmixed/htmlmixed.js"></script>
  <script src="codemirror-5.4/addon/display/fullscreen.js"></script>
  <script src="codemirror-5.4/keymap/sublime.js"></script>
  <script src="codemirror-5.4/addon/hint/show-hint.js"></script>
  <script src="codemirror-5.4/addon/hint/css-hint.js"></script>
  <script src="codemirror-5.4/addon/hint/javascript.js"></script>

<h3>Editor</h3>
  <div class="control-group">
    <label class="control-label" for="textarea2">HTML</label>
    <div class="controls">
        <textarea class="code" name="code" id="codert" cols="40" rows="5" placeholder="Enter code here ..." style="width: 810px; height: 200px">
       </textarea>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="textarea3">CSS</label>
        <div class="controls">
          <textarea id="code" class="code" name="codeCSS"  cols="40" rows="5" …
Run Code Online (Sandbox Code Playgroud)

html javascript css autocomplete codemirror

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

如何在传出的Android VOIP呼叫中实现振铃

我们正在使用agora.io在我们的应用程序(VOIP)中进行语音呼叫。两个人之间的通话似乎很顺利。但是,当我拨打B人的电话时,在通话过程中我听不到拨号音。我基本上想在通话时听到铃声。但是,此人在电话响铃时正在收听来电者的声音。

有人可以帮我怎么做吗?

我们正在构建Android App,Java,Kotlin和Agora.io SDK

java android voice voip agora.io

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

Capybara :: ElementNotFound:无法找到字段"title"

我无法解决这个问题.请帮我.它给了我找不到元素的错误.

规格/功能/待办事项/ create_spec.rb

require 'spec_helper'

describe "Creating todos" do

 let(:user) { FactoryGirl.create(:user)}
 before(:each) do
   visit root_path
   click_link "Login"

   fill_in "Email",  with:  "user@gmail.com"
   fill_in "Password",  with: "password"
   click_button "Sign in"
 end

  it "redirects to the todos index page" do
   visit "/todos"

   fill_in "title", with: "MyString"
   click_button "Create"

   expect(page).to have_title("MyString")
 end
Run Code Online (Sandbox Code Playgroud)

我的观点代码._new_form.html.erb

     <%= form_for current_user.todos.new, remote:true  do |f| %>
       <div class="input-group">
         <%= f.text_field :title, class: "form-control",   placeholder: "title" %>
         <span class="input-group-btn">
         <%= f.submit "Create", class: "btn btn-success" %>
         </span>
       </div>
     <% end …
Run Code Online (Sandbox Code Playgroud)

ruby rspec ruby-on-rails

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

在ruby中以相反顺序打印多位元素数组

如何以相反的顺序打印元素数组,而不仅仅是单个数字,还有多位数字.

[2, 5, 6 7]
Run Code Online (Sandbox Code Playgroud)

它应该以相反的顺序打印数组元素,方法是7 6 5 2按每个数字的空格.

我已经为此编写了代码.

   puts "Enter the array elements"
    arr = gets.strip
    arr = arr.split(' ').map(&:to_i)
    x = arr.reverse_each {|f| }
    z = x.join(" ")
    print z.reverse
Run Code Online (Sandbox Code Playgroud)

单位数字很酷,如何反转用户输入给出的输入数组中的多位数字,如:

[45, 76, 87 ] # this should reverse the array as `87 76 45`


[556, 674, 878 ] # this should reverse the array as `878 674 556`
[8797, 7347, 9374 ] # this should reverse the array as `9374 7374 8797`
Run Code Online (Sandbox Code Playgroud)

ruby arrays

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