[FogBugz #515] Migration de redactor vers Froala #578

Open
opened 2023-07-04 08:43:42 +02:00 by fbenoist68 · 11 comments

Assigned To: CLOSED
Project: Mobile Portal
Area: Divers
Category: Fonctionnalité
Priority: A fixer impérativement

Assigned To: CLOSED Project: Mobile Portal Area: Divers Category: Fonctionnalité Priority: A fixer impérativement
Poster
Owner

Event ID: 2991
Date: 2017-05-14T06:07:35Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

La solution finale a été de prendre htmlcleaner

try {
                // Déclaration htmlcleaner
                HtmlCleaner cleaner = new HtmlCleaner();

                // Déclaration des properties
                CleanerProperties props = cleaner.getProperties();

                // On peut écrire des properties particulières
                // props.setAdvancedXmlEscape(true);
                // props.setOmitXmlDeclaration(true);
                // props.setOmitDoctypeDeclaration(false);
                // props.setTranslateSpecialEntities(true);
                // props.setTransResCharsToNCR(true);
                // props.setRecognizeUnicodeChars(true);
                // props.setIgnoreQuestAndExclam(true);
                // props.setUseEmptyElementTags(false);
                // props.setPruneTags("script,style,title");
                // on passe le cleaner
                TagNode tagNode = cleaner.clean(oStream, oResult.getString("nls_caracter_set"));

                // on pourrait supprimer des attributs
                //tagNode.removeAttribute("xmlns:xml");
                // déclaration du sérializer XML
                CompactXmlSerializer xmlSerializer = new CompactXmlSerializer(props);

                // pour debug, affichage du contenu "clean"
                //String cleanedPage = xmlSerializer.getAsString(tagNode); //, oResult.getString("nls_caracter_set"));
                //System.out.println(cleanedPage);
                // XML to Stream
                oStream = new ByteArrayInputStream(xmlSerializer.getAsString(tagNode).getBytes());
            } catch (IOException e) {
                System.out.println("Erreur de conversion HTMLCLEANER!");
            }

Event ID: 2991 Date: 2017-05-14T06:07:35Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p>La solution finale a &eacute;t&eacute; de prendre htmlcleaner</p> <pre> try { // D&Atilde;&copy;claration htmlcleaner HtmlCleaner cleaner = new HtmlCleaner(); // D&Atilde;&copy;claration des properties CleanerProperties props = cleaner.getProperties(); // On peut &Atilde;&copy;crire des properties particuli&Atilde;&uml;res // props.setAdvancedXmlEscape(true); // props.setOmitXmlDeclaration(true); // props.setOmitDoctypeDeclaration(false); // props.setTranslateSpecialEntities(true); // props.setTransResCharsToNCR(true); // props.setRecognizeUnicodeChars(true); // props.setIgnoreQuestAndExclam(true); // props.setUseEmptyElementTags(false); // props.setPruneTags(&quot;script,style,title&quot;); // on passe le cleaner TagNode tagNode = cleaner.clean(oStream, oResult.getString(&quot;nls_caracter_set&quot;)); // on pourrait supprimer des attributs //tagNode.removeAttribute(&quot;xmlns:xml&quot;); // d&Atilde;&copy;claration du s&Atilde;&copy;rializer XML CompactXmlSerializer xmlSerializer = new CompactXmlSerializer(props); // pour debug, affichage du contenu &quot;clean&quot; //String cleanedPage = xmlSerializer.getAsString(tagNode); //, oResult.getString(&quot;nls_caracter_set&quot;)); //System.out.println(cleanedPage); // XML to Stream oStream = new ByteArrayInputStream(xmlSerializer.getAsString(tagNode).getBytes()); } catch (IOException e) { System.out.println(&quot;Erreur de conversion HTMLCLEANER!&quot;); } </pre>
Poster
Owner

Event ID: 2403
Date: 2016-10-29T01:59:32Z
Person: Frederik Benoist
Description: Fermé par Frederik Benoist

Event ID: 2403 Date: 2016-10-29T01:59:32Z Person: Frederik Benoist Description: Fermé par Frederik Benoist
Poster
Owner

Event ID: 2402
Date: 2016-10-29T01:59:32Z
Person: Frederik Benoist
Description: Résolu (Implémenté) and assigned to Frederik Benoist by Frederik Benoist

Event ID: 2402 Date: 2016-10-29T01:59:32Z Person: Frederik Benoist Description: R&#233;solu (Impl&#233;ment&#233;) and assigned to Frederik Benoist by Frederik Benoist
Poster
Owner

Event ID: 2384
Date: 2016-10-26T03:49:52Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

http://stackoverflow.com/questions/1443158/binary-data-in-json-string-something-better-than-base64

Smile format

It's very fast to encode, decode and compact

Speed comparison (java based but meaningful nevertheless): https://github.com/eishay/jvm-serializers/wiki/

Also it's an extension to JSON that allow you to skip base64 encoding for byte arrays

Smile encoded strings can be gzipped when space is critical

 

Event ID: 2384 Date: 2016-10-26T03:49:52Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p>http://stackoverflow.com/questions/1443158/binary-data-in-json-string-something-better-than-base64</p> <p>Smile format</p> <p>It&#39;s very fast to encode, decode and compact</p> <p>Speed comparison (java based but meaningful nevertheless): https://github.com/eishay/jvm-serializers/wiki/</p> <p>Also it&#39;s an extension to JSON that allow you to skip base64 encoding for byte arrays</p> <p>Smile encoded strings can be gzipped when space is critical</p> <p>&nbsp;</p>
Poster
Owner

Event ID: 2383
Date: 2016-10-25T18:57:16Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

Pour faire un unescape

select DBMS_XMLGEN.CONVERT('"a')  from dual;

==> &quot;a

Event ID: 2383 Date: 2016-10-25T18:57:16Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p>Pour faire un unescape</p> <p>select DBMS_XMLGEN.CONVERT(&#39;&quot;a&#39;)&nbsp; from dual;</p> <p>==&gt; &amp;quot;a</p>
Poster
Owner

Event ID: 2382
Date: 2016-10-25T07:53:08Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

http://htmlcleaner.sourceforge.net/index.php

HtmlCleaner is an open source HTML parser written in Java. HTML found on the Web is usually dirty, ill-formed and unsuitable for further processing. For any serious consumption of such documents, it is necessary to first clean up the mess and bring some order to the tags, attributes and ordinary text. For any given HTML document, HtmlCleaner reorders individual elements and produces well-formed XML. By default, it follows similar rules that the most of web browsers use in order to create the Document Object Model. However, you can provide custom tag and rule sets for tag filtering and balancing.

Event ID: 2382 Date: 2016-10-25T07:53:08Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p>http://htmlcleaner.sourceforge.net/index.php</p> <p>HtmlCleaner is an open source HTML parser written in Java. HTML found on the Web is usually dirty, ill-formed and unsuitable for further processing. For any serious consumption of such documents, it is necessary to first clean up the mess and bring some order to the tags, attributes and ordinary text. For any given HTML document, HtmlCleaner reorders individual elements and produces well-formed XML. By default, it follows similar rules that the most of web browsers use in order to create the Document Object Model. However, you can provide custom tag and rule sets for tag filtering and balancing.</p>
Poster
Owner

Event ID: 2363
Date: 2016-10-14T20:48:58Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

En fait il est préférable de garder en base l'exact résultat de FROALA et de le parser juste avant de générer le PDF avec le transformant en XML compatible avec xmlworker

Event ID: 2363 Date: 2016-10-14T20:48:58Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p> En fait il est pr&eacute;f&eacute;rable de garder en base l&#39;exact r&eacute;sultat de FROALA et de le parser juste avant de g&eacute;n&eacute;rer le PDF avec le transformant en XML compatible avec xmlworker</p>
Poster
Owner

Event ID: 2362
Date: 2016-10-14T08:44:32Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

Il y a un souci de la conversion en PDF. Froala ne ferme pas les self closing tag.

Il faut faire un expression régulière pour les fermer manuellement

<area />
<base />
<br />
<col />
<command />
<embed />
<hr />
<img />
<input />
<keygen />
<link />
<meta />
<param />
<source />
<track />
<wbr />
Event ID: 2362 Date: 2016-10-14T08:44:32Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p> Il y a un souci de la conversion en PDF. Froala ne ferme pas les self closing tag.</p> <p> Il faut faire un expression r&eacute;guli&egrave;re pour les fermer manuellement</p> <pre class="default prettyprint prettyprinted" style="margin: 0px 0px 1em; padding: 5px; border: 0px; font-size: 13px; overflow: auto; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; display: block; color: rgb(57, 51, 24); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; background-color: rgb(239, 240, 241)"> <code style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; background-color: rgb(239, 240, 241)"><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;area</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;base</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;br</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;col</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;command</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;embed</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;hr</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;img</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;input</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;keygen</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;link</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;meta</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;param</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;source</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;track</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">&lt;wbr</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(48, 51, 54)"> </span><span class="tag" style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(125, 39, 39)">/&gt;</span></code></pre>
Poster
Owner

Event ID: 2351
Date: 2016-10-13T14:11:22Z
Person: Frederik Benoist
Description: Modifié par Frederik Benoist

OK MP_ETAB_TODO

Faire :

  • VISITE_MODIFICATION
  • VISITE_CONTROLE
  • VOIR SI ON PEUT FAIRE SIGNATURE MAIL

SUPPRIMER SAISIE AUTONOME

 

Event ID: 2351 Date: 2016-10-13T14:11:22Z Person: Frederik Benoist Description: Modifié par Frederik Benoist <p> OK MP_ETAB_TODO</p> <p> Faire :</p> <ul> <li> VISITE_MODIFICATION</li> <li> VISITE_CONTROLE</li> <li> VOIR SI ON PEUT FAIRE SIGNATURE MAIL</li> </ul> <p> SUPPRIMER SAISIE AUTONOME</p> <p> &nbsp;</p>
Poster
Owner

Event ID: 2350
Date: 2016-10-13T14:09:58Z
Person: Frederik Benoist
Description: Attribué à Frederik Benoist par Frederik Benoist

Event ID: 2350 Date: 2016-10-13T14:09:58Z Person: Frederik Benoist Description: Attribué à Frederik Benoist par Frederik Benoist
Poster
Owner

Event ID: 2349
Date: 2016-10-13T14:09:58Z
Person: Frederik Benoist
Description: Ouvert par Frederik Benoist

Event ID: 2349 Date: 2016-10-13T14:09:58Z Person: Frederik Benoist Description: Ouvert par Frederik Benoist
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fbenoist68/mobileportal#578
There is no content yet.