我试图让编辑器一切正常,直到现在,但现在我需要创建一个处理程序,可以检测div中的任何更改或在div中编辑的任何内容
<?php $row="testing content" ?>
<!-- my editor section-->
<div id="editor">
<div id="options">
<span><a id="iimg">Insert Image from gallery</a></span>
<span>Upload image to gallery</span>
<span><a id="iheading">Heading</a></span>
</div>
<div id="product_descriptioncontent" contenteditable="true"><?php echo $row; ?>
</div><!-- viewable editor -->
<input type="hidden" name="textareacontent" value="" id="textareacontent" >
<!-- hidden field to submit values -->
</div>
<!-- end of editor section -->
<div id="imc"></div> <!-- image gallery loading section -->
<script>
$(document).ready(function(){
$('#iheading').click(function(){
$('#product_descriptioncontent').append('<h1>Heading</h1>');
});
$('#iimg').click(function(){
$('#imc').load('imagegallery.php',function(){
$('#gallery img').on('click',function(){
$('#product_descriptioncontent').append('<img src="http://localhost/sites/site_pics/otherpic/1.png"><br> ');
});
});
});
$('#product_descriptioncontent').change(function(){
alert("pppp");// how …Run Code Online (Sandbox Code Playgroud) 我怎么能让这个标题多行?
我曾尝试将标题文本设置为多行,甚至使用 allowedThigtening(flag: Bool) 对其进行配置,但这些选项均无效。
当前代码在这里:
import SwiftUI
struct DistributionCentersView: View {
var dcViewModel = DistributionCenterViewModel()
@State private var pickedSelectedData = 0
@State private var searchTerm = ""
init() {
//...
}
var body: some View {
NavigationView {
VStack {
VStack {
Picker(selection: $pickedSelectedData, label: Text("")){
Text("All").tag(0)
Text("Nevial").tag(1)
Text("Net power").tag(2)
}.pickerStyle(SegmentedPickerStyle())
.foregroundColor(Color.white)
.background(Color(#colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)))
SearchBar(text: $searchTerm)
}
.padding(.leading, 16)
.padding(.trailing, 16)
.padding(.top, 34)
List {
ForEach (dcViewModel.distribuitionCenters){ dc in
ZStack {
DistributionCenterCell()
.listRowInsets(EdgeInsets(top: …Run Code Online (Sandbox Code Playgroud) 我有一个主视图,其中包含带有 TabView 的主体,每个选项卡显示不同的列表。另外,我在主类的顶部声明了一个状态变量,用于控制是否必须显示类似模态的视图。
问题是,当我更改该状态变量的值时,主视图的所有主体都会用动画重新绘制。这不是所需的行为,因为我没有更改与更新该变量的列表关联的数据。
struct HomeView: View {
@State private var selection = 0
@State var modalShown = false //This is the problematic var that makes a list to be updated with an animation
@EnvironmentObject var filters: UserFilters
@EnvironmentObject var filtersViewController: FiltersViewController
init() {
UITabBar.appearance().backgroundColor = #colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)
UITabBar.appearance().barTintColor = #colorLiteral(red: 0.03921568627, green: 0.03921568627, blue: 0.03921568627, alpha: 1)
}
var body: some View {
return ZStack {
TabView(selection: $selection){
IncidencesView(modalShown: $modalShown) //A view that …Run Code Online (Sandbox Code Playgroud) 我希望能够在我的视图堆栈上点击一个具体的按钮。为了实现这一点,首先我在我的代码中设置了一个可访问性 ID:
Button(action: {
withAnimation(.easeOut(duration: 1)) {
self.modalShown.toggle()
}
}) {
FilterButton()
.accessibility(identifier: "modalFilterViewBtn")
}
.buttonStyle(PlainButtonStyle())
}
Run Code Online (Sandbox Code Playgroud)
所以,然后在我的文本案例中,我试图寻找那个 id:
IOSElement elem1 = driver.findElementByAccessibilityId("modalFilterViewBtn");
wait.until(ExpectedConditions.elementToBeClickable(elem1));
elem1.click();
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:无法使用给定的搜索参数在页面上找到元素。(..)
最后,如果我使用 Appium 检查器来知道我想要的元素的可访问性 ID,它似乎是另一个与我在代码中设置的名称不同的名称:
即使我查找具有该 id("Filter") 的元素,在我的测试用例中也找不到它。
那么,使用 SwiftUI 设置此辅助功能 ID 的正确方法是什么?
谢谢
我希望能够通过uid以编程方式从Firebase删除用户帐户,但是我只能从数据库中删除它。
在swift4上可以得到类似的东西吗?
Task<Void> task = FirebaseAuth.getInstance().deleteUser(uid)
.addOnSuccessListener(aVoid -> System.out.println("Successfully deleted user."))
.addOnFailureListener(e -> System.err.println("Error updating user: " + e.getMessage()));
Run Code Online (Sandbox Code Playgroud)