Jump to content

Extension:VEForAll

From mediawiki.org
This page is a translated version of the page Extension:VEForAll and the translation is 16% complete.
Manual pengaya MediaWiki
VEForAll
Status keluaran: stabil
Penerapan Pengait , Kulit
Deskripsi Menetapkan fungsionalitas JavaScript untuk membolehkan ekstensi lain memasukkan VisualEditor ke dalam area teks mereka
Perancang Pierre Boutet, Clément Flipo, Ike Hecht, Yaron Koren and Cindy Cicalese
Versi terbaru 0.7 (Mei 2026)
Kebijakan kompatibilitas Induk mempertahankan kompatibilitas mundur.
MediaWiki >= 1.40.0
Perubahan pangkalan data Tidak
Licence Lisensi Publik Umum GNU 2.0 atau lebih baru
Unduh
Terjemahkan pengaya VEForAll jika tersedia di translatewiki.net
Masalah Tugas terbuka · Laporkan kekutu

The VEForAll ("VisualEditor For All") extension allows other extensions to incorporate the VisualEditor interface into textareas for user editing.

This extension does not directly impact the user interface. Rather, it defines a JavaScript function (called "applyVisualEditor()") that can be called by other extensions on their textareas. At the moment, the following extensions can make use of VEForAll:

As might be expected, the VisualEditor extension must be installed for this extension to work.

Pemasangan

  • Unduh dan pindahkan folder VEForAll yang diekstrak ke direktori extensions/ Anda.
    Pengembang dan penyumbangsih kode sebaiknya memasang pengaya dari Git sebagai gantinya, menggunakan:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VEForAll
    
  • Tambahkan kode berikut di bawah berkas LocalSettings.php Anda:
    wfLoadExtension( 'VEForAll' );
    
  • Yes Selesai – Telusuri ke Special:Version di wiki Anda untuk memastikan pengayanya berhasil dipasang.

Menggunakan VEForAll dengan ekstensi lain

VEForAll can currently be used with the following extensions: CommentStreams , Page Forms , FlexForm , VisualData

  • For CommentStreams, you simply need to have VEForAll (and VisualEditor) installed, and then textareas for entering comments will automatically get the VisualEditor interface.
  • For Page Forms, in the form definition, add |editor=visualeditor to the tag for any textarea input (including the "free text" input), and the VisualEditor interface should show up when viewing that form.
  • For FlexForm, use editor="ve" when defining a textarea, e.g. <textarea name="whatever" editor="ve"></textarea>. You can have as many VE editors on a page as needed and you can even add a menu/button to the VE Editor that will open another VE Editor.
  • For VisualData, VEForAll is enabled by default in the form for creating a new article, and can be enabled through the Schema Builder in any input with type string and format textarea.

Konfigurasi

By default, the toolbar is displayed at the bottom of the textarea. In Page Forms, you can instead display it at the top by adding |class=toolbarOnTop to the textarea's tag in the form definition.

You can use the "VEForAllToolbarConfigNormal" and "VEForAllToolbarConfigWide" hooks to customize the display of the VisualEditor toolbar. One or the other hook is called, depending on whether "toolbarOnTop" is set: "Normal" is called if it is not set, and "Wide" if it is.

For example, to add buttons for "Insert > Math formula", "Insert > Images and media", and "Cite" in the normal (toolbar on the bottom) case, add the following to LocalSettings.php, below the inclusion of VEForAll:

$wgHooks['VEForAllToolbarConfigNormal'][] = function( &$defaultConfig ) {
        $defaultConfig[4]['include'][] = 'math';
        $defaultConfig[4]['include'][] = 'media';
        $defaultConfig[4]['include'][] = 'transclusion';
        $defaultConfig[] = [ 'include' => [ 'reference' ] ];
};
$wgHooks['VEForAllToolbarConfigWide'][] = function( &$defaultConfig ) {
        $defaultConfig[4]['include'][] = 'math';
        $defaultConfig[4]['include'][] = 'media';
        $defaultConfig[4]['include'][] = 'transclusion';
        $defaultConfig[] = [ 'include' => [ 'reference' ] ];
};

(the same for toolbar on top)

For the first and last lines to have an effect, the Math and Cite extensions must be installed, respectively.

List of potential button names

This list of potential button names was derived from the VisualEditor source code:

  • alienExtension
  • big
  • blockquote
  • bold
  • bullet
  • cancel
  • changeDirectionality
  • checkList
  • clear
  • code
  • comment
  • commentAnnotation
  • commandHelp
  • editCheckDialog
  • findAndReplace
  • gallery
  • heading1
  • heading2
  • heading3
  • heading4
  • heading5
  • heading6
  • indent
  • insertTable
  • italic
  • language
  • link
  • media
  • mergeCells
  • meta
  • meta/advanced
  • meta/categories
  • meta/languages
  • meta/settings
  • meta/templatesUsed
  • mwExportWikitext
  • mwLanguageVariant
  • mwPre
  • mwSignature
  • number
  • openHelpCompletionsTrigger
  • outdent
  • paragraph
  • preformatted
  • redo
  • showSave
  • small
  • specialCharacter
  • strikethrough
  • subscript
  • superscript
  • table
  • tableCellData
  • tableCellHeader
  • transclusion
  • underline
  • undo

Known issues

In some skins, the dropdowns may look rather compressed. You can apply a small CSS tweak to fix this:

table.formtable,
table.multipleTemplateInstanceTable {
  border-collapse: inherit;
}

Penulis dan kredit

VEForAll is heavily based on the (now-obsolete) VEForPageForm extension by Pierre Boutet and Clément Flipo. Some work to make the code more generic was done by Ike Hecht, Yaron Koren and Cindy Cicalese. Others who contributed to the code include Anysite and Mark Hershberger. VEForAll also includes code from the StructuredDiscussions extension.

Riwayat versi

  • 0.1 - - Initial version
  • 0.2 - - Made toolbar configurable; removed dependency on the Math extension; fixed submitting values for "focused" textareas; set VE direction (RTL/LTR) correctly; added "veForAll.targetCreated" hook; many other fixes
  • 0.3 - - Improved support for MW 1.35+; removed support for MW < 1.29; added handling for Page Forms "max height" parameter; added escaping of pipes in table wikitext within Page Forms template fields; bug fixes
  • 0.4 - - Improved support for MW 1.34+; removed support for MW < 1.32; fixes for pipe escaping
  • 0.4.1 - - Fixed support for MW 1.39+; other fixes
  • 0.5 - - Further fix for support for MW 1.39+; removed support for MW < 1.35
  • 0.5.1 - - Fixed Parsoid handling for MW 1.40+; fixed handling of "rowspan" and "colspan" attributes; updated hook handling
  • 0.5.2 - - Improved support for MW 1.41+; fix for rapid conversion between wikitext and HTML
  • 0.6 - - Removed support for MW < 1.39; removed requirement for "visualeditor-enable" preference; fix for "toolbar on top" positioning
  • 0.7 - - Removed support for MW 1.39; improved support for MW 1.44+; code improvements
  • 0.8 - - Removed support for MW 1.40; added hiding of unnecessary "uneditable element" warnings from VE