Please help. I use tinyMCE as inline editor. So I need that when user in edit mode press enter then will be <br /> not <p>. I read manual and FAQ and try
tinyMCE.init({
'height' : '100%',
'widht':'100%',
'content_css' : styles + ',/sdtc-new/nc/interface/common/css/mce-editor.css',
'mode' : "specific_textareas",
'editor_selector' : prefix + o.id,
'theme':'advanced',
theme_advanced_buttons1: o.buttons.join(','),
theme_advanced_buttons2 : "",
**theme_advanced_buttons3 : "",
force_br_newlines : true,
force_p_newlines : false,
forced_root_block : '' // Needed for 3.x**
});
But it's not work . Actually some time it's work like when I delete all conetent in edit area and type new text. But i need that it works all time. Please help. Version of tinyMCE 3.4.4
You will need to set
tinyMCE.init({
forced_root_block : false,
force_br_newlines : true,
force_p_newlines : false
...
});
Here is a helpfull section of the tinymce FAQ.
Related
I have a jquery plugin which i have purchased from code canyon for social sharing.
I have it configured for single item sharing, however I wish to make it connected to multiple instances on a page.
<script>
$('a.shareplus').shareplus({
icons: "facebook,twitter,google",
height : '150px',
width : '150px',
shareurl : '#application.settings.websiteurl#/article/' + $(this).attr('data-href'),
displayTitle : true,
title : 'Share this item from',
sticker : false,
pin : false,
gplus : false,
tweets : false,
fbLikebox : false
});
</script>
This works perfectly for a single item that is shared on a webpage. Ive searched the documentation for this plugin, however I cant find any reference for it to be attached to multiple items on a single page.
What Im wondering is.. Im thinking about using the .bind() method to connect to it on click and using the data-href custom attribute to define the page for it to be connected to.
But this doesnt seem to work.
<script>
$('a.shareplus').bind('click',shareplus({
icons: "facebook,twitter,google",
height : '150px',
width : '150px',
shareurl : '#application.settings.websiteurl#/article/' + $(this).attr('data-href'),
displayTitle : true,
title : 'Share this item from',
sticker : false,
pin : false,
gplus : false,
tweets : false,
fbLikebox : false
});
})</script>
Im not too sure on how to connect the bind api to links that contain functions that have parameters so any help greatly appreciated
Try to write your code in document.ready() and use on() instead of bind() also use data() for data attributes like,
$(function(){
$('a.shareplus').on('click',function(){
$(this).shareplus({
icons: "facebook,twitter,google",
height : '150px',
width : '150px',
shareurl : '#application.settings.websiteurl#/article/'+$(this).data('href'),
displayTitle : true,
title : 'Share this item from',
sticker : false,
pin : false,
gplus : false,
tweets : false,
fbLikebox : false
});
});
});
I am using fancybox 2 and am appending html content to the modal. I turned of scrolling, and now the content that overflows the modal is hidden. Is this a problem with the max-height of the modal? How do I fix this?
My Code:
$('.fancybox-open').fancybox({
openEffect : 'none',
closeEffect : 'none',
'scrolling' : 'no',
'closeBtn' : true,
afterLoad : function() {
this.content.html();
}
});
You have multiple possible reasons this is breaking.
We need more info for a definitive answer, but here are some likely/possible reasons.
Try a few of these parameters:
$('.fancybox-open').fancybox({
openEffect : 'none',
closeEffect : 'none',
'scrolling' : 'no',
'height' : 1000, <--- Try these one at a time
'autoHeight' : true, <--- Try these one at a time
'autoResize' : true, <--- Try these one at a time
'fitToView' : true, <--- Try these one at a time
'closeBtn' : true,
afterLoad : function() {
this.content.html();
}
});
You can read the full plugin options documented here:
http://fancyapps.com/fancybox/#docs
While I am pasting a content from a webpage, the tinymce editor in IE8 doesn't display the content.
Hi, i am adding the image that I got.
My issue is
1.I have copy content from the webpage http://ch.tbe.taleo.net/CH02/ats/careers/requisition.jsp?org=TRAILERPARK&cws=1&rid=148
and try to paste in to my tinymce editor which is open in Ie8..
2.the result is shown as like in the image as red box
Refere to Adding new fonts to TinyMCE font options
the site you're copying from uses (see the source):
#font-face
{
font-family: "Museo Slab W01 1000";
src: url("http://www.trailerpark.com/Fonts/ee02ec61-b42e-49bb-9942-0793380267f5.eot?iefix");
src:
url("http://www.trailerpark.com/Fonts/f6e64e68-be62-481f-bcf3-923028fc62e0.svg#f6e64e68-be62-481f-bcf3-923028fc62e0") format("svg"),
url("http://www.trailerpark.com/Fonts/b6bcb198-882f-4f57-a02c-07e8155aab5f.woff") format("woff"),
url("http://www.trailerpark.com/Fonts/cfa01f25-bb4c-4a09-8ba3-8afafcbb3508.ttf") format("truetype");
}
Use the method type : encoding : "raw"
function exilTinyMCEInit(args) {
tinyMCE.init({
mode : "exact",
theme : "advanced",
plugins : "paste",
elements : args,
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,bullist,numlist,undo,redo",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_resizing : false,
onchange_callback : "exilTinyMCEOnChangeHandler",
encoding : "raw",
setup : function(ed) {
var curElement = P2.getFieldObject(ed.id);
if (curElement.disabled || curElement.readOnly) {
ed.settings.readonly = true;
} else {
ed.settings.readonly = false;
}
}
});
}
tinyMCE keeps stripping the class-attribute of my element, when clicking "remove formatting", although i've added it to the extended_valid_elements. look here:
...
extended_valid_elements : "p[class],figure[class],figcaption",
valid_children : "+p[figure]",
...
all gets stripped. do you have any idea?
thank you very much!
Take a look at this: http://tinymce.moxiecode.com/wiki.php/Configuration:formats (see the "remove format"-section).
You'll have to edit tiny_mce.js .
Search for the code shown there and add the following to the removeformat-array:
{selector : 'p', attributes : ['style'], split : false, expand : false, deep : true}
It should prevent tinymce from removing the class-attribute from p-elements when using the remove-format-button.
code must be:
...
formats : {
removeformat : [
{selector : 'figure', attributes : ['style'], split : false, expand : false, deep : true}
]
},
...
I want to add multi TinyMCE editors and each one has its own configuration in one page?
How I can do it?
You could do something like this:
jQuery version:
$('textarea.editor1').tinymce(
{
script_url : '../admin/tiny_mce/tiny_mce.js',
theme : "simple",
plugins : "", // put plugins here
setup : function(ed)
{
ed.onInit.add(function(ed)
{
});
}
});
$('textarea.editor2').tinymce(
{
script_url : '../admin/tiny_mce/tiny_mce.js',
theme : "simple",
plugins : "", // put plugins here
setup : function(ed)
{
ed.onInit.add(function(ed)
{
});
}
});
Non-jQuery version:
tinyMCE.init(
{
mode : "textareas",
theme : "simple",
editor_selector : "editor1"
});
tinyMCE.init(
{
mode : "textareas",
theme : "simple",
editor_selector : "editor2"
});
This is easy to achieve. I use the jQuery lib to save code, but it is easy to create this code without jQuery. Supposed you have html elements (i.e. textareas) with ids "my_id1" and "my_id1", that you wish to get a tinymce for all you need to do is:
var config_tinymce_1 = {
plugins :"save",
theme_advanced_buttons1 : "bold,italic,underline,save",
theme_advanced_buttons2 : "",
...
};
var config_tinymce_2 = {
plugins :"save",
theme_advanced_buttons1 : "save",
theme_advanced_buttons2 : "",
...
};
$(document).ready(function(){
init_obj_1 = {element_id:'my_id1', window: window};
$.extend(true, init_obj_1, config_tinymce_1);
tinyMCE.execCommand('mceAddFrameControl',false, init_obj_1);
init_obj_2 = {element_id:'my_id2', window: window};
$.extend(true, init_obj_2, config_tinymce_2);
tinyMCE.execCommand('mceAddFrameControl',false, init_obj_2);
});