I’m officially baffled (what else is new

).
I assume that the Rich Text input option lets you use an RTE to edit the TV content in the Manager (though I can’t get it to work in Revo) but don’t have any idea what output type(s) should be used with that option.
I can’t make any sense at all of the Rich Text output widget and I can’t find any documentation that tells me how to make it work. All I could get it to do was put a <richtextwidget> tag on the screen in 0.9.6. I can’t seem to get it to do anything in Revo. I also have no clue what Input Options are appropriate with it.
Someone take pity on me please.
-
☆ A M B ☆
- 24,524 Posts
An input type will determine what is displayed when editing a document. A Rich Text input type will provide a textarea with the default RTE your site is configured to use. Use whatever output widget you want to format the value of the textarea in the final page, just as if it were a plain textarea field.
Output widgets determine what is displayed on the final web page. A Rich Text output widget will give your visitor a textarea with the default RTE. When submitting the form, the content of the textarea will be in the POST as usual.
Don’t get overly excited about the "voodoo" of Rich Text. All it is is a javascript application that layers the RTE over a textarea in the user’s browser. A complex javascript application, true, but it’s still just a way of automatically putting HTML tags in the textarea on the client side, whether it’s a manager user or a web user.
Thanks. The first part I knew, the second I guessed, but why doesn’t it work for me?
Here’s the code I’m trying (after setting Output Type to Rich Text):
<form>
<textarea>
[*myTV*]
</textarea>
</form>
-
☆ A M B ☆
- 24,524 Posts
Taking a look at the code for a rich text widget might help:
case "richtext":
$value = parseInput($value);
$w = $params['w']? $params['w']:'100%';
$h = $params['h']? $params['h']:'400px';
$richtexteditor = $params['edt']? $params['edt']: "";
$o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
$o.= htmlspecialchars($value);
$o.= '</textarea></div>';
$replace_richtext = array($id);
// setup editors
if (!empty($replace_richtext) && !empty($richtexteditor)) {
// invoke OnRichTextEditorInit event
$evtOut = $modx->invokeEvent("OnRichTextEditorInit", array(
'editor' => $richtexteditor,
'elements' => $replace_richtext,
'forfrontend' => 1,
'width' => $w,
'height' => $h
));
if(is_array($evtOut)) $o.= implode("",$evtOut);
}
break;
As you can see, it provides a <div> container with a <textarea>, all with the required IDs and classes.
Quote from: sottwell at Jun 15, 2009, 11:36 PM
Taking a look at the code for a rich text widget might help:
$o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
$o.= '</textarea></div>';
As you can see, it provides a <div> container with a <textarea>, all with the required IDs and classes.
With every version I’ve tried in 0.9.6, I either get an empty input area with no RTE, or I get an input area that displays the raw HTML code above.
In Revo, I just get the empty input area but am reserving judgment until I get something working in Evo.
If anyone has a working example, I’d love to see it.
I wonder if it could be a conflict with QuickEdit (which persists in putting code on the page even though I have no # tags)?
-
☆ A M B ☆
- 24,524 Posts
Aye aye, Cap’n...
http://www.sottwell.com/RTE-TV.html
Although this is on the 1.0 from svn, but the code hasn’t changed any.
Aha. Your example works for me in FF3 and IE7 but my version of the same thing on localhost only works in FF (I had been testing it in IE7). Go figure. IE7 JS weirdness I guess.
It doesn’t work in Revo for me even in FF. The <richtext> tag is there but there’s no code initializing any RTE (no js code at all). I know Tiny is installed because it shows when I edit the doc.
Thanks!