EzDevInfo.com

wymeditor

Pure js cross-browser WYSIWYM editor with a focus on the clean separation of content and styling. WYMeditor

How do I enable the WYMEditor for front end pages of Refinery CMS?

I'm customizing a Refinery CMS instance and creating custom front end pages. I tried to follow the README for Wymeditor, but it seems that the Wymeditor embedded in RefineryCMS has been modified, and this isn't working.

https://github.com/wymeditor/wymeditor

I tried to view the source of a Refinery admin page with the editor, and just copied the Javascript and CSS source tags to include into my front end custom page, and added the class to the text area, and called the wymeditor() function, but it gave a Javascript error.

HTML source...
<link rel='nofollow' href="/assets/wymeditor/skins/refinery/skin.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/wymeditor/setup.js?body=1" type="text/javascript"></script>
<script src="/assets/wymeditor/functions.js?body=1" type="text/javascript"></script>
...

Yields console error

Uncaught TypeError: Cannot read property 'msie' of undefined boot_wym.js?body=1:117

Source: (StackOverflow)

Setting default text in WYMEDITOR

I've got a question about using WYMEditor in ASP.NET MVC 3 with jQuery. I'd like to set default text in WYMEditor on my web page. If I'm doing in that way :

<script type="text/javascript">
jQuery(function() {
   jQuery(".wymeditor").wymeditor( { html : '<strong>some text</strong>'});
 });

There is no problem, and wymeditor shows well-formated text, but is I try it in that way :

<script type="text/javascript">
jQuery(function() {
   jQuery(".wymeditor").wymeditor( { html : '@ViewBag.HtmlText'});

 });

(HtmlText is variable where I keep : <strong>some text</strong>) the WymEditor shows me not formated text <strong>some text</strong>. I tried HtmlEncoding and etc, but it stil isn't working.


Source: (StackOverflow)

Advertisements

JQuery .bind() correct format

I have this code -

jQuery('.wymeditor').wymeditor( {
    html: '<p>Hello, World!<\/p>',
    postInit: function(wym) {
         var html = "<li class='wym_tools_newbutton'>"
                 + "<a name='NewButton' rel='nofollow' href='#'"
                 + " style='background-image:"
                 + " url(js/wymeditor/img/media.png);'"
                 + " title='Insert an image' >"
                 + "</a></li>";
       jQuery(wym._box).find(wym._options.toolsSelector + wym._options.toolsListSelector).append(html);
       jQuery(wym._box).find('li.wym_tools_newbutton a').click(function() {

       jQuery('#modal').show().css( { 'left': (winW-980)/2+'px', 'top': '100px' } ).load('admin_list_media.php');

                jQuery('.imgname').bind('change',function(){

                alert('123');

                var InsertImg = '#'+jQuery(this).attr('id');

                wym.insert('<img src="uploads/'+jQuery(InsertImg).val()+'" />');

                jQuery('#modal').empty().hide();

             });
            return(false);
            } );
            }
        } );

