Topic on Extension talk:WYSIWYG

Using CKEditor Alongside Mediawiki (about comments- tag) ✔

7
24.180.6.34 (talkcontribs)

Hello Everyone,

I have a dilemma. Goal: I want users to be able to use XML tags like <comments /> alongside using a WYSIWG editor. Problem: The XML tag is being converted to HTML, but when I open edit again, it doesn't work.

background: I'm using the WYSIWG editor (http://www.mediawiki.org/wiki/Extension:WYSIWYG). I've downloaded comments so users can use comment boxes (http://www.mediawiki.org/wiki/Extension:Comments)


I want to have comment boxes enabled, so I go to my WYSIWG editor, and I click on source, and at the bottom I put <comments /> To put the comment boxes. But when I go back to the WYSIWG editor, it has parsed <comments /> tag and converts it into:

<form name="ChangeOrder" action=""><select name="TheOrder"><option value="0">Sort by date</option><option value="1">Sort by score</option></select></form> Enable comment auto-refresher

<form action="" method="post" name="commentform"> Add your comment <textarea name="comment_text" id="comment" rows="5" cols="64"></textarea>

<input type="button" value="Post comment" class="site-button"></input> </form>


Question/Solution? Is there a way I can get the comment boxes to work alongside the WYSIWYG? I also want to try to special tag for WYSIWG, but it won't let me insert <comments /> as a special tag.

Ciencia Al Poder (talkcontribs)

Apparently, every new extension tag needs to have a special treatment by the WYSIWYG extension

Try to verify that in LocalSettings.php you have the comments extension included before WYSIWYG. If it's already there, I guess it would require modifications in the code to support it

24.180.6.34 (talkcontribs)

In my local settings, I have the comment extension inside of there and I have the WYSIWYG extensions as well.

Are you sure there is no possibility for WYSIWYG editor to ignore special tags?

Riparap (talkcontribs)

The order of extensions listed in LocalSettings.php may have some kind of effect. I do not have comments -extension installed and #6 bundle does not seem to handle <comments> -tag automatically in that case. Based on my test also "empty" <comments allow="Derfel,Jack Phoenix,Misza"></comments> tag will cause problems... plus there may not be any space within allow -definition.

It is not a big issue to make wysiwyg treat <comments> tags as special element always. Main problem is with special.js tag -dialog, it accepts only this kind of tags: <comments allow="xxxx"></comments> and currently it does not know how to parse html element of <comments> into textbox.

I would like to avoid to write different attribute names for each tag in program of tag -dialog. I could make it work using f.ex getAttribute( 'allow' ) but instead I would like to use code like element.attributes[0].nodeName. For some reason it does not work at all for special -element. Does somebody have a solution to this?

Jleezy777 (talkcontribs)

I am on version 1.5.6_0 [B551] using CKEditor 4.4.4 (revision 1ba5105) I am using this : https://www.mediawiki.org/wiki/Extension:WYSIWYG

I have programming knowledge, so I might be able to edit the CKEditor's special.js file to allow <comments /> as a tag, but I have not had much experience with JavaScript.

Where is a good place to start adding more code? I bet there is an easier way though.

Riparap (talkcontribs)

Solution using something like "element.attributes[0].nodeName" would be nice to have but I could not make it work. Wysiwyg of #6 is now using special attribute to pass attribute names to tag-dialog. This is anyway better way than predefined fixed list of attributes (which has been removed at ~23.11.14).

#6 bundle is stored in github. F.ex other persons have contributed to it so that they have cloned repository of #6 in github, created new branch there for fix and finally created pull request for the fix in github, which I have then been able to merge into #6.

Riparap (talkcontribs)

Based on test I did, it seems that it does not matter in which order extensions are defined in file LocalSettings.php. F.ex I had hovergallery extension defined as last in LocalSettings.php way below definitions of wysiwyg extension and hovergallery extension was recognized by wysiwyg. So it seems that wysiwyg, at least on some level, is aware of all extensions automatically no matter in what order they have been declared.

Wysiwyg (<nowki>#6</nowiki> bundle) treats all "unknown" simple mediawiki tags as special element as long as extension producing it is installed in MW. Editing these tags should now be possible with tag -dialog. Attributes of these tags, if any, should be recognized automatically.

I made few modifications with #6 because of comments -extension. It should now support definitions of comments -tag but it is not fully compatible.

These can be inserted using tag -dialog:

  • <comments allow="derfel,jack" voting="plus"></comments>
  • <comments allow="derfel,jack"></comments>
  • <comments></comments>
  • <comments allow="Derfel,Jack Phoenix,Misza" voting="plus"></comments>[1]


At this moment tag -dialog will not allow this:

  • <comments />


  1. About spaces in attributes of comments -tag: This is allowed by tag -dialog but was earlier corrupted when page was reopened for editing in wysiwyg because of space inside allow -attribute. This has been fixed in #6 bundle (~24.11.14).
Reply to "Using CKEditor Alongside Mediawiki (about comments- tag) ✔"