CKeditor - How can I append <article> tags to the editable content body? - ckeditor

Trying to add <article> tag inside the body of CKeditor, so like this:
<iframe frameborder="0" src="" style="width: 100%; height: 100%;" class="cke_wysiwyg_frame cke_reset" title="Rich Text Editor, editor1" aria-describedby="cke_50" tabindex="0" allowtransparency="true">
<html lang="en" dir="ltr">
<body spellcheck="false" class="cke_editable cke_editable_themed cke_contents_ltr" contenteditable="true">
<article> <!-- Add this -->
<p>Content</p>
</article> <!-- Add this -->
</body>
</html>
</iframe>
Could not find how to get this into the editor. Any tips on how to go about this?

Related

Adding a background image in a bootstrap based blade template

I have a laravel application.
I am using bootstrap in the frontend alongwith blade templates.
I want to add a background image to my landing page.
I am trying to style the page by putting a background image to the body. But its not working as in the image is not showing
Below is my code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Latest compiled and minified CSS -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Arizonia' rel='stylesheet' type='text/css'>
</head>
<style>
body {
background-image: {{url('/images/gym_background.jpg')}};
}
</style>
<body>
#include('partials.header')
<div class="container">
#yield('content')
</div>
</body>
</html>
In My chrome console i don't see any error of not loading the image.
The code for content section
#extends('layouts.master')
#section('content')
<div class="row">
<div class="col-md-12">
<h3>Welcome to your neighourbood Gym</h3>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<h1 class="post-title">Plans</h1>
<p>Plans available in our gym!</p>
<p>Click to view</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 text-center">
<h1 class="post-title">Gallery</h1>
<p>Have a look around our gym</p>
<p>Click to view</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 text-center">
<h1 class="post-title">Contact us</h1>
<p>Click for more details</p>
</div>
</div>
#endsection
Best Regards,
Saurav
Given the following folder structure:
`/public/images/gym_background.jpg`
Change this:
<style>
body {
background-image: {{url('/images/gym_background.jpg')}};
}
</style>
To this:
<style>
body {
// Add a . in front to look in the right folder + dropping the double {{ }}
background-image: url('./images/gym_background.jpg');
}
</style>
Here is a good read on relative vs absolute paths for the extra curious.
If you don't see the image and there's no 404 error in the network inspector, then probably your image is hidden under some other element that takes all the screen and has solid (white?) background. Try setting the same CSS on div.container, then it should work.
UPD: Scratch that, the problem is curly braces. It will work if you remove those {{ and }}.

Conditional formatting for HTML Signatures in Outlook 2016+

