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

Install WYMEditor on subdomain

Support forum for WYMeditor.

Install WYMEditor on subdomain

Postby ionut.dogaru on Fri Apr 02, 2010 8:24 am

I think I have found a way to install this beautiful editor on a subdomain(serve files from subdomain) and make it working on any page from main domanin.
I saw that some has got into trouble regarding this and I did it myself yesterday.

So the solution.

file: wymeditor/iframe/default/wymiframe.html
add line in <head>: <script type="text/javascript">document.domain = 'domain-name-where-you-want-to-use-editor.com';</script>
and modify the path to the wymiframe.css file so it looks like http://static.domain-name-where-you-wan ... iframe.css

file where you use editor:
add line in head:<script type="text/javascript">document.domain = 'domain-name-where-you-want-to-use-editor.com';</script>
include next files:
<script type="text/javascript" src="http://static.domain-name-where-you-want-to-use-editor.ro/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://static.domain-name-where-you-want-to-use-editor.ro/path-to-files/jquery.wymeditor.js"></script>
<!-- lang file -->
<script type="text/javascript" src="http://static.domain-name-where-you-want-to-use-editor.ro/path-to-files/lang/en.js"></script>
<!-- skin files -->
<script type="text/javascript" src="http://static.domain-name-where-you-want-to-use-editor.ro/path-to-files/skins/default/skin.js"></script>
<link type="text/css" rel="stylesheet" href="http://static.domain-name-where-you-want-to-use-editor.ro/path-to-files/skins/default/skin.css">

note that you have to add lang files and plugin files and skin files by hand. They can not be included with ajax...
After this call editor like:
<script type="text/javascript">jQuery( function(){ jQuery('.wymeditor').wymeditor({basePath:'http://static.domain-name-where-you-want-to-use-editor.ro/path-to-files/'}); });</script>

Hope it helps
Regards
You have to climb higher if you want to see further
ionut.dogaru
 
Posts: 3
Joined: Fri Apr 02, 2010 8:12 am
Location: Romania

Re: Install WYMEditor on subdomain

Postby ionut.dogaru on Sat Apr 03, 2010 11:49 am

Sorry for missleading...
It seems to work great il all browsers but IE7,8...
You have to climb higher if you want to see further
ionut.dogaru
 
Posts: 3
Joined: Fri Apr 02, 2010 8:12 am
Location: Romania

Re: Install WYMEditor on subdomain

Postby mr_lundis on Sat Apr 03, 2010 1:39 pm

This is interesting, if we could get this to work in IE as well I'll update the docs to include this as a workaround.

Cheers ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: Install WYMEditor on subdomain

Postby ionut.dogaru on Wed Apr 07, 2010 12:06 pm

Ok, finally I managed it. The only browser I haven't tried this yet is IE6 but I think it has no reasons not to work.

So:
Install all the files in you static sub-domain, something like:
root_static/js/jquery.wymeditor.js
root_static/js/wymeditor/ - all the other files needed by the editor.

than in your page where you want to use editor include next files:
<script type="text/javascript" src="http://static.domain.com/js/jquery.wymeditor.js"></script>
<script type="text/javascript" src="http://static.domain.com/js/wymeditor/lang/en.js"></script> - or any language file
<script type="text/javascript" src="http://static.domain.com/js/wymeditor/skins/default/skin.js"></script> - or any other skin
<link rel="stylesheet" type="text/css" href="http://static.domain.com/js/wymeditor/skins/default/skin.css" /> - the corresponding stylesheet for selected skin
and the jquery, of course.

put the wymiframe.html file from js/wymeditor/iframe/default/wymiframe.html in the root of your site or whatever path you want but be careful to be served by the server from the same domain/subdomain where the page (in which you want the editor displayed) is. And than edit it
and put the wright path to the stylesheet on the static domain <link rel="stylesheet" type="text/css" media="screen" href="http://static.domain.com/js/wymeditor/iframe/default/wymiframe.css" />

than call the editor like
jQuery( function(){
jQuery('.wymeditor').wymeditor({
basePath : 'http://static.domain.com/js/wymeditor/',
iframeBasePath : 'http://www.domain.ro/', - or whatever path you want
updateSelector : "form[name='myform']", - this is used to update editor before submit it can be used with ajax too if you catch the submit event
updateEvent: 'submit'
});
});

I have tried to create some dynamic script tags in page but it seems that some new browsers(FF3.6) do not allow this anymore(I only tried to add them in head tag, maybe in the body it allows you). recently I have read abot something line using script tags like this <script type="plain/text"> whatever you want </script> and than with jQuery's html function get the code and evaluate it, but I don't know if it's a valid attribute plain/text...

Anyway for a workaround this is ok, so good luck!
ionut.dogaru
 
Posts: 3
Joined: Fri Apr 02, 2010 8:12 am
Location: Romania

Re: Install WYMEditor on subdomain

Postby mr_lundis on Fri Apr 09, 2010 4:34 pm

Thank you for looking in to this. Any idea why the document.domain fix fail in IE? As of what I read on MSDN it should work...

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: Install WYMEditor on subdomain

Postby Glebushka on Mon Dec 06, 2010 10:05 am

IE resets document.domain when enabling designMode

This seems to be the same problem:
http://yuilibrary.com/projects/yui2/ticket/2052000
Glebushka
 
Posts: 1
Joined: Mon Dec 06, 2010 10:04 am


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests