Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -2338,7 +2338,37 @@ |
2339 | 2339 | return $buttons; |
2340 | 2340 | } |
2341 | 2341 | |
| 2342 | + /** |
| 2343 | + * Output preview text only. This can be sucked into the edit page |
| 2344 | + * via JavaScript, and saves the server time rendering the skin as |
| 2345 | + * well as theoretically being more robust on the client (doesn't |
| 2346 | + * disturb the edit box's undo history, won't eat your text on |
| 2347 | + * failure, etc). |
| 2348 | + * |
| 2349 | + * @todo This doesn't include category or interlanguage links. |
| 2350 | + * Would need to enhance it a bit, <s>maybe wrap them in XML |
| 2351 | + * or something...</s> that might also require more skin |
| 2352 | + * initialization, so check whether that's a problem. |
| 2353 | + */ |
| 2354 | + function livePreview() { |
| 2355 | + global $wgOut; |
| 2356 | + $wgOut->disable(); |
| 2357 | + header( 'Content-type: text/xml; charset=utf-8' ); |
| 2358 | + header( 'Cache-control: no-cache' ); |
2342 | 2359 | |
| 2360 | + $previewText = $this->getPreviewText(); |
| 2361 | + #$categories = $skin->getCategoryLinks(); |
| 2362 | + |
| 2363 | + $s = |
| 2364 | + '<?xml version="1.0" encoding="UTF-8" ?>' . "\n" . |
| 2365 | + Xml::tags( 'livepreview', null, |
| 2366 | + Xml::element( 'preview', null, $previewText ) |
| 2367 | + #. Xml::element( 'category', null, $categories ) |
| 2368 | + ); |
| 2369 | + echo $s; |
| 2370 | + } |
| 2371 | + |
| 2372 | + |
2343 | 2373 | /** |
2344 | 2374 | * Get a diff between the current contents of the edit box and the |
2345 | 2375 | * version of the page we're editing from. |