Jquery.tinymce.js gets loaded but TinyMCE doesnt get inserted - ruby-on-rails

We have used tinyMCE at several places in our app just by adding a class to the text area or whichever element wherein we need to insert TinyMCE. But when I try to add tinyMCE to a newly created text area, it doesn't get loaded. But when I inspect the code, I Can find that the Jquery.tinymce.js script has been loaded. Kindly help me out.

Looks like you call the tinymce init function on pageload.
When you create a new textarea on the fly you should init that tinymce instance explicitly.
For this use:
tinymce.execCommand('mceAddControl', false, 'id_of_the_new_textarea');

Related

cannot load html text into div tag using jquery in Vaadin 7

Many thanks for your help and support in advance. Using vaadin 7 AbstractJavaScriptComponent, I am trying to load html snippet in place of div tag and the screen does not display anything. Could not figure it out the reason. Please help !
window.de_vaadin_ui_myapp_MyWidget = function() {
$(document).ready(function(){
$("#content").load("html/NewFile.html");
});
var element = this.getElement();
this.onStateChange = function() {
element.innerHTML ="<div id=\"content\"></div>";
};
};
the html file is located in the package de.vaadin.ui.myapp.MyWidget.html
There are multiple things that could go wrong here. It would help if you'd describe any relevant log messages or such.
I can see multiple different reasons for why this isn't working for you:
The connector logic is not run at all e.g. because of a typo in the #JavaScript annotation value or the name of the connector function (i.e. de_vaadin_ui_myapp_MyWidget). You can verify that it's actually loaded by adding e.g. console.log(this.getElement()) inside the top level function.
The HTML is requested from the wrong URL. Check the network inspector in the browser's developer tools to see which absolute URL is actually loaded and whether that returns the expected result or only e.g. a 404 response. If this is the problem, you could either move the HTML file to some other place or change the relative URL passed to load to something
The contents of the extended element is reset every time there is a state change event because innerHTML is reassigned. It might help to move the statement that assigns innerHTML outside of the onStateChange handler so that it would only be run once during initialization. This might also cause a situation where $("#content") is run before the div has even been created, causing it to not find the target element.

My smartGWT widgets are not displaying propoerly

I have simply added SmartGWT example in my application.
But the widgets are not coming up properly
Specially the button , Its simply showing the button text ,and not even the structure of button
please have a look
http://screencast.com/t/ddEQQIZLxq
whereas it should be like this
http://screencast.com/t/8SK16Zhggx
any idea, where i am wrong.
It looks like your theme is not properly loaded. Be sure that you are inheriting theme in your .gwt.xml file.
From https://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/Skinning.html
A skin is implicitly loaded when you add an tag in your .gwt.xml file to include SmartGWT components (name="com.smartgwt(ee).SmartGWT(Pro|Power|EE)"). To switch skins, add the "NoTheme" suffix to the "name" attribute of this tag, then add . These tags cause a tag to be injected into your bootstrap .html page, which loads load_skin.js for the appropriate skin. load_skin.js loads the stylesheet and sets the CSS styleNames and media URLs that Smart GWT components will use.
To inspect your page, you can use firebug and make sure that skin_styles.css and load_skin.js are loaded.

Sitecore Auto-Save If Sublayout Added on the Page

