Extension talk:TinyMCE

Jump to navigation Jump to search

About this board

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

10
Summary by DuncanCrane

Partial fix, see comments for detail

Monocero (talkcontribs)

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?

86.139.55.197 (talkcontribs)

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

Monocero (talkcontribs)

At my computer two screens from imgur are displayed correctly. I use MediaWiki 1.32.0 and TinyMCE 0.3 latest version.

DuncanCrane (talkcontribs)

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

Monocero (talkcontribs)

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.

86.139.55.197 (talkcontribs)

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

Monocero (talkcontribs)

"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

86.164.120.53 (talkcontribs)

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


Monocero (talkcontribs)

I understand it. All right.

DuncanCrane (talkcontribs)

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

TinyMCE editor not displayed

8
Summary by DuncanCrane

Fix added to master branch

Loman87 (talkcontribs)

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

DuncanCrane (talkcontribs)

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)

Loman87 (talkcontribs)

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


190.90.156.130 (talkcontribs)

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.

86.139.55.197 (talkcontribs)

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

Loman87 (talkcontribs)

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

86.164.120.53 (talkcontribs)

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

Hi Lorenzo, great that Yaron had already provided a fix. I'll mark as resolved

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

9
Summary by DuncanCrane

Fix added to master

Squeak24 (talkcontribs)

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)

Squeak24 (talkcontribs)
Squeak24 (talkcontribs)

Sorry, I tried it, and it still comes up with the same error.

Squeak24 (talkcontribs)

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.

Yaron Koren (talkcontribs)

Is this in a regular form field, or the "free text"?

Squeak24 (talkcontribs)

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.

DuncanCrane (talkcontribs)

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)

DuncanCrane (talkcontribs)

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)

DuncanCrane (talkcontribs)

Patch now merged with master branch DuncanCrane (talk) 10:21, 16 June 2019 (UTC)

Text area/existing text not showing

6
Summary by DuncanCrane

Fix added to master branch

Tommyheyser (talkcontribs)

I've just installed the extension and added the patch for WikiEditorHooks.php. The wiki is still new and doesn't have much content so on most pages with existing text, TinyMCE and rich text are showing up fine. On at least one page though, which has a Heading 2 text and some normal text, TinyMCE shows up but the text entry area is blank. I can enter text, but whatever I typed doesn't get added to the page.

Not sure if it's relevant, but I'm running MW 1.31.1 with SMW 3.0.0, on IIS 8.5 running on Windows Server 2012 R2. I'm accessing the wiki via Chrome 70 on macOS 10.14.1.

DuncanCrane (talkcontribs)

Hi Tommy

Apologies for the delay replying, this page somehow dropped off my watchlist. Would it be possible to copy the wikitext from the page (using the standard editor) and pasting it here as I've not been able to reproduce the problem.

Many thanks, Duncan DuncanCrane (talk) 16:38, 22 November 2018 (UTC)

Jack.f.13 (talkcontribs)

Hi,


I would like to add that I am also having this same issue. Fresh install of Mediawiki using XAMPP and freshly installed TinyMCE but whenever I attempt to edit a page after creation, nothing appears in the text entry field. If I hit preview post, changes aren't shown and trying to view the code in the source code section >< nothing appears there either. I can normally create pages fine using TinyMCE but editing is where the issue lies.

Jack.f.13 (talkcontribs)

I would like to add, I managed to resolve this issue by rolling back and using the last release version (not current) seems to be a bug with the latest version

Julz711 (talkcontribs)

Hi,

I am having the same issue. I tested which text would make the editor window appear blank. For me it happend only when the last thing was a headline, not followed by standard paragraph text. E.g. if a source code of a page only contains

=Test=

the editor window would be blank. If it contains

=Test=
Test

everything would work just fine. I hope this helps.

DuncanCrane (talkcontribs)

Hi Julz, Jack and Tommy I tried the content suggested by Julz and couldn't reproduce the error. I think I may have resolved this when fixing another problem, but if you still find you get the same thing, please let me know. Thank you all for trying this extension. DuncanCrane (talk) 08:56, 20 June 2019 (UTC)

The file does not exist on this wiki.

2
Summary by DuncanCrane

Fix added to the master branch

Leshespes (talkcontribs)

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

DuncanCrane (talkcontribs)

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)

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

2
Summary by DuncanCrane

Fix suggested by Hermann has been added to master branch

HermannSchwärzler (talkcontribs)

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").

DuncanCrane (talkcontribs)

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)

Bug wrt external links containing underscores ("_")

5
Summary by DuncanCrane

Change suggesed by Hermann has been added to the master branch

HermannSchwärzler (talkcontribs)

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?

DuncanCrane (talkcontribs)

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)

89.246.165.171 (talkcontribs)

We are still facing the same problem with the currently available version.

DuncanCrane (talkcontribs)

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

86.164.120.53 (talkcontribs)

Hi Hermann - it should now be available in the master code.

89.246.165.171 (talkcontribs)

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.

DuncanCrane (talkcontribs)

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

This post was hidden by Krunalb (history)
Krunalb (talkcontribs)

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.

86.164.120.53 (talkcontribs)

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

Reply to "JS Error infinite loop"

Tabular presentation lost after source edits in Page Forms

2
Cavila (talkcontribs)

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.


DuncanCrane (talkcontribs)

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

Reply to "Tabular presentation lost after source edits in Page Forms"

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

2
89.246.165.2 (talkcontribs)

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

DuncanCrane (talkcontribs)

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

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