Jump to content

Extension talk:TinyMCE/2019

Add topic
From mediawiki.org
[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.


When one creates/edits an external link that contains an '_' in its link URL the URL gets split at the '_' and the part after the first '_' becomes part of the link text.

This is due to the fact that in tinymce/plugins/mw_wikicode/plugin.js the insertLink function replaces every '_' in the URL with a space (' ') even for external links. And that's a bug as this should only be done for internal links (if at all).

My solution for this are these changes to that file:

--- a/tinymce/plugins/mw_wikicode/plugin.js 
+++ b/tinymce/plugins/mw_wikicode/plugin.js 
@@ -2894,11 +2894,12 @@ var MwWikiCode = function() {
                                        //This is necessary to avoid the bswikicode parser from breaking the markup
                                        var href = data.href.replace(/(^.*?\[|\].*?$|\r\n|\r|\n)/gm, ''); //first layer of '[...]' //external-, file- and mailto- links''
                                        href = href.replace(/(^.*?\[|\].*?$|\r\n|\r|\n)/gm, ''); //potential second layer of '[[...]]' //internal and interwiki links''
-                                       var aLink = decodeURIComponent(href).replace("_"," "); 
+                                       var aLink = decodeURIComponent(href);
                                        var aLabel = decodeURI(data.text).replace("_"," ");
                                        var wikitext = "";
                                        
                                        if (data["class"] == "link internal mw-internal-link mceNonEditable") { 
+                                               aLink = aLink.replace("_"," ");
                                                if (aLabel) {
                                                        wikitext = "[[" + aLink + "|" + aLabel + "]]";
                                                } else {

Is this a valid solution or am I missing something? HermannSchwärzler (talk) 11:05, 2 March 2019 (UTC)Reply

Hi Hermann
Firstly my apologies for such a long delay. I seem to have a problem that I'm not getting notified of posts to this page which is probably down to my incompetence! Secondly, thank you for trying this extension and taking the trouble to both let me know of this problem AND provide a solution.
What you observed was a bug and what you gave was a valid solution. I'll add it to the master branch over the next day or so and I do hope you will continue to use the TinyMCE extension and let me now of any problems or suggestions.
Kind regards
DuncanCrane (talk) 18:05, 19 June 2019 (UTC)Reply
We are still facing the same problem with the currently available version. 89.246.165.171 (talk) 09:23, 24 July 2019 (UTC)Reply
Hi Hermann
I am sorry, I somehow overlooked adding the change back to the master. I'll look into it over the next few days. Your patch should still work in the meantime.
Many thanks - Duncan DuncanCrane (talk) 08:15, 4 October 2019 (UTC)Reply
Hi Hermann - it should now be available in the master code. 86.164.120.53 (talk) 14:50, 11 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

"<brdata-attributes="" />" and "<brdata-mce-bogus="" />" appearing after save - small bug in wikicode-plugin

[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.


Sometimes we see lines containing

<brdata-attributes="" /> and <brdata-mce-bogus="" />

appearing in our texts. I am not sure why and when this happens but after looking at the code it was pretty obvious that a small bug in tinymce/plugins/mw_wikicode/plugin.js was causing this.

Line 1701 reads

return '<br' + decodeURI(attributes) + ' />';

this has to be

return '<br ' + decodeURI(attributes) + ' />';

imo (note the added " " after "br"). HermannSchwärzler (talk) 10:49, 4 March 2019 (UTC)Reply

Hi Hermann
Please accept my apologies again and thanks for spotting this bug too. I will update to master in next day or two.
Kind regards
DuncanCrane (talk) 18:09, 19 June 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.
[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.


Hi there,

I was wondering if it's possible to change the default parameters from images and links?

At least for the TinyMCE editor in my wiki, when I click the 🖻 upload/edit file icon, the parameters in the image tab default to:

Vertical alignment: Middle

Horizontal alignment: Right

Format: Thumb


Similarly for 🔗linking, the default parameter is type: external


I would prefer different defaults for these - could anyone recommend a way to change them? Is it something in TinyMCE, or maybe a $wgDefault-style command I could use in LocalSettings.php?


I'm new to wiki/php so let me know if you need some other info. Thanks! Calebfergie (talk) 01:28, 10 April 2019 (UTC)Reply

Hi Calebfergie
Sorry for the delay in replying and thank you for using the TinyMCE Extension and raising this query.
Unfortunately these defaults are set in the code. I think I could add some settings for this into LocalSettings though. Currently I'm working on a new version with quite a few enhancements so my preference would be to add this to the new version if that's OK/
In the meantime, if you you are happy to edit the code, for the upload these settings are in:
'function displayForm(dialogData)' on line 363 of .../extensions/TinyMCE/tinymce/plugins/mw_upload/plugin.js
To change the default of the linking to 'internal' first rather than 'external' you can reverse the entries in:
array 'link_class_list:' on line 66 of .../extensions/TinyMCE/MW_tinymce.js
Hopefully that will be OK for now. Do let me know if you've any other suggestions
DuncanCrane (talk) 09:21, 20 June 2019 (UTC)Reply
Apparently that workaround doesn't work anymore. But changing order on
line 145 in .../extensions/TinyMCE/custom_plugins/mediawiki/plugins/mw_wikilink/plugin.js works. Activede (talk) 20:56, 30 December 2021 (UTC)Reply
Thanks Activede, I'll check that out and update.
Duncan DuncanCrane (talk) 15:44, 31 December 2021 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

MediaWiki_Language_Extension_Bundle

[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 wonder if there is any conflicts between this extension and the extensions in MediaWiki_Language_Extension_Bundle AssetDenmark (talk) 18:54, 10 April 2019 (UTC)Reply

Hi AssetDenmark
I'm so sorry I didn't notice your question earlier and thank you for trying this extension. Unfortunately MLEB is something I haven't had cause to try so I'm not sure of the answer to your question. If you have experienced a problem, if you can give me a little more information then I'd be happy to investigate.
DuncanCrane (talk) 09:30, 20 June 2019 (UTC)Reply
Thanks @DuncanCrane - I am having all sorts of challenges, basically because i was cheap and got a host that wont support command-line and thus I can not install the parser and other stuff that is needed to make translations and advanced parsing work. My - temporary - solution is to translate in word (and) then not have and support for 2nd language texts. ( I can not, it seem seems, even create a page in a different language... not without getting to know the Mediawiki API etc. )
The
So until I get to a point where i can focus on coding, rather than adding content, I am sort of stuck... right now I use WikiEditor as I am not even able to install "pasoid"(sp?) for the Visualeditor...
I think i found that the language extension does rely on the parsers used by VisualEditor and it will thus not work with WikiEditor or TinyMCE, but my attention is not elsewhere. I hope that I will have time to get this to work eventually... AssetDenmark (talk) 11:54, 21 June 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

TinyMCE editor not displayed

[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.


Hi,

great extension! But I couldn't try it :) After installing and adding the patch to WikiEditor.hooks, when I click on edit there is a call like this ?title=Page_title&action=tinymceedit, which is correct, I guess. Anyway no WYSIWYG editor is loaded.

At this link there is a screenshot. No php error is shown. Here is my version:

Product Version
MediaWiki 1.31.1
PHP 7.0.33-0ubuntu0.16.04.3 (apache2handler)
MySQL 5.7.25-0ubuntu0.16.04.2
ICU 55.1
Elasticsearch 5.6.1
Lua 5.1.5

Thanks for the help!

Lorenzo Loman87 (talk) 07:27, 11 April 2019 (UTC)Reply

Hi Lorenzo
I'm very sorry I didn't spot your question until now and thank you for using this extension. I wonder do you get the same problem if you remove the patch for the wiki editor? If not then the problem may be the same or related to this one. Would you let me know if this is the case?
DuncanCrane (talk) 09:36, 20 June 2019 (UTC)Reply
Hi, thanks for your answer. I tried disabling the wiki editor patch (that is correctly places in WikiEditorHooks.php) but TinyMCE isn't working anyway. The only difference is that with the patch disabled the wiki editor toolbar is loaded.
Any other ideas?
Thanks,
Lorenzo

Loman87 (talk) 11:05, 2 July 2019 (UTC)Reply
Hi, I have the same problem as Loman87, some idea that it can be, so far I can't make it work.
I appreciate any help. 190.90.156.130 (talk) 15:45, 12 September 2019 (UTC)Reply
Hi
Sorry for the delay and thank you for using this extension. It may be that another extension is incompatible with this one. Would you try disabling all extensions except TinyMCE and trying it again. If that works, perhaps you would add the disabled extensions back one at a time, testing to see if TinyMCE still works after each one is enabled. This should allow us to identify which extension is causing the problem, if any.
Many thanks
Duncan 86.139.55.197 (talk) 15:58, 3 October 2019 (UTC)Reply
Thanks for your answer but I found another solution. The issue was related to wgTinyMCEDirectionality and here there is a patch to correct a line in MW_tinymce.js.
All the best,
Lorenzo Loman87 (talk) 14:16, 16 October 2019 (UTC)Reply
Hi Lorenzo That's great that Yaon had provided a fix. I'll mark as resolved and ensure that the master branch is up to date.
Many thanks
Duncan 86.164.120.53 (talk) 15:10, 20 October 2019 (UTC)Reply
Hi Lorenzo, great that Yaron had already provided a fix. I'll mark as resolved 86.164.120.53 (talk) 15:13, 20 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

"|" is not allowed, except within or ...

[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.


Hi, I am writing some help pages for a number of Wikis. I am using Page Forms and TinyMCE. When I try and show how a table works, when I click on save, I get the following error?

"|" is not allowed, except within {{...}} or [[...]]

Is there a way to overcome this, or is there a way where I can toggle between TinyMCE and WikiEditor when using Page Forms?

Any help is appreciated. Squeak24 (talk) 10:52, 30 May 2019 (UTC)Reply

I think I found the answer at https://www.mediawiki.org/wiki/Extension_talk:Page_Forms/Archive_March_to_May_2018 Squeak24 (talk) 10:56, 30 May 2019 (UTC)Reply
Sorry, I tried it, and it still comes up with the same error. Squeak24 (talk) 11:01, 30 May 2019 (UTC)Reply
Apologies, me again. it seems to be an issue when using the pipe symbol. Is there any way of using this without brackets in TinyMCE. Squeak24 (talk) 12:53, 30 May 2019 (UTC)Reply
Is this in a regular form field, or the "free text"? Yaron Koren (talk) 14:16, 30 May 2019 (UTC)Reply
Apologies for the delay. It's in a regular form field.
Having had a play this morning, when I insert imagemaps as well I get the same error. Squeak24 (talk) 11:03, 5 June 2019 (UTC)Reply
Hi Squeak24.
Sorry for the delay getting back to you. This error message seems to be generated from within PageForms. I wonder if you could try inserting the "|" into the field when the TinyMCE editor is not enabled and see if the same thing happens?
You can use the standard template {{!}} of course, as you would when using templates in tables, but this no longer is strictly WYSIWYG. Also I just noticed that when you try and edit the page again after saving then the same problem happens. I'll investigate a bit more and let you know.
DuncanCrane (talk) 15:45, 12 June 2019 (UTC)Reply
Hi again. I've added a patch that hopefully will identify any '|' characters that would cause this error message and convert them to {{!}} before saving. They will still display as a '|' on your wiki page but will be {{!}} in the wiki code.
The patch is awaiting review before it is updated to the master branch, but you can see what has changed by looking at the diff on this page.
Hopefully that will meet your needs? Thanks also for using this extension and please do let me know if you get any further problems or have any suggestions for improvements.
DuncanCrane (talk) 13:06, 13 June 2019 (UTC)Reply
Patch now merged with master branch
DuncanCrane (talk) 10:21, 16 June 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

The file does not exist on this wiki.

[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.


Hi. When trying to insert a "file in this wiki" I get the error "The file does not exist on this wiki. Select Ok if you would like to upload a new file or select Cancel and enter a different filename for this link".

But the file exists. Whats the problem here?

Using MW 1.32.1 Leshespes (talk) 12:24, 14 June 2019 (UTC)Reply

Hi Leshespes
Thank you for trying this extension and letting me know about this problem.
This error would normally only be displayed if you are 'uploading' a file that already exists in the wiki (ie linking to a file that is already on the wiki). This may be by choice, eg you selected the file type of 'wiki' in the dialog, or if you tried to upload a file that already exists and have then been offered the option to link to that file.
The problem is if the destination file includes a prefix such as 'File:' (or equivalent if you have a wiki in a different language to English) as the field expects just a file name. Because the destination file name is automatically created from the source, unless it is changed manually, it will include the prefix if it was included with the source file name.
To avoid this happening, I've made a change that strips any prefix from the source when creating the destination file name when the upload type is 'wiki'.
I have uploaded a patch that is waiting review before being merged with the master branch. If you'd like to make the change soonr, please refer to the patch here
Hopefully that will fix the problem but please let me know if not.
DuncanCrane (talk) 10:20, 16 June 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Tabular presentation lost after source edits in Page Forms

[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.


Not sure if I should report this here or on the Page Forms talk page.

Someone alerted me of a problem that can occur if you're working in Page Forms. I was able to reproduce it by following these steps:

  • Either edit or create a table in a textarea field in Page Forms, with the TinyMCE extension enabled
  • Then open the dialog "View and edit wiki source code"
  • Press OK to close the dialog
  • Go back to the table in the textarea field

MW 1.27.0 + PF 4.5.3 + TinyMCE 0.3

Result: The table syntax is no longer rendered to produce a table. (The pipes are still properly escaped I think but that's about it. )

I have followed the same steps in the regular wiki editor and everything checks out fine there.


Cavila 06:54, 19 July 2019 (UTC)Reply

Hi
Thank you for using this extension and I'm sorry I didn't spot your post earlier. I couldn't find a PageForms release 4.5.3 but tried the final releases for 4.3, 4.4, 4.5 and the current release 4.6 but couldn't get the problem to reproduce. Possibly it was fixed in one of the minor releases of PF or one of the bug fixes on TinyMCE 0.3? If you are still having problems and have tried downloading the current versions then would you let me have a copy of the wiki text as it appears in the 'View and edit wiki source code' dialog?
Many thanks - Duncan DuncanCrane (talk) 13:32, 4 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

JS Error infinite loop

[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'm getting the following error message quite often: "Sorry, an infinite loop occurred. The editor had to shut down. Please check your wiki page for errors." But it seems to save the changes. 89.246.165.171 (talk) 10:00, 24 July 2019 (UTC)Reply

Sorry for the delay in replying.
That usually means the TinyMCE extension has encountered a problem when converting the editor HTML back to wiki markup. Specifically it is usually when dealing with an HTML block construct such as headers, lists and definitions etc. It may have saved all the text up to the point it encountered the problem which is why it appears to have saved something. If the block was not closed it may have saved all the text as markup but if you re-enter the TinyMCE editor it is likely the text will look strange.
If you can identify the specific input that causes the problem that would help me isolate the bug.
Many thanks - Duncan DuncanCrane (talk) 07:32, 4 October 2019 (UTC)Reply
While Creating new Heading get the same error. on preview it still show the change and when try to save it deleted most of the body of the article. Krunalb (talk) 15:51, 11 October 2019 (UTC)Reply
Hi
Thank you for trying this extension. I've not been able to reproduce this error simply by creating and saving headings in various combinations. I suspect it may be a result of something else in the article, possibly in combination with adding headings. Would you provide a link to the page with the error or an image of the page or the content of the article so I can test this to reproduce the problem?
Thanks
Duncan 86.164.120.53 (talk) 10:38, 12 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Fatal exception of type "Error" in page Special:Categories

[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.


As long as the extension is installed, I cannot open the Special:Categories page any more. Instead, I get the aforementioned error message. My Wiki is in German language (don't know if that may cause it). 89.246.165.2 (talk) 09:14, 8 August 2019 (UTC)Reply

Hi
I'm sorry for the delay in replying. That is strange. Can you let me know the versions of the software that you are using?
Many thanks
Duncan DuncanCrane (talk) 16:33, 3 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

TinyMCE does not work with the CreatePageUw extension

[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.


Hi,

I'm using the TinyMCE editor and I'm using the Extension:CreatePageUw, but TinyMCE does not display when creating a new page in CreatePageUw. It looks like a mistake. I reported it to the author of the CreatePageUw extension and what he wrote to me:

https://www.mediawiki.org/wiki/Extension%20talk%3ACreatePageUw#h-TinyMCE_does_not_work_with_the_CreatePageUw_extension-2019-09-23T06%3A07%3A00.000Z

@DuncanCrane

Can anyone create this function for this editor to work correctly in the CreatePageUw extension? Monocero (talk) 14:23, 24 September 2019 (UTC)Reply

The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

A gap is created in the editor between the inserted image and the title

[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.


Hi @DuncanCrane


I use the TinyMCE editor on my wiki and I probably noticed a certain mistake.


The created article looks like this, no large spaces:


https://i.imgur.com/gdMJ2pi.png


But in the TinyMCE editor is visible the gap between the image and the created title, example: ==Title==


https://i.imgur.com/nHiwjNA.png


A space is created if the inserted image is in front of this title, example:


inserted image


==Title==


Can you check it and possibly fix this mistake? Monocero (talk) 17:26, 30 September 2019 (UTC)Reply

Hi
Firstly thank you for using this extension. I had a slight problem looking at the second image you uploaded as it says it is no longer available. I'll see if I can recreate the problem but would you also let me know which versions of software are being used in your environment?
Many thanks
Duncan 86.139.55.197 (talk) 05:45, 3 October 2019 (UTC)Reply
At my computer two screens from imgur are displayed correctly. I use MediaWiki 1.32.0 and TinyMCE 0.3 latest version. Monocero (talk) 17:13, 3 October 2019 (UTC)Reply
Hi
Thank you - I can now also see both images. Looking at these, I wonder how you are stopping the text from wrapping around the picture? The usual approach would be to use the 'none' parameter for horizontal alignment when defining the picture link (in mediawiki source code or in the TinyMCE dialog box). If I do this, the images I insert are displayed correctly in both the wiki page and the TinyMCE editor.
If you are not using the 'none' parameter, would you try it and see if that fixes the problem? If you are using the 'none' parameter, would you let me have the wiki source code for this part of the page, including the text before the image and after it?
Many thanks - Duncan DuncanCrane (talk) 11:09, 4 October 2019 (UTC)Reply
I use the "none" parameter in the code of the inserted photo.
See the code of this page:
LINK
In other articles it is the same. Monocero (talk) 14:22, 4 October 2019 (UTC)Reply
Hi
This is an interesting problem. You are right that the TinyMCE editor isn't displaying the page exactly as it shows when displayed by mediawiki. This is because mediawiki ignores the blank line that you have inserted after the picture and before the title. This blank line is not needed, as the effect of the 'none' parameter is that whatever text follows will be displayed on a new line anyway.
One might have expected that mediawiki would display the blank line you have entered as it would if it there was text on it, but it doesn't. If you remove this blank line you will find that the page displays exactly the same.
The problem is, if Tinymce hides this blank line then you would not know it is there if you wished to edit it. This might lead to strange results. I could replace the blank line with a placeholder character so that it shows up in TinyMCE editor which would allow it to be edited? This approach is used where a new line is used in a line of wiki text, which mediawiki also ignores.
Alternatively, you might just remove the blank line after the picture and then both TinyMCE and mediawiki would display the same? In fact, there is a bug in the current code which in effect does exactly this if you save the page without making any changes?
What do you think?
Duncan 86.139.55.197 (talk) 11:54, 8 October 2019 (UTC)Reply
"This is an interesting problem. You are right that the TinyMCE editor isn't displaying the page exactly as it shows when displayed by mediawiki. This is because mediawiki ignores the blank line that you have inserted after the picture and before the title. This blank line is not needed, as the effect of the 'none' parameter is that whatever text follows will be displayed on a new line anyway".
I understand it. I just like neatness in the code, so I made one space between the texts and codes. I mean it:
https://images89.fotosik.pl/263/416a238560442a26.png
If I did not make space between content then the source would look like this:
https://images90.fotosik.pl/263/b77218aa8a4c015d.png
"The problem is, if Tinymce hides this blank line then you would not know it is there if you wished to edit it. This might lead to strange results. I could replace the blank line with a placeholder character so that it shows up in TinyMCE editor which would allow it to be edited? This approach is used where a new line is used in a line of wiki text, which mediawiki also ignores".
Do you want to check it out? Does this solution make sense? I have no idea, you are a programmer and what do you think about it?
"Alternatively, you might just remove the blank line after the picture and then both TinyMCE and mediawiki would display the same? In fact, there is a bug in the current code which in effect does exactly this if you save the page without making any changes?"
An empty line, I mean "larger space" is created only if this code is added. Look at the screen, I marked it with a red frame.
https://images91.fotosik.pl/263/9932b9a2b13094dc.png
https://images90.fotosik.pl/263/73c66a11cc952c3d.png Monocero (talk) 08:50, 10 October 2019 (UTC)Reply
I did try the placeholder idea. Because both the image and the title are html 'block' structures anything before or after them shows on a new line, so the placeholder would show up on its own line between the two. This doesn't seem to be any better than what happens now.
The 'larger space' you refer to is just how mediawiki displays an empty line between an image and a title. Try adding a second blank line in your wiki markup between the image and the title and see how it is displayed on the page. It looks larger than an empty line because the mediawiki styling for titles and images includes padding around them.
You ask what I think. As a programmer and an author I think that making everything that's in the wiki-markup available to be edited in the TinyMCE editor is the right thing to do, even if it means there is a slight difference between what is shown in the editor and what is eventually displayed on the page. For my users, this is much preferable to having to author pages in wiki markup.
I think, currently, it is not possible to make the empty line you have between the image and title in the wiki markup available to be edited in the TinyMCE editor without the space displaying. As this compromise only affects authors of pages I think it is acceptable. If you feel differently then I suggest you try out VisualEditor instead, although I don't know if this would fix this issue for you.
Thanks again for trying this extension and bringing this to my attention. I'm sorry at this time I don't have a solution for you.
Duncan

86.164.120.53 (talk) 14:49, 11 October 2019 (UTC)Reply
I understand it. All right. Monocero (talk) 15:38, 11 October 2019 (UTC)Reply
B.T.W., I've added a patch to the master branch that will stop the bug mentioned in my first response, where TinyMCE removes the blank line between the picture and the title. At least this way your formatting in the wiki markup should be preserved. This patch is waiting for review, but you may want to install it straight away if you are using the TinyMCE editor.
Many thanks
Duncan DuncanCrane (talk) 16:40, 13 October 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Other plugins

[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 prefer tinymce instead of Wikieditor etc. !

I found that mw-tinymce uses version 4.6.4 - the official tinymce 4.6.4-dist at github has more plugins like 'code'.

I added (after adding the plugins from the 4.6.4-dist ) to the MW_tinymce.js

'codemirror': extensionAssetsPath + '/TinyMCE/tinymce/plugins/codemirror/plugin.js', which is loaded

But the soucecode is not colored etc. What else must i edit ? Perhaps You can integrate it ..!

  • The same is with the fontawesome-plugin -integration https://github.com/josh18/TinyMCE-FontAwesome-Plugin (or higher versions) Just adding the path to [extensionAssetsPath and adding fontawesome to line 40 brings only the icon but no real function.. <span> and <i> must also preserved...but not in localsetting.php Perhaps You can integrate it too !


( There is also a great smaller skin https://github.com/instructure/tinymce-light-skin/releases) Manbu (talk) 12:21, 27 October 2019 (UTC)Reply

Hi Manbu
Thanks for using this extension and I'm glad you are finding it useful . I should be able to have a look at this a little later in the week and I'll report back if I can find a solution.
Kind regards, Duncan. DuncanCrane (talk) 16:38, 29 October 2019 (UTC)Reply
Hi Again
I had a quick look at the CodeMirror plugin you mention. From what I could see this plugin runs a separate editor called 'CodeMirror' which provides the functionality that you describe. This 'CodeMirror' editor also needs to be installed on your system to get that functionality I believe.
I wasn't sure if you had got the 'CodeMirror' editor to load successfully from the TinyMCE editor? Also I wasn't sure if it is the 'CodeMirror' editor that isn't colouring the source code, or if you want the TinyMCE editor to display text within <code> tags with coloured syntax highlighting?
If your problem is with the 'CodeMirror' editor not colouring the source code, then I think you will need to get in touch with the author of the plugin.
If you want TinyMCE to colour text within <code> tags then I think you need a different plugin to do this, called CodeSample, which is documented here - https://www.tiny.cloud/docs-4x/plugins/codesample/
I also looked at the 'FontAwesome' plugin. I wasn't sure from your description if you had also added the css library for 'FontAwesome' as well as the plugin? The instruction for doing this is in the first line of the example TinyMCE configuration where it says "content_css: https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', noneditable_noneditable_class: 'fa',".
Because 'content_css:' is also used to add other css libraries, such as the one for the mediawiki skin, you will need to add the 'FontAwesome' css library to the 'content_css:' array in MW_tinymce.js rather than replacing what is already there.
The documentation for the 'preserved tags' array is just an example as there are quite a few html tags that could be preserved. A full list can be found here https://meta.wikimedia.org/wiki/Help:HTML_in_wikitext. I suggest that you add any of these you need to the array in your 'LocalSettings' file. If you feel like adding them all to the array then please do update the documentation to include the full ist as I'm sure others may find that useful :-)
I'm not sure if the alternative skin you mention is still maintained and there does appear to be an issue reported on git hub. I'm not sure what the advantage is for using this skin but there is a risk by using a non-standard skin this will increase the maintenance overhead if/when the TinyMCE extension is updated to use later versions of TinyMCE. Otherwise I see no reason why you shouldn't give it a try? If it is functionally equivalent to the standard skin then it should be possible to change MW_tinymce.js to use it. Instructions how to do this can be found here https://www.tiny.cloud/docs-4x/general-configuration-guide/customize-ui/.
Hope these suggestions help? Do let me know how you get on.
Kind regards, Duncan DuncanCrane (talk) 17:49, 31 October 2019 (UTC)Reply
Not quite helpful, because my question was not really answered. I wanted to add a codeeditor (plugin : code) and codemirror for the lines and colors. The mentioned codemirror plugin contains the codemirror in a subdirectory (installation of codemirror as extension does not help - neither fontawesome-extension)
For Html in wikitexts i can allow html and css in the localsettings - there are also some extension for that.
Fa5 has some options like rotate, where i must have direct access to the source code instead of markdown-code.
Beside that i wanted to know how to integrate the fontawesome plugin in the MW_tinymce.js just as the codemirror - the rather complicated syntax. Adding to the tinymce.js has not the wanted effects. ( i will have to make a fork git-repository..) Manbu (talk) 10:40, 3 November 2019 (UTC)Reply
Hi Manbu
I'm sorry if I'm not understanding your questions and maybe my suggestions aren't clear either.
Would you answer the following to help me understand what is happening better?
CodeMirror plugin
  • is the TinyMCE editor extension loading the CodeMirror plugin and are you able to use it?
  • if it is, is the CodeMirror plugin showing lines and colouring correctly?
  • if it is, is the TinyMCE editor extension showing lines and colouring correctly when you exit the CodeMirror plugin?
  • if it is, is Mediawiki showing lines and colouring correctly when you save the page?
FontAwesome plugin
  • is the TinyMCE editor extension loading the FontAwesome plugin and are you able to use it?
  • if it is, is the FontAwesome plugin showing icons correctly?
  • if it is, is the TinyMCE editor extension icons correctly when you select the icon in the FontAwesome dialog?
  • if it is, is Mediawiki showing icons correctly when you save the page?
Would you also let me know what versions of software you are currently using?
Many thanks
Duncan 86.165.29.174 (talk) 16:03, 6 November 2019 (UTC)Reply
Hi Manbu
I did some more investigation on the fontawesome plugin for the TinyMCE extension. In order for it to work properly, mediawiki must also load the fontawesome css file using the mediawiki:common.css page on your wiki.
I also made some changes to the plugin and configuration so that the font is loaded from the plugin directory rather than and external cdn repository. I will upload all the necessary files and changes to the master branch and also update the extension installation page with the instructions how to get mediawiki to load the css in the next day or two.
Meanwhile I'll have a look at the codemirror plugin as well.
Kind regards
Duncan 86.165.114.62 (talk) 13:21, 12 November 2019 (UTC)Reply
The https://github.com/christiaan/tinymce-codemirror contains the codemirror
The https://github.com/josh18/TinyMCE-FontAwesome-Plugin doesnt contain fontawesome woff etc. but wants an entry into tinymce.init({...
content_css: 'https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
These are plugins function with tinymce (hopefully). I am mostly interested where i must change and how ( MW_tinymce.js and others) - but i will try myself Manbu (talk) 15:34, 18 November 2019 (UTC)Reply
Hi Manbu
I added a patch to the TinyMCE extension yesterday which enables the fontawesome plugin. This includes a slightly modified version of the original fontawesome plugin as well as configuration updates for the TinyMCE extension and for the mediawiki install. I'll update the extension documentation later today.
The CodeMirror plugin is a bit more problematic. I got it to load and display the html from the TinyMCE editor window. However, when this is saved back to the TinyMCE editor it is causing changes that affect the source wikicode. A principle of the design of the TinyMCE extension is that, as far as possible, any wikicode is preserved unless it is edited in TinyMCE.
To get CodeMirror to work in this way needs quite a lot of changes to the TinyMCE extension. I am currently working on a new version of the extension where a lot of these changes already exist, so I am reluctant to spend much time on the current version to get this working. However, I hope to include CodeMirror with the new version when it is released.
Thank you for suggesting adding these plugins as I canb see they might be very useful.
Duncan

86.165.28.136 (talk) 14:37, 3 December 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Infinite loop occurred

[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.


Hi Duncan, great work with this extension. Much easier to install than Visual Editor.

I have TinyMCE on a number of my Wikis, I keep getting an "infinite loop occurred error".

I am a private network with no Internet access.

Hopefully, this will show you what the issue is:

<figure-inline class="mw-default-size"></figure-inline>

Any help is appreciated.

Squeak24 (talk) 17:06, 12 November 2019 (UTC)Reply

Hi
I'm glad you are finding this extension useful and thank you for letting me know you have a problem with it. Sorry for the delay in getting back to you!
The code that produces this error is converting html blocks back to wiki code. This is typically things like lists ('ol', 'ul', 'li', 'dl', 'dd', 'dt'), blockquotes, paragraphs, ruled lines or headings.
I wonder if you would mind trying to isolate the text you are inserting to the block that is causing the problem and let me have that so I can reproduce the error and fix it?
From others that have had this problem, I think you may be able to find where the problem is happening. If you use the '<>' button to view the wikicode in the TinyMCE editor and then click 'OK' you should also get the error.
If you then click OK to the error message then I think it may return the text up to the point the error occurred to the TinyMCE editor. You should the be able to user the browser 'inspect' function to view what was returned to the editor and possibly get an idea which contents is giving rise to it.
I should also ask if you have recently downloaded the extension, as this has happened a few times before and may have been fixed if you have an early version of the extension?
Many thanks
Duncan 86.165.114.62 (talk) 16:38, 16 November 2019 (UTC)Reply
Thanks for responding Duncan. No issues on the delay.
I have also found that it does it when inserting images as well. With the viewing the code, it does tend to happen when inserting code such as references using the {{}} button. Sometimes when I click on OK, it just doesn't do anything.
I haven't recently updated the extension, the last time I updated it was in September. It's showing on the Extension page the last update was in February, is that the case, or has it been updated recently?
The generated Wikitext that I was working on is:
Arcu cursus euismod quis viverra nibh cras pulvinar mattis nunc. Vitae elementum curabitur vitae nunc sed velit<ref>a footnote</ref>. Rhoncus [https://gov.uk aenean ]vel elit scelerisque mauris pellentesque. Elit [[pellentesque|pellentesque ]] habitant morbi tristique. Tortor consequat id porta nibh venenatis cras sed felis eget. Nisi scelerisque eu ultrices vitae auctor eu. Mi sit amet mauris commodo. Non tellus orci ac auctor. Hendrerit gravida rutrum quisque non tellus orci. At volutpat diam ut venenatis tellus in metus vulputate eu. Hendrerit gravida rutrum quisque non tellus orci. Adipiscing at in tellus integer feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Dolor morbi non arcu risus quis.</code> [[File:Chrysanthemum.jpg|800px|none|middle|frameless]] {{{!}} class="wikitable" {{!}}- {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}- {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}{{!}}<br /> {{!}}}
Squeak24 (talk) 11:59, 18 November 2019 (UTC)Reply
Hi
Thanks that has helped. Although I haven't been able to reproduce the infinite loop error, I've definitely found something strange going on!
I have a question, if I may? I wasn't sure if you are using the TinyMCE editor in Page Forms, but it looked a bit like you are from your initial image? I tried entering your text into a PF text field that uses the TinyEditor. I did manage to save OK and the page displayed as expected but when I tried to edit it again with PF I got an unmatched brackets error.
The cause seems to be the link '|' characters which are getting replaced with '{|' when the page is saved or something like that.
There have been a few changes since September, my apologies if I haven't been updating the documentation to reflect this. It may be worth downloading the current master - it may solve the infinite loop although I think there are still problems for me to fix.
Many thanks
Duncan 86.164.134.20 (talk) 18:26, 19 November 2019 (UTC)Reply
Hi again
I'm sorry I tried but I'm still having no luck reproducing the infinite loop error. I've tried two different scenarios.
First, I used your text within a form field and it seems to work fine. I can edit, view the source code as wiki text and save without error. If this is your scenario then, as suggested yesterday, it may be worth updating to the latest master branch to see if that fixes the problem?
If I use your text when editing a non-forms page I do get a problem. This is caused by the '{{{!}}' at the start of the table. Currently the extension thinks the first two '{'s mark the start of a template rather than the 2nd and 3rd '{' characters and this means the table isn't recognised. This doesn't cause the infinite loop problem for me but the extension doesn't process the table correctly.
The processing of tables and templates in the current version of the extension is a bit of a cludge! I am currently working on a new version where these will be rewritten but this is a little way off from completion.
In the meantime, there is a couple of things you could try.
Firstly you might avoid using the '{{!}}' template in tables unless the table is a parameter being passed to a template. In this case you have to use '{{!}}' but I believe the fact it is in a template will result in the extension correctly processing it.
Alternatively I can change the extension so that all '{{!}}' calls are converted to '|'characters before the wiki text is converted to html. I've done some testing and this prevents the problem I identified. The downside though is that the '|' characters will not be converted back to '{{!}}' when the page is saved unless the editor is being called from within a form. In this case all '|' characters are converted to ''{{!}}' when the page is saved as one might expect.
I do apologise I haven't found a solution yet but do let me know if this helps or if there is any further information you can give me?
Kind regards
Duncan 86.165.28.136 (talk) 16:31, 20 November 2019 (UTC)Reply
Thanks Duncan, I will download the master to see if that fixes it.
Your help is appreciated. Sorry for the delay in responding, it's been very busy recently!
Gary Squeak24 (talk) 10:57, 27 November 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Error after installation (Invalid server index index #DB_SLAVE)

[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.


Hi all,

after installing TinyMCE as an extension, I am getting an internal error whenever I acces any page of the wiki. When I do not switch on the TinyMCE extension via wfLoad in the LocalSettings.php, the error does not occur. Does anyone have an idea, how I can solve this error?


MediaWiki internal error.

Original exception: [XgDShhsge4LQQHZRjtVHxwAAAgY] /notes/index.php?title=Hauptseite   UnexpectedValueException from line 462 of /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Invalid server index index #DB_SLAVE
Backtrace:
#0 /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php(896): Wikimedia\Rdbms\LoadBalancer->getConnectionIndex(string, array, string)
#1 /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1043): Wikimedia\Rdbms\LoadBalancer->getConnection(string, array, string, integer)
#2 /mnt/web301/a3/52/58651952/htdocs/notes/includes/GlobalFunctions.php(2576): Wikimedia\Rdbms\LoadBalancer->getMaintenanceConnectionRef(string, array, string)
#3 /mnt/web301/a3/52/58651952/htdocs/notes/extensions/TinyMCE/TinyMCE.hooks.php(409): wfGetDB(string)
#4 /mnt/web301/a3/52/58651952/htdocs/notes/extensions/TinyMCE/TinyMCE.hooks.php(271): TinyMCEHooks::enableTinyMCE(Title, RequestContext)
#5 /mnt/web301/a3/52/58651952/htdocs/notes/includes/Hooks.php(174): TinyMCEHooks::addEditSectionLink(SkinVector, Title, string, string, array, Language)
#6 /mnt/web301/a3/52/58651952/htdocs/notes/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#7 /mnt/web301/a3/52/58651952/htdocs/notes/includes/skins/Skin.php(1671): Hooks::run(string, array)
#8 /mnt/web301/a3/52/58651952/htdocs/notes/includes/parser/ParserOutput.php(356): Skin->doEditSectionLink(Title, string, string, Language)
#9 [internal function]: ParserOutput->{closure}(array)
#10 /mnt/web301/a3/52/58651952/htdocs/notes/includes/parser/ParserOutput.php(359): preg_replace_callback(string, Closure, string)
#11 /mnt/web301/a3/52/58651952/htdocs/notes/includes/OutputPage.php(1945): ParserOutput->getText(array)
#12 /mnt/web301/a3/52/58651952/htdocs/notes/includes/OutputPage.php(1960): OutputPage->addParserOutputText(ParserOutput, array)
#13 /mnt/web301/a3/52/58651952/htdocs/notes/includes/page/Article.php(821): OutputPage->addParserOutput(ParserOutput, array)
#14 /mnt/web301/a3/52/58651952/htdocs/notes/includes/actions/ViewAction.php(63): Article->view()
#15 /mnt/web301/a3/52/58651952/htdocs/notes/includes/MediaWiki.php(511): ViewAction->show()
#16 /mnt/web301/a3/52/58651952/htdocs/notes/includes/MediaWiki.php(302): MediaWiki->performAction(Article, Title)
#17 /mnt/web301/a3/52/58651952/htdocs/notes/includes/MediaWiki.php(900): MediaWiki->performRequest()
#18 /mnt/web301/a3/52/58651952/htdocs/notes/includes/MediaWiki.php(527): MediaWiki->main()
#19 /mnt/web301/a3/52/58651952/htdocs/notes/index.php(44): MediaWiki->run()
#20 {main}

Exception caught inside exception handler: [XgDShhsge4LQQHZRjtVHxwAAAgY] /notes/index.php?title=Hauptseite   UnexpectedValueException from line 462 of /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Invalid server index index #DB_SLAVE
Backtrace:
#0 /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php(896): Wikimedia\Rdbms\LoadBalancer->getConnectionIndex(string, array, string)
#1 /mnt/web301/a3/52/58651952/htdocs/notes/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1043): Wikimedia\Rdbms\LoadBalancer->getConnection(string, array, string, integer)
#2 /mnt/web301/a3/52/58651952/htdocs/notes/includes/GlobalFunctions.php(2576): Wikimedia\Rdbms\LoadBalancer->getMaintenanceConnectionRef(string, array, string)
#3 /mnt/web301/a3/52/58651952/htdocs/notes/extensions/TinyMCE/TinyMCE.hooks.php(409): wfGetDB(string)
#4 /mnt/web301/a3/52/58651952/htdocs/notes/extensions/TinyMCE/TinyMCEAction.php(61): TinyMCEHooks::enableTinyMCE(Title, RequestContext)
#5 /mnt/web301/a3/52/58651952/htdocs/notes/includes/Hooks.php(174): TinyMCEAction::displayTab(SkinVector, array)
#6 /mnt/web301/a3/52/58651952/htdocs/notes/includes/Hooks.php(234): Hooks::callHook(string, array, array, NULL, string)
#7 /mnt/web301/a3/52/58651952/htdocs/notes/includes/skins/SkinTemplate.php(1121): Hooks::runWithoutAbort(string, array)
#8 /mnt/web301/a3/52/58651952/htdocs/notes/includes/skins/SkinTemplate.php(447): SkinTemplate->buildContentNavigationUrls()
#9 /mnt/web301/a3/52/58651952/htdocs/notes/includes/skins/SkinTemplate.php(215): SkinTemplate->prepareQuickTemplate()
#10 /mnt/web301/a3/52/58651952/htdocs/notes/includes/OutputPage.php(2574): SkinTemplate->outputPage()
#11 /mnt/web301/a3/52/58651952/htdocs/notes/includes/exception/MWExceptionRenderer.php(134): OutputPage->output()
#12 /mnt/web301/a3/52/58651952/htdocs/notes/includes/exception/MWExceptionRenderer.php(53): MWExceptionRenderer::reportHTML(UnexpectedValueException)
#13 /mnt/web301/a3/52/58651952/htdocs/notes/includes/exception/MWExceptionHandler.php(121): MWExceptionRenderer::output(UnexpectedValueException, integer)
#14 /mnt/web301/a3/52/58651952/htdocs/notes/includes/exception/MWExceptionHandler.php(195): MWExceptionHandler::report(UnexpectedValueException)
#15 /mnt/web301/a3/52/58651952/htdocs/notes/includes/MediaWiki.php(558): MWExceptionHandler::handleException(UnexpectedValueException)
#16 /mnt/web301/a3/52/58651952/htdocs/notes/index.php(44): MediaWiki->run()
#17 {main} 149.172.219.75 (talk) 14:53, 23 December 2019 (UTC)Reply
You're using older version of the extension (for MW 1.33) which uses $dbr = wfGetDB( DB_SLAVE ); on line 409. You should try installing the one for 1.34. to see if it will work. – Ammarpad (talk) 04:56, 25 December 2019 (UTC)Reply
I have the same issue although I am using version 1.34 Silvio Senger (talk) 20:15, 27 December 2019 (UTC)Reply
It's the extension that you should update not MW. – Ammarpad (talk) 04:59, 28 December 2019 (UTC)Reply
I'm using the latest Version (0.3) according to the extension Site (Extension:TinyMCE). Is there any newer?
Thank you for your help. Silvio Senger (talk) 12:22, 28 December 2019 (UTC)Reply
I am afraid you're not, (or probably something weird is happening). Please check the extension's files and copy the entire code from line 407 to 418 in TinyMCE.hooks.php file. – Ammarpad (talk) 17:54, 28 December 2019 (UTC)Reply
Ok, got it. I accidentally used the linked ZIP file inside the text instead of using the link on the right side.
Thanks again for your help! Silvio Senger (talk) 21:42, 29 December 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.