-
Notifications
You must be signed in to change notification settings - Fork 0
issue with sanitize #1
Conversation
okay je vois, je vais essayer de lancer chez moi |
@Uzziahlukeka crée un fichier index.php à la racine du projet <?php
use Devscast\EditorJs\Editor;
require __DIR__ . '/vendor/autoload.php';
$data = <<<JSON
{
"time": 1739980616433,
"blocks": [
{
"id": "mhTl6ghSkV",
"type": "paragraph",
"data": {
"text": "Hey. Meet the new Editor. On this picture you can see it in action. Then, try a demo 🤓"
}
},
{
"id": "l98dyx3yjb",
"type": "header",
"data": {
"text": "Key features",
"level": 3
}
},
{
"id": "os_YI4eub4",
"type": "list",
"data": {
"style": "unordered",
"meta": {},
"items": [
"It is a block-style editor",
"It returns clean data output in JSON",
"Designed to be extendable and pluggable with a <a href='https://editorjs.io/creating-a-block-tool'>simple API</a>"
]
}
},
{
"id": "1yKeXKxN7-",
"type": "header",
"data": {
"text": "What does it mean «block-styled editor»",
"level": 3
}
},
{
"id": "TcUNySG15P",
"type": "paragraph",
"data": {
"text": "Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc. Each of them is an independent <sup data-tune='footnotes'>1</sup> contenteditable element (or more complex structure) provided by Plugin and united by Editor's Core."
},
"tunes": {
"footnotes": [
"It works more stable then in other WYSIWYG editors. Same time it has smooth and well-known arrow navigation behavior like classic editors."
]
}
},
{
"id": "M3UXyblhAo",
"type": "header",
"data": {
"text": "What does it mean clean data output?",
"level": 3
}
},
{
"id": "KOcIofZ3Z1",
"type": "paragraph",
"data": {
"text": "There are dozens of ready-to-use Blocks and a simple API <sup data-tune='footnotes'>2</sup> for creating any Block you need. For example, you can implement Blocks for Tweets, Instagram posts, surveys and polls, CTA buttons, and even games."
},
"tunes": {
"footnotes": [
"Just take a look at our Creating Block Tool guide. You'll be surprised."
]
}
},
{
"id": "ksCokKAhQw",
"type": "paragraph",
"data": {
"text": "Classic WYSIWYG editors produce raw HTML-markup with both content data and content appearance. On the contrary, <mark class='cdx-marker'>Editor.js outputs JSON object</mark> with data of each Block."
}
},
{
"id": "XKNT99-qqS",
"type": "attaches",
"data": {
"file": {
"url": "https://drive.google.com/user/catalog/my-file.pdf",
"size": 12902,
"name": "file.pdf",
"extension": "pdf"
},
"title": "My file"
}
},
{
"id": "7RosVX2kcH",
"type": "paragraph",
"data": {
"text": "Given data can be used as you want: render with HTML for Web clients, render natively for mobile apps, create the markup for Facebook Instant Articles or Google AMP, generate an audio version, and so on."
}
},
{
"id": "eq06PsNsab",
"type": "paragraph",
"data": {
"text": "Clean data is useful to sanitize, validate and process on the backend."
}
},
{
"id": "hZAjSnqYMX",
"type": "image",
"data": {
"file": {
"url": "assets/codex2x.png"
},
"withBorder": false,
"withBackground": false,
"stretched": true,
"caption": "CodeX Code Camp 2019"
}
}
]
}
JSON;
$editor = new Editor($data);
dd($editor); pour tester facilement |
@Uzziahlukeka continue avec cette base |
1256abb
to
266de02
Compare
d'acccord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pour tester les blocks par toujours du JSON en utilisant le factory, pour simplifier pour l'instant test juste si on arrive a créer le block a partir d'un json via le factory et le deuxième si on arrive à convertir en html c'est tout.
src/BlockFactory.php
Outdated
'table' => Table::create($data, $allowedTags), | ||
'warning' => Warning::create($data, $allowedTags), | ||
}; | ||
self::initializeFactories(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
humm là tu crées tous les blocks avec la même donné et stock en mémoire le résultat qui ne sera peut être pas utilisé ! on doit y réfléchir encore un peu mais je ne pense pas qu'il ait un problème de performance à ce niveau.
le problème c'était avec la validation du schema, mais on va gérer ça après
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Uzziahlukeka any updates ?
i am a bit lost right now about what i should do before i saw the revision you made and i thought it was done |
non il faut fixer la CI, et tester correctement en partant du json et du
factory,
si tu n'as pas beaucoup de temps devant toi je peux le faire fais juste
signe
Le mar. 8 avr. 2025 à 11:38, Uzziah Lukeka ***@***.***> a
écrit :
… i am a bit lost right now about what i should do before i saw the revision
you made and i thought it was done
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHNMFVPAHXO4WHUTZ6MNSND2YOKJXAVCNFSM6AAAAABZRXJQRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBVHA2DCNRTGE>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
[image: Uzziahlukeka]*Uzziahlukeka* left a comment
(devscast/editorjs-backend#1)
<#1 (comment)>
i am a bit lost right now about what i should do before i saw the revision
you made and i thought it was done
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHNMFVPAHXO4WHUTZ6MNSND2YOKJXAVCNFSM6AAAAABZRXJQRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBVHA2DCNRTGE>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
quand j'essaie de convertir d'about en html , le sanitize n'arrive pas a faire passer les balises et ca ne fonctionne pas alors j'ai essaye ici de sanatize puis convertir alors ceci donne toujours la meme chose les balises ne passent pas ici