Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mj-font + issue template #371

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: 🐞 Bug report
description: Create a bug report for GrapesJS MJML.
title: "BUG: "
labels: []
body:
- type: markdown
attributes:
value: |
In order to understand and fix the issue, we ask you to fill correctly all the statements/questions.
**If you don't indicate a reproducible demo with relative steps to reproduce the bug, the issue might be CLOSED.**
Note: before creating a bug issue, search in GitHub Issues to check if a similar bug was already reported.
- type: checkboxes
attributes:
label: GrapesJS version
description: |
Ensure to use the latest version available [![npm](https://img.shields.io/npm/v/grapesjs.svg)](https://www.npmjs.com/package/grapesjs).
options:
- label: I confirm to use the latest version of GrapesJS
required: true
- type: checkboxes
attributes:
label: GrapesJS MJML version
description: |
Ensure to use the latest version available [![npm](https://img.shields.io/npm/v/grapesjs-mjml.svg)](https://www.npmjs.com/package/grapesjs-mjml).
options:
- label: I confirm to use the latest version of GrapesJS MJML
required: true
- type: input
attributes:
label: What browser are you using?
placeholder: ex. Chrome v91
validations:
required: true
- type: input
attributes:
label: Reproducible demo link
description: |
Use one of these starter templates to create your demo: [JSFiddle](https://jsfiddle.net/szLp8h4n) - [CodeSandbox](https://codesandbox.io/s/1r0w2pk1vl).
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: |
Indicate, step by step, how to reproduce the bug, what is the expected behavior and which is the current one.
If you're also able to create a video of the issue, that would be extremely helpful.
value: |
**How to reproduce the bug?**
1. ...
2. ...

**What is the expected behavior?**
...

**What is the current behavior?**
...

If is necessary to execute some code in order to reproduce the bug, paste it here below:
```js
// your code here
```
validations:
required: true
- type: checkboxes
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/artf/grapesjs/blob/dev/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: 🚀 Feature Request
url: https://github.com/GrapesJS/mjml/discussions/categories/ideas
about: "Suggest any ideas you have using our discussion forums."
- name: 🙏 Help
url: https://github.com/GrapesJS/mjml/discussions/categories/q-a
about: "If you have a question or need help, ask a question on the discussion forums."
- name: 📢 Show and tell
url: https://github.com/GrapesJS/mjml/discussions/categories/show-and-tell
about: "Have something nice to say or share about GrapesJS? We'd love to hear it!"
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ This plugin enables the usage of [MJML](https://mjml.io/) components inside the


[Demo](http://grapesjs.com/demo-mjml.html)
<p align="center"><img src="http://grapesjs.com/img/grapesjs-mjml-demo.jpg" alt="GrapesJS" align="center"/></p>
<br/>

Supported MJML components (using default mjml-browser parser):
`mj-mjml`
Expand Down
23 changes: 14 additions & 9 deletions src/components/Font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default (editor: Editor, { opt, coreMjmlModel, coreMjmlView, sandboxEl }:
...coreMjmlModel,
defaults: {
draggable: componentsToQuery(typeHead),
void: false
void: false,
},
},
view: {
Expand All @@ -38,19 +38,24 @@ export default (editor: Editor, { opt, coreMjmlModel, coreMjmlView, sandboxEl }:

renderStyle() {},

renderChildren() {},

getTemplateFromMjml() {
let mjmlTmpl = this.getMjmlTemplate();
let innerMjml = this.getInnerMjmlTemplate();
const htmlOutput = mjmlConvert(opt.mjmlParser, `${mjmlTmpl.start}
${innerMjml.start}${innerMjml.end}${mjmlTmpl.end}`, opt.fonts);
const mjmlTmpl = this.getMjmlTemplate();
const innerMjml = this.getInnerMjmlTemplate();
const htmlOutput = mjmlConvert(
opt.mjmlParser,
`${mjmlTmpl.start}
${innerMjml.start}${innerMjml.end}${mjmlTmpl.end}`,
opt.fonts,
);
let html = htmlOutput.html;
let start = html.indexOf('<head>') + 6;
let end = html.indexOf('</head>');
const start = html.indexOf('<head>') + 6;
const end = html.indexOf('</head>');
html = html.substring(start, end).trim();
sandboxEl.innerHTML = html;
return this.getTemplateFromEl(sandboxEl);
},
}
},
});

};
Loading