Talk:VisualEditor

About this board

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

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"
91.135.212.179 (talkcontribs)

Hello!

I have a problem. All text fields or buttons in VisualEditor are displayed as descriptions, like "{visualeditor-ca-editsource}" without the text itself.


Please, help me. Thanks

Whatamidoing (WMF) (talkcontribs)

Do you operate a third-party wiki? What is the language set for your account (in Special:Preferences at your wiki)?

Reply to "Descriptions instead of text"

Visual Editor tab not displayed in new name space

3
Sokote zaman (talkcontribs)

Hello

I created a new namespace, but the visual editor tab is not displayed

please guide me

Thank you


#teb_tab

# 3824

define("NS_TEBTAB", 3824);

define("NS_TEBTAB_TALK", 3825);

// Add namespaces.

$wgExtraNamespaces[NS_TEBTAB] = "teb_tab";

$wgExtraNamespaces[NS_TEBTAB_TALK] = "teb_tab_talk";

// Additional flow for other NameSpaces

$wgNamespaceContentModels[NS_TEBTAB_TALK] = 'flow-board';

// Additional Subpages

$wgNamespacesWithSubpages[NS_TEBTAB] = true;


$wgVisualEditorAvailableNamespaces = [ "Tebtab" => true ];

Jdforrester (WMF) (talkcontribs)

The $wgVisualEditorAvailableNamespaces array is indexed on the namespace ID, not the string name for it in a particular language. You want $wgVisualEditorAvailableNamespaces = [ NS_TEBTAB => true ]; instead.

Sokote zaman (talkcontribs)

Thank you for your response

Thank you it was solved

To add several custom spaces, please provide a sample code

Thanks@Jdforrester (WMF)

Reply to "Visual Editor tab not displayed in new name space"

PDF link in VE shown as thumb, in wiki as text...

2
178.7.97.22 (talkcontribs)

Hi,

when I add a Link to PDF-File in VE using "add / pics" (einfügen, Bilder und Medien)

while beeing inside ve its shown nice with icon-thumbnail and I can change the Style (with border or without...):

kasuro.com/pdflinkinve.png


but as soon as I save and leave ve, it is shown as plain text link:

kasuro.com/pdflinkinwiki.png


returning to VE its nice again...


when I search for showing PDF with Icon, i could only find the hint for using Templates...

But I dont understand, why ve shows it correctly and wiki not.

Is there any chance to set it, that wiki displays it like its displayed in ve?


thank you very much

Whatamidoing (WMF) (talkcontribs)

Do you know how to insert it correctly (the appearance you want) in the old wikitext editor? If so, we could compare the wikitext for what works vs what the visual editor is doing, and figure out how to make them both do the right thing.

Reply to "PDF link in VE shown as thumb, in wiki as text..."

Error contacting the Parsoid/RESTBase server: (curl error: 7) Couldn't connect to server

4
Sccotty (talkcontribs)

Getting this error when trying to use the visual editor. Can create a new page fine but cannot save them (same error).

MediaWiki 1.35.1
PHP 7.3.25 (apache2handler)
MariaDB 10.3.27-MariaDB
ICU 63.1

Any help is appreciated.

2003:C0:4F1B:CB40:78F1:237A:6989:B7B9 (talkcontribs)

Ich habe das gleiche Problem.

Sccotty (talkcontribs)

This was solved by adding https: to our $wgServer in LocalSettings.php

Ablum010777 (talkcontribs)

I have this problem, too, and I have https: in my $wgServer. However, in my case, we host Wikis via an internal and an external URL. The problem shows up only over the external URL. How do I configure this in LocalSettings.php and Apache?

Reply to "Error contacting the Parsoid/RESTBase server: (curl error: 7) Couldn't connect to server"
Sławobóg (talkcontribs)

Could you add two apostrophes to often used special character list: ‘ (U+2018) and ’ (U+2019)? It would be nice if, when clicked, the selected text would be inside these apostrophes. These apostrophes are often used in dictionaries (in many languages) to expain the meaning of a word / phrase.

Whatamidoing (WMF) (talkcontribs)
Sławobóg (talkcontribs)

But it should be a thing for all Wikipedias. It is used by English dictionaries too.

Whatamidoing (WMF) (talkcontribs)
Reply to "Apostrophes"
Summary by Pandakekok9

Standalone demo link changed to working one

Pandakekok9 (talkcontribs)
Jdforrester (WMF) (talkcontribs)
Return to "VisualEditor" page.