FCKeditor integration guide

From MediaWiki+FCKeditor

Jump to: navigation, search
  1. Download the nightly build of the FCKeditor for MediaWiki extension.
  1. Extract the archive to your MediaWiki root directory. You should be able to access the directory extensions/FCKeditor/fckeditor from your MediaWiki root


Modify configuration file

After you've downloaded the extension and actual editor, add this line at the end of LocalSettings.php:
require_once("$IP/extensions/FCKeditor/FCKeditor.php");

Also make sure $wgUseAjax is turned on (it is by default on newer MediaWikis), eg in LocalSettings.php, add the line

$wgUseAjax = 'true'; //after the previous line

Tips & Tricks

Question: I get this error on installation of nightly build (linked from this page) Detected bug in an extension! Hook FCKeditor_MediaWiki::onCustomEditor failed to return a value; should return true to continue hook processing or false to abort.


Question: Please explain how to set up the Rich Editor and Open Rich editor in new window button on the Edit Page. I have downloaded the package and placed it in the directory as stated above but those two links on the edit page is missing. I would like the editor to operate as in the [Sandbox]. I would apreciate your help in integrating this useful tool to a mediawiki.

  • Answer: ????

The bundled FCKEditor (2.6.4) has a bug in WebKit browsers (Safari/Chrome) where the editor does not occupy the full vertical space of the textarea until you click a button in the FCKEditor toolbar. This can be fixed by replacing the ./extensions/FCKEditor/fckeditor directory with version 2.6.6 of FCKEditor. Download here: http://ckeditor.com/download -CVN I've had the same problem you have to be sure it is the Fckeditor

Q: Is it possible to disable FCKEditor on a per user basis? Some of our editors prefer to use the standard editor, and others prefer the FCKEditor. There doesn't seem to be an option in the User Preferences of the Wiki.

A: Yes;  In the "my preferences" section on the "misc" tab you can apply many options to contol the "Rich Text Editor"


Q: It does not work for french (ça ne fonctionne pas en français)..

A: There are mistakes in the file FCKeditor.i18n.php, the quotes are not well set. Replace the french section by (remplacez le paragraphe de français par) :

/** French (Français) 
 
 * @author Crochet.david
 * @author IAlex
 * @author Verdy p
 */
 
$messages['fr'] = array( 'fckeditor-desc' => 'Permet la modification en utilisant l’éditeur WYSIWYG FCKeditor',
                         'textrichditor' => 'Éditeur de texte enrichi',
                         'prefs-fckeditor' => 'Éditeur enrichi',
                         'tog-riched_disable' => "Désactiver l’éditeur enrichi",
                         'tog-riched_disable_ns_main' => "Désactiver l’éditeur enrichi dans l’espace de noms principal.",
                         'tog-riched_disable_ns_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:talk}} ».",
                         'tog-riched_disable_ns_user' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:user}} ».",
                         'tog-riched_disable_ns_user_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:user_talk}} ».",
                         'tog-riched_disable_ns_project' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:project}} ».",
                         'tog-riched_disable_ns_project_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:project_talk}} ».",
                         'tog-riched_disable_ns_image' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:file}} ».",
                         'tog-riched_disable_ns_image_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:file_talk}} ».",
                         'tog-riched_disable_ns_mediawiki' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:mediawiki}} ».",
                         'tog-riched_disable_ns_mediawiki_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:mediawiki_talk}} ».",
                         'tog-riched_disable_ns_template' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:template}} ».",
                         'tog-riched_disable_ns_template_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:template_talk}} ».",
                         'tog-riched_disable_ns_help' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:help}} ».",
                         'tog-riched_disable_ns_help_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:help_talk}} ».",
                         'tog-riched_disable_ns_category' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:category}} ».",
                         'tog-riched_disable_ns_category_talk' => "Désactiver l’éditeur enrichi dans l’espace de noms « {{ns:category_talk}} ».",
                         'rich_editor_new_window' => "Ouvrir l’éditeur enrichi dans une nouvelle fenêtre",
                         'tog-riched_start_disabled' => "Démarrer avec l’éditeur enrichi désactivé",
                         'tog-riched_use_popup' => "Ouvrir l’éditeur enrichi dans une popup",
                         'tog-riched_use_toggle' => "Donner la possibilité de changer entre l’éditeur original WikiText et l’éditeur enrichi",
                         'tog-riched_toggle_remember_state' => "Se souvenir de la dernière selection de l’éditeur", );



