Talk:VisualEditor

About this board

Previous discussion was archived at Talk:VisualEditor/Archive 1 on 2015-09-01.

Wikia credits missing from history?

2
Zblace (talkcontribs)

According to the Verge article it seems that there was a partnership in development of VE that should be referenced no? Anyone informed on how it went and how exceptional this was or not from regular WMF practices?

Jdforrester (WMF) (talkcontribs)

The credits file for VisualEditor (as auto-published under Special:Version) lists the engineers from Wikia (Christian and Inez) alongside those from Wikimedia (and those from other organisations).

Reply to "Wikia credits missing from history?"

Migrating extension to new version

2
Ti infotrad (talkcontribs)

I presently have a couple of extensions which are integrated with VisualEditor in MW 1.35. I am trying to migrate them to the new version (MW 1.39 RC1, downloaded zip) but I am getting a number of errors: non existing functions (template spec extend, onRawFallbackButtonClick, getParameterNames..). I have not been able to find documentation explaining how to migrate. Is there any available? Any help you can provide? I also could not find a list of extensions integrated in VE, which I could use to perform code comparisons.

Ti infotrad (talkcontribs)

And to be ultra precise, here is the error I am getting. Note I have not changed the code and it was working fine in my previous version of MW.

In my extension module, I have implemented the function insertTransclusionNode. In it, when inserting a new node, once I have build my object (getPlainObject), I call the following function


surfaceFragment.insertContent( [{type: 'gacdmslinker',attributes: {mw: obj,calaction: 'insert'}},{ type: '/gacdmslinker' }] );


and this is when I get the following error:


VM522:28 Uncaught TypeError: Converting circular structure to JSON

    --> starting at object with constructor 'VeDmDocument'

    |     property 'bindings' -> object with constructor 'Object'

    |     property 'transact' -> object with constructor 'Array'

    |     ...

    |     property 'context' -> object with constructor 'VeDmInternalList'

    --- property 'document' closes the circle

    at JSON.stringify (<anonymous>)

    at ve.dm.Surface.storeChanges (load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=1lvvz:180:941)

    at OO.EventEmitter.emit (<anonymous>:28:656)

    at ve.dm.Surface.breakpoint (load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=1lvvz:175:902)


The weird thing is, my object (gacdmslinkernode) is still created in the sense that, if I save the document and re-edit it with VE, it shows up correcly. However, the error seems to be preventing the insertion of the title of the object (but not of the associated icon) and instead it uses the page title as the title. And also, when I update an existing node, I get no error and it works fine.

Reply to "Migrating extension to new version"

How to hook before "EDIT" in the visual editor?

1
75.9.133.35 (talkcontribs)

I'm studying to create my own extension with Visual Editor, and I'm struggling to figure out how I can make a hook in the dialog pop up for the contents.


For example, I'm making a traditional tag extension, like <ABC> MY TEXT </ABC>

And, When I enter the Visual Editor, the tag can be edit through the pop-up box, and the "Code" section shows "MY TEXT". This is good.


Now, before giving the text of "MY TEXT" to the "Code" section in the pop-up box, I want to manipulate the "MY TEXT" and give the manipulated string to the "Code" section.


For example, I want to give "_MANIPULATED_ MY TEXT _DONE_" to the "Code" section in the pop-up box in the Visual Editor instead of "MY TEXT" string.


Can someone help me how I can achieve the goal, please?

Reply to "How to hook before "EDIT" in the visual editor?"

Enable Automatic citation in Nepali Wikipedia.

2
Summary by Whatamidoing (WMF)
बडा काजी (talkcontribs)

Automatic citation is feature in most Wikis but not in Nepali Wiki. It would be a very handy new tool to have. Any ideas how you enable it?

Jdforrester (WMF) (talkcontribs)

You need to configure your wiki to handle it: Citoid/Enabling Citoid on your wiki. This can be a little complicated, as it's built around the needs and processes of the bigger Wikipedias at the time, but should be do-able.

Reply to "Enable Automatic citation in Nepali Wikipedia."

adding tools to the standalone version

2
Mabidan (talkcontribs)

How can I add or activate tools (extensions) like graph, math, and etc to the standalone version?

Jdforrester (WMF) (talkcontribs)

The stand-alone (non-MediaWiki) version of VisualEditor can be extended by writing code along the lines of VisualEditor/Gadgets#Triggering a command using a toolbar tool (though some of the advice there will not apply, because it's talking about the MediaWiki context).

The MediaWiki extensions you mention are each reliant on MediaWiki, and so can't be added to the stand-alone version of VisualEditor.

Reply to "adding tools to the standalone version"

How to show both edit tabs for all users?

4
84.147.33.26 (talkcontribs)

I want my MediaWiki to appear like this:

Instead of this:

Reason: Since the MediaWiki 1.35 update, which defaults to VisualEditor, I have observed in Special:RecentChanges that many edits are tagged with Visual Editor: Switched, meaning they opened VE and switched to source editing afterwards.

What do I need to change in LocalSettings.php for both tabs to appear?

Wladek92 (talkcontribs)
198.24.162.179 (talkcontribs)
Whatamidoing (WMF) (talkcontribs)

I think that it depends upon whether you have the VisualEditor/Single edit tab system. Some WMF wikis do, and some don't, and I have no idea what's the default for third-party MediaWiki installations.

Reply to "How to show both edit tabs for all users?"

Is there a way to preserve textarea undo history when injecting/inserting characters into the edit textarea?

10
Jasonkhanlar (talkcontribs)

