From 27818908328f9bb83ebd9cea07576b342b32fd2c Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sat, 22 May 2010 14:34:08 -0500 Subject: [PATCH] Updated Sanitizer for HTML5 Sanitizer should recognize HTML elements and attributes. New Allowed Elements: article aside audio canvas command details dialog figcaption figure footer header hgroup mark meter nav progress rp rt ruby section source summary time video war (OK, audio and video were already there) New Allowed Attributes: autocomplete contenteditable contextmenu draggable formaction icon low max min open optimum pattern placeholder preload pubdate required reversed spellcheck step wrap Attributes removed: abbr charset loopcount loopend loopstart noshade nowrap rev rules Maruku supports @start and @reversed on ordered lists. It doesn't seem to support IALs on li elements, so you still can't attach @value to an li. --- lib/sanitizer.rb | 34 +++--- public/svg-edit/editor/images/node_clone.png | Bin 0 -> 571 bytes public/svg-edit/editor/images/node_delete.png | Bin 0 -> 589 bytes .../svg-edit/editor/images/svg_edit_icons.svg | 26 +++- public/svg-edit/editor/locale/lang.fr.js | 59 ++++----- public/svg-edit/editor/locale/lang.nl.js | 55 +++++---- public/svg-edit/editor/svg-editor.js | 21 ++-- public/svg-edit/editor/svgcanvas.js | 113 ++++++++++-------- .../maruku/lib/maruku/output/to_html.rb | 4 +- 9 files changed, 175 insertions(+), 137 deletions(-) create mode 100755 public/svg-edit/editor/images/node_clone.png create mode 100755 public/svg-edit/editor/images/node_delete.png diff --git a/lib/sanitizer.rb b/lib/sanitizer.rb index d5052b94..43e69b40 100644 --- a/lib/sanitizer.rb +++ b/lib/sanitizer.rb @@ -10,12 +10,14 @@ module Sanitizer require 'stringsupport' require 'set' - acceptable_elements = Set.new %w[a abbr acronym address area audio b big blockquote br - button caption center cite code col colgroup dd del dfn dir div dl dt - em fieldset font form h1 h2 h3 h4 h5 h6 hr i img input ins kbd label - legend li map menu ol optgroup option p pre q s samp select small span - strike strong sub sup table tbody td textarea tfoot th thead tr tt u - ul var video] + acceptable_elements = Set.new %w[a abbr acronym address area article aside + audio b big blockquote br button canvas caption center cite code + col colgroup command dd del details dfn dialog dir div dl dt + em fieldset figcaption figure font footer form h1 h2 h3 h4 h5 h6 header + hgroup hr i img input ins kbd label legend li map mark menu meter nav + ol optgroup option p pre progress q rp rt ruby s samp section select small + source span strike strong sub summary sup table tbody td textarea tfoot + th thead time tr tt u ul var video wbr] mathml_elements = Set.new %w[annotation annotation-xml maction math merror mfrac mfenced mi mmultiscripts mn mo mover mpadded mphantom mprescripts mroot @@ -28,15 +30,15 @@ module Sanitizer line marker mask metadata missing-glyph mpath path pattern polygon polyline radialGradient rect set stop svg switch text textPath title tspan use] - acceptable_attributes = Set.new %w[abbr accept accept-charset accesskey action - align alt axis border cellpadding cellspacing char charoff charset - checked cite class clear cols colspan color compact controls coords datetime - dir disabled enctype for frame headers height href hreflang hspace id - ismap label lang longdesc loop loopcount loopend loopstart - maxlength media method multiple name nohref - noshade nowrap poster prompt readonly rel rev rows rowspan rules scope - selected shape size span src start style summary tabindex target title - type usemap valign value vspace width xml:lang] + acceptable_attributes = Set.new %w[accept accept-charset accesskey action + align alt autocomplete axis border cellpadding cellspacing char charoff + checked cite class clear cols colspan color compact contenteditable contextmenu + controls coords datetime dir disabled draggable enctype for formaction frame + headers height href hreflang hspace icon id ismap label lang longdesc loop low + max maxlength media method min multiple name nohref open optimum pattern placeholder + poster preload pubdate readonly rel required reversed rows rowspan spellcheck scope + selected shape size span src start step style summary tabindex target title + type usemap valign value vspace width wrap xml:lang] mathml_attributes = Set.new %w[actiontype align close columnalign columnlines columnspacing columnspan depth display @@ -73,7 +75,7 @@ module Sanitizer xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space xmlns xmlns:xlink xmlns:se y y1 y2 zoomAndPan] - attr_val_is_uri = Set.new %w[href src cite action longdesc xlink:href xml:base] + attr_val_is_uri = Set.new %w[href src cite action formaction longdesc xlink:href xml:base] svg_attr_val_allows_ref = Set.new %w[clip-path color-profile cursor fill filter marker marker-start marker-mid marker-end mask stroke] diff --git a/public/svg-edit/editor/images/node_clone.png b/public/svg-edit/editor/images/node_clone.png new file mode 100755 index 0000000000000000000000000000000000000000..2187d07395fc87f0a6e7c463e026f510eab15ff2 GIT binary patch literal 571 zcmV-B0>u4^P)y zPe_w-7{@;Ykz}w6f*k~@$kL3WTeZbN$U`KFj@H4wYlmWX3Zw{j@zNjNyH=r)EDv+S=qGcHOO1xYi$C31YIsW64oR|2{}EX1yHb3!2ys!&&y5tB88WK z2_97^2s(nNtKFvNqMgSxW5tHk-$homLi)8LxTha9D(VV;e>j^0$=Cc%4P%Q1lKMoe?t|9V3^(VD zaQu442B~THdkfU&w5MkH&|GhiX&K8yui`prOg#iO)rgb_v;)*K@Fa1}w2b9+E+#W) zT&Q_lP(7`>OTRwUkNlk9+dpGpdU4V%IN(==aV`8wiD%l@p7`{tpWFXcKxcVdlJl<; zhjq(6!FnB{PlXl1Z7tHQxO)PCHl5*wo)OV3+cgZTb62od>o-@)PHm~x|5*S4002ov JPDHLkV1kIN1PTBE literal 0 HcmV?d00001 diff --git a/public/svg-edit/editor/images/node_delete.png b/public/svg-edit/editor/images/node_delete.png new file mode 100755 index 0000000000000000000000000000000000000000..ea3f7e6876102e856758a807d663ea161b1f0764 GIT binary patch literal 589 zcmV-T0pt|>%D9ik}z&l|QDn^64 zK|8(0cdHFc^UO)SQJy-@fGWKUv@6MqgbM4G7C=oU&kGI-j+OZ46SN3+xqDT??8mCQ73hQ?MZdVYvGiIno3RuWYGzd%m`aRiswz?TF^;~C?u zWgE*0+f;C1bb@9@snsn|RY|-k(pwY>{evI3G9Bj<8FM9Jn~K{;d|j|aBvKUlgU@uf zy111w2R4Kk0zN^?jSSa@=eLKmpIWS^`BmKLFBcyb$ibHrDDU^{;`lRd>seH5^zpbS zxM0a_c#^z*{hr)NaOk;c(v5NggT?>6wsrO;(~ff|8eNTS@jJa$5AK!|ND3AN%~slI zk4<&u4n(F@F}9eE9l4oZ_62g^sA(=I5D-*bX`|iB7`cRPsxQ?Q1JxInZ^O7dgXxYo z7mwTK{j$N;TWKGtF8a3nyo+15(dPvoV831v(U-vR&##9gseJ!*msdDYqaYJna9=~; zWL^hDlkdF20UC9U*`nw6yTmDtco*2A6NHuh9eAWg_9*0C0H9u1xuo|5^?|*52-@mx bV6)CI)O}%VinA1j00000NkvXXu0mjfb&C=! literal 0 HcmV?d00001 diff --git a/public/svg-edit/editor/images/svg_edit_icons.svg b/public/svg-edit/editor/images/svg_edit_icons.svg index 20a06612..f5e22ade 100644 --- a/public/svg-edit/editor/images/svg_edit_icons.svg +++ b/public/svg-edit/editor/images/svg_edit_icons.svg @@ -946,6 +946,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/public/svg-edit/editor/locale/lang.fr.js b/public/svg-edit/editor/locale/lang.fr.js index ab03da9f..de8e2302 100644 --- a/public/svg-edit/editor/locale/lang.fr.js +++ b/public/svg-edit/editor/locale/lang.fr.js @@ -4,7 +4,7 @@ {"id": "circle_cx", "title": "Changer la position horizontale cx du cercle"}, {"id": "circle_cy", "title": "Changer la position verticale cy du cercle"}, {"id": "circle_r", "title": "Changer le rayon du cercle"}, -{"id": "connector_no_arrow", "textContent": "No arrow"}, +{"id": "connector_no_arrow", "textContent": "Sans flèches"}, {"id": "copyrightLabel", "textContent": "Powered by"}, {"id": "cornerRadiusLabel", "title": "Changer le rayon des coins du rectangle"}, {"id": "curve_segments", "textContent": "Courbe"}, @@ -23,6 +23,7 @@ {"id": "icon_medium", "textContent": "Moyenne"}, {"id": "icon_small", "textContent": "Petite"}, {"id": "icon_xlarge", "textContent": "Super-Grande"}, +{"id": "idLabel", "title": "Identifier l'élément"}, {"id": "image_height", "title": "Changer la hauteur de l'image"}, {"id": "image_opt_embed", "textContent": "Incorporer les images en tant que données (fichiers locaux)"}, {"id": "image_opt_ref", "textContent": "Utiliser la référence des images "}, @@ -40,14 +41,14 @@ {"id": "line_x2", "title": "Changer la position horizontale x de fin de la ligne"}, {"id": "line_y1", "title": "Changer la position verticale y de début de la ligne"}, {"id": "line_y2", "title": "Changer la position verticale y de fin de la ligne"}, -{"id": "linecap_butt", "title": "Linecap: Butt"}, -{"id": "linecap_round", "title": "Linecap: Round"}, -{"id": "linecap_square", "title": "Linecap: Square"}, -{"id": "linejoin_bevel", "title": "Linejoin: Bevel"}, -{"id": "linejoin_miter", "title": "Linejoin: Miter"}, -{"id": "linejoin_round", "title": "Linejoin: Round"}, -{"id": "main_icon", "title": "Main Menu"}, -{"id": "mode_connect", "title": "Connect two objects"}, +{"id": "linecap_butt", "title": "Terminaison : Sur le nœud"}, +{"id": "linecap_round", "title": "Terminaison : Arrondie"}, +{"id": "linecap_square", "title": "Terminaison : Carrée"}, +{"id": "linejoin_bevel", "title": "Raccord : Biseauté"}, +{"id": "linejoin_miter", "title": "Raccord : Droit"}, +{"id": "linejoin_round", "title": "Raccord : Arrondi"}, +{"id": "main_icon", "title": "Menu principal"}, +{"id": "mode_connect", "title": "Connecter deux objets"}, {"id": "page", "textContent": "Page"}, {"id": "palette", "title": "Cliquer pour changer la couleur de remplissage, Shift-Clic pour changer la couleur de contour"}, {"id": "path_node_x", "title": "Changer la positon horizontale x du nœud"}, @@ -66,7 +67,7 @@ {"id": "straight_segments", "textContent": "Droit"}, {"id": "stroke_color", "title": "Changer la couleur du contour"}, {"id": "stroke_style", "title": "Changer le style du contour"}, -{"id": "stroke_width", "title": "Changer la largeur du contour"}, +{"id": "stroke_width", "title": "Changer la largeur du contour de 1, Shift-Click pour changer la largeur de 0.1"}, {"id": "svginfo_bg_note", "textContent": "Note: La toile de fond n'est pas sauvegardée avec l'image."}, {"id": "svginfo_change_background", "textContent": "Toile de fond de l'Éditeur"}, {"id": "svginfo_dim", "textContent": "Dimensions du canevas"}, @@ -78,8 +79,8 @@ {"id": "svginfo_title", "textContent": "Titre"}, {"id": "svginfo_width", "textContent": "Largeur:"}, {"id": "text", "title": "Changer le contenu du texte"}, -{"id": "toggle_stroke_tools", "title": "Show/hide more stroke tools"}, -{"id": "tool_add_subpath", "title": "Add sub-path"}, +{"id": "toggle_stroke_tools", "title": "Montrer/Cacher plus d'outils de Contour"}, +{"id": "tool_add_subpath", "title": "Ajouter un sous-chemin"}, {"id": "tool_alignbottom", "title": "Aligner le bas des objets"}, {"id": "tool_aligncenter", "title": "Centrer verticalement"}, {"id": "tool_alignleft", "title": "Aligner les côtés gauches"}, @@ -87,7 +88,7 @@ {"id": "tool_alignright", "title": "Aligner les côtés droits"}, {"id": "tool_aligntop", "title": "Aligner le haut des objets"}, {"id": "tool_angle", "title": "Changer l'angle de rotation"}, -{"id": "tool_blur", "title": "Change gaussian blur value"}, +{"id": "tool_blur", "title": "Changer la valeur du flou gaussien"}, {"id": "tool_bold", "title": "Texte en gras"}, {"id": "tool_circle", "title": "Cercle"}, {"id": "tool_clear", "textContent": "Nouvelle image"}, @@ -99,15 +100,15 @@ {"id": "tool_docprops_cancel", "textContent": "Annuler"}, {"id": "tool_docprops_save", "textContent": "OK"}, {"id": "tool_ellipse", "title": "Ellipse"}, -{"id": "tool_export", "textContent": "Export as PNG"}, -{"id": "tool_eyedropper", "title": "Eye Dropper Tool"}, +{"id": "tool_export", "textContent": "Exporter au format PNG"}, +{"id": "tool_eyedropper", "title": "Outil Pipette"}, {"id": "tool_fhellipse", "title": "Ellipse main levée"}, {"id": "tool_fhpath", "title": "Crayon à main levée"}, {"id": "tool_fhrect", "title": "Rectangle main levée"}, -{"id": "tool_font_size", "title": "Taille de la police"}, +{"id": "tool_font_size", "title": "Changer la taille de la police"}, {"id": "tool_group", "title": "Grouper les éléments"}, {"id": "tool_image", "title": "Outil Image"}, -{"id": "tool_import", "textContent": "Import SVG"}, +{"id": "tool_import", "textContent": "Importer un objet SVG"}, {"id": "tool_italic", "title": "Texte en italique"}, {"id": "tool_line", "title": "Tracer des lignes"}, {"id": "tool_move_bottom", "title": "Déplacer vers le bas"}, @@ -115,9 +116,11 @@ {"id": "tool_node_clone", "title": "Cloner le nœud"}, {"id": "tool_node_delete", "title": "Supprimer le nœud"}, {"id": "tool_node_link", "title": "Rendre les points de contrôle solidaires"}, -{"id": "tool_opacity", "title": "Changer l'opacité de l'élément"}, +{"id": "tool_opacity", "title": "Changer l'opacité de l'élément sélectionné"}, {"id": "tool_open", "textContent": "Ouvrir une image"}, +{"id": "tool_openclose_path", "title": "Ouvrir/Fermer sous-chemin"}, {"id": "tool_path", "title": "Outil Chemin"}, +{"id": "tool_position", "title": "Aligner l'élément relativement à la Page"}, {"id": "tool_rect", "title": "Rectangle"}, {"id": "tool_redo", "title": "Refaire l'action"}, {"id": "tool_reorient", "title": "Réorienter le chemin"}, @@ -133,7 +136,7 @@ {"id": "tool_ungroup", "title": "Dégrouper les éléments"}, {"id": "tool_wireframe", "title": "Mode Fil de Fer"}, {"id": "tool_zoom", "title": "Zoom"}, -{"id": "url_notice", "title": "NOTE: This image cannot be embedded. It will depend on this path to be displayed"}, +{"id": "url_notice", "title": "NOTE: Cette image ne peut être incorporée en tant que données. Le contenu affiché sera celui de l'image située à cette adresse"}, {"id": "zoom_panel", "title": "Changer le niveau de zoom"}, {"id": "sidepanel_handle", "textContent": "C A L Q U E S", "title": "Tirer vers la gauche/droite pour redimensionner le panneau"}, { @@ -143,16 +146,16 @@ "QmoveElemsToLayer": "Déplacer les éléments sélectionnés vers le calque '%s' ?", "QwantToClear": "Voulez-vous effacer le dessin ?\nL'historique de vos actions sera également effacé !", "cancel": "Annuler", - "defsFailOnSave": "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.", + "defsFailOnSave": "NOTE : À cause d'un bug de votre navigateur, cette image peut être affichée de façon incorrecte (dégradés ou éléments manquants). Cependant, une fois enregistrée, elle sera correcte.", "dupeLayerName": "Il existe déjà un calque de ce nom !", "enterNewImgURL": "Entrer la nouvelle URL de l'image", "enterNewLayerName": "Veuillez entrer le nouveau nom du calque", "enterUniqueLayerName": "Veuillez entrer un nom (unique) pour le calque", - "exportNoBlur": "Blurred elements will appear as un-blurred", - "exportNoDashArray": "Strokes will appear filled", - "exportNoImage": "Image elements will not appear", - "exportNoText": "Text may not appear as expected", - "exportNoforeignObject": "foreignObject elements will not appear", + "exportNoBlur": "Les éléments ayant du flou gaussien seront affichés sans flou", + "exportNoDashArray": "Les contours seront affichés remplis", + "exportNoImage": "Les éléments Image ne seront pas affichés", + "exportNoText": "Le texte peut être affiché de façon incorrecte", + "exportNoforeignObject": "Les éléments foreignObject se seront pas affichés", "featNotSupported": "Fonction non supportée", "invalidAttrValGiven": "Valeur fournie invalide", "key_backspace": "Suppr.", @@ -161,13 +164,13 @@ "key_up": "Haut", "layer": "Calque", "layerHasThatName": "Le calque porte déjà ce nom", - "loadingImage": "Loading image, please wait...", + "loadingImage": "Chargement de l'image, veuillez patienter...", "noContentToFitTo": "Il n'y a pas de contenu auquel ajuster", - "noteTheseIssues": "Also note the following issues: ", + "noteTheseIssues": "Notez également les problèmes suivants : ", "ok": "OK", "pathCtrlPtTooltip": "Glisser-déposer le point de contrôle pour ajuster les propriétés de la courbe", "pathNodeTooltip": "Glisser-déposer le nœud pour le déplacer. Double-cliquer le nœud pour changer de type de segment", - "saveFromBrowser": "Select \"Save As...\" in your browser to save this image as a %s file." + "saveFromBrowser": "Selectionner \"Enregistrer sous...\" dans votre navigateur pour sauvegarder l'image en tant que fichier %s." } } ] \ No newline at end of file diff --git a/public/svg-edit/editor/locale/lang.nl.js b/public/svg-edit/editor/locale/lang.nl.js index 04d11064..8c7cd41c 100644 --- a/public/svg-edit/editor/locale/lang.nl.js +++ b/public/svg-edit/editor/locale/lang.nl.js @@ -4,8 +4,8 @@ {"id": "circle_cx", "title": "Verander het X coordinaat van het cirkel middelpunt"}, {"id": "circle_cy", "title": "Verander het Y coordinaat van het cirkel middelpunt"}, {"id": "circle_r", "title": "Verander de cirkel radius"}, -{"id": "connector_no_arrow", "textContent": "No arrow"}, -{"id": "copyrightLabel", "textContent": "Powered by"}, +{"id": "connector_no_arrow", "textContent": "Geen pijl"}, +{"id": "copyrightLabel", "textContent": "Mogelijk gemaakt door"}, {"id": "cornerRadiusLabel", "title": "Verander hoekradius rechthoek"}, {"id": "curve_segments", "textContent": "Gebogen"}, {"id": "ellipse_cx", "title": "Verander het X coordinaat van het ellips middelpunt"}, @@ -23,6 +23,7 @@ {"id": "icon_medium", "textContent": "Gemiddeld"}, {"id": "icon_small", "textContent": "Klein"}, {"id": "icon_xlarge", "textContent": "Extra groot"}, +{"id": "idLabel", "title": "Identificeer het element"}, {"id": "image_height", "title": "Verander hoogte afbeelding"}, {"id": "image_opt_embed", "textContent": "Toevoegen data (lokale bestanden)"}, {"id": "image_opt_ref", "textContent": "Gebruik bestand referentie"}, @@ -40,14 +41,14 @@ {"id": "line_x2", "title": "Verander eind X coordinaat van de lijn"}, {"id": "line_y1", "title": "Verander start Y coordinaat van de lijn"}, {"id": "line_y2", "title": "Verander eind Y coordinaat van de lijn"}, -{"id": "linecap_butt", "title": "Linecap: Butt"}, -{"id": "linecap_round", "title": "Linecap: Round"}, -{"id": "linecap_square", "title": "Linecap: Square"}, -{"id": "linejoin_bevel", "title": "Linejoin: Bevel"}, -{"id": "linejoin_miter", "title": "Linejoin: Miter"}, -{"id": "linejoin_round", "title": "Linejoin: Round"}, -{"id": "main_icon", "title": "Main Menu"}, -{"id": "mode_connect", "title": "Connect two objects"}, +{"id": "linecap_butt", "title": "Lijneinde: Geen"}, +{"id": "linecap_round", "title": "Lijneinde: Rond"}, +{"id": "linecap_square", "title": "Lijneinde: Vierkant"}, +{"id": "linejoin_bevel", "title": "Lijnverbinding: Afgestompt"}, +{"id": "linejoin_miter", "title": "Lijnverbinding: Hoek"}, +{"id": "linejoin_round", "title": "Lijnverbinding: Rond"}, +{"id": "main_icon", "title": "Hoofdmenu"}, +{"id": "mode_connect", "title": "Verbind twee objecten"}, {"id": "page", "textContent": "Pagina"}, {"id": "palette", "title": "Klik om de vul kleur te veranderen, shift-klik om de lijn kleur te veranderen"}, {"id": "path_node_x", "title": "Verander X coordinaat knooppunt"}, @@ -78,8 +79,8 @@ {"id": "svginfo_title", "textContent": "Titel"}, {"id": "svginfo_width", "textContent": "Breedte:"}, {"id": "text", "title": "Wijzig tekst"}, -{"id": "toggle_stroke_tools", "title": "Show/hide more stroke tools"}, -{"id": "tool_add_subpath", "title": "Add sub-path"}, +{"id": "toggle_stroke_tools", "title": "Toon/verberg meer lijn gereedschap"}, +{"id": "tool_add_subpath", "title": "Subpad toevoegen"}, {"id": "tool_alignbottom", "title": "Onder uitlijnen"}, {"id": "tool_aligncenter", "title": "Centreren"}, {"id": "tool_alignleft", "title": "Links uitlijnen"}, @@ -87,7 +88,7 @@ {"id": "tool_alignright", "title": "Rechts uitlijnen"}, {"id": "tool_aligntop", "title": "Boven uitlijnen"}, {"id": "tool_angle", "title": "Draai"}, -{"id": "tool_blur", "title": "Change gaussian blur value"}, +{"id": "tool_blur", "title": "Verander Gaussische vervaging waarde"}, {"id": "tool_bold", "title": "Vet"}, {"id": "tool_circle", "title": "Cirkel"}, {"id": "tool_clear", "textContent": "Nieuwe afbeelding"}, @@ -99,15 +100,15 @@ {"id": "tool_docprops_cancel", "textContent": "Annuleren"}, {"id": "tool_docprops_save", "textContent": "Ok"}, {"id": "tool_ellipse", "title": "Ellips"}, -{"id": "tool_export", "textContent": "Export as PNG"}, -{"id": "tool_eyedropper", "title": "Eye Dropper Tool"}, +{"id": "tool_export", "textContent": "Exporteer als PNG"}, +{"id": "tool_eyedropper", "title": "Kleuren kopieer gereedschap"}, {"id": "tool_fhellipse", "title": "Vrije stijl ellips"}, {"id": "tool_fhpath", "title": "Potlood"}, {"id": "tool_fhrect", "title": "Vrije stijl rechthoek"}, {"id": "tool_font_size", "title": "Verander lettertype grootte"}, {"id": "tool_group", "title": "Groepeer elementen"}, {"id": "tool_image", "title": "Afbeelding"}, -{"id": "tool_import", "textContent": "Import SVG"}, +{"id": "tool_import", "textContent": "Importeer SVG"}, {"id": "tool_italic", "title": "Cursief"}, {"id": "tool_line", "title": "Lijn"}, {"id": "tool_move_bottom", "title": "Naar achtergrond"}, @@ -117,7 +118,9 @@ {"id": "tool_node_link", "title": "Koppel controle punten"}, {"id": "tool_opacity", "title": "Verander opaciteit geselecteerde item"}, {"id": "tool_open", "textContent": "Open afbeelding"}, +{"id": "tool_openclose_path", "title": "Open/sluit subpad"}, {"id": "tool_path", "title": "Pad"}, +{"id": "tool_position", "title": "Lijn element uit relatief ten opzichte van de pagina"}, {"id": "tool_rect", "title": "Rechthoek"}, {"id": "tool_redo", "title": "Opnieuw doen"}, {"id": "tool_reorient", "title": "Herorienteer pad"}, @@ -133,7 +136,7 @@ {"id": "tool_ungroup", "title": "Groepering opheffen"}, {"id": "tool_wireframe", "title": "Draadmodel"}, {"id": "tool_zoom", "title": "Zoom"}, -{"id": "url_notice", "title": "NOTE: This image cannot be embedded. It will depend on this path to be displayed"}, +{"id": "url_notice", "title": "Let op: Dit plaatje kan niet worden geintegreerd (embeded). Het hangt af van dit pad om te worden afgebeeld."}, {"id": "zoom_panel", "title": "In-/uitzoomen"}, {"id": "sidepanel_handle", "textContent": "L a g e n", "title": "Sleep naar links/rechts om het zijpaneel te vergroten/verkleinen"}, { @@ -143,16 +146,16 @@ "QmoveElemsToLayer": "Verplaats geselecteerde elementen naar laag '%s'?", "QwantToClear": "Wil je de afbeelding leeg maken?\nDit zal ook de ongedaan maak geschiedenis wissen!", "cancel": "Annuleren", - "defsFailOnSave": "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.", + "defsFailOnSave": "Let op: Vanwege een fout in je browser, kan dit plaatje verkeerd verschijnen (missende hoeken en/of elementen). Het zal goed verschijnen zodra het plaatje echt wordt opgeslagen.", "dupeLayerName": "Er is al een laag met die naam!", "enterNewImgURL": "Geef de nieuwe afbeelding URL", "enterNewLayerName": "Geef een nieuwe laag naam", "enterUniqueLayerName": "Geef een unieke laag naam", - "exportNoBlur": "Blurred elements will appear as un-blurred", - "exportNoDashArray": "Strokes will appear filled", - "exportNoImage": "Image elements will not appear", - "exportNoText": "Text may not appear as expected", - "exportNoforeignObject": "foreignObject elements will not appear", + "exportNoBlur": "Vervaagde elementen zullen niet vervaagd worden geexporteerd.", + "exportNoDashArray": "Lijnstijlen zullen gevuld worden geexporteerd..", + "exportNoImage": "Plaatjes elementen zullen niet worden geexporteerd.", + "exportNoText": "Tekst kan mogelijk niet zo worden geexporteerd zoals verwacht.", + "exportNoforeignObject": "Vreemde objecten zullen niet worden geexporteerd.", "featNotSupported": "Functie wordt niet ondersteund", "invalidAttrValGiven": "Verkeerde waarde gegeven", "key_backspace": "backspace", @@ -161,13 +164,13 @@ "key_up": "omhoog", "layer": "Laag", "layerHasThatName": "Laag heeft al die naam", - "loadingImage": "Loading image, please wait...", + "loadingImage": "Laden van het plaatje, even geduld aub...", "noContentToFitTo": "Geen inhoud om omheen te passen", - "noteTheseIssues": "Also note the following issues: ", + "noteTheseIssues": "Let op de volgende problemen: ", "ok": "Ok", "pathCtrlPtTooltip": "Versleep het controle punt om de boog eigenschappen te veranderen", "pathNodeTooltip": "Versleep knooppunt om hem te verslepen. Dubbel klik knooppunt om het segment type te veranderen", - "saveFromBrowser": "Select \"Save As...\" in your browser to save this image as a %s file." + "saveFromBrowser": "Kies \"Save As...\" in je browser om dit plaatje op te slaan als een %s bestand." } } ] \ No newline at end of file diff --git a/public/svg-edit/editor/svg-editor.js b/public/svg-edit/editor/svg-editor.js index f6f9c568..601ea303 100644 --- a/public/svg-edit/editor/svg-editor.js +++ b/public/svg-edit/editor/svg-editor.js @@ -246,7 +246,9 @@ 'zoom':'zoom.png', 'clone':'clone.png', + 'node_clone':'node_clone.png', 'delete':'delete.png', + 'node_delete':'node_delete.png', 'group':'shape_group.png', 'ungroup':'shape_ungroup.png', 'move_top':'move_top.png', @@ -300,8 +302,10 @@ '#tool_image':'image', '#tool_zoom':'zoom', - '#tool_clone,#tool_clone_multi,#tool_node_clone':'clone', - '#layer_delete,#tool_delete,#tool_delete_multi,#tool_node_delete':'delete', + '#tool_clone,#tool_clone_multi':'clone', + '#tool_node_clone':'node_clone', + '#layer_delete,#tool_delete,#tool_delete_multi':'delete', + '#tool_node_delete':'node_delete', '#tool_add_subpath':'add_subpath', '#tool_openclose_path':'open_path', '#tool_move_top':'move_top', @@ -1823,15 +1827,6 @@ */ - // var setIcon = function(holder_sel, id) { - // var icon = $.getSvgIcon(id).clone(); - // var holder = $(holder_sel); - // icon[0].setAttribute('width',holder.width()); - // icon[0].setAttribute('height',holder.height()); - // holder.empty().append(icon) - // .attr('data-curopt', holder_sel.replace('_show','')); // This sets the current mode - // } - // Unfocus text input when workarea is mousedowned. (function() { var inp; @@ -2296,7 +2291,7 @@ var icon = $.getSvgIcon(icon_id).clone(); $(elem).empty().append(icon); var size = curPrefs.iconsize; - if(size !== 'm') { + if(size && size !== 'm') { var icon_sizes = { s:16, m:24, l:32, xl:48}, obj = {}; obj[elem + ' .svg_icon'] = icon_sizes[size]; $.resizeSvgIcons(obj); @@ -3464,7 +3459,7 @@ updateCanvas(true); // }); - // var revnums = "svg-editor.js ($Rev: 1569 $) "; + // var revnums = "svg-editor.js ($Rev: 1574 $) "; // revnums += svgCanvas.getVersion(); // $('#copyright')[0].setAttribute("title", revnums); diff --git a/public/svg-edit/editor/svgcanvas.js b/public/svg-edit/editor/svgcanvas.js index 806d52d1..d46357da 100644 --- a/public/svg-edit/editor/svgcanvas.js +++ b/public/svg-edit/editor/svgcanvas.js @@ -961,7 +961,6 @@ function BatchCommand(text) { '').documentElement, true); $(svgroot).appendTo(container); - var opac_ani = document.createElementNS(svgns, 'animate'); $(opac_ani).attr({ attributeName: 'opacity', @@ -1777,7 +1776,9 @@ function BatchCommand(text) { var i = selectedElements.length; while(i--) { - var cmd = recalculateDimensions(selectedElements[i]); + var elem = selectedElements[i]; +// if(canvas.getRotationAngle(elem) && !hasMatrixTransform(canvas.getTransformList(elem))) continue; + var cmd = recalculateDimensions(elem); if (cmd) { batchCmd.addSubCommand(cmd); } @@ -2052,6 +2053,8 @@ function BatchCommand(text) { } } } + // End here if all it has is a rotation + if(tlist.numberOfItems == 1 && canvas.getRotationAngle(selected)) return null; } // if this element had no transforms, we are done @@ -2132,6 +2135,7 @@ function BatchCommand(text) { transformListToTransform(tlist).matrix), m = svgroot.createSVGMatrix(); + // temporarily strip off the rotate and save the old center var gangle = canvas.getRotationAngle(selected); if (gangle) { @@ -2157,7 +2161,11 @@ function BatchCommand(text) { var tx = 0, ty = 0, operation = 0, N = tlist.numberOfItems; - + + if(N) { + var first_m = tlist.getItem(0).matrix; + } + // first, if it was a scale then the second-last transform will be it if (N >= 3 && tlist.getItem(N-2).type == 3 && tlist.getItem(N-3).type == 2 && tlist.getItem(N-1).type == 2) @@ -2359,6 +2367,11 @@ function BatchCommand(text) { // if it was a translate, put back the rotate at the new center if (operation == 2) { if (gangle) { + newcenter = { + x: oldcenter.x + first_m.e, + y: oldcenter.y + first_m.f + }; + var newRot = svgroot.createSVGTransform(); newRot.setRotate(gangle,newcenter.x,newcenter.y); tlist.insertItemBefore(newRot, 0); @@ -2550,8 +2563,12 @@ function BatchCommand(text) { // if it was a translate, put back the rotate at the new center if (operation == 2) { if (angle) { + newcenter = { + x: oldcenter.x + m.e, + y: oldcenter.y + m.f + }; var newRot = svgroot.createSVGTransform(); - newRot.setRotate(angle,newcenter.x,newcenter.y); + newRot.setRotate(angle, newcenter.x, newcenter.y); tlist.insertItemBefore(newRot, 0); } } @@ -3447,50 +3464,15 @@ function BatchCommand(text) { var y2 = y; if(evt.shiftKey) { + var snap = Math.PI/4; // 45 degrees var diff_x = x - start_x; var diff_y = y - start_y; - - var angle = ((Math.atan2(start_y-y,start_x-x) * (180/Math.PI))-90) % 360; - angle = angle<0?(360+angle):angle - - // TODO: Write all this more efficiently + var angle = Math.atan2(diff_y,diff_x); var dist = Math.sqrt(diff_x * diff_x + diff_y * diff_y); - var val = Math.sqrt((dist*dist)/2); - var diagonal = false; - - if(angle >= 360-22.5 || angle < 22.5) { - x2 = start_x; - } else if(angle >= 22.5 && angle < 22.5 + 45) { - diagonal = true; - } else if(angle >= 22.5 + 45 && angle < 22.5 + 90) { - y2 = start_y; - } else if(angle >= 22.5 + 90 && angle < 22.5 + 135) { - diagonal = true; - } else if(angle >= 22.5 + 135 && angle < 22.5 + 180) { - x2 = start_x; - } else if(angle >= 22.5 + 180 && angle < 22.5 + 225) { - diagonal = true; - } else if(angle >= 22.5 + 225 && angle < 22.5 + 270) { - y2 = start_y; - } else if(angle >= 22.5 + 270 && angle < 22.5 + 315) { - diagonal = true; - } - - if(diagonal) { - if(y2 < start_y) { - y2 = start_y - val; - } else { - y2 = start_y + val; - } - - if(x2 < start_x) { - x2 = start_x - val; - } else { - x2 = start_x + val; - } - } + var snapangle= Math.round(angle/snap)*snap; + x2 = start_x + dist*Math.cos(snapangle); + y2 = start_y + dist*Math.sin(snapangle); } - shape.setAttributeNS(null, "x2", x2); shape.setAttributeNS(null, "y2", y2); @@ -4831,16 +4813,36 @@ function BatchCommand(text) { this.addSeg = function(index) { // Adds a new segment var seg = p.segs[index]; - if(!seg.prev) return; var prev = seg.prev; - - var new_x = (seg.item.x + prev.item.x) / 2; - var new_y = (seg.item.y + prev.item.y) / 2; - - var list = elem.pathSegList; - var newseg = elem.createSVGPathSegLinetoAbs(new_x, new_y); + var newseg; + switch(seg.item.pathSegType) { + case 4: + var new_x = (seg.item.x + prev.item.x) / 2; + var new_y = (seg.item.y + prev.item.y) / 2; + newseg = elem.createSVGPathSegLinetoAbs(new_x, new_y); + break; + case 6: //make it a curved segment to preserve the shape (WRS) + // http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm#Geometric_interpretation + var p0_x = (prev.item.x + seg.item.x1)/2; + var p1_x = (seg.item.x1 + seg.item.x2)/2; + var p2_x = (seg.item.x2 + seg.item.x)/2; + var p01_x = (p0_x + p1_x)/2; + var p12_x = (p1_x + p2_x)/2; + var new_x = (p01_x + p12_x)/2; + var p0_y = (prev.item.y + seg.item.y1)/2; + var p1_y = (seg.item.y1 + seg.item.y2)/2; + var p2_y = (seg.item.y2 + seg.item.y)/2; + var p01_y = (p0_y + p1_y)/2; + var p12_y = (p1_y + p2_y)/2; + var new_y = (p01_y + p12_y)/2; + newseg = elem.createSVGPathSegCurvetoCubicAbs(new_x,new_y, p0_x,p0_y, p01_x,p01_y); + var pts = [seg.item.x,seg.item.y,p12_x,p12_y,p2_x,p2_y]; + replacePathSeg(seg.type,index,pts); + break; + } + insertItemBefore(elem, newseg, index); } @@ -5030,10 +5032,17 @@ function BatchCommand(text) { var diff_x = cur_x - prev_x; var diff_y = cur_y - prev_y; // get control points from straight line segment + /* var ct1_x = (prev_x + (diff_y/2)); var ct1_y = (prev_y - (diff_x/2)); var ct2_x = (cur_x + (diff_y/2)); var ct2_y = (cur_y - (diff_x/2)); + */ + //create control points on the line to preserve the shape (WRS) + var ct1_x = (prev_x + (diff_x/3)); + var ct1_y = (prev_y + (diff_y/3)); + var ct2_x = (cur_x - (diff_x/3)); + var ct2_y = (cur_y - (diff_y/3)); points = [cur_x,cur_y, ct1_x,ct1_y, ct2_x,ct2_y]; } break; @@ -9038,7 +9047,7 @@ function BatchCommand(text) { // Function: getVersion // Returns a string which describes the revision number of SvgCanvas. this.getVersion = function() { - return "svgcanvas.js ($Rev: 1569 $)"; + return "svgcanvas.js ($Rev: 1573 $)"; }; this.setUiStrings = function(strs) { diff --git a/vendor/plugins/maruku/lib/maruku/output/to_html.rb b/vendor/plugins/maruku/lib/maruku/output/to_html.rb index 889e592c..fb9b9a9c 100644 --- a/vendor/plugins/maruku/lib/maruku/output/to_html.rb +++ b/vendor/plugins/maruku/lib/maruku/output/to_html.rb @@ -410,7 +410,9 @@ It is copied as a standard HTML attribute. [['pre'], attrs], [['q', 'blockquote'], attrs+[:cite]], [['ins','del'], attrs+[:cite,:datetime]], - [['ol','ul','li'], attrs], + [['ol'], attrs+[:reversed, :start]], + [['ul'], attrs], + [['li'], attrs+[:value]], ['table',attrs+[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]], ['caption',attrs], [['colgroup','col'],attrs+[:span, :width]+cellhalign+cellvalign],