Reputation: 1481
I'm using CKEDITOR in inline mode with multiple editors per page. To create them, I use <textarea>
tags in the HTML and then run a script that executes CKEDITOR.inline()
against each of them as soon as the webpage is loaded.
That works fine as long as I define my final configuration in "config.js", but I need to update one of the configuration options dynamically.
Here's my script, using JQuery to loop thru the <textarea>
elements after the page is loaded. As a diagnostic, I have the CKEDITOR.replace()
sandwiched between alert
statements. This code replaces the first <textarea>
with an editor and displays the first alert
statement. However, it quits during the CKEDITOR.replace()
statement and never displays the second alert
.
$(function () {
$("textarea").each(function () {
editor = CKEDITOR.inline($(this)[0]);
alert("Before replace, editor=" + editor);
CKEDITOR.replace(editor, {
filebrowserImageUploadUrl: "/new/url/to/be/executed"
});
alert("After replace");
})
});
Not only does the second alert
not execute, but the configuration option I'm trying to update remains as it appears in "config.js".
I think I need to specify something other than "editor" as the first parameter for the CKEDITOR.replace()
statement, but I don't know what.
Upvotes: 2
Views: 1968
Reputation: 1481
After more research, I discovered that I can set configuration options within the CKEDITOR.inline
method call. Here's a working version of the script:
$(function () {
$("textarea").each(function () {
CKEDITOR.inline($(this)[0], {
filebrowserImageUploadUrl: "/new/url/to/be/executed"
});
});
});
Upvotes: 5