So, I'm trying to understand the conditional formatting in HTML email signatures within Outlook 2016 and above.
I have this short demo code:
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<!--[if mso]>
<p style="background: blue">
<![endif]-->
<p style="background: pink">TEST TEST TEST</p>
<!--[if mso]>
</p>
<![endif]-->
</body>
</html>
Which, by my logic, should change the background colour to blue, if the HTML is rendered within Outlook 2016.
However, it's pink.
Is my code incorrect logically? or is there something wrong with the conditional statement all together?
Do conditional statements even still work in Outlook?
[Edit] So, this seems to work, as far as setting the text blue, but I now can't get the text to be green elsewhere.
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<p style="background: pink">TEST TEST TEST</p>
<!--[if mso]>
<p style="background: blue">
<![endif]-->
<!--[if !mso]>
<p style="background: green">
<![endif]-->
Test Test Test 2
</p>
</body>
</html>
Ok, so the condition, needs to be within the element that it's trying to change.
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<p style="background: pink">
<!--[if mso]>
<p style="background: blue">
<![endif]-->
Test Test Test
</p>
</body>
</html>```

Why is this mdbootstrap carousel code resizing my images?

I'm using the carousel component provided here: https://mdbootstrap.com/docs/jquery/javascript/carousel/
I want my pictures to be centered and in original size but instead, they're being stretched to fit the whole screen:
This is the code (I used the same random image for demonstration):
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Material Design Bootstrap</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="css/mdb.min.css" rel="stylesheet">
<!-- Your custom styles (optional) -->
<link href="css/style.css" rel="stylesheet">
<style>
.carousel-inner > .item > img, .carousel-inner > .item > a > img {
width: 100%;
}
</style>
</head>
<body>
<!-- Start your project here-->
<!--Card-->
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="https://cdn.pixabay.com/photo/2018/06/14/13/04/nature-3474826_960_720.jpg"
alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://cdn.pixabay.com/photo/2018/06/14/13/04/nature-3474826_960_720.jpg"
alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://cdn.pixabay.com/photo/2018/06/14/13/04/nature-3474826_960_720.jpg"
alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!--/.Card-->
<!-- Start your project here-->
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
</body>
</html>
The actual images which are used in the code are too big... and they've used the w-100 class on <img> which is why
you see the images shrunk (in case of mdBootstrap's default images)
you see the images stretched (in case of your images)
I removed the file to show how a smaller image without being stretched will look... check the snippet below:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block " src="https://cdn.pixabay.com/photo/2018/06/14/13/04/nature-3474826_960_720.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block " src="https://www.akberiqbal.com/JumboMob.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block " src="https://mdbootstrap.com/img/Photos/Slides/img%20(33).jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block " src="https://mdbootstrap.com/img/Photos/Slides/img%20(31).jpg" alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>

Ajax Issue while sorting the Table at client side

I am using Ajax call in Spring Boot App, Not able to do Table sorting for the columns, Anyway of doing client side sorting in Ajax ?
Since you didn't include any client-side code I'll just make a few assumptions:
Solution 1: You may have additional unwanted divs in your table. The Bootstrap3 sortable table is picky when it comes to structure. Don't put any divs beneath or above the tr values. Do something like this:
<table id="example" class="table table-striped table-bordered table-hover" style="max-width: 85% !important;">
<thead>
<tr>
<th><b>Requested By</b></th>
<th><b>Request Type</b></th>
<th><b>Reason</b></th>
<th><b>Requested Date</b></th>
<th><b>Status</b></th>
</tr>
</thead>
<tbody>
<tr th:each="request : ${requests}" th:if="${request.get('requestStatus') == 'Pending'}">
<td th:text="${request.get('author').get('username')}" class="initial-name">Employee Initials</td>
<td th:text="${request.get('requestType')}">Request Type</td>
<td th:text="${request.get('requestText')}">Reason</td>
<td th:text="${request.get('dateRequested')}">Requested Date</td>
<td th:switch="${request.get('requestStatus')}">
<th:block th:case="Pending" th:text="${request.get('requestStatus')}"><span class="nnit">Pending</span></th:block>
<th:block th:case="Approved" th:text="${request.get('requestStatus')}"><span class="green">Approved</span></th:block>
<th:block th:case="Rejected" th:text="${request.get('requestStatus')}"><span class="nnit">Rejected</span></th:block>
</td>
</tr>
</tbody>
</table>
Solution 2: There's a small chance you included your scripts outside of your fragment if you're using Thymeleaf as a templating engine.
Template:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.thymeleaf.org ">
<head lang="en">
<title>Sample Springboot Application</title>
<!-- Bootstrap CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet"/>
<!-- Internal Stylesheet -->
<link href="../static/css/style.css" th:href="#{/css/style.css}" rel="stylesheet" media="screen"/>
<!--Font Awesome-->
<link rel="stylesheet" href="https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css" integrity="sha384-dNpIIXE8U05kAbPhy3G1cz+yZmTzA6CY8Vg/u2L9xRnHjJiAK76m2BIEaSEV+/aU" crossorigin="anonymous"/>
</head>
<body>
<div class="container" style="width: 100% !important;">
<div th:replace="fragments/header :: header"></div>
<div th:replace="fragments/table:: table"></div>
<div th:replace="fragments/footer :: footer"></div>
</div>
</body>
</html>
Fragment (Correct):
<div th:fragment="table" xmlns:th="http://www.w3.org/1999/xhtml">
<!-- Get table code from this link and paste here: http://stackoverflow.com/questions/31888566/bootstrap-how-to-sort-table-columns -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
});
</script>
<!-- Include all scripts before closing fragment div -->
</div>
Fragment (Incorrect):
<div th:fragment="table" xmlns:th="http://www.w3.org/1999/xhtml">
<!-- Get table code from this link and paste here: http://stackoverflow.com/questions/31888566/bootstrap-how-to-sort-table-columns -->
<!-- Whoops! You included your scripts (below) after your fragment's closing div! -->
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
});
</script>

Perfomance is bad while switching between the pages with jquery mobile

I was facing performance problem while switching between the pages.I went to various forums and added something like faskclick and more.
First time, when i switch to different page, it takes around 3-4 seconds but from second time it is fast e.g. 1 - 1.5 sec. Now, sometimes, click does not work. Out of 5 clicks, only 2-3 clicks works. I am struggling to figure out what went wrong ?
If you can help me out finding why click is not working and how to improve performance when using jquery mobile, it would really be helpful. Following are my code snippets
<html>
<!-- head -->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0" />
<title>Project</title>
<link rel="stylesheet" href="StyleSheet/jquery.mobile-1.3.0.css" />
<script src="StyleSheet/jquery-1.8.2.min.js"></script>
<script src="StyleSheet/jquery.mobile-1.3.0.js"></script>
<script src="StyleSheet/fastclick.js"></script>
<script type="application/javascript">
$.mobile.defaultPageTransition = 'none';
$.mobile.transitionFallbacks.slideout = 'none';
window.addEventListener('load', function() {
new FastClick(document.body);
}, false);
$( document ).bind( "mobileinit", function() {
$.mobile.buttonMarkup.hoverDelay = 500
});
</script>
</head>
<body>
<div id="container">
<div data-role="page" id="HomePage" class="jqm-demos">
<div class="ui-body ui-body-b">
CLick Me to go second page
</div>
</div>
<div data-role="page" id="SecondPage" class="jqm-demos">
<div class="ui-body ui-body-b">
<br> CLick Me to go first page
<div id="JQM" data-theme="b" data-content-theme="c"
data-role="collapsible" data-collapsed-icon="arrow-d"
data-expanded-icon="arrow-u">
<h3>
<span style="float: left;"> JQM is very slow </span> <a
href="#JQM_1" class="splitButtonClicked" data-rel="popup"> <span
style="float: right;"
class="ui-btn-up-b ui-btn-corner-all ui-icon ui-icon-arrow-r2"></span>
</a>
</h3>
<p>I sther any way so that page transition should happen just
like native applciation when using JQM ? Botton click also also
sometimes not responsive.</p>
</div>
</div>
<!-- content -->
<!-- footer -->
<div data-role="footer" data-theme="b" data-tap-toggle="false"
data-position="fixed">
<!--class="ui-bar ui-bar-b"-->
<a href="#" data-rel="back" data-role="button" data-icon="arrow-l"
data-iconpos="notext" class="ui-btn-left" data-theme="b">left</a>
<center>
<a href="#HomePage" data-role="button" data-icon="home"
data-iconpos="notext" data-theme="b">Home</a>
</center>
<a href="#" data-role="button" data-icon="arrow-r"
data-iconpos="notext" class="ui-btn-right" data-theme="b">Right</a>
</div>
<!-- /footer -->
</div>
</div>
</body>
</html>

Resources