CKEditor 4: How to add CSS stylesheet from plugin?
Tags: javascript,css,ckeditor
Problem :
Tried this for now, but no luck
editor.addCss(this.path + 'tabber.css');
editor.document.appendStyleSheet(this.path + 'tabber.css');
Full code
(function () {
CKEDITOR.plugins.add('tabber', {
init: function (editor) {
editor.ui.addButton('addTab', {
command: 'addTab',
icon: this.path + 'icons/tabber.png',
label: Drupal.t('Insert tabs')
});
editor.addCss(this.path + 'tabber.css');
editor.document.appendStyleSheet(this.path + 'tabber.css');
editor.addCommand('addTab', {
exec: function (editor) {
editor.insertHtml('<dl>' +
'<dt>Tab title 1</dt>' +
'<dd><p>Tab content 1.</p></dd>' +
'<dt>Tab title 2</dt>' +
'<dd><p>Tab content 2.</p></dd>' +
'</dl>');
}
});
}
});
})();
Solution (thanks for the answer for pointing the right way) inside init
var cssPath = this.path + 'tabber.css';
editor.on('instanceReady', function () {
this.document.appendStyleSheet(cssPath);
});
Solution :
CKEDITOR.addCss
accepts string as a parameter, so there's no way to pass any path there. CKEDITOR.document.appendStyleSheet
is correct though (fiddle):
CKEDITOR.replace( 'editor', {
on: {
instanceReady: function() {
this.document.appendStyleSheet( 'http://path.to.your.css' );
}
}
} );
Just make sure that:
- Your CSS exists.
- It has correct permissions to be read.
- Your HTML is allowed in the editor (also read the integration guide as since 4.1 you need to adjust
allowedContent
for your command).
I guess you may also find CKEDITOR.getUrl useful.
CSS Howto..
You have 2 posibilities: background-size: cover; or background-size: contain; The first one will cover all the area, cutting some part of the image. The second one will make the image...
Try this way $(document).ready(function(){ var ac = $("#ac").text().split(' '); $("#ac").text(ac[0]) }) ...
display:table/table-cell works nicely. a::before { content: ">"; padding-right: 20px; } div { width: 150px; margin: 1em; border: 1px solid grey; } /* relevant stuff */ a { display: table; text-decoration:...
try this div#container { width: 1000px; margin: 0 auto;} Hope this will helps!! or reply me back.....
you defined a z-index for your main ul but it seems to be in static position (so z-index has no effect) : try with ul#secondary-nav { z-index: 9999; position: relative;...
You make them pay for it. Then you can afford to pay someone to do the work. If they refuse to pay for it, you tell them this is out...
try this $('td[valign="top"]').find("div") // this will find all the divs updated either you name all the divs, with a class selector and get that with class selector.. or else you...
#wrapper { border:1px solid green; position:relative;// add this } #load { display: none; position: absolute; right: 50%; //this top: 50%;//this background: url(http://i.imgur.com/fhiyJSJ.gif); width: 43px;//hack to center horizontally height: 11px;//hack...
Two changes I would recommend Add the below Jquery code to add delay: jQuery('div.dropdown').hover(function() { jQuery(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); }, function() { jQuery(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); }); Remove the css /.dropdown:hover...
A pseudo-element is ideal here which can be styled in any fashion you want, color, width & height...even position below the link text. a { position: relative; text-decoration: none; }...
Take a look here: i used document.getElementById('CompareProfilePic1').style.backgroundSize = "45px 45px"; ...
Try this maybe? Make sure JQuery is included at top of page (I host mine myself but you can probably get the google hosting) It looks something like this: <script...
From earlier stackoverflow post: http://stackoverflow.com/questions/1309055/cross-browser-way-to-flip-image-via-javascript-css .flip-vertical { -moz-transform: scaleY(-1); -webkit-transform: scaleY(-1); transform: scaleY(-1); filter: flipv; /*IE*/ } ...
By default, each and every element is as much wider as its content would take space so you donot need to write any code for that, just remove any code...
As feeela says, using position is how you will accomplish this. .parent_with_height200px { height: 200px; position: relative; background-color: #DDDDDD; } .left { width: 50%; position: absolute; bottom: 0px; left: 0px;...
You could use font-size : http://codepen.io/anon/pen/KuJln p:before{ content:'This text has replaced the original.'; font-size:16px;/* if rem not supported */ font-size:1rem; } p{ font-size:0.01px;/* 0+ for ie , yep :) */...
The most obvious solution is just to close the container...have your full width div then open a new container. The title 'container' is just a class...not an absolute requirement that...
You need rel link(href='/css/normalize.css', rel='stylesheet') ...
You can use the :last-child or :last-of-type pseudo classes - see http://www.w3schools.com/cssref/sel_last-child.asp and http://www.w3schools.com/cssref/sel_last-of-type.asp...
You have to make two click handlers for #topicicon and #searchform and use .hide() and .show() as shown :- $("#topicicon").click(function(){ $("#topiclist").show(); $("#searchform1").hide(); }); $("#searchform").click(function(){ $("#topiclist").hide(); $("#searchform1").show(); }); and you are...
maybe you should install vs2010 sp1? I was having the same problem the other day and I installed sp1, It was solved.
Try to stop the browser from rendering the css by using javascript window.stop(). Tested: 1. Go to: w3schools.com/tags/tryit.asp?filename=tryhtml_link_tag 2. Add window.stop(); below the tag 3. Click on the Submit button...
I didn't go this route originally because I thought there would be some "flashing" when scrolled. I tried it, and am not seeing any. This pretty much finds out where...
You can use the join function to generate the csv from the map of checked checkboxes excluding the 'Select All' checkbox. Following is what you can do: deptsSelected = $.map($(':checkbox:not(#'...
shift a particular target word to the best horizontal center that words will allow You can achieve a rough centering using quite simple JavaScript. All it does is scan along...
How are you displaying the image? You can't perform CSS operations on an ImageResource directly, but neither can you display it directly. You have to stick it in an Image,...
This may work: .border { border:2px solid #36F; position:relative; z-index:10 } .border:before { content:""; display:block; position:absolute; z-index:-1; top:2px; left:2px; right:2px; bottom:2px; border:2px solid #36F } ...
If I understand correctly what you mean (to move logo of Lamborghini without that strange effect of heading), then you may try to use this (copied from answer to question...
you can do this using flexbox. Do as followed: .banLinks { border: 2px solid black; width: 553px; text-align: center; margin: 0 auto; display: flex; justify-content: space-around; //or space-between whatever you...
If you were using Chrome, and had open the style.css file at least once then you may use this method to recover the cache: chrome://cache/ You will get all the...