Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Installing TinyMCE Help

Reply
Thread Tools

Installing TinyMCE Help

 
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      06-05-2007
Hi all,
I have difficulties initializing TinyMCE. Initialization involved 1
included file tiny_mce.js and one which I include "on demand" (see
tinyMCEOnDemand()). The content of that function is all the way below.
If I do not "demand" that file but, rather, write locally, everything
works smoothly with included file tiny_mce.js. But my HTML object
required for initialization appears on the page when user decides to
make it appear, therefore TinyMCE cannot be initialized until a
necessary html object is visible (i.e. textarea). I wrote function
start() to simulate this process of my needs. As a result, I suffer
running the code below.
Can anyone suggest something?

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My example</title>
<!-- tinyMCE -->

<script language="javascript" type="text/javascript" src="../jscripts/
tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
function start(){
var body = document.getElementsByTagName("body")[0];
var d = document.createElement('div');
d.style.display = "none";
d.innerHTML = "<textarea id='Descriptions' style='width:450px; height:
250px'></textarea>";
body.appendChild(d);
d.style.display = "block";
tinyMCEOnDemand();
}

function tinyMCEOnDemand(){
var head = document.getElementsByTagName("head")[0];
var script = document.createElement('script');
script.id = 'tinyMCEScriptInitializer';
script.type = 'text/javascript';
script.src = "tinyInit.js";
head.appendChild(script);
}
</script>
<!-- /tinyMCE -->

</head>
<body onload="setTimeout('start()',3000);">
</body>
</html>

============================
tinyInit.js file has:

tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "Descriptions",
save_callback : "customSave",
content_css : "example_advanced.css",
extended_valid_elements : "a[href|target|name]",
plugins : "table",
theme_advanced_buttons3_add_before :
"tablecontrols,separator",
//invalid_elements : "a",
theme_advanced_styles : "Header 1=header1;Header
2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific
setting CSS classes
//execcommand_callback : "myCustomExecCommandHandler",
debug : false
});

// Custom event handler
function myCustomExecCommandHandler(editor_id, elm, command,
user_interface, value) {
var linkElm, imageElm, inst;

switch (command) {
case "mceLink":
inst = tinyMCE.getInstanceById(editor_id);
linkElm =
tinyMCE.getParentElement(inst.selection.getFocusEl ement(), "a");

if (linkElm)
alert("Link dialog has been overriden. Found link href: " +

tinyMCE.getAttrib(linkElm, "href"));
else
alert("Link dialog has been overriden.");

return true;

case "mceImage":
inst = tinyMCE.getInstanceById(editor_id);
imageElm =
tinyMCE.getParentElement(inst.selection.getFocusEl ement(), "img");

if (imageElm)
alert("Image dialog has been overriden. Found image src: " +

tinyMCE.getAttrib(imageElm, "src"));
else
alert("Image dialog has been overriden.");

return true;
}

return false; // Pass to next handler in chain
}
// Custom save callback, gets called when the contents is to be
submitted
function customSave(id, content) {
alert(id + "=" + content);
}

 
Reply With Quote
 
 
 
 
-Lost
Guest
Posts: n/a
 
      06-05-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I have difficulties initializing TinyMCE.

<snip TinyMCE code and whatnot>

You are *still* working on that TinyMCE example?

Any link to your example? Any errors or is TinyMCE just not behaving as
you expect?

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
 
Reply With Quote
 
 
 
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      06-05-2007
On Jun 5, 4:30 pm, -Lost <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > I have difficulties initializing TinyMCE.

>
> <snip TinyMCE code and whatnot>
>
> You are *still* working on that TinyMCE example?
>
> Any link to your example? Any errors or is TinyMCE just not behaving as
> you expect?
>
> --
> -Lost
> Remove the extra words to reply by e-mail. Don't e-mail me. I am
> kidding. No I am not.


Yes, still working, thanks.
Error: tinyMCE is not defined and page keeps loading witout any
success.
Working Example: http://www.eclayer.com/tinymceexample.html
Included File: http://www.eclayer.com//tinymce/jscr...ce/tiny_mce.js
(Note: not my website but a good demo)

 
Reply With Quote
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      06-05-2007
THIS IS a plug-n-play example which works! Try to remove textarea and
it won't work. My goal is to add textarea dynamically and init
tinyMCE. That's all...

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My example</title>
<!-- tinyMCE -->

<script language="javascript" type="text/javascript"

src="http://www.eclayer.com//tinymce/jscripts/tiny_mce/tiny_mce.js"></
script>

<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "Descriptions",
save_callback : "customSave",
content_css : "example_advanced.css",
extended_valid_elements : "a[href|target|name]",
plugins : "table",
theme_advanced_buttons3_add_before :
"tablecontrols,separator",
//invalid_elements : "a",
theme_advanced_styles : "Header 1=header1;Header
2=header2;Header 3=header3;Table Row=tableRow1", // Theme

specific setting CSS classes
//execcommand_callback : "myCustomExecCommandHandler",
debug : false
});


