forked from spip/porte_plume
Browse Source
En théorie onAjaxLoad s'applique sur le contenu ajax chargé. En pratique, il y a un petit bug qui fait que si on édite une modale ajax, onAjaxLoad s'applique sur tout le document, ce qui fait recalculer toutes les hauteurs de textarea dans ce cas là (exemple : éditer / ajouter un document lors de l'édition d'un article). Il faudrait corriger ce point.3.1 v1.15.10

2 changed files with 11 additions and 8 deletions
@ -1,24 +1,27 @@
|
||||
function barre_forcer_hauteur () { |
||||
jQuery(".markItUpEditor").each(function() { |
||||
jQuery(".markItUpEditor", this == window ? null : this).each(function() { |
||||
var hauteur_min = jQuery(this).height(); |
||||
var hauteur_max = parseInt(jQuery(window).height()) - 200; |
||||
var hauteur = hauteur_min; |
||||
|
||||
|
||||
var signes = jQuery(this).val().length; |
||||
if (signes){ |
||||
/* en gros: 400 signes donnent 100 pixels de haut */ |
||||
var hauteur_signes = Math.round(signes / 4) + 50; |
||||
if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max)
|
||||
if (hauteur_signes > hauteur_min && hauteur_signes < hauteur_max) { |
||||
hauteur = hauteur_signes; |
||||
else
|
||||
if (hauteur_signes > hauteur_max)
|
||||
} else { |
||||
if (hauteur_signes > hauteur_max) { |
||||
hauteur = hauteur_max; |
||||
|
||||
} |
||||
} |
||||
|
||||
jQuery(this).height(hauteur); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
jQuery(window).bind("load", function() { |
||||
jQuery(window).on("load", function() { |
||||
barre_forcer_hauteur(); |
||||
onAjaxLoad(barre_forcer_hauteur); |
||||
}); |
||||
|
Loading…
Reference in new issue