I was just glancing at https://stackoverflow.com/questions/44471699/how-to-make-undo-work-in-an-html-textarea-after-setting-the-value and https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#browser_compatibility shows that execCommand is supported by all major web browsers. I noticed on Wikipedia both in the edit area at top (Special Characters), as well as the additional ones on the bottom (dropdown menu for Insert, Wiki markup, Symbols, etc.), that undo states are lost when clicking on any of the characters to insert. Is there a way that future versions can fix this to preserve the undo history?


Note: I see that execCommand is "Deprecated: This feature is no longer recommended." but otherwise still I would like to see a way to insert characters that preserves undo history. Also see https://stackoverflow.com/a/70831583

Whatamidoing (WMF) (talkcontribs)

Do you know whether this is specific to Firefox?

Jasonkhanlar (talkcontribs)

It is not specific to Mozilla Firefox. The issue affects Chrome/Chromium and Opera

Whatamidoing (WMF) (talkcontribs)

So that's most editors. @ESanders (WMF), do you have any thoughts about how this could be done?

ESanders (WMF) (talkcontribs)

What does this have to do with VE?

Whatamidoing (WMF) (talkcontribs)

I assumed that "textarea" was "the area where the text is" (e.g., ContentEditable), but I don't know.

ESanders (WMF) (talkcontribs)

I think @Jasonkhanlar is referring to <textarea> in the 2010 wikitext editor. That has known issues with the undo stack (T33780), and my go-to answer is to use the 2017 wikitext editor, which has it's own undo stack implementation.

Jasonkhanlar (talkcontribs)

I see. That is correct. It seems that https://en.wikipedia.org/ is using the 2010 wikitext editor, I tried to find the 2017 wikitext editor, and according to 2017 wikitext editor it is part of VisualEditor, which perhaps solves the undo state issue that I mentioned. Unfortunately, since neither Wikipedia seems to use it, nor does my webhost allow me to add "AllowEncodedSlashes NoDecode" to my website's VirtualHost section, and I get "Error contacting the Parsoid/RESTBase server (HTTP 404)" when enabling the VisualEditor extension for my site, I cannot check to see the 2017 wikitext editor in action. I read: https://mediawiki.org/wiki/Extension:VisualEditor#Allowing_VisualEditor_on_page_titles_containing_slashes Also whichever editor is used on Mediawiki.org, also undo does not work here either, when clicking the buttons to add special characters.

ESanders (WMF) (talkcontribs)

Your webhost may allow adding an .htaccess file?

Jasonkhanlar (talkcontribs)

Q: "Your webhost may allow adding an .htaccess file?"

A: https://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes shows 2 contexts: server config or virtual host. There is no .htaccess context for the AllowEncodedSlashes Directive. Therefore, I am unable to enable encoded slashes from within a .htaccess file in my webhost environment.

Reply to "Is there a way to preserve textarea undo history when injecting/inserting characters into the edit textarea?"

Tamplate shutdown my VisualEditor

4
Nicolas senechal (talkcontribs)

When I try to modify a page who contain a tamplate with the VisualEditor I have this error Error contacting the Parsoid/RESTBase server (HTTP 500) .

what should I do?

Whatamidoing (WMF) (talkcontribs)

Is this a private wiki, or one of the WMF-hosted wikis?

Nicolas senechal (talkcontribs)

it's a private wiki.

Whatamidoing (WMF) (talkcontribs)

You might have better luck asking at Project:Support desk, since the folks there know something about installing MediaWiki and its extensions.

Reply to "Tamplate shutdown my VisualEditor"

VisualEditor button does not work

2
Idris, the wise (talkcontribs)

Hello. I am working on a local mediawiki 1.37.1

At first when I added wfLoadExtension( 'VisualEditor' ); it was okay and i could edit some text

then the "Error contacting the Parsoid-/RESTBase-Server (HTTP 403)" started to appear and it stopped working.

And know when I click on the edit button, nothing happens. just the page refreshes and for a moment u could see the loading bar


WHat should I do?


mediawiki 1.37.1 is the last stable version and I do not intend to upgrade to 1.38 until it is stabe.

Whatamidoing (WMF) (talkcontribs)

I suggest posting this at Project:Support desk. It sounds like you might be having a problem with site configuration.

Reply to "VisualEditor button does not work"

Adding button to apply smallcaps template to selected text

5
83.36.48.202 (talkcontribs)

Hello. I am trying to add a button to Visual Editor, to apply smallcaps template to selected text. So far, I have been able to create the button, following the example at VisualEditor/Gadgets/Add a tool. Now I can insert some fixed text in smallcaps, with this code: var myTemplate = [ {

type: 'mwTransclusionBlock',
attributes: {
 mw: {
  parts: [ {
   template: {
    target: {
     href: 'Template:Smallcaps',
     wt: 'Smallcaps'
    },
    params: {
     1: {
      wt: 'my parameter'
     }
    }
   }
  } ]
 }
}

}, {

type: '/mwTransclusionBlock' 

} ]; And then assigning it to a toolbar button, as described in VisualEditor/Gadgets/Add a tool. Now, the next step is replacing the fixed text 'my parameter', with the selected text from the editor. I have very little knowledge of Javascript, maybe this is a trivial issue but I don't know how to deal with it. Any help is much appreciated.

Whatamidoing (WMF) (talkcontribs)
83.36.48.202 (talkcontribs)

@Whatamidoing (WMF) Thanks for your response. It seems like that method could also work for me, with small modifications. Could you tell me where and how are you inserting that code? I tried to insert it the same way as my previous code, but it didn't work for me.

83.46.41.89 (talkcontribs)

I found the solution myself. This topic gives an example of exactly what I am trying to achieve, as a gadget: Topic:Vfmg4amjkxvrlhjp

Whatamidoing (WMF) (talkcontribs)

Congratulations. I'm glad that you found that.

Reply to "Adding button to apply smallcaps template to selected text"
Return to "VisualEditor" page.