给定一个带有 的 div contenteditable=true,如何向元素添加文本?
<div aria-autocomplete="list" contenteditable="true" role="textbox" spellcheck="true">
</div>
Run Code Online (Sandbox Code Playgroud)
我已经尝试过document.activeElement.value,但由于它是一个 div 我无法设置该值
升级到版本0.11后单击时,不会弹出angular-ui-bootstrap日期选取器.
我已经尝试了推荐的工作设置
is-open="dt.open" ng-focus="dt.open=true"
Run Code Online (Sandbox Code Playgroud)
只有在一个日历上启用它时才有效,但如果在同一页面上有两个日历,则无效(打开且无法使用).任何人都知道更好的工作,不污染范围?
我也尝试将ng-focus更改为ng-click,并且没有运气.
你能默认所有路线json吗?
我有以下api范围,但我想知道你是否可以在全球范围内做同样的事情?
scope :api, defaults: {format: :json} do
get "/search(/:query)(/:location)" => "search#index"
end
Run Code Online (Sandbox Code Playgroud)
例如,所有user资源也将默认为json
resources :users
Run Code Online (Sandbox Code Playgroud) 我今天早些时候问了这个关于将所有路由包装成默认 json 格式的问题。我本可以发誓它更早地工作,但我可能弄错了。
这是怎么工作的:
resources :insurances, only: [:index, :show], :defaults => { :format => 'json' }
Run Code Online (Sandbox Code Playgroud)
但这不会:
constraints format: :json do
resources :insurances, only: [:index, :show]
end
Run Code Online (Sandbox Code Playgroud)
我是否缺少有关约束如何工作的基本知识?
我有两个 SELECT 语句想要求和。两个查询都工作正常,但我无法对总计的输出进行求和。我尝试遵循这个问题,但无法通过将查询包装在中来求和select id, sum(amount) from ( )
SELECT "patient_profiles"."id", count(distinct recommendations.id) AS total
FROM "patient_profiles"
LEFT OUTER JOIN
"recommendations" ON "recommendations"."patient_profile_id" = "patient_profiles"."id"
GROUP BY "patient_profiles"."id"
UNION
SELECT "patient_profiles"."id", count(distinct patient_profile_potential_doctors.id) AS total
FROM "patient_profiles"
LEFT OUTER JOIN "patient_profile_potential_doctors" ON "patient_profile_potential_doctors"."patient_profile_id" = "patient_profiles"."id"
GROUP BY "patient_profiles"."id"
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ruby aws sdk将图像上传到s3.如果我没有设置content_type,我可以上传base64字符串.如果我将content_type设置image/png为上传只是通用图像缩略图.
obj = #<Aws::S3::Object bucket_name="mybucket", key="test">
>> params[:file]
>> "data:image/png;base64,iVB...."
obj.put(body: params[:file], content_type: 'image/png', content_encoding: 'base64')
Run Code Online (Sandbox Code Playgroud)
如何将Base64字符串上传到s3?如果更直接的话,我也愿意上传为字节
我正在使用Javascript API 客户端,并希望在我的索引上返回facet.我相信为索引打开了faceting因为1.我在UI 2中切换了开关.我可以在仪表板中使用faceting作为索引.我使用以下参数设置我的索引:
var params = {
tagFilters: 'query',
aroundLatLngViaIP: true,
getRankingInfo: 1,
facets: "*"
};
Run Code Online (Sandbox Code Playgroud)
但是,这会返回一个空的facets对象.如何通过所有可能的分面选项接收构面对象?
如何在字符串中删除"Dr","Dr."或"dr"?
"Dr. Drake Cohen" would become "Drake Cohen"
"Dr Drake Cohen" would become "Drake Cohen"
"Drake Cohen" would become "Drake Cohen"
"Rachel Smith" would become "Rachel Smith"
"Dr. Rachel Smith" would become "Rachel Smith"
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
str.replace(/dr./i, "")
Run Code Online (Sandbox Code Playgroud)
但这会删除Dr.的所有实例
我想让文本出现在 div 的顶部,该 div 的边框也有白色背景,这样您就不会看到边框线穿过文本。我尝试在文本中添加 z-index 但我相信position: relative这并不重要。我也愿意接受有关如何完成的其他建议,并且不想使用 afieldset和legend。
#large-div-text {
padding: 20px;
border: 1px solid rgba(64, 189, 233, 0.42);
position: relative;
margin-top: -10px;
}
#why {
background-color: #FFF;
text-align: center;
z-index: 1000;
}Run Code Online (Sandbox Code Playgroud)
<div id="why">
No line behind me, please!
</div>
<div id="large-div-text">
Large div text
</div>Run Code Online (Sandbox Code Playgroud)
我正在尝试构建下面的简单表格。
我正在使用flexbox,但无法正确对齐textarea。align-items: center对齐整个div。我尝试将textarea div取出,并且在将textarea相对于上述flexbox容器对齐时遇到麻烦。在将x,照片,名称和对齐方式居中的同时,如何实现上述文本框的位置。
.container {
display: flex;
}
.content {
flex-grow: 1;
}
textarea {
width: 100%;
}
img {
border-radius: 30px;
margin: 0 10px;
}Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div>
x
</div>
<div>
<img src="http://via.placeholder.com/50x50">
</div>
<div class="content">
<div>Brad</div>
<div>Boston</div>
<textarea></textarea>
</div>
</div>Run Code Online (Sandbox Code Playgroud)