Q: FCKEditor seemed to install fine, but when I click the "Use Rich Editor" link, I get the following Javascript error: Line 108, Char 3, Error: Access is denied, Code: 0, URL: http://www.unisigep.com/ltf/index.php?title=Issues/opportunities&action=edit.  Is this a file permissions issue? Any ideas?

  • A1: $wgServer is being set incorrectly based on the default logic. Force $wgServer to the correct base URL (e.g., http://example.com) in LocalSettings.php. Make sure that $wgServer . $wgScriptPath . '/index.php' evaluates to the correct URL to land you on the main page of your wiki.
  • A2: wgServer is not defined in ajax.js (maybe because a https)

To fix this, I added this code to the skin template straight below <head> tag:

 <script type="text/javascript"> 
var wgServer = "http://example.com/wiki";
var wgScriptPath = "/wiki";
var wgScript = wgScriptPath + "/index.php";
</script>


Where example.com is the name of your domain and /wiki is the path to your wiki.

(Addendum: For Monobook, you change this in skins/MonoBook.php)


Q: How can I get the clipboard to work as I expect? In my installation, every time I paste, a javascript dialog box pops up prompting me to paste plain text. At the very least, I would like to be able to copy-paste text without this box appearing... and at best, I would like for the copy-paste functionality to also maintain formatting. Both of these requirements are satisfied and working well for me in the FCKeditor demo here: http://www.fckeditor.net/demo

  • A: add the following lines to extensions/FCKeditor/fckeditor_config.js
FCKConfig.AutoDetectPasteFromWord = true;
FCKConfig.CleanWordKeepsStructure = false;
FCKConfig.ForcePasteAsPlainText = false;

The above doesn't seem to actually work to solve this problem.

  • A2: You may also need to allow Javascript to control the context menus.  This is either or situation; changing this may be unacceptable because it affects the operation of the browser.
    • Firefox: in Menu item "Tools", "Options", "Content" Tab, Click on "Advanced" across from "Enable Javascript".  Change the setting of the checkmark box "Disable or Replce Context Menus".
    • Internet Explorer: Will prompt you to allow access to Javascript and Clipboard.  Allow both items.

It worked for me. Clear your cache. Also, make sure you delete the existing line that says "FCKConfig.ForcePasteAsPlainText = true ;" -CVN

Q: Is it possible to indent bullet list. In the wiki system you can use ** to indent the bullet list. Is it possible to build this in the rich editor ?

  • A: In fckeditor_config.js add the following to the button configuration: 'Outdent','Indent' - use these to change the indentation of the bullet points.

Q: Is it possible to add a button to change text color?

  • A1: To enable buttons to change font color in the toolbar, do the following:
    • open fckeditor_config.js file (located inside of extensions/fckeditor directory)
    • uncomment two buttons:
      ['TextColor','BGColor'],
    • save the file, clear your browsers cache
    • done!
  • A2: If you can't see the third toolbar (for example with the text color buttons) you have to add this line below of the require_once command in the LocalSettings.php:
     $wgFCKEditorToolbarSet   = "Wiki";
    You'll notice that 'Wiki' is the name of the variable used when setting what buttons to show in the fckeditor_config.js file.
    Adding 'Default' will ignore settings made there and use the default layout instead.
    I imagine you could setup multiple layouts ('AdvancedWiki' and 'SimpleWiki') in fckeditor_config.js, and quickly change back and forth by making this change in the LocalSettings.php file.

Q: Getting this error after making the changes

Warning: require_once(/www/htdocs/w009ee69/includes/ParserOptions.php) [function.require-once]: failed to open stream: No such file or directory in /www/htdocs/w009ee69/extensions/FCKeditor/FCKeditor.php on line 29
Fatal error: require_once() [function.require]: Failed opening required '/www/htdocs/w009ee69/includes/ParserOptions.php' (include_path='/www/htdocs/w009ee69:/www/htdocs/w009ee69/includes:/www/htdocs/w009ee69/languages:.:/usr/share/php:..')
in /www/htdocs/w009ee69/extensions/FCKeditor/FCKeditor.php on line 29
  • A: You need to use MediaWiki 1.10.x or higher!
  • OR...your extension installed into the wrong folder.
  • A similar error may be the result of invalid permissions on the FCKEditor directory. For IIS servers on Windows: ensure that all permissions (ACLs) on the files are inherited from the parent.

Q: Is there a possibility to add Links to Categories and give the Link another names, like the command: [[:Category:Editors|Editors]] directly without changing into the Wikitext-mode?

  • A:
    • Simply type out the name you want your link to show up as, highlight it, then apply the link by clicking on the link toolbar button.
    • In the prompt, type in ":Category:Editors" (without quotes).
    • Click "OK".
    • Link is now applied.

Q: Is there a way to actually add documents with this tool?
For example, if you insert an image, it is [[Image:Xyz.jpg]] and you can do that from the image button. I have documents that are uploaded into my wiki that I can include in wiki text via [[media:xyz.doc]] - my end users want a button for this.  it that possible and I just can't figure it out?

  • A:
    --This is an image i searched for using Rich Editor interface
    --This is an image i searched for using Rich Editor interface
    The Rich Editor includes an image button. Click the button and type part of the file name in the search box. Finally choose the layout for the image and click ok.
  • Comment: this doesn't answer the question. Though the editor can really insert images, files and external links in HTML, these features are disabled in connection with Mediawiki. Would need a patch here!
  • A: I have a different solution to insert "Media:" links. See http://www.rakekniven.de/content/insert-media-links-using-insert-image-button-wiki

Q: I have exactly the same requirement: I need to insert documents in-line, not images.

  • Comment: Nor does the insert image option on the toolbar have the option to upload or anything but the basic tab...

Q: How can I link to an outside website without changing to wikitext mode as in:
[www.google.com Google]?

  • A: The Rich Editor includes a Link button. You can use that to create external links.

Q: How do you make the rich editor the default for all users?

  • A: You need to edit ./extensions/FCKeditor/FCKeditor.php and change the boolean field for Disabled Start.
    Find
    $wgDefaultUserOptions['riched_start_disabled'] = 1; 
    and change to this
    $wgDefaultUserOptions['riched_start_disabled'] = 0; 

Q: How can I dissable rich text editing on a per-page basis? I'd like to be able to put something in the page like __NORICHTEXT__ to make it impossible to edit just that page with the rich text editor.

Q: How can you display the same toggle links that visitors see to logged in users.
(Allowing the switch between FCK and Wiki editor. My logged in users are unable to access the Wiki's default editor.

  • A1: If you go to "My Preferences", "Misc" tab and enable "Use toggle to select between wikitext and rich editor" a toggle link will appear when logged in. This works in FCKeditor version 2.6.3 in IE and Firefox.
  • A2: To do this automaticly go in $MEDIA_WIKI_ROOT/maintenance/ and do this:
    php userOptions.php riched_use_toggle --old '' --new 1 

Q: I've just installed FileLink which adds a button to the normal editor, however I'd like to have this same button in FCKeditor. Is this possible to add?

Q: I have the FileLink Extension installed too, and when I disable the Rich Editor, I do not have the FileLink button, but the script wich is executed when I desactivate the FCK Editor?

Q: Hi! I would like to know how to:

  1. deactivate FCK editor in template namespace for all users,
  2. get the same blue link as in this site in order to get back the standard windows,
  3. avoid that FCK change <includeonly> to <includeonly&gt (and others) in previously made pages.
  • A: 2 things required:
  1. Edit fckconfig.js , ProcessHTMLEntities (+Latin+Greek) set to FALSE
  2. Edit fckeditorcode_ie.js,fckeditorcode_gecko.js , disable encode functions (comment where it is neccessary). Check the whole files for "lt;" and check it out.
  3. do not forget delete all browser cache and history...important also.
  • A: for deactivating fck editor in some namespaces (usefull in templates namespaces) use :

$wgFCKexcludedNamespaces = array();


Q: FCK Editor destroys the style of my tables. Is it possible to use "normal" Wiki tables instead of that ugly FCK-Tables ?

  • Q: FCK Editor loose captions when style with frame or thumb
  • A: MediaWiki tries to be smart regarding alt-text of images, as they don´t want to double it within title and alt-text...

edit includes/parser/Parser.php (line 4394) to put in alt-text everytime

      # In the old days, [[Image:Foo|text...]] would set alt text.  Later it
      # came to also set the caption, ordinary text after the image -- which
      # makes no sense, because that just repeats the text multiple times in
      # screen readers.  It *also* came to set the title attribute.
      #
      # Now that we have an alt attribute, we should not set the alt text to
      # equal the caption: that's worse than useless, it just repeats the
      # text.  This is the framed/thumbnail case.  If there's no caption, we
      # use the unnamed parameter for alt text as well, just for the time be-
      # ing, if the unnamed param is set and the alt param is not.
      #
      # For the future, we need to figure out if we want to tweak this more,
      # e.g., introducing a title= parameter for the title; ignoring the un-
      # named parameter entirely for images without a caption; adding an ex-
      # plicit caption= parameter and preserving the old magic unnamed para-
      # meter for BC; ...
      if( $caption !== '' && !isset( $params['frame']['alt'] )
      && !isset( $params['frame']['framed'] )
      && !isset( $params['frame']['thumbnail'] )
      && !isset( $params['frame']['manualthumb'] ) ) {
         $params['frame']['alt'] = $params['frame']['title'];
      }
### ALT-TEXT NEEDED FOR FCKEDITOR!!! ####
$params['frame']['alt'] = $params['frame']['title'];

In Mediawiki 1.16 this works better:

Just paste this after the big comment #In old times blah blah blah yadda yadda

$params['frame']['alt'] = $params['frame']['caption'];


Q: He instalado el FCKeditor sobre MediaWiki 1.13 todo desde cero, solo con esa extensión, no me tira ningun tipo de error, el la pagina escial:version se ve que esta instalado el editor, pero a la hora de editar una apgina el editor no aparece, eleimina la barra de edisión standar de MediaWiki y nada mas. alguien le ha pasado?? podrian ayudarme??

Q: ¿Es posible añadir un botón para cambiar el color del texto?

  • A1: Para activar los botones para cambiar el color de la fuente en la barra de herramientas, haga lo siguiente:
    • fckeditor_config.js abrir el archivo (que se encuentra dentro de las extensiones / fckeditor directorio)
    • descomentar dos botones:
       [ 'TextColor', 'bgcolor'],</ pre>
      
 
    • guardar el archivo, borrar su caché de los navegadores ** hecho! *A2: Si usted no puede ver la tercera barra de herramientas (por ejemplo el color del texto con los botones) tiene que agregar esta línea por debajo de la require_once comando en el LocalSettings.php: <pre>$ wgFCKEditorToolbarSet = "Wiki", que te aviso 'Wiki' es el nombre de la variable de ajuste cuando se utilizan los botones para mostrar lo que en el fckeditor_config.js archivo.
      añadir 'por defecto' ignorará ajustes realizados allí y utilizar la configuración predeterminada en lugar.
      me imagino que usted puede configurar múltiples diseños ( 'AdvancedWiki' y 'SimpleWiki') en fckeditor_config.js, y rápidamente chnage hacia adelante y hacia atrás, haciendo este cambio en el archivo LocalSettings.php .

Q: Obtener este error después de hacer los cambios

Advertencia: require_once (/ www/htdocs/w009ee69/includes/ParserOptions.php) [function.require-una vez]: no abrir corriente: No existe el fichero o directorio en / www/htdocs/w009ee69/extensions/FCKeditor/FCKeditor.php en la línea 29
Fatal error: require_once () [function.require]: Failed opening necesario '/ www/htdocs/w009ee69 / includes / ParserOptions.php '(include_path =' / www/htdocs/w009ee69: / www/htdocs/w009ee69/includes: / www/htdocs/w009ee69/languages:. / usr / share / php :..')
en / www/htdocs/w009ee69/extensions/FCKeditor/FCKeditor.php en la línea 29 
  • A: Necesita usar MediaWiki 1.10.x o superior!
  • O ... su extensión instala en la carpeta equivocada.

Q: ¿Existe una posibilidad de añadir enlaces a las categorías y la otra los nombres de Enlace, al igual que el comando: [[: Categoría: Editores | Editores]]
</ span> directamente sin modificar en la Wikitext modo?

  • A:
    • Simplemente escriba el nombre que usted quiere que su enlace aparezca como, resáltela y, a continuación, aplicar el vínculo haciendo clic en el botón de barra de herramientas de enlace.
    • En el símbolo del sistema, escriba ": Categoría: Editores" (sin comillas).
    • Haz clic en "Aceptar".
    • Enlace se aplica actualmente.

Q: ¿Existe realmente una manera de añadir documentos con esta herramienta? Por ejemplo, si inserta una imagen, es [[Imagen: Xyz.jpg]] </ nowiki> y que puede hacer que la imagen de botón. tengo los documentos que se suben a mi wiki que puedo incluir en el wiki de texto a través de <nowiki> [ [medios de comunicación: xyz.doc]] - mi los usuarios finales desean un botón para ello. lo que sea posible y yo simplemente no puede con ello?

  • A:
    Esta es una imagen i buscado enriquecido para el uso de la interfaz del Editor
    Esta es una imagen i buscado enriquecido para el uso de la interfaz del Editor
    El Rico editor de imagen incluye un botón. Haga clic en el botón y escriba parte del nombre de archivo en el cuadro de búsqueda. Por último elija el diseño de la imagen y haga clic en Aceptar.
  • Comentario: esto no responde a la pregunta.

Q: Tengo exactamente la misma obligación: tengo que insertar los documentos en línea, no imágenes. ¡Gracias!

  • Comentario: Tampoco la opción de insertar la imagen en la barra de herramientas tienen la opción de subir o algo, pero la ficha de base ...

Q: ¿Cómo puedo enlazar a una página web fuera sin cambiar a modo wikitext como en: [Google www.google.com]

  • A: La enriquecido Editor incluye un botón de enlace.

Usted puede usarlo para crear los enlaces externos. [Http://google.com google.com]

Q: ¿Cómo se hace el rico editor por defecto para todos los usuarios?

  • A: Es necesario editar. / extensions / FCKeditor / FCKeditor.php y cambiar el campo booleano de inicio para personas de movilidad reducida.
    Encuentra;
     $ wgDefaultUserOptions [ 'riched_start_disabled'] = 1; </ pre> para este <pre> $ wgDefaultUserOptions [ 'riched_start_disabled'] = 0; </ pre>
    

Image:Learn FCK editor Sandbox test 01 01.jpg

 

Q: ¿Cómo se puede mostrar la misma alternar los vínculos que los visitantes ver a usuarios registrados. (Permitir que el cambio entre FCK Wiki y editor. Mis usuarios registrados no pueden acceder a la Wiki del editor por defecto.

  • 'A1: "Si usted ve a" Mis Preferencias "," Varios "y permitir" Utilizar para seleccionar alternar entre ricos wikitext y editor de "cambiar un vínculo aparecerá cuando conectado FCKeditor Esto funciona en la versión 2.6.3 en IE y Firefox.
  • A2: Para hacer esto automáticamente va en $ MEDIA_WIKI_ROOT / mantenimiento / y hacer esto: <pre> php userOptions.php riched_use_toggle - antiguo- nuevo 1

Q: Acabo de instalar FileLink, que añade un botón para el editor normal, sin embargo me gustaría que este mismo botón en FCKeditor. ¿Es posible añadir?

Q: He instalado la extensión FileLink demasiado, y cuando los ricos deshabilitar el Editor, no tengo la FileLink botón, pero el script que se ejecuta cuando desactivar la FCK Editor?

Q: ¡Hola! Me gustaría saber cómo:

  1. desactivar FCK editor en plantilla nombres para todos los usuarios,
  2. obtener el mismo color azul como enlace en este sitio con el fin de recuperar el estándar de Windows,
  3. FCK evitar que el cambio <includeonly> para <includeonly> ( y otros) en las páginas anteriores.
  • A: 2 cosas necesarias:
  1. Modificar fckconfig.js, ProcessHTMLEntities (+ latín + griego) establece en FALSE
  2. Modificar fckeditorcode_ie.js , fckeditorcode_gecko.js, deshabilitar funciones codificar (comentario cuando sea necesario). Compruebe la totalidad de los archivos "lt;" y comprobar que funciona.
  3. no olvide eliminar todos los caché del navegador y de la historia. importante también .. ¡Gracias!

Q: Hi! this editor work only on textarea named wpTextbox1?if i create my own textarea how i can activate on it FCKeditor?it is possibile?

Q: I have installed Extension Drafts into Mediawiki which has been customised to use FCKeditor. The problem is that the extension is not able to detect changes in the text area when a user edits the page and also the draft stored does not include the changes made in the editing area. It is able to detect the changes made to the summary text field and the checkbox which says "This is minor edit", and it autosaves the changes after a certain timeout. However if we click on Show preview, then the extension saves the changes in the editing text area (which gets displayed). The extensions is designed to detect keypress, cut, paste etc changes to wpTextbox1. What i am guessing is that the editing text area does not refer to wpTextbox1. So can anyone please tell me what is the variable that refers to the editing text area so that I can use it?? 

A: go to <<your-Mediawiki-folder>>/extensions/Drafts/. Edit file Drafts.js, line 28-29:

			case 'unchanged':
				form.wpDraftSave.disabled = false;

then add the following line at the end of this.initialise() function (line 145-146):

     self.change();

This way your 'Save draft' button will always be enabled. Cheers, Vladimir.

Q: Hi! I am using MediaWiki v1.15.1 and PHP v5.3.3. Today when i tried to edit a wiki page using FCKeditor, I received the following error:

Detected bug in an extension! Hook FCKeditor_MediaWiki::onCustomEditor failed to return a value; should return true to continue hook processing or false to abort.

Backtrace:

  1. 0 /home/ovacl/public_html/includes/Wiki.php(502): wfRunHooks('CustomEditor', Array)
  2. 1 /home/ovacl/public_html/includes/Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
  3. 2 /home/ovacl/public_html/index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
  4. 3 {main}

I updated to the latest version of FCKEditor, but get the same error. Any ideas???

  • A: The problem is the php version (>= 5.3.0), just modify in file : FCKeditor.body.php
   public function onCustomEditor(&$article, &$user) {
   global $wgRequest, $mediaWiki;

by

   public function onCustomEditor($article, $user) {
   global $wgRequest, $mediaWiki;

Q: Is there a way to insert a "wiki tab", corresponding to a colon in wikitext

A:

Q: Is there a way to insert the equivalente of a leading "**" or "#*" or anything similar?

A:

Views