Open main menu
This page is a translated version of the page Manual:Live preview and the translation is 65% complete.

Other languages:
English • ‎español • ‎français • ‎magyar • ‎српски / srpski • ‎中文 • ‎日本語

实时预览是MediaWiki的一项用以预览的功能,它可以在不重新加载原有HTML代码的情况下显示条目或章节的预览。

It has some bugs, see live preview tracking bug for an up to date list.

启用实时预览

实时预览的启用与否取决于LocalSettings.php中的$wgLivePreview变量。要激活该功能,你还需要在“我的参数设置”的“编辑”中予以开启。

优点

  • 传入流量更少:不会再次从服务器获取wiki代码和所有菜单,
  • 响应时间更短,
  • 编辑窗体中的光标位置不变。

缺点:

只更新预览区域,这意味着:

  • scripts are not executed if they do not use the wikipage.content hook.
  • some parts of the interface like interlanguage links, transclusion list etc might not be updated correctly.
  • navigating in the browser history – with the preview – no longer works

技术细节

A live preview makes use of the Parse API and the difftotext-option of the Revisions API, to submit the new version of the text in order to receive parsed preview or diff changeset in the Edit page.

See also