which adds a new button to a wym editor. This opens a modal which contains images, the idea is to select an image and insert into the wym editor. Works if i use jQuery('.imgname').live('change',function(){ ... but not if I use jQuery('.imgname').bind('change',function(){ problem is I have to use .bind() because the change event handler gets bound every time the modal opens and so I dupliacte image inserts each time I was told to replace .live() with .bind() but it doesn't work (OK in my code). Suggestions please


Source: (StackOverflow)

wymeditor does not accept the AltGr + i character

We've just had a problem come up when users try and enter the character í or Í (AltGr + i/I). In wymeditor it just doesn't appear, though as you can see here it is accepted by input fields on other websites when using the same browser.

I have tested it on the basic wymeditor examples and they also fail to display anything for AltGr + i. The issue can be recreated on other machines and various browsers.

Other characters like ú, ó, á and ú work fine (looks like I'm missing a vowel somewhere...) and it is possible to cut and paste the í or Í characters from another application in to wymeditor. My best guess at this point is that wymeditor is intercepting the keypress for some reason.

Any suggestions would be greatly appreciated - translators really struggle with this sort of thing!


Source: (StackOverflow)

How can WYMeditor and Jquery UI Dialog work together

In my modal dialog, when I'm done editing with WYMeditor, I want to click the OK button and have it update the Textarea. I don't see any example how to use this with a Jquery UI modal dialog, so I'm kind of stuck.


Source: (StackOverflow)

wymeditor set value?

I am trying to set the value of wymeditor textarea,
in API documentation, to set or get the value, the code below is given;

wym.html("<p>Hello, World.</p>");

but this code is not working.

How can I set the value of wymeditor textarea?

thanks.


Source: (StackOverflow)

WYSIWYG WYMEditor - Cant get to load

This is my code:

http://jsfiddle.net/Y6Lc4/

This is my load code:

jQuery(function() {
    jQuery('.wymeditor').wymeditor();
});
​

Why oh why does this not work?! I've copied the code from the demo site!


Source: (StackOverflow)

Embed doesn't work

Here's how javascript includes look like on the page:

<script type="text/javascript" src="/static/js/jquery/jquery.js"></script>
<script type="text/javascript" src="/static/js/wymeditor/jquery.wymeditor.min.js"></script>
<script type="text/javascript" src="/static/js/wymeditor/plugins/embed/jquery.wymeditor.embed.js"></script>
<script type="text/javascript" src="/static/js/admin_textarea.js"></script>

The problem is that when I save the content within the iframe, it is removed. UPDATE Here is the content of admin_textarea.js:

$(document).ready(function() {
    $('head', document).append('<link rel="stylesheet" type="text/css" media="screen" rel='nofollow' href="/static/js/wymeditor/skins/minimal/skin.css" />');
    $('head', document).append('<link rel="stylesheet" type="text/css" media="screen" rel='nofollow' href="/static/js/wymeditor/skins/minimal/skin.js" />');
    $("textarea").wymeditor({
        updateSelector: "input:submit",
        updateEvent:    "click",
        lang: 'ru'
    });
});

Source: (StackOverflow)

Django CMS / WYMEditor Stop Stripping of Whitespace

I'm aware of what WYMEditor is all about and that using Paragraphs for spacing is not intended, however the problem here is with the client requiring that we give them this functionality.

I've looked high and low to find where WYMEditor does it's stripping of whitespace and can't seem to find it at all.

It seems that when you press enter it creates a P visually, however when clicking the source it doesn't contain it. Furthermore, manually editing HTML source to contain <p>&nbsp;</p> doesn't work, as WYMEditor strips it out.

Just wondering if anybody has had this issue before and knows how to get rid of this functionality? It's worth noting that I believe the replacement is happening both in the 'text' module of Django-CMS, and also in the Javascript for WYMEditor.


Source: (StackOverflow)

Django-CMS WYMeditor not correctly working on Nginx

I am a new user to Django and Django Cms.
on local machine all js, html,css files download well when i work with backend
But on production when i use text plugin I can't get some files
There are:
GET http://example.com/admin/cms/page/15/edit-plugin/56/lang/uk.js/ 500 (Internal Server Error) GET http://example.com/admin/cms/page/15/edit-plugin/56/iframe/default/wymiframe.html/ 500 (Internal Server Error) (Status Code:301 MOVED PERMANENTLY)

Where example.com - my own site:)
File uk.js - i added by monkey patching. (everything work fine on local machine) In my html code in local I have:

<iframe src="/static/cms/wymeditor/iframe/default/wymiframe.html" onload="this.contentWindow.parent.WYMeditor.INSTANCES[0].initIframe(this)"></iframe>

On production side:

<iframe src="iframe/default/wymiframe.html" onload="this.contentWindow.parent.WYMeditor.INSTANCES[0].initIframe(this)"></iframe>

My urls.py:

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('core.urls')),
)

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += patterns('',
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {
        'document_root': settings.MEDIA_ROOT}))

my core urls.py:

from django.conf.urls import patterns, url, include
from django.http import HttpResponse

urlpatterns = patterns('core.views', 

   url(r"^robots.txt$", lambda r: HttpResponse("User-agent: *\nDisallow: /", mimetype="text/plain")),
   url(r"^commissions/$","commissions", name = "commissions" ),
   url(r"^commissions/(?P<slug>[a-zA-Z0-9_\-]+)/$","commissions", name = "comma" ),
   url(r'^news/', include('cmsplugin_news.urls'),{}),
   url(r'^', include('cms.urls')),
)

WHen i do python manage.py collectstatic - everything fine and i have all static files on my static folder Please help me what i doing wrong ?


Source: (StackOverflow)

Customising the Link plugin

I am currently building a multi-site Django website. I would like to be able to override the functionality of the base link plugin cms.plugins.link to be able to link to any other page within any of the other sites.

I'm using the default editor, WYMeditor.

I have already created a custom CMSPlugin abstract model which provides the functionality I need by using the cms.models.fields.PageField class and am using it within bespoke plugins.

What I'm unsure about is how (or if) I can either change the existing cms.plugins.link model or somehow extend this. I need to have this modified plugin available within the Available Plugins list in a simple cms.plugins.text instance.

For what it's worth, the code for my custom plugin follows:

class PluginWithLinks(models.Model):
    """
    There are a number of plugins which use links to other on-site or off-site
    pages or offsite. This information is abstracted out here. Simply extend
    this class if you need a class which has links as a core part of its
    functionality.
    """
    page_link = PageField(
        verbose_name="page",
        help_text="Select an existing page to link to.",
        blank=True,
        null=True
    )
    url = models.CharField(
        "link", max_length=255, blank=True, null=True,
        help_text="Destination URL. If chosen, this will be used instead of \
the page link. Must include http://")
    link_text = models.CharField(
        blank=True, null=True, max_length=100, default='More', help_text='The \
link text to be displayed.')
    target = models.CharField(
        "target", blank=True, max_length=100,
        choices=((
            ("", "same window"),
            ("_blank", "new window"),
            ("_parent", "parent window"),
            ("_top", "topmost frame"),
        ))
    )

    class Meta:
        abstract = True

    @property
    def link(self):
        if self.url:
            return self.url
        elif self.page_link:
            full_url = "http://%s%s" % (
                self.page_link.site.domain,
                self.page_link.get_absolute_url()
            )
            return full_url
        else:
            return ''

Source: (StackOverflow)

WymEditor problem with IE 9

I added to my web WymEditor. Everything works fine on firefox and google chrome. The only problem is IE9, where when I opening page with wymeditor, the new empty tab opens also. This is some kind of problem with iframe, I was searching for it in wymeditor code and found this : " //This function is executed twice, though it is called once! //But MSIE needs that, otherwise designMode won't work. //Weird."

Does anyone know how to fix it?


Source: (StackOverflow)

getting value of several textarea from WYMeditor

I would like getting the value of two textarea from WYMeditor:

The first one:

<script type="text/javascript">
 jQuery(function() {
    $(" .wymeditor").wymeditor({
     logoHtml: '',
     lang: 'fr',
     skin: 'default',
    });
 });
</script>

And the second one:

<script type="text/javascript">
 jQuery(function() {
  $(" .wymeditor_ref").wymeditor({
     logoHtml: '',
     lang: 'fr',
     skin: 'silver',
  });
 });
</script>

HTML:

<textarea id="definition" class="wymeditor" name="definition"/></textarea>
<textarea id="references_definitions" class="wymeditor_ref" name="definition"/></textarea>

I'm using this: WYMeditor.INSTANCES[0].html();

But, the problem is I don't know how to do if there are two textarea. How getting the second value?

Thanks a lot!!


Source: (StackOverflow)

Using the Django-CMS Wymeditor for ZInnia Entries

Is there a way to use the Django-cms WYMeditor (and all of it's plugin capabilities) as the editor for Zinnia?

The goal is to be able to upload photos/videos as content within the entries.


Source: (StackOverflow)

RefineryCMS / Wymeditor whitelisting fails

I am trying to use RefineryCMS + refinerycms-videojs and the WYMeditor keeps stripping of f wrong tags..

So when I insert the video for example and press "Save", I get this:

<video id="video_1" class="video-js vjs-default-skin" width="400" height="300" data-setup=" {&quot;autoplay&quot;: false,&quot;controls&quot;: true,&quot;preload&quot;: true,&quot;loop&quot;: true}"><source src="/system/videos/W1siZiIsIjIwMTMvMDUvMjkvMTJfMTlfMTRfNjMyX0JlYXN0aWUubXA0Il1d/Beastie.mp4" type="video/mp4"></source>

Here the closing /video tag is stripped.

The whitelists that refinerycms-videojs adds are these:

config.wymeditor_whitelist_tags = {'video' => {'attributes' => {'1' => 'poster', '2' => 'width', '3' => 'height', '4' => 'source', '5' => 'controls'} },
                                 'source' => {'attributes' => {'1' => 'src', '2' => 'type'}}}

Here is the example of what javascript generated by this code looks like, surprisingly the .js file that I get in my browser is not really different (in that part)..

I guess something is missing, but what..?


Source: (StackOverflow)