You are not logged in.
#1 2007-01-04 10:21:37
- happy_noodle_boy
- TWG Member
- Registered: 2005-02-24
- Posts: 171
Correct use of mceReplaceContent?
Hi,
Having a little trouble using the mceReplaceContent command through this insert function:
function insertCode() {
var f = document.forms[0];
var type = getSelectValue(f, 'type');
var html = '{' + type + '}{$selection}{/' + type + '}';
tinyMCEPopup.execCommand("mceBeginUndoLevel");
tinyMCEPopup.execCommand("mceReplaceContent", false, html);
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
}
This almost works as it should, except the {$selection} variable is stripped of any elements it may have in it.
The purpose of this function is part of a plugin to insert 'Joomla code' around a selection, such as {rokguest}some text or html{/rokguest}.
If the text inbetween the {rokguest} 'tags' contains any html formatting, eg: bold, underline etc. (or any html at all), this is removed/replaced with just the plain text.
Any ideas of how to get this to work properly?
ryan.
just because you're not paranoid, doesn't mean everybody isn't out to get you.
Offline
#2 2007-01-04 11:45:30
- happy_noodle_boy
- TWG Member
- Registered: 2005-02-24
- Posts: 171
Re: Correct use of mceReplaceContent?
This works in IE, but in Firefox, the code and selected html is inserted before the origianl html (the original remains).
function insertCode() {
var f = document.forms[0];
var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
var type = getSelectValue(f, 'type');
var html = '{' + type + '}' + inst.selection.getSelectedHTML() + '{/' + type + '}';
tinyMCE.execCommand('mceInsertContent', false, html);
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
}
just because you're not paranoid, doesn't mean everybody isn't out to get you.
Offline
#3 2008-07-24 04:07:25
- becklede
- Member
- Registered: 2008-07-24
- Posts: 4
Re: Correct use of mceReplaceContent?
Did you ever find a fix for this?
Offline
#4 2008-07-24 07:28:13
- happy_noodle_boy
- TWG Member
- Registered: 2005-02-24
- Posts: 171
Re: Correct use of mceReplaceContent?
I think this stpped being an issue in TinyMCE 3
just because you're not paranoid, doesn't mean everybody isn't out to get you.
Offline
#5 2008-12-08 20:40:11
- sheryl
- Member
- Registered: 2007-06-20
- Posts: 34
Re: Correct use of mceReplaceContent?
Upgrading to TinyMCE 3 requires rewriting plugins. Is there another fix to this? Thanks.
Offline
© 2003-2010