Page MenuHomePhabricator

FCKeditor extension (WYSIWYG): new hook needed
Closed, DeclinedPublic

Description

Author: w.walc

Description:
adds new hook to Sanitizer

Overview:

FCKeditor extension uses it's own parser in Ajax calls to convert wiki text into HTML.
This customized parser actually simply extends MediaWiki parser by overriding original methods and modifies the way how text is parsed (e.g it does not perform template substitution, keeps HTML comments).

There is one problem with templates (reported here: http://dev.fckeditor.net/ticket/2069).

The problem:

Suppose we have:

{|{{Prettytable}}

-
{{Hl2}}Cell 1
{{Hl2}}Cell 2
}

FCKeditor extension converts {{Prettytable}} to unique string identificator before sending text to internalParse(). This uniqueid is unfortunately later stripped by Sanitizer::fixTagAttributes().
I have already fixed the FCKeditor extension - adding SanitizerAfterFixTagAttributes hook allows me to add back required text to $attribs array, but the problem is that now users must apply manual changes in the MediaWiki core in order to have it fixed.

It would be great if this hook (SanitizerAfterFixTagAttributes) could be added to the core in MediaWiki 1.13.


Version: 1.13.x
Severity: enhancement
URL: http://dev.fckeditor.net/ticket/2069

attachment SanitizerAfterFixTagAttributes.patch ignored as obsolete

Details

Reference
bz13821

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:10 PM
bzimport set Reference to bz13821.

w.walc wrote:

same as previous, corrected indentation

Attached:

Reverted in r33747. This seems like a really bad place to put such a hook, and it's ugly and weird to boot.

w.walc wrote:

Ok, how about adding a hook at the end of Sanitizer::setupAttributeWhitelist()? Does it sound better?
It seems that this function is called only once by Sanitizer. Other users could possibly disallow some unwanted attributes with this hook.

With this hook I could change the $whitelist array a little bit, add another "fake" attribute to each element and pass unique id of a template definition.
All I need to do is to tell MediaWiki to not strip some fake attributes.

A basic issue is that this is some global state... are you conditionally switching in this hook conditionally for special processing or is it always going to go to general HTML output?

w.walc wrote:

Yes, this is a hook that could be enabled only in specific cases (when ajax call is requested by FCKeditor and wfSajaxWikiToHTML command is executed), I must admit that didn't think about that.
So, this hook wouldn't be used on each page request.

Assigned: Andrew. Hope he can bring this to a satisfactory close.

Changing File/Repo ==> General/Unknown...definitely not a File/Repo issue.

Closing this bug as there doesn't seem to be a satisfactory resolution.