// Custom event handler
function myCustomExecCommandHandler(editor_id, elm, command,
user_interface, value) {
var linkElm, imageElm, inst;

switch (command) {
case "mceLink":
inst = tinyMCE.getInstanceById(editor_id);
linkElm =
tinyMCE.getParentElement(inst.selection.getFocusEl ement(), "a");

if (linkElm)
alert("Link dialog has been overriden. Found link href: " +

tinyMCE.getAttrib(linkElm, "href"));
else
alert("Link dialog has been overriden.");

return true;

case "mceImage":
inst = tinyMCE.getInstanceById(editor_id);
imageElm =
tinyMCE.getParentElement(inst.selection.getFocusEl ement(), "img");

if (imageElm)
alert("Image dialog has been overriden. Found image src: " +

tinyMCE.getAttrib(imageElm, "src"));
else
alert("Image dialog has been overriden.");

return true;
}

return false; // Pass to next handler in chain
}

// Custom save callback, gets called when the contents is to be
submitted
function customSave(id, content) {
alert(id + "=" + content);
}


</script>
<!-- /tinyMCE -->

</head>
<body>

<textarea id='Descriptions' style='width:450px; height:250px'></
textarea>

</body>
</html>

 
Reply With Quote
 
-Lost
Guest
Posts: n/a
 
      06-05-2007
(E-Mail Removed) wrote:
> THIS IS a plug-n-play example which works! Try to remove textarea and
> it won't work. My goal is to add textarea dynamically and init
> tinyMCE. That's all...
>

<snip semi-working example>

1. Either rewrite the init() method, because its DOM-readiness is ****.

I tried tests both by dynamically adding textareas and by attempting to
hide/show them.

No luck.

The init() method does some really weird stuff in regards to the
original textarea. For example, it rewrites the entire damn thing into
this convoluted TABLE, SPAN crap.

2. Find the TABLE of TinyMCE and hide it. Here is the kicker though...
YOU MUST hide it via JavaScript. Do it via CSS and the TABLE gets
removed before TinyMCE initializes it. Another sign of TinyMCE and/or
its init() method being feces.

I have seen stool samples with better code and practices than what
TinyMCE produces.

Poop Count = 4

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      06-05-2007
On Jun 5, 12:58 pm, (E-Mail Removed) wrote:
> Hi all,
> I have difficulties initializing TinyMCE.


Is the TinyMCE support not helpful?

http://tinymce.moxiecode.com/punbb/index.php

Peter

 
Reply With Quote
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      06-06-2007
On Jun 5, 6:16 pm, Peter Michaux <(E-Mail Removed)> wrote:
> On Jun 5, 12:58 pm, (E-Mail Removed) wrote:
>
> > Hi all,
> > I have difficulties initializing TinyMCE.

>
> Is the TinyMCE support not helpful?
>
> http://tinymce.moxiecode.com/punbb/index.php
>
> Peter


The cost per question is 25.

 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      06-06-2007
On Jun 5, 5:09 pm, (E-Mail Removed) wrote:
> On Jun 5, 6:16 pm, Peter Michaux <(E-Mail Removed)> wrote:
>
> > On Jun 5, 12:58 pm, (E-Mail Removed) wrote:

>
> > > Hi all,
> > > I have difficulties initializing TinyMCE.

>
> > Is the TinyMCE support not helpful?

>
> >http://tinymce.moxiecode.com/punbb/index.php

>
> > Peter

>
> The cost per question is 25.


Holy crap! Do they pay 25 for each bug report?

I just loaded their demo. Wow that took a long time.

What about the FCKEditor? Free support.

Peter

 
Reply With Quote
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      06-06-2007
On Jun 5, 7:54 pm, Peter Michaux <(E-Mail Removed)> wrote:
> On Jun 5, 5:09 pm, (E-Mail Removed) wrote:
>
> > On Jun 5, 6:16 pm, Peter Michaux <(E-Mail Removed)> wrote:

>
> > > On Jun 5, 12:58 pm, (E-Mail Removed) wrote:

>
> > > > Hi all,
> > > > I have difficulties initializing TinyMCE.

>
> > > Is the TinyMCE support not helpful?

>
> > >http://tinymce.moxiecode.com/punbb/index.php

>
> > > Peter

>
> > The cost per question is 25.

>
> Holy crap! Do they pay 25 for each bug report?
>
> I just loaded their demo. Wow that took a long time.
>
> What about the FCKEditor? Free support.
>
> Peter


I may have found what I need but I still solve various aspects such as
appending innerHTML, etc.:

http://tinymce.moxiecode.com/punbb/v...ic.php?id=4673

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tinyMce validation problem? Ravi Katta Ruby 1 08-26-2008 02:09 PM
Edit in place with tinyMCE RonY Javascript 0 04-07-2007 11:24 PM
Cursor in TinyMCE in SWTBrowser jsimon Java 0 12-13-2006 01:24 PM
Willing to pay for some expert help integrating TinyMCE davehansen22@gmail.com Java 3 07-19-2006 09:51 PM
tinymce Manfred W Java 2 08-12-2005 08:46 AM



Advertisments