Forum closed. New forum available at http://community.wymeditor.org/

Problem initializing WYMeditor in dynamic DIV

Support forum for WYMeditor.

Problem initializing WYMeditor in dynamic DIV

Postby mikenshmirtz on Wed Feb 16, 2011 6:22 pm

When I load the sample locally (http://localhost/js/wymeditor/examples/01-basic.html), everything looks perfect.

When I load the sample into an existing div, the page loads but just shows a plain textarea:
Code: Select all
$(document).ready(function() {
  $("#cms_edit").load('/js/wymeditor/examples/01-basic.html');  // load the same exact file that works into a div
})


I've even replaced the jquery call to load from googleapis.com, where I already load it, to ensure there is no conflict from multiple jquery instances:
Code: Select all
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>


The div that I'm loading the content into is nested in the page as such:
html > body > div#adminmenu_top.ui-tabs > div#ui-tabs-1.ui-tabs-panel > div#cms_edit

Any help is greatly appreciated. I really like the functionality of this editor and would like to deploy this to my team.
mikenshmirtz
 
Posts: 4
Joined: Wed Feb 16, 2011 5:59 pm

Re: Problem initializing WYMeditor in dynamic DIV

Postby mikenshmirtz on Wed Feb 16, 2011 6:42 pm

It seems jquery.wymeditor.min.js needs to be loaded in the head section, so loading it via AJAX is a no go. I just threw the call in the main page head for now and it seems to work (though all the icons are stacked vertically, I imagine that will be a relatively easy fix for me.)
mikenshmirtz
 
Posts: 4
Joined: Wed Feb 16, 2011 5:59 pm

Re: Problem initializing WYMeditor in dynamic DIV

Postby mikenshmirtz on Thu Feb 17, 2011 6:10 pm

So everything seemed pretty perfect until I realized the textarea content is no longer being submitted with the form. The textarea submits the content that was in it when the page loaded... no changes. What gives? :?:
mikenshmirtz
 
Posts: 4
Joined: Wed Feb 16, 2011 5:59 pm

Re: Problem initializing WYMeditor in dynamic DIV

Postby mikenshmirtz on Thu Feb 17, 2011 6:25 pm

mikenshmirtz wrote:So everything seemed pretty perfect until I realized the textarea content is no longer being submitted with the form.


It seems I need to ask the question before I figure out the answer for myself. It seems I have to manually make a call to update the instance when I want to submit the form. (If there was some documentation online somewhere, I could probably figure out how to fix this the right way as opposed to this hack.)

Anyway, in case it helps anyone else, I just added this to my button binding:
Code: Select all
$.each(WYMeditor.INSTANCES, function() { this.update(); });
mikenshmirtz
 
Posts: 4
Joined: Wed Feb 16, 2011 5:59 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests