Page MenuHomePhabricator

Requesting hook to affect preview text
Closed, DeclinedPublic

Description

Author: achuggard

Description:
There are pages that I would like to write an extension to create custom display
wrappers for specific pages (i.e. syntax highlighting for source code articles),
however it's close to impossible to pull and wrap the preview text.

by inserting:
wfRunHooks('EditPageBeforePreview',array(&$this,&$toparse));
at line 1384 of EditPage.php, 1.8alpha (r15811), it would be possible to wrap
preview text with the same or similar wrappers as one would do on view or edit.

This solves most of the problems for such an extension (see url). The only
remaining problem is how to implement the wrapper for when the cache occurs on
save without saving the wrapper in the database.


Version: unspecified
Severity: enhancement
URL: http://cirl.missouri.edu/downloads/CIRLCustom/HighlightCode.php

Details

Reference
bz6812

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:16 PM
bzimport set Reference to bz6812.
bzimport added a subscriber: Unknown Object (MLST).

shorlbeck wrote:

I agree that this hook really needs to be added. FCKeditor, for example, extends the EditPage class and adds two custom hooks: 'EditPageBeforePreviewText' and 'EditPageBeforePreviewTextEnd', but extending the class isn't always an option, and I know my extensions would be so much easier to write/manage if these hooks were available. I am sad to see this was proposed in 2006 but nothing has been done about it still. With 1.13.0 almost out, I would be overjoyed to see it make it in there at the very last minute (but I won't hold my breath).

sumanah wrote:

I'm getting a 404 when I visit http://cirl.missouri.edu/downloads/CIRLCustom/HighlightCode.php -- therefore, removed the "patch" & "need-review" keywords.

Scott, Charlie, how do you feel about MediaWiki's current editor extensions? Is this request still something you want/need?

achuggard wrote:

To be honest Sumana, I haven't looked at the Mediawiki codebase too closely in almost 3 years now. I'm know it was something I really wanted between 1.8 and 1.13... but I could not say if it is still needed.

shorlbeck wrote:

Hi Sumana, sorry for the slow reply. I haven't been working on any Mediawiki projects for a long time now, but I do recall that it would have been very helpful to have that hook added. I jumped through a lot of hoops in order to implement a solution that COULD have been very quick and easy with this hook. So while I personally have no need for it now, I am sure there are other developers who would really benefit from it.

Is this still an issue? It has been years since there has been any comment here and I know a lot of things have changed from 1.19 to 1.22.

(In reply to Technical 13 from comment #5)

Is this still an issue? It has been years since there has been any comment
here and I know a lot of things have changed from 1.19 to 1.22.

Are these hooks sufficient:

  • EditPageGetPreviewContent
  • AlternateEditPreview

?

No replies to comment 4 and comment 6, hence assuming that the hooks listed in comment 6 are sufficient.