Patch for CKeditor.body.php to make it work in MW 1.18
Yes it works, but in my wikis I got a problems. I use "pretty URLs" like Wikipedia does ... and all the internal (wiki) links are broken after an edit.
I don't use pretty URL and my internal links are broken too.. and replaced by "RTENOTITLE"
Hi there,
please provide more details about this, i.e. WYSIWYG version, SMW, MW versions etc.
Does this happen in all browsers?
Does this happen to links with labels or without?
Thanks for reporting this, your feedback is important!
I have got the same problem with RTENOTITLE. It happens with mediawiki 1.18 and this extension, but also with the FCKeditor extension. WYSIWYG version 1.6.0, mediawiki 1.18 which has been upgraded from a 1.17.
All the internal links with or without labels are modified... Example: [[Link title]] -> [[/mediawiki-1.18.0/index.php?title=Link_title&action=edit&redlink=1|RTENOTITLE]]
And if I switch a lot between classic editor and WYSISYG, I obtain much bigger things like : "[[/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=Link_title&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1]]"
It happens the same with a link and a label, except that the label is kept instead of RTENOTITLE.
Tested in Chrome and Firefox.
I just realised that the modification seem to happen when the wikisyntax is *loaded* into the page, not when is submitted/saved or loaded into the editor component. I have traced back through the javascript and it seems like the php code at CKeditorParser.body.php overrides the replaceInternalLinks method and always converts internal links. I don't have time to dig further until later, but this is the only place in all the code where something is replaced by RTENOTITLE. It seems that this is a somewhat too indiscriminate conversion to always make.
function replaceInternalLinks($text) {
$text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "RTENOTITLE", $text); // #2223: () => RTENOTITLE
$text = preg_replace("/\[\[:(.*?)\]\]/", "RTECOLON$1", $text); // change ':' => 'RTECOLON' in links
$text = parent::replaceInternalLinks($text);
$text = preg_replace("/\|RTENOTITLE\]\]/", "]]", $text); // remove unused RTENOTITLE
return $text;
}