I am using CKEditor 4 with BootstrapCK4. I am using it in my ASP.NET MVC Project.When I open the the page wit CKEditor , I see only a big grey blank instead of normal display of editor. It's like that:
HTML output of my codes:
<html>
<head>
<title>YaziEkle</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap.min.js" type="text/javascript"></script>
<style>
#import "/Content/admin.css"
</style>
<script src="/ckeditor/ckeditor.js"></script>
</head>
<body>
<div class="kapsayici">
<div class="wrapper">
<ul class="menu">
<li class="anasayfa-m">Anasayfa</li>
<li class="yazilar-m">Yazılar</li>
<li class="kategoriler-m">Kategoriler</li>
<li class="sayfalar-m">Sayfalar</li>
<li class="gorunum-m">Görünüm</li>
<li class="yorumlar-m">Yorumlar</li>
<li class="kullanicilar-m">Kullanıcılar</li>
</ul><br />
</div>
<form id="form">
<select data-val="true" data-val-required="Kategori seçilmelidir." id="Kategori" name="Kategori"><option value="1">kk</option>
<option value="2">kk</option>
<option value="3">kk</option>
</select>
<input class="form-control" data-val="true" data-val-maxlength="Baslik alanı, uzunluğu en fazla '-1' olan bir dize veya dizi türü olmalıdır." data-val-maxlength-max="-1" data-val-required="Başlık boş bırakılamaz." id="Baslik" name="Baslik" placeholder="Başlık" type="text" value="" />
<label class="control-label" for="inputError"><span class="field-validation-valid" data-valmsg-for="Baslik" data-valmsg-replace="true"></span></label>
<textarea cols="20" data-val="true" data-val-maxlength="Icerik alanı, uzunluğu en fazla '-1' olan bir dize veya dizi türü olmalıdır." data-val-maxlength-max="-1" data-val-required="İçerik boş bırakılamaz" id="yaziekle" name="Icerik" rows="2">
</textarea>
<label class="control-label" for="inputError"><span class="field-validation-valid" data-valmsg-for="Icerik" data-valmsg-replace="true"></span></label>
</form>
<script>
CKEDITOR.replace("yaziekle",
{
width: "61.5%",
}
);
</script>
</div>
</body>
</html>
EDIT: Fiddle: http://jsfiddle.net/Swr9K/1/
What's the reason of this problem? How can I solve? Thanks in advance.
Removing the width attribute will get the ckEditor panel showing.
I think you are missing jQuery adapter for CKEditor. Like this:
<script src="#Url.Content("~/Scripts/ckeditor/adapters/jquery.js")" type="text/javascript"></script>
you should find this js file in your CKEditor installation folder.
Related
I was trying to create a login form inside a modal like shown here (https://codepen.io/skcals/pen/bxdpaN).
However when I put this same code on my own website here is how it renders :
Has some one ever met the same issue ? And knows how to solve it ?
This is my html head were materialize css is included :
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type = "text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type = "text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.js"></script>
And this is the code of my login form
<div id="login-modal" class="modal">
<h5 class="modal-close" style="color:black;">✕</h5>
<div class="modal-content center">
<h4>Se connecter</h4>
<br>
<form action="#">
<div class="input-field">
<i class="material-icons prefix">person</i>
<input type="text" id="name">
<label for="name">Username</label>
</div>
<br>
<div class="input-field">
<i class="material-icons prefix">lock</i>
<input type="password" id="pass">
<label for="pass">Password</label>
</div>
<br>
<div class="left" style="margin-left:20px;">
<input type="checkbox" id="check">
<label for="check">Remember Me</label>
</div>
<br>
<input type="submit" value="Login" class="btn btn-large login-btn">
</form>
</div>
</div>
I used your code in my project and it worked fine!
The only thing I can think off is using the newest version of JQuery:
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
In the meantime, I've solved my own issue by moving the login div somewhere else. Previously it was inside my navbar menu and I think that is was causing the display issue.
There is just one last thing, the remember me check box doesn't show up ...
I'm creating a simple web application with Ruby using Sinatra, and when modifying the views, the CSS is applied to all .erb files except one. I'm not quite sure what the issue is. I've tried:
Clearing my browser cache
Running the application on a new browser (Chrome, Safari, Firefox, even Edge)
Running the application on a different device
Linking the stylesheet directly from the erb file
This is my layout.erb file
<br/>
<h2>Upload a Video</h2>
<br/>
<br/>
<form action="/create_video" method="POST">
<div class="col-6">
<label for="videoTitle">Video Title</label>
<input type="text" class="form-control" aria-describedby="emailHelp" placeholder="Enter video title" name="title">
</div>
<br/>
<div class="col-6">
<label for="videoDescription">Video Description</label>
<input type="text" class="form-control" placeholder="Enter video description" name="description">
</div>
<br/>
<br/>
<div class="col-6">
<label for="videoURL">Video Link</label>
<input type="text" class="form-control" placeholder="Enter link to video" name="l_url">
</div>
<br/>
<div class="col-6">
<label for="listingUrl">Company</label>
<input type="text" class="form-control" placeholder="Enter company name" name="company">
</div>
<br/>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<br/>
<br/>
</div>
My layout.erb file
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Roboto:300|Niramit|Nunito" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="animate.css">
</head>
<body>
<%= erb :navigation %>
<main role="main">
<%= yield %>
</main>
<footer class="end">
<div class="footer-grid">
<div class="footer-one">
<p> logo<p>
</div>
<div class="footer-two">
<p>© Copyright Ignite 2018. All rights reserved.</p>
<p>Terms of use • Press Inquiries • General Inquiries • Investors</p>
</div>
<div class="footer-three">
<img src="https://image.flaticon.com/icons/svg/185/185981.svg" width=40 height=40>
<img src="https://image.flaticon.com/icons/svg/185/185961.svg" width=40 height=40>
<img src="https://image.flaticon.com/icons/svg/185/185985.svg" width=40 height=40>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
Finally, this is a small snippet where the style sheet IS working:
<br/>
<br/>
<h2>Videos</h2>
<br/>
<br/>
<% #videos.each do |v| %>
<img src="<%= v.logo %>" width="110" height="110">
<h3><%= v.title %></h3>
<p><%= v.l_url %></p>
<p><%= v.description %> </p>
<br/>
<% end %>
<br/>
<br/>
<br/>
<br/>
</div>
Any idea what might be wrong? I appreciate any tips.
I think this might resolve your issue, I think the link to your stylesheets might be broken.
If the page is not in the top-path, if it looks something like this:
http://localhost/namespace/ThisIsThePage
In your layout.erb-file, you are refering to the stylesheets using:
href="style.css"
In your CSS-imports, I'd recommend to refer to the stylesheets by using e.g:
href="/style.css"
Note the slash before the filename. The slash tells the browser that the resource will loaded from the root-path of your webserver. Without the slash, the browser will try to grab the style.css from the path below:
http://localhost/namespace/style.css
I'm starting to play with javascript for the first time and I turned the index.html of a steroids project into a simple login form but the content is going below the header. I've also tried the <ionic-header-bar><ionic-content> tags but none works. What am I missing?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<meta name="viewport" content="width=device-width">
<title>Gestor de Mesas</title>
<link rel="stylesheet" href="/components/ionic/css/ionic.min.css" />
<link rel="stylesheet" href="/stylesheets/application.css" />
<script src="/javascripts/onerror.js"></script>
<script src="/javascripts/console.log.js"></script>
<!-- cordova.js is served from localhost to ensure the correct version -->
<script src="http://localhost/cordova.js"></script>
<script src="/components/steroids-js/steroids.js"></script>
<script src="/javascripts/application.js"></script>
</head>
<body class="content">
<ion-header-bar class="bar bar-header bar-positive">
<h1 class="title">Login</h1>
</ion-header-bar>
<ion-content>
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text">
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password">
</label>
<li class="item item-checkbox">
<label class="checkbox">
<input type="checkbox">
</label>
Lembrar?
</li>
</div>
<button class="button button-positive">
Entrar
</button>
</ion-content>
</body>
</html>
Try adding Class "has-header" to your tag. It'll solve the issue. This is because :
ion-header-bar is positioned absolutely. and hence your lower content goes behind it. .has-header class defines top : 44px, which will move your content down with the required space.
I'm creating a form in bootstrap, but as the content expands beyond the screen, the screen doesnt show the scroll control, so i cant see or reach the extra content?!
I've tried setting overflow but it's as if there is no extra content?
To see a live demo: http://jsfiddle.net/8hYVq/
<html>
<head>
<title>Majstorce</title>
<link rel="stylesheet" href="/static/bootstrap.css" type="text/css" media="screen" charset="utf-8">
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript">
window.__admin_media_prefix__ = "/static/admin/";
</script>
<script type="text/javascript" src="/static/admin/js/chosen/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/DateTimeShortcuts.js"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<h1>My test page...</h1>
<ul class="nav">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
<li>Link 5</li>
</ul>
</div>
</div>
<div class="container">
<h3>My form</h3>
<div class="row">
<div class="span8">
<form action="" method="POST">
<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='7ea0a3a7726d12e63e4fee21a7d53f21' /></div>
<p><label for="Title">Title:</label> <input id="title" type="text" name="title" maxlength="255" /></p>
<p><label for="Category">Category:</label> <select name="Category" id="Category">
<option value="" selected="selected">---------</option>
<option value="1">Cars</option>
<option value="2">Food</option>
</select></p>
<p><label for="Description">Description:</label> <input id="Description" type="text" name="Description" maxlength="255" /></p>
<p><label for="user">User:</label> <select name="user" id="user">
<option value="" selected="selected">---------</option>
<option value="1">CustomUser object</option>
</select></p>
<p><label for="id_grad">Location:</label> <select name="Location" id="Location">
<option value="" selected="selected">---------</option>
<option value="1">New York</option>
<option value="2">Washington</option>
</select></p>
<p><label for="From">From:</label> <input id="From" type="text" class="vDateField" name="From" size="10" /></p>
<p><label for="To">To:</label> <input id="To" type="text" class="vDateField" name="To" size="10" /></p>
<input type="submit" name="submit" value="Post"/>
</form>
</div>
<div class="span4">asd</div>
<div class="clear" style="clear:both"> </div>
</div>
</div>
</div>
</body>
</html>
As Pavlo Mykhalov hawk eye noticed, the container was part of the navbar class, and hence the error...
Thank you Pavlo!
I am trying retrieve an element "Nature News Standard Article in Nature News & Comment" which is part of below HMTL code.
I have following WebDriver code in selenium:
if ("Polopoly CM".equals(driver.getTitle())) {
System.out.println("----> Title of page <----");
driver.findElement(By.xpath("//*[starts-with(#id,'nav_') and #class='p_textOutput']"));
System.out.println("----> Xpath Selected <----");
driver.findElement(By.xpath("//*[starts-with(#id,'nav_') and #class='p_textOutput']")).click();
System.out.println("----> Xpath Clicked <----");
}
Problem is: i am unable to retrive the required element through Xpath/CSS from HTML
HTML:
<document>
<html xmlns:polopoly="http://www.polopoly.com/polopoly/cm/app/gui" xmlns="http://www.w3.org/1999/xhtml" style="cursor: default;">
<head>
<body id="nav_3" class="navFrameBody" onbeforeunload="busyCursor();" onload="onLoad(); idleCursor();">
<script type="text/javascript"> <!-- Jasmine.createFrame('nav'); //--> </script>
<form id="mainform" name="mainform" method="post" action="CM">
<input type="hidden" value="2852906396" name="owid"/>**
<input type="hidden" value="1332852912984" name="ofid"/>
<input type="hidden" value="nav" name="ofn"/>
<input type="hidden" value="true" name="ofs"/>
<input id="nav_1" type="hidden" value="0" name="nav_1"/>
<input id="nav_2" type="hidden" value="0" name="nav_2"/>
<div id="nav_13_placeHolder" class="ajax_placeHolder">
<fieldset id="nav_14" class="field"/>
<div id="nav_4" class="p-group quickCreator expanded">
<div id="nav_4_state">
<input id="nav_15" type="hidden" value="expanded" name="nav_15"/>
</div>
<div class="toggleIcon clearfix"/>
<script lang="javascript">$(document).ready(function() {p_makeExpandable('nav_4', 'nav_15')});</script>
<fieldset id="nav_16" class="contentCreator field topContentCreator">
<div class="quickCreator contentCreator container">
<div class="quickCreator header clearfix">
<h2> Create New </h2>
<a id="nav_17" class="customize" href="javascript:actionEventData({$contentId:"18.232.1319560059", $action:"edit", $target:"work", $opentab:"menu/quickCreatorLayout"})">Customize</a>
</div>
<div class="list">
<div class="quickCreator link">
<input type="hidden" value="" name="nav_18"/>
<a id="nav_18" href="javascript:submitForm(document.mainform, document.mainform.nav_18, "x")">
<img id="nav_19" class="centered" alt="" src="images/icons/transparentIcon.png"/>
<span id="nav_20" class="p_textOutput">Nature News Standard Article in Nature News & Comment</span>
</a>
</div>
</div>
</div>
</fieldset>
</div>
<div id="nav_5" class="p-group contentTree expanded">
<div id="nav_5_state">
<input id="nav_21" type="hidden" value="expanded" name="nav_21"/>
</div>
<div class="toggleIcon clearfix"/>
<script lang="javascript">$(document).ready(function() {p_makeExpandable('nav_5', 'nav_21')});</script>
<div class="field contentTree">
<div id="nav_6_placeHolder" class="ajax_placeHolder">
<div class="header">
<span class="label">Content Tree</span>
<button id="nav_9" type="button" value="Refresh tree" name="nav_9">
<img id="nav_22" class="centered" alt="" src="images/icons/refresh.png"/>
<span id="nav_23" class="p_textOutput"> Refresh tree</span>
<script type="text/javascript"> <!-- jQuery(document).ready(function() { addOnClickEvent("nav_9",null, "nav_9_placeHolder", null, new IndicatorLifecycleHook('p.std_ajaxIndicator', true, 0.8, "createImageTop('images/ajax/busy_indicator_big_green.gif')")); }); //--> </script>
</button>
</div>
<div class="tree">
<div id="nav_8_placeHolder" class="ajax_placeHolder">
<script type="text/javascript"> jQuery.require(["script/polopoly-ui.js"]); </script>
<input id="nav_8" type="hidden" value="" name="nav_8"/>
<script type="text/javascript"> jQuery.require(["script/polopoly-ui.js"]); </script>
<ul id="nav_8_tree" class="tree">
</div>
</div>
</div>
</div>
</div>
<fieldset id="nav_24" class="field clipboard">
<input id="nav_25" type="hidden" value="" name="nav_25"/>
</fieldset>
</form>
<script type="text/javascript"> <!-- jQuery(document).ready(function() { if(window.parent.SeleniumPageLoadCountnav==null) { window.parent.SeleniumPageLoadCountnav=1; window.parent.SeleniumPageLoadCountnavOld=0; } else { window.parent.SeleniumPageLoadCountnav+=1; } }); //--> </script>
</body>
</html>
</document>
I see two elements which can be selected by your xpath locator. Try to find both of them.
List<WebElement> elements = webDriver.findElements(By.xpath("your_xpath"));
for (Element element : elements) {
element.click();
}
Your HTML code is:
Nature News Standard Article in Nature News & Comment
So, You can use id or xpath to retrieve the element text as follows:
Using id:
String s = driver.findElement(By.id("nav_20")).getText();
System.out.println(s);
Using xpath:
String s1 = driver.findElement(By.xpath("//span[#id='nav_20']")).getText();
System.out.println(s1);
css=a[href*='javascript:submitForm'] > span.p_textOutput
Try the above CSS Selector. I am sure it will work out.
Please Let me know is it working or NOT.