Le 06/01/07, bertrand Gugger<bertrand@toggg.com> a écrit :
Bonjour,
Il y a déjà les textarea auto extensibles.
De façon générale, hors de question pour moi de transformer Crayons en
un monstre plein de gadgets inutiles. Ça n'est pas un jeu. Je trouve
déjà que les ajouts de Gilles n'on rien à faire là.
Il n'est pas question de transformer Crayons en monstre plein de
gadgets, mais de permettre à l'utilisateur de personaliser ce plugin
pour le rendre conforme à ce qu'il veut en faire : par exemple,
certains peuvent apprécier d'avoir un changement de fond pastel lors
du passage souris sans savoir même modifier la CSS (et sans savoir que
c'est possible). Un cas concret est celui de John qui compte utiliser
Crayons dans le cadre d'un handicap mental : ici le fait de repérer
facilement les éléments éditables est un plus -- alors que d'autres
situation ça peut vite saouler..
A mes yeux pour Crayons en particulier (et pour d'autres certainement
aussi) il y a la fonctionalité et l'intégration au site. C'est cette
dernière partie qui, à mes yeux, pèche actuellement.. Il faudrait
avoir la personalisation du plugin, avec une interface d'activation /
désactivation claire, paramétrable pour chaque utilisateur par
cookie..
On peut aussi imaginer de sortir les personnalisations du traitement
principal, en mettant tout ce qui est en option dans des thèmes. Mais
ça me semble un peu prématuré car il n'existe pas actuellement de
possibilité de greffer des éléments externes à Crayons.
.Gilles
--
--
toggg
Théophile Helleboid - Chtitux wrote:
> Bonjour à tous,
> En cherchant le web, je suis tombé sur une boîte de texte avec une
> poignée en bas qui permet de l'agrandir par le bas.
> je me suis dit que ça pourrait être utile pour crayons, et j'ai adapté
> le script.
> Ça marche sur Firefox (tous les geckos), et Konqueror (j'ai pas testé
> les autres).
>
> C'est donc la reprise d'un fichier de javascript d'un thème de
> dotclear, sous GPL (je me suis promis de remercier et mailer l'auteur
> du thème).
>
> Ci joint; le patch, qui est dispo sur la zone :
> http://trac.rezo.net/trac/spip-zone/attachment/ticket/561/crayons-resizable.diff#preview
>
> Gilles me prévient qu'on pourrait faire une option pour
> activer/désactiver cette partie.
> Je suis cependant trop pressé pour l'écouter, mais promis, demain, j'y
> pense 
>
> Baille (déjà 00h30 !)
> ------------------------------------------------------------------------
>
> Index: images/resizer.png
> ===================================================================
> Impossible d'afficher : fichier considéré comme binaire.
> svn:mime-type = application/octet-stream
>
> Modification de propriétés sur images/resizer.png
> ___________________________________________________________________
> Nom : svn:mime-type
> + application/octet-stream
>
> Index: crayons.css
> ===================================================================
> --- crayons.css (révision 8540)
> +++ crayons.css (copie de travail)
> @@ -38,3 +38,10 @@
> .crayon-edit, .crayon-pencil, .crayon-img-changed {
> cursor: pointer;
> }
> +.jstHandle {
> + background:transparent url("images/resizer.png") no-repeat scroll 45%;
> + cursor:s-resize;
> + font-size:0.1em;
> + height:16px;
> + width:100%;
> +}
> \ Pas de fin de ligne à la fin du fichier
> Index: tetecrayons.php
> ===================================================================
> --- tetecrayons.php (révision 8540)
> +++ tetecrayons.php (copie de travail)
> @@ -53,6 +53,7 @@
> function Crayons_preparer_page($page, $droits, $wdgcfg = array()) {
>
> $jsFile = find_in_path('crayons.js');
> + $resizeJS = find_in_path('resize.js');
> $cssFile = find_in_path('crayons.css');
> $config = var2js(array(
> 'imgPath' => dirname(find_in_path('images/pencil.png')),
> @@ -103,6 +104,7 @@
> <link rel="stylesheet" href="{$cssFile}" type="text/css" media="all" />
> {$inclure_jquery}
> <script src="{$jsFile}" type="text/javascript"></script>
> +<script src="{$resizeJS}" type="text/javascript"></script>
> <script type="text/javascript">
> var configCrayons = new cfgCrayons({$config});
> </script>
> Index: resize.js
> ===================================================================
> --- resize.js (révision 0)
> +++ resize.js (révision 0)
> @@ -0,0 +1,88 @@
> +/* ***** BEGIN LICENSE BLOCK *****
> + * This file is part of DotClear.
> + * Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All
> + * rights reserved.
> + *
> + * DotClear is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * DotClear is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with DotClear; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + *
> + * ***** END LICENSE BLOCK *****
> +*/
> +
> +function jsToolBar(textarea) {
> + if (!document.createElement) { return; }
> +
> + if (!textarea) { return; }
> +
> + if ((typeof(document["selection"]) == "undefined")
> + && (typeof(textarea["setSelectionRange"]) == "undefined")) {
> + return;
> + }
> +
> + this.textarea = textarea;
> +
> + this.editor = document.createElement('div');
> + this.editor.className = 'jstEditor';
> +
> + this.textarea.parentNode.insertBefore(this.editor,this.textarea);
> + this.editor.appendChild(this.textarea);
> +
> + this.toolbar = document.createElement("div");
> + this.toolbar.className = 'jstElements';
> + this.editor.parentNode.insertBefore(this.toolbar,this.editor);
> +
> + // Dragable resizing (only for gecko)
> + if (this.editor.addEventListener)
> + {
> + this.handle = document.createElement('div');
> + this.handle.className = 'jstHandle';
> + var dragStart = this.resizeDragStart;
> + var This = this;
> + this.handle.addEventListener('mousedown',function(event) { dragStart.call(This,event); },false);
> + // fix memory leak in Firefox (bug #241518)
> + window.addEventListener('unload',function() {
> + var del = This.handle.parentNode.removeChild(This.handle);
> + delete(This.handle);
> + },false);
> +
> + this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling);
> + }
> +
> + this.context = null;
> + this.toolNodes = {}; // lorsque la toolbar est dessinÃ(c)e , cet objet est garni
> + // de raccourcis vers les Ã(c)lÃ(c)ments DOM correspondants aux outils.
> +}
> +
> +/** Resizer
> +-------------------------------------------------------- */
> +jsToolBar.prototype.resizeSetStartH = function() {
> + this.dragStartH = this.textarea.offsetHeight + 0;
> +};
> +jsToolBar.prototype.resizeDragStart = function(event) {
> + var This = this;
> + this.dragStartY = event.clientY;
> + this.resizeSetStartH();
> + document.addEventListener('mousemove', this.dragMoveHdlr=function(event){This.resizeDragMove(event);}, false);
> + document.addEventListener('mouseup', this.dragStopHdlr=function(event){This.resizeDragStop(event);}, false);
> +};
> +
> +jsToolBar.prototype.resizeDragMove = function(event) {
> + this.textarea.style.height = (this.dragStartH+event.clientY-this.dragStartY)+'px';
> +};
> +
> +jsToolBar.prototype.resizeDragStop = function(event) {
> + document.removeEventListener('mousemove', this.dragMoveHdlr, false);
> + document.removeEventListener('mouseup', this.dragStopHdlr, false);
> +};
> Index: action/crayons_html.php
> ===================================================================
> --- action/crayons_html.php (révision 8540)
> +++ action/crayons_html.php (copie de travail)
> @@ -198,10 +198,20 @@
> $type = is_array($spec) ? $spec[$champ]['type'] : $spec;
> switch ($type) {
> case 'texte':
> - $input = '<textarea class="crayon-active"'
> + $input = '
> +<textarea style="width:100%;" id="c_content" class="crayon-active"'
> . ' name="content_'.$this->key.'_'.$champ.'">'
> . entites_html($val)
> - . '</textarea>'."\n";
> + . '</textarea>
> +<script type="text/javascript">
> +//<![CDATA[
> +if (document.getElementById) {
> + if (document.getElementById(\'c_content\')) {
> + var commentTb = new jsToolBar(document.getElementById(\'c_content\'));
> + }
> +}
> +//]]>
> +</script>'."\n";
> break;
> case 'ligne':
> default:
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> spip-zone@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone
>
_______________________________________________
spip-zone@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone