To Yii Team: pinning this or similar topic is welcome. Most of Web 2.0 projects require a rich text editor. Yii is the best for Web 2.0 development (my yii experience proves me this).
We have worked with TinyMCE for long time, but now need to create forms on-the-fly in a popup. Popup is a jquery-ui dialog (works great), code for the form is a response to the ajax call (we insert response html in the div directly). At this moment tinymce is able to handle just 1 first popup (if you press cancel and open a 2nd dialog, then due to a javascript error you are loosing the current page and being redirected).
Then we tried CKEditor, it may handle N dialogs, but we have to destroy all instances of the editor in the dialog when user presses cancel button. And skins in the dialog are not working for IE (works great in Firefox, Chrome, and others).
For our current project we are going to try MarkItUp, and if time allow, next one will be Wymeditor.
I’d go for Wymeditor as I think what you read on its home page is so true:
Problem with full-featured WYSIWYG editor like CKEditor, TinyMCE etc. is that you can style content in a different way from the main site, so it could “degenerate visually”. MarkItUp with markdown is very good but it could be complex for newbie users. I think WYMeditor would be a good compromise as it’s more “visual” than MarkItUp, still you change the content structure without altering the main site styling.
actually u can load css of ur main site and content will looks same. the only thing u have to solve - css for <body>, coz <body> for iframe (ur WYSIWYG’s content) and <body> for main site - sometimes differ alot.
Yes, but the user could customize the content style (color ecc.) in ways that are not coherent with the main template, while Wymeditor is specifically designed to only customize the structure and not the style.
I found interesting editor nicedit, which transforms div into editable content by setting contenteditable="true" so content looks exacly like it will be presented on page. Simple and elegant solution.
However it does not work on IE 6 and im not sure if on IE 7 and further development seems to be inactive…
Since I store in DB some pieces of code too eval(), I use editArea which natively does PHP Syntax Highlighting (among css, html, xml, python, bf, etc…) and is extensible to others
(Argh, first post, not allowed to embed links: "www dot cdolivet dot com" then click on editArea in the sidebar )
I fixed that problem with TinyMCE. It is due that you haven’t remove previous references to the editor. I use extensively AJAX and that problem was just that. Here my useful functions:
var tinyEls = [];
// once ajax content has been loaded
// this function will recreate the editor
function addTiny(a) {
if (window.tinyMCE) {
if (tinyEls.length == 0) tinyMCE.idCounter = 0;
tinyMCE.execCommand("mceAddControl", false, a);
tinyEls.push(a)
}
}
// add content to tiny (not really needed)
function addText2Tiny(a, <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' /> {
tinyMCE.execInstanceCommand(a, "mceSetContent", false, <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />
}
// remove all created
function removeTiny() {
$.each(tinyEls, function () {
tinyMCE.execCommand("mceRemoveControl", false, this)
});
tinyEls = []
}
// remove a specific one
function extractTiny(a) {
var b = $.inArray(a, tinyEls);
if (<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' /> {
tinyMCE.execCommand("mceRemoveControl", false, a);
tinyEls.splice(b, 1)
}
}
I remove it from the document (using extractTiny or removeTiny) before erasing the HTML tags holding the editor (getting its contents of course and set them to their appropriate TEXTAREA tags) and when I load a new one, I just call the addTiny method passing the ID of the newly added TEXTAREA tag.