Topic on Extension talk:WYSIWYG

Image captions editable in WYSIWYG

Varlin (talkcontribs)

Hi. I was able to add this feature to my wiki (after I asked for help). You can check here how it works :

NOTE that it is not possible to add links in the caption (the parser breaks it) but this is not specific to this feature.

HOW TO DO IT ? Well, I can give you the two files (this one and this one) that have been modified, but I have not kept precise information about which lines precisely have been changed... I should compare with last version on github (because my files are differents due to some tweaks I made) and make the commits, but I think I'll never have the time. Anyway, I hope it will be useful to someone.

NOTE that the mediawiki/plugin.js file in the link above is also affected by changes related to this tweak.

Riparap (talkcontribs)

Great work.

It looks like this will convert all images to have option "frame" always. This will make it impossible to adjust size of image in document (Help:Images).

I was trying to tweak it but could not quite understand everything it is doing. F.ex. what is purpose of editor.document.getBody().on( 'keyup' ..'click'..'mouseup'..'drop' ..'afterCommandExec' triggers, are they all really needed or are some of them result of your tests?

It also leaves html code (div- block) in wikitext, I am tying to fix this by jumping over div- tags with class 'capturedImage' and rejecting div tags with class 'imageLegend'.

Riparap (talkcontribs)

I have been trying to convert <div> + <img>image + <div>caption as widget. It looks like this <div> which is used to wrap everything together makes it impossible to have image as inline element (f.ex image in the middle of line).

I am just wondering if there is a way to make <div> to behave like <span>?

...I have tried display:inline + clear:both with styles but for some reason it does work. It looks like <span> tag has to be used when image needs to be inline element....but this will then require various modifications with image.js dialog when alignment related settings are changed.

Varlin (talkcontribs)

Yes I wanted a really simple behavior : either a frame with a caption, either nothing. I don't have the use of other options like thumbnails etc.

I'm sorry I don't have the answer to your questions, since I did not implement that part of the code myself (too complicated for me)...

Reply to "Image captions editable in WYSIWYG"