Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#233 closed defect (wontfix)

Dojo does not play well with TinyMCE editor

Reported by: dojo_trac@… Owned by: alex
Priority: high Milestone:
Component: Core Version: 0.1
Keywords: tinymce Cc: dojo_trac@…
Blocked By: Blocking:

Description

When I load both tinymce and dojo together onto a page, tinymce doesn't work. To be more specific, if I load dojo before tinymce, tinymce doesn't work, and it gives me an error stating: "tinyMCE.baseURL has no properties".

If I load dojo after I load tinymce though, it works fine.

The problem seems to be occurring when tinymce is loaded with scriptaculous as well, as described here: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=1526

Change History (9)

comment:1 Changed 14 years ago by dojo_trac@…

Priority: normalhigh

I take back what I said about tinymce working.

When I load both tinymce and dojo into a page, whichever I load first is the script that works. If I load dojo first, then tinymce, then dojo works perfectly, but tinymce screws up. If I load tinymce first, then dojo, then dojo throws a bunch of weird errors.

(by load first, I mean which script src="" tag comes first)

comment:2 Changed 14 years ago by M4g3

Priority: highnormal

I have the same problem here, the problem has something to do with the fact that you initialize tinymce through a script tag without src as in:

<script language="javascript" type="text/javascript">
	tinyMCE.init({
		mode : "textareas",
		theme : "simple"
	});
</script>

The error thrown by dojo is that the Nth script tag has no src attribute, which definitely is right. I have no clue how a solution to this would go though..

comment:3 Changed 14 years ago by anonymous

Priority: normalhigh

comment:4 Changed 14 years ago by anonymous

Cc: dojo_trac@… added
Milestone: 0.2release

I've also tried taking the tinymce config javascript out of the main page, and linking it through a script src="". In that case, again tinyMCE works, but Dojo throws these errors: (live site is: https://cms.cob.ohio-state.edu/cms/ssk/ )

DEBUG: failed loading src/widget/Editor.js with error: [SyntaxError: syntax error, file: https://cms.cob.ohio-state.edu/cms/ssk/js/dojo.js, line: 179] DEBUG: failed loading src/widget.js with error: [SyntaxError: syntax error, file: https://cms.cob.ohio-state.edu/cms/ssk/js/dojo.js, line: 179] DEBUG: failed loading src/package.js with error: [SyntaxError: syntax error, file: https://cms.cob.ohio-state.edu/cms/ssk/js/dojo.js, line: 179] DEBUG: failed loading src.js with error: [SyntaxError: syntax error, file: https://cms.cob.ohio-state.edu/cms/ssk/js/dojo.js, line: 179] DEBUG: failed loading package.js with error: [SyntaxError: syntax error, file: https://cms.cob.ohio-state.edu/cms/ssk/js/dojo.js, line: 179] FATAL: Could not load 'dojo.widget.Editor'; last tried 'package.js'

comment:5 Changed 14 years ago by alex

Owner: changed from anonymous to alex
Status: newassigned

so having run this through a debugger, it appears to be a race condition between the JS engine and the DOM in which the <script> element we care about isn't exposed in the DOM yet, and so we can't access it to figure out where Dojo "came from".

The work-around is to set baseRelativePath in djConfig to direct Dojo to the directory that dojo.js was loaded from, but this is sub-optimal.

comment:6 Changed 14 years ago by alex

Milestone: 0.2release0.3release

I've been unable to produce a stand-alone test case for this issue. As a result I'm moving it out to 0.3.

Can the original reporter contribute a tarball with a test case?

comment:7 Changed 14 years ago by alex

Milestone: 0.3release0.2release

Ok, got a test case from Praneet. Moving back to 0.2

comment:8 Changed 14 years ago by alex

Resolution: wontfix
Status: assignedclosed

After much more digging, it appears that this is a Firefox/Mozilla? issue and not one that is likely to be remedied by us. In the test case provided, TinyMCE's "init" method does a series of document.write() calls which output <script> blocks. When we subsequently attempt to look at the list of <script> blocks in the DOM to determine which one is "ours", only those <script> elements that occured *before* the document.write() calls are returned.

The workaround in this scenario is to include TinyMCE *after* dojo.js. This un-breaks the example page and I would expect it to be a general-purpose remedy.

comment:9 Changed 12 years ago by (none)

Milestone: 0.2release

Milestone 0.2release deleted

Note: See TracTickets for help on using tickets.