Talk:VisualEditor/2019
Add topic| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
This is not the place for bug reports about VisualEditor - those should go on the feedback page. |
Previous discussion was archived at Talk:VisualEditor/Archive 1 on 1 September 2015.
VisualEditor Stuck: Cannot read property 'toText' of null
[edit]Here is code which stucked
ve.dm.MWInternalLinkAnnotation.static.dataElementFromTitle=
function(title,rawTitle){
var element,target=title.toText(),
namespaceIds=mw.config.get('wgNamespaceIds');
Here is console error
load.php?debug=false…ersion=1c9irsr:1892 Uncaught TypeError: Cannot read property 'toText' of null at Object.mw.loader.implement.ve.dm.MWInternalLinkAnnotation.static.dataElementFromTitle (load.php?debug=false…ersion=1c9irsr:1892) at Object.mw.loader.implement.ve.dm.MWInternalLinkAnnotation.static.newFromTitle (load.php?debug=false…ersion=1c9irsr:1893) at Object.ve.ui.MWLinkAction.static.getLinkAnnotation (load.php?debug=false…ersion=1c9irsr:1734) at Object.mw.loader.implement.ve.dm.MWExternalLinkAnnotation.static.toDataElement (load.php?debug=false…ersion=1c9irsr:1890) at VeDmConverter.ve.dm.Converter.createDataElements (load.php?debug=false…version=1c9irsr:965) at VeDmConverter.ve.dm.Converter.getDataFromDomSubtree (load.php?debug=false…version=1c9irsr:971) at VeDmConverter.ve.dm.Converter.getDataFromDomSubtree (load.php?debug=false…version=1c9irsr:974) at VeDmConverter.ve.dm.Converter.getDataFromDomSubtree (load.php?debug=false…version=1c9irsr:974) at VeDmConverter.ve.dm.Converter.getDataFromDomSubtree (load.php?debug=false…version=1c9irsr:974) at VeDmConverter.ve.dm.Converter.getDataFromDomSubtree (load.php?debug=false…version=1c9irsr:974)
| mw.loader.implement.ve.dm.MWInternalLinkAnnotation.static.dataElementFromTitle | @ | load.php?debug=false…ersion=1c9irsr:1892 | |
| mw.loader.implement.ve.dm.MWInternalLinkAnnotation.static.newFromTitle | @ | load.php?debug=false…ersion=1c9irsr:1893 | |
| ve.ui.MWLinkAction.static.getLinkAnnotation | @ | load.php?debug=false…ersion=1c9irsr:1734 | |
| mw.loader.implement.ve.dm.MWExternalLinkAnnotation.static.toDataElement | @ | load.php?debug=false…ersion=1c9irsr:1890 | |
Fatihbahceci (talk) 12:11, 13 January 2019 (UTC)
When other extension uses curl_exec, visualeditor throws "Unknown error" when editing article
[edit]Using MediaWiki 1.29.1. I am using extension SlackNotifications. When editing an article, the extension SlackNotifications in the end runs curl_exec($curl_h) which then throws "Unknown error" on VisualEditor's UI. After commenting out the curl_exec($curl_h) in SlackNotifications extension, VisualEditor works fine.
Are there known issues when other extension uses curl and VisualEditor? This is the full code that SlackNotifications extension uses for full curl init and send:
$curl_h = curl_init();
curl_setopt($curl_h, CURLOPT_URL, $wgSlackIncomingWebhookUrl);
curl_setopt($curl_h, CURLOPT_POST, 1);
curl_setopt($curl_h, CURLOPT_POSTFIELDS, $post);
// I know this shouldn't be done, but because it wouldn't otherwise work because of SSL...
curl_setopt ($curl_h, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($curl_h, CURLOPT_SSL_VERIFYPEER, 0);
// Set proxy for the request if user had proxy URL set
if ($wgHTTPProxy) {
curl_setopt($curl_h, CURLOPT_PROXY, $wgHTTPProxy);
curl_setopt($curl_h, CURLOPT_RETURNTRANSFER, true);
}
// ... Aaand execute the curl script!
curl_exec($curl_h);
curl_close($curl_h); Kulttuuri (talk) 20:29, 1 March 2019 (UTC)
- I have the same issue with visualeditor giving an "unknown error" when saving edits, although the edits still get saved.
- My mediawiki version is 1.29+
- php 5.5
- I am not using the extension slacknotification, but i do have the Echo extension installed, which i assume works in a similar way by providing notifications.
- I found another post mentioning cURL needs to be installed, and got it enabled a half hour ago, although my problem still persists so i suspect i might need to do something more than just having the php extension cURL installed.
- I am wondering if the "heroku fix" for parsoid might be contributing to the problem?
- The solution for users on shared hosting, where you run parsoid from a heroku account. Oleolsenkjhølkølk (talk) 23:40, 1 March 2019 (UTC)
Cannot preview templates in Visual Editor
[edit]I have installed the Visual Editor and TemplateData as well as TemplateWizard; however on my wiki the Visual Editor does not show the preview of templates used in all articles. How to solve the problem? Thanks!
Screenshot: [1] Eagle (talk) 23:14, 28 May 2019 (UTC)
Param _website_ is undiscriminating?
[edit](Originally posted on other page and moved to this page.) @PPelberg (WMF), hello, AHollender (WMF) pointed me to your attention on this subject.
Could we remove “website” param from the cite-web template auto-generate feature on mobile visual editor? Maybe it is not working best when the auto-generating cite-web template is picking up “website” param. It picks up both the root part of the url, and as the publisher or the parent directory of the webpage displayed, but for me the choice is not predictable.
In jawp, people find it annoying when I add/did not empty the “website” param, especially when I apply mobile VE and my edits add any root address of the webpage; example a) is accepted as: website= Wikimedia; example b) is not appreciated/requested to omit values if website=www.wikimedia.org.
I support that “website” param is useful when it indicates that the website publisher and the actual child webpage producer/director have meaningful relationship, like a film festival committee as a 3rd-party organizer commissioned by a local government.
May I remind you that I am a strong supporter of mobile visual editor and can’t wait to see auto-generating function fir web citing to Desktop. But at the moment, I don’t have any page to point editors to when they are unhappy with “website” parameters.
Timid resolution would be to request that “website” param will be an option that I will add, but the system does not autofill value. Do you think it will be agreeable for single-byte language wikis? Omotecho (talk) 13:48, 29 July 2019 (UTC)
- @Mvolz (WMF), this sounds like a Citoid question.
- It might be possible to solve it merely by changing the TemplateData at the local wiki. Parameters are only added if they're marked as "suggested" or "required" by that community. Whatamidoing (WMF) (talk) 21:41, 29 July 2019 (UTC)
- Yup, it's a citoid question. If you would like to no longer add the website parameter, that would be something you would discuss with other community members on the Cite web template. (https://en.wikipedia.org/wiki/Help_talk:Citation_Style_1) and reach a community decision about. If the community decides they no longer want it added automatically on Cite web, then it can be removed in the template data of the Template here: https://en.wikipedia.org/wiki/Template:Cite_web#TemplateData
- It's true that often the website param is effectively "useless" and just the root URL, when we do not have a specific Zotero translator for the website. However, sometimes it isn't, so never adding it isn't a great solution. And in formal citation styles i.e. APA, MLA this parameter is required, no matter how useless it may be. But again, it's a community decision :).
- It is possible to improve the data quality of this parameter in Zotero as well, but a better universal website translator is somewhat stalled there. Hopefully it will eventually be merged though! https://github.com/zotero/translators/pull/1897 Mvolz (WMF) (talk) 09:39, 2 August 2019 (UTC)
- @Mvolz (WMF), thank you for crystal clear explanation and mapping the possibilities and solution threshold. As this issue was pointed to me on jawp, I will go back and see if it would be a major issue to target among jawp editors in line with your advise, especially as I myself need to read what Citoid is. I will catch up with what Zetero is as well, before reaching out to see how jawp editors appreciate website parameter. As we are using double byte writing system, a separate issue but some expects to see either website or publisher be autogenerated in double byte/Japanese writing system, noting it a nonsense to output with roman/single byte characters; a native editor scripts website params manually for native readers using double bytes.
- @Whatamidoing (WMF), thank you to pointing where my inquery belongs, and while not the main topic here, but the background of the issue above makes me doubt if understanding Citoid / formal citation ie APA, MLA, comprehended/digested extensively on jawp, partly due to, in general, the act/concept of citing itself could be the best asset any Japanese high school or university grads learn through wikipedia as a reader/editor. Even making footnotes nor listing sources nor references in APA/MLA style were, and still are, the skill you lack as a college graduate if you are not a science or philosophy major.
- That said, it is why I am very looking forward to new advanced mobile editing features. As much as you enjoy “freeriding” the citation feature (big “ icon), you will see the _magic_ of autocreate button that only requires to input url. Then, suddenly it challenges you; it says you can create citation from scratch. Take up the challenge, and you come to see there are empty fields/params you might need to fill. I find it a very effective education/learning process which advances your skill as an editor. How I wish I had it when my beaks were very yellow! Omotecho (talk) 16:36, 9 August 2019 (UTC)
- Citoid is the magic auto-creator, and Zotero is one of its servants.
- On the single-byte/double-byte question, when you put in a URL, Zotero is often smart enough to find some of the answers in the HTML code at that URL, but it never translates anything.
- So as I understand it, if you give the magic citoid button the url https://www.example.com, the citoid service sends Zotero to look at the page. Zotero can find the code
<title>Example Domain</title>in the HTML for that page, but it can't do much more than that. Whatamidoing (WMF) (talk) 18:55, 9 August 2019 (UTC)
Copy and Paste a Table from Microsoft Excel
[edit]I tried to copy and paste a table from LibreOffice Calc into the VisualEditor and I was very happy that it works.
However, I can't copy tables from Microsoft Excel into the VisualEditor. I tried it on our own installation, as well as on de.wikipedia.org. The result was the following: The text of all the cells was written in one line. The columns were separated by two spaces, the lines by four spaces.
While searching on the internet I got the impression, that other people successfully copied from Excel to the VisualEditor.
My questions are: Does it in principle work? And if it works in principle: What is the trick to make it work?
Thanks in advance for any answer. Marc-André Aßbrock (talk) 10:23, 16 August 2019 (UTC)
- Hmm. It works in principle, but whether any given spreadsheet/any given version works... I don't know. Were you able to test a very small table (just a few cells, with no fancy formatting)?
- In the meantime, have you considered exporting it as a .csv file? You can drag-and-drop .csv files into the visual editor, and it will convert them to tables for you. Whatamidoing (WMF) (talk) 01:07, 23 August 2019 (UTC)
- We use HTML to paste from spreadsheets. To see what HTML Excel is producing, you can paste into the right side of this: https://edg2s.github.io/content-editable-sandbox/ which will help us investigate. You can also do the paste with the developer console open (F12) and see if there are any errors listed. ESanders (WMF) (talk) 23:39, 26 August 2019 (UTC)
- Thanks @ESanders (WMF) 50.74.80.182 (talk) 14:52, 8 October 2019 (UTC)
Backreferences for regular expressions
[edit]The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Can I make a backrefence to a captured group when using the search and replace function? DonBarredora (talk) 16:31, 16 August 2019 (UTC)
I don't think I understand this question. Do you have a diff, or can you show me in wikitext what you want to do? (If you start typing <pre then this discussion tool with automagically guess that you want to add some code to the page. But visit my user talk page if it's easier to post the wikitext there.) Whatamidoing (WMF) (talk) 01:10, 23 August 2019 (UTC)
- Suppose I enter the following regular expression in the search box:I would like to know if it's possible to reference that captured group in the replace box, like:
(0-9)+
Thank you. DonBarredora (talk) 03:55, 25 August 2019 (UTC)\1
- Yes, captured groups are referenced using
$1,$2, etc.. Jdforrester (WMF) (talk) 15:40, 26 August 2019 (UTC) - That's what I wanted, thanks for the help. 190.190.135.175 (talk) 16:13, 26 August 2019 (UTC)
- We just use JavaScript string.replace, so any of these can be used: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter ESanders (WMF) (talk) 23:36, 26 August 2019 (UTC)
Visual Editor Toolbar is overlaps the TemplateData Dialog
[edit]Anyone have any clue why the toolbar would be overlapping on top of the TemplateData dialog? 50.82.132.227 (talk) 02:46, 28 August 2019 (UTC)
- On what page? Whatamidoing (WMF) (talk) 17:39, 28 August 2019 (UTC)
Dirty diffs on unrelated changes
[edit]The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
I have Visual Editor and for some reason it generates "dirty diffs" when saving pages on unrelated changes. For example, a user may edit only a single paragraph, but VE removes all "non-significant" white space from tables, headings and lists, in all the page that hasn't been touched.
See this diff as an example.
I though the problem was that I didn't update Parsoid since the last MediaWiki upgrade, but that's not true, because I'm using the latest version available on Debian: 0.10.0all Ciencia Al Poder (talk) 19:59, 8 September 2019 (UTC)
- Weird. Can you reproduce this on a smaller, simpler page? (The point is to see that it happens on a page that you know doesn't contain any unusual wikitext or HTML.) Whatamidoing (WMF) (talk) 03:08, 10 September 2019 (UTC)
- Yes, try this test page. You can change something on the first paragraph and see the resulting diff on preview
- Just to give more information, I also have RESTBase installed Ciencia Al Poder (talk) 09:05, 10 September 2019 (UTC)
- Special:Version says that your version is a couple of months older than the most recent... but I'm not sure that's the problem. I think that if there had been whitespace changes like that across all the wikis, that someone would have been complaining.
- @Cscott, do you have any thoughts about what to check? Whatamidoing (WMF) (talk) 18:37, 11 September 2019 (UTC)
- It sounds like "selective serialization" isn't enabled, which is the feature which specifically prevents dirty diffs. I think RESTBase is required to enable selective serialization, so that may be the first thing to check. cscott (talk) 15:52, 7 October 2019 (UTC)
- I have RESTBase installed. Is there anything I can do to debug if selective serialization is not working or failing? logs? network traffic between RESTBase and Parsoid? Ciencia Al Poder (talk) 21:35, 7 October 2019 (UTC)
- I only had to uncomment this line from config.yaml:
# Use selective serialization (default false)useSelser: true- Too bad nobody here was able to suggest such a simple change (and zero documentation about it!) </rant> Ciencia Al Poder (talk) 20:09, 23 October 2019 (UTC)
middle-click-paste in VisualEditor on Chrome/ium not working
[edit]Under Linux desktops it is normal to mark any text with the mouse and then insert it anywhere with the center button (wheel) of the mouse.
If you now have the VisualEditor open in Chrome or Chromium and want to insert marked text with the "middle-click-paste" function, the cloud symbol will always appear instead of the text: ☁
Normal copy / paste works as desired.
Under Firefox the problem is not present.
Btw. the problem is also present in THIS editor. ;)
System: Debian buster
Mediawiki: 1.33
VisualEditor: 8c9c37e CrankyAlias (talk) 08:43, 19 September 2019 (UTC)
- This working fine for me on this site, is this just an issue in 1.33? ESanders (WMF) (talk) 15:25, 3 October 2019 (UTC)
Get wikitext using JavaScript
[edit]Is there a way to get the current wikitext being shown in the editor using JavaScript? BrandonXLF (talk) 04:13, 4 December 2019 (UTC)
- Why do you want to do that? I'm pretty sure that there's a much easier way to accomplish your goal. Whatamidoing (WMF) (talk) 20:18, 12 December 2019 (UTC)
- For a user script that will run some regex replacements on the code in the editor. BrandonXLF (talk) 02:52, 13 December 2019 (UTC)
- I assume you are talking about 2017WTE, in which case the surface is in fact compatible with the textSelection API, so
$( '#wpTextbox1' ).textSelection( 'getContents' )- would work. You can use the same API to replace the contents with
setContents. - Note this isn't the most efficient API as the whole document will be replaced. If you want to do more targeted replacements you can use the document's findText method. Here's an example script that fixes date formats:ESanders (WMF) (talk) 10:07, 16 December 2019 (UTC)
var target = ve.init.target, surface = target.surface.model, // non-global regex for returning matches pattern = new RegExp( '([0-9]{1,2})/([0-9]{1,2})(?:/([0-9]{1,4}))?' ); target.initialEditSummary = 'Fix date formats.'; surface.documentModel.findText( new RegExp( pattern.source, 'g' ), { noOverlaps: true } ).map( function ( range ) { // Build all fragments before modifying return surface.getLinearFragment( range ); } ).forEach( function ( fragment ) { var matches = fragment.getText().match( pattern ), year = matches[ 3 ] ? +matches[ 3 ] : new Date().getFullYear(); if ( year < 100 ) { year += 2000; } // Sanity check that numbers are in range. Avoids matching things like 24/7. if ( +matches[ 1 ] > 12 || +matches[ 2 ] > 31 ) { return; } fragment.insertContent( year + '-' + matches[ 1 ].padStart( 2, '0' ) + '-' + matches[ 2 ].padStart( 2, '0' ), true ); } );
- Is this complicated enough that you really need to use a script? VisualEditor (visual and wikitext modes) has a built-in find/replace module that handles regex. Whatamidoing (WMF) (talk) 22:32, 27 December 2019 (UTC)
- I'm sure there's a better way to do it, but with the regex I'm using, I have to split the text into arrays and run several different regex rules on the text. BrandonXLF (talk) 22:35, 27 December 2019 (UTC)
Real-time collaboration progress?
[edit]This page says that real-time collaboration is a feature that is worked upon 'right now' for visual editor. My question is, has work started on real-time collaboration (e.g. google docs style) at all? If yes when will be able to see a first experimental version? In months or years?
At least for the standalone visual-editor, not the one in wikipedia
I have actually found this video which shows this feature implemented through togetherJS.
Thanks MavropaliasG (talk) 10:37, 4 December 2019 (UTC)
- Hi, the page you found is from early 2017. Since then we have done a lot of the backend work to make real-time collaboration possible, and we even have some experimental code that MW users can install, see VisualEditor/Real-time collaboration. Unfortunately this feature is not in the team's priorities for the next year, so we can't make any commitments on when it might be ready, however if you watch the Real-time collaboration page, any updates will be posted there. ESanders (WMF) (talk) 15:45, 5 December 2019 (UTC)
- @ESanders (WMF) I did some reading on this task, and I saw you gave some presentations in 2017 and 2018, whose slides I read. You have some great questions inside, also outlined in this abstract. I am very curious if there are any good answers to those questions or not. Unfortunately the notetaker for the 2018 session did not provide any points from the discussion, Would it be possible, whenever you have time, to either put those questions on the task page, or to a page so that proposals to those problems are collaboratively solved? Thank you MavropaliasG (talk) 16:41, 16 December 2019 (UTC)
- Those panels will have been run by @Cscott though I doubt he has the old missing notes. ESanders (WMF) (talk) 22:04, 16 December 2019 (UTC)
- Thank you for replying. Is there a page that those questions are available for people to brainstorm on? I feel like having those up on a page (adjunct to the real-time collaboration page?) would allow people to find a solution, much more effectively than a 15-min hurried discussion in a conference. So please, if possible, add those questions somewhere prominent.
- Moreover, another way to answering those questions, would be to just fix the bugs for the real time collaboration functionality (at least in the future) and allow third-party installations of mediawiki to use them and through trial and error find the best way (through their feedback) for this to work. MavropaliasG (talk) 02:05, 17 December 2019 (UTC)
- Thank you so much MavropaliasG (talk) 03:25, 6 December 2019 (UTC)
Cookie Visual Editor
[edit]The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
I note that a cookie is being set by the Visual Editor. Name is "VEE", value is "visualeditor". Why is this? I ask this in connection with the GDPR.
Regards, Jethro Waanders (talk) 14:42, 6 December 2019 (UTC)
- The cookie is set to remember the last editor you used, so as to not give you different editor and annoy you. – Ammarpad (talk) 19:12, 7 December 2019 (UTC)