Is there anyway to make auto-save once I added a sublayout component?
I created one sublayout and if I add it on the page in page editor, it doesn't appear on that time. By saving the item, it appears on the page editor.
So, I'd like to make if sublayouts are added on the page, then make the page automatic save.
Is it possible?
===== Update =====
This is the end of CreateNewDatasource Method and it updates Rendering Layout field.
//set datasource, save and close
myItem.Editing.BeginEdit();
myDataSourceItem = myItem.Add(newName, template);
rd.Datasource = myDataSourceItem.ID.ToString();
myItem[Sitecore.FieldIDs.LayoutField] = ld.ToXml();
myItem.Editing.EndEdit();
myItem.Editing.AcceptChanges();
return myDataSourceItem;
I'm not sure what the exact issue is with the way you have the control coded currently, I assume is to do with Sitecore control lifescycle so would need more in depth investigation. In any case, I suggest you re-think and implement using a more Sitecore friendly process.
Instead you should Prompt the User to Select/Create Datasource Item when inserting Rendering via Page Editor. The user can then either select an existing item or create a new one. The item will automatically be set as the datasource of your control and you will be able to immediately start editing in the Page Editor without having to save first.
It would be possible to make changes to the webedit.js file of sitecore but I would not recommend it because:
1) You will run into problems if you want to upgrade your solution to a newer version of sitecore later on.
2) The whole page will be saved everytime you add a new sublayout. The editor will not be able to discard his changes if he decides not to save the item after doing some other changes.
3) I also think that it is true what jammykam sayed in his comment. If the newly added sublayout will not appear on the page, there will be some javascript sideeffect caused by scripts on the page. To avoid this you could modify your sublayout or layout not to include custom javascript files when sitecore is in pageedit mode as a workaround and find out if this solves the problem.

way to reinitialize a page each time it is shown

I have some pages which are filled dynamically by content loaded with Ajax. My problem is that each time I go to this page, the old content is still there if it hasn't been replaced by new content...
I've thought about 2 home solutions like:
Creating a "template" page. By calling "pagebeforeshow", I'll copy the code from the template in the target page, and add there the dynamic content...
Each DOM where dynamic content must be put into, I had a class "clearcache" and by calling "pagebeforeshow" I do a $(".clearcache").empty();
I don't know how to deal with that. Have you ever got the same issue?
EDIT:
I bind the "tap" event to store the block-id into localstorage, to load dynamic content in the #PageBlock
Everything works very well (tap event, localstorage for the var, ajax loading). The issue comes really when I go from block to other blocks. The new content overwrite old content instead of beginning from a new "blank" page.
For example I have a list where I append datas I get from Ajax. If I switch to another block, the list is completed and not refreshed..
I could do something like empty the list, and then appending content, but I'd like something better because I have several pages/lists/dom like that...
Thanks for your help ;)
I faced a similar problem where the new contents where not shown on the page when i tried to append it.There is a simple solution where you can just replace append with prepend.
Example:
Replace
$("#divid").append(content)
with
$("#divid") .prepend(content)

embedded form relations with doctrine

I currently using ahDoctrineEasyEmbeddedRelationsPlugin to embed a Block form into a Page form.
All works well, but I'd like to hide the label of the embeddedRelation.
I've created a 'homepage-main-top' Block within the Page form in the admin, now when editting this Page, I now see 'homepage-main-top' is randomly appearing before the embedded block relation
Looking at the plugin docs, there doesn't seem to be anything relating to removing/hiding this:
http://imageshack.us/photo/my-images/197/relation.png
Does anyone know how to not display this?
Thanks
I've been struggeling with somewhat the same problem, only I needed to style the label instead of hidding / stripping it.
From what I've found out there is no simple way to manipulate the label of the embedded form, but I figured the following 'hack'.
The embedRelation method accepts a inner- and outer-decorator parameter. You can use these to wrap extra markup around the label and the embedded form. You can then use CSS to hide the label using a specific id / css class.
By openning tags in the outerdecorator and closing them in the inner decorator you can wrap the label in a tag (which is rendered inbetween the two). It is kind of tricky to make sure your HTML is still valid.
I know this is kind of a crappy solution but I haven't found a better way up until now.
Add this line to your parent form:
$this->widgetSchema['EmbeddedFormName']->setLabel(' ');
If the above doesn't work, try using the 'newFormLabel' option (from the plugin's documentation).
$this->embedRelations(array(
'RelationName' => array(
// ...
'newFormLabel' => ' ',
// ...
),
// ...
));

Resources