Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle
A symfony bundle to parse data generated by EditorJS
https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle
Last synced: 3 months ago
JSON representation
A symfony bundle to parse data generated by EditorJS
- Host: GitHub
- URL: https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle
- Owner: SyntaxPhoenix
- License: gpl-3.0
- Created: 2021-04-09T22:56:56.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-02T22:04:42.000Z (about 1 year ago)
- Last Synced: 2024-07-11T14:19:30.727Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 159 KB
- Stars: 18
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-editorjs - editorjs-symfony-parser-bundle - Bundle for Symfony to parse blocks created with Editor.js (Libraries / PHP)
README
[![Contributors][contributors-shield]][contributors-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![GPLv3 License][license-shield]][license-url]
EditorJS Symfony Parser Bundle
Table of Contents
## About The Project
The EditorJS-ParserBundle parses editorjs-configs [Editor.js](https://editorjs.io/ "Editor.js Homepage"). It is designed to be best integrated in Symfony and also offers a Twig-Extension. The bundle is based on [Durlecode/editorjs-simple-html-parser](https://github.com/Durlecode/editorjs-simple-html-parser), but strongly improved the parsing by using an object-oriented approach.### Built With
* [editorjs-simple-html-parser](https://github.com/Durlecode/editorjs-simple-html-parser)
## Usage
```php
use SyntaxPhoenix\EJSParserBundle\Parser\EditorjsParser;$parser = new EditorjsParser($data);
$html = $parser->toHtml();
```Where `$data` is the clean JSON data coming from Editor.js *See `$data` example below*
```json
{
"time" : 1583848289745,
"blocks" : [
{
"type" : "header",
"data" : {
"text" : "Hello World",
"level" : 2
}
}
],
"version" : "2.16.1"
}
```### Installation
```
composer require syntaxphoenix/editorjs-symfony-parser-bundle
```## Supported Plugins
Package | Key | Main CSS Class
--- | --- | ---
@editorjs/code | `code` | `.prs-code`
@editorjs/embed | `embed` | `.prs-embed`
@editorjs/delimiter | `delimiter` | `.prs-delimiter`
@editorjs/header | `header` | `.prs-h{header-level}`
@editorjs/link | `link` | `.prs-link`
@editorjs/list | `list` | `.prs-list`
@editorjs/paragraph | `paragraph` | `.prs-paragraph`
@editorjs/raw | `raw` |
@editorjs/simple-image | `simpleImage` | `.prs-image`
@editorjs/image | `image` | `.prs-image`
@editorjs/warning | `warning` | `.prs-warning`
@editorjs/table | `table` | `.prs-table`
editorjs-alert | `alert` | `.prs-alert` + `.prs-alert-{type}`
editorjs-youtube-embed | `youtubeembed` | `.prs-youtubeembed`If you want to add a new Parser for a specific editorjs-plugin you can fork the master and make a pull-request. Please also change the readme in that case and add the parser you have edited.
## Methods
#### `toHtml()`
Return generated HTML### Generated HTML
##### Code
```html
```##### Embed
###### *(Actually working with Youtube, Codepen & Gfycat)*```html
```##### Delimiter
```html
```##### Header
```html
Lorem
```##### Link
```html
Title
Description
https://example.com/
```##### Ordered List
```html
```##### Unordered List
```html
```##### Paragraph
```html
Pellentesque
malesuada fames
tempus
```##### Image
```html
```
##### Warning
```html
Title
Message
```##### Raw
```html
Raw HTML ...
```##### Alert
```html
My Text
```## Roadmap
See the [open issues](https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle/issues) for a list of proposed features (and known issues).
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request## License
Distributed under the GPLv3 License. See `LICENSE` for more information.
## Contact
[@SyntaxPhoenix](https://twitter.com/SyntaxPhoenix) - [email protected]
Project Link: [https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle](https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle)
[contributors-shield]: https://img.shields.io/github/contributors/SyntaxPhoenix/editorjs-symfony-parser-bundle.svg?style=flat-square
[contributors-url]: https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle/graphs/contributors
[stars-shield]: https://img.shields.io/github/stars/SyntaxPhoenix/editorjs-symfony-parser-bundle.svg?style=flat-square
[stars-url]: https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle/stargazers
[issues-shield]: https://img.shields.io/github/issues/SyntaxPhoenix/editorjs-symfony-parser-bundle.svg?style=flat-square
[issues-url]: https://github.com/SyntaxPhoenix/editorjs-symfony-parser-bundle/issues
[license-shield]: https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat-square
[license-url]: https://www.gnu.org/licenses/gpl-3.0