No fixed semi-transparent background when calling Featherlight manually via js - featherlight.js

hoping I could see an example of how to enable the background overlay when calling Featherlight manually. I'm using a simple string containing a div as the content
Thanks for any help!

The answer was to simply use 'beforeContent' in config similar to the following:
featherlightConf={
type: 'html',
beforeContent: function(event){
$("div.featherlight").css("background", "rgba(0,0,0,.5)")
}
};

Related

TinyMCE: How do I prevent `<br data-mce-bogus="1">` text in editor?

I have a page with several TinyMCE (v4) editors, which all work great ... until I try and add:
inline: true
to their configuration. When I do that the inline-ing part works great (the toolbar is gone, then appears when I focus the editor), but for some strange reason the editor stops working at that point. Inside the editor I see:
<br data-mce-bogus="1">
but I can't edit that text, or add new text, or do anything at all really with the editor.
I can make the editor work again if I remove inline: true, but I really want the inline effect. Does anyone have any idea how I can get inline without breaking my editors?
Actually, the "bogus" br tags appear for inline divs, too. They are added whenever the input field is empty. There appears to be no easy way to get rid of them. I use a CSS rule during the preview phase:
br[data-mce-bogus="1"] {
display:none;
}
And then strip them out if they make it to the server when the user tries to save.
I recently had this problem, inline: true would not work with a textarea. I change mine to a div and it now works as expected.
Are you using the tinymce jQuery package? The same thing was happening to me until I tried using the normal tinymce package instead.
<script>
$(document).ready(function () {
$("#comment").ready(function () {
$("#comment").val("")
})
})
</script>
I add this jquery script in html to solve this bug.
Add this snippet to your CSS file. That would prevent video bogus.
[data-mce-bogus="all"] {
display:none;
}

Adding icons to an button in gwt

i have button and want to set an icon to it along with the text inside it. their is no property to add icon to button like in smartGwt .. any idea how to achieve it please help.
There are many ways of achieving this.
Way 1 : Easy way
Just set the background image via code.
myButton.getElement().getStyle().setBackgroundImage("path");
Way 2: Another easy way
Set your own html
myButton.setHtml("Pass the html string");
Way 3: Easy but gives more control
myButton.addStylename("buttonStyle")
Use css to style this
.buttonStyle{
color : red;
}
Way 4: Best way according to me
Create your own split button wrapping it around a flowpanel or horizontalPanel, with image as your first widget and button as your another widget. This gives you additional control on image and as well as button. You can have your click handler on image as well as button and you can style each one of them individually.
This is how I achieved setting an icon in my get:button.
Add an extra style class hook, mine below is btn-fa-group to your gwt button. If you use the attribute 'addStyleNames' you can define them in your stylesheet and have multiple classes.
<g:Button text=" Post Your Answer" enabled="false" ui:field="showPostButton" addStyleNames="btn btn-default btn-fa-group" />
Now in your CSS define the following declaration:
btn-fa-group:before {
color: #333333;
content: "\f0c0";
display: inline-block;
font-family: "fontawesome";
}
Some important things to note; don't forget the before selector, make sure the unicode starts with a slash and have fontAwesome installed. Alternatively you can use another glyph icon if you have the font installed.
You can set innerhtml with image in button i.e.
Button button=new Button("<image src='abc.jpg' width='200px' height='300px' />Ok");
Button bt = new Button();
bt.getElement().getStyle().setBackgroundImage("url('path/to/ur/image/imagename.extention')");
also set size of background image wrt to the size of button
bt.getElement().getStyle().setProperty("backgroundSize","30px");
Add a Css Class to your Button is probalby the best solution.
button.addStyleName("ButtonIcon");
How to define the CSS and HTML you can read here.
Yes ,you can .Gwt have a SmartGwt type button called push buttopn
com.google.gwt.user.client.ui.PushButton
You can pass Image object to it as below
Image image = new Image(GWT.getModuleBaseURL() + "/images/search-arrow.png");
RootPanel.get().add(new PushButton(image));

Repositioning fancybox to center after loading new ajax content

I have implemented a fancybox which opens and loads ajax content without any problems. But when I load new ajax content into a div in the FancyBox using jquery I need to center the FancyBox on the screen again.
function refreshContent(url) {
$("#content").fadeOut("slow", function(){
$.fancybox.showLoading();
$("#content").load(url,false, function() {
$.fancybox.hideLoading()
$("#content").fadeIn("slow");
$.fancybox.reposition();
});
})
As you can see, I have tried with the reposition() method, but with no effect. The same applies to center()
What am I missing here?
I'm using Fancybox ver 2.0.5
Maybe is a little late but in fancy 2 there is a method:
$.fancybox.reposition();
You can see the other methods here:
http://fancyapps.com/fancybox/#docs
Regards
Probably need to put you reposition call inside the complete function of the fadeIn. Otherwise it gets called before the content is visible.

TinyMCE Removes site base url

im using TinyMCE Wysiwyg editor, and when i enter a link, or an image from the same website, it removes the base url
for example, if i enter: http://www.domain.com/somelink.php - i'll get - somelink.php
any ideas how to solve it?
thanks!
Add this few lines in your tinyMCE.init function :
convert_urls:true,
relative_urls:false,
remove_script_host:false,
(Old thread I know but in case anyone else is googling this:)
I had to set convert_urls to false as well.
I am using TinyMCE within Umbraco, so I needed to make the changes in /config/tinyMceConfig.config and then restart the website.
It's very easy to solve.
Instead of Epharion said, simply put this line in your tinyMCE.init function:
tinyMCE.init({
...
document_base_url : "http://www.site.com/path1/"
});

How do you programatically remove (not disable) a button from TinyMCE?

I can disable the table button using this:
tinyMCE.activeEditor.controlManager.get('divId_table').setDisabled(true)
but what I'm interested in is actually hiding it. Any idea on how to accomplish that?
Thank you!
First, you have to use the advanced theme.
Then, add this option in the TinyMCE init code.
tinyMCE.init({
...
theme_advanced_disable : "bold, justifyleft, justifyright"
});
I hope this might help someone.
source
list of elements' name here
I'm not familiar with TinyMCE myself, but since you appear to have javascript access to the element itself, all you need to do is set it's display property to "none".
document.getElementById("theButton").style.display = "none";
incase ur trying to hide a specific button, use the following code.
$('.mce_cut').hide() //hides cut button
lookup other button titles using firebug in case u wish to hide something specific.
Incase you are looking to hide specific editor's button, modifiy the jquery selector to select correct sibling/descendent.
alternately, try this ..
tinyMCE.activeEditor.controlManager.controls.ctl00_SPWebPartManager1_g_5005db96_e035_4197_a958_75f008b35061_ctl00_tbKeywords_cut.remove()
Note that ctl00_SPWebPartManager1_g_5005db96_e035_4197_a958_75f008b35061_ctl00_tbKeywords is my asp.net control's id. Don't bother about this if ur not using Asp.net serverside textbox control. In case you are.. <% theTextBoxID.ClientID %> gets u that.
Use the following (using jQuery; a non-jQuery approch is easily built):
var elem = $(ed.id+'_'+'divId_table')
elem.addClass('mceButtonDisabled');
elem.removeClass('mceButtonEnabled');