Git Product home page Git Product logo

Comments (9)

Moreno-dev avatar Moreno-dev commented on August 23, 2024 2

@alexzaganelli it looks like it's working now! Good job mate!

from strapi-plugin-email-designer.

github-actions avatar github-actions commented on August 23, 2024

Thank you!! This is your first issue on this repo

from strapi-plugin-email-designer.

alexzaganelli avatar alexzaganelli commented on August 23, 2024

May you please try the v2.0.1?
Thank you

from strapi-plugin-email-designer.

Moreno-dev avatar Moreno-dev commented on August 23, 2024

is it already available through NPM?

from strapi-plugin-email-designer.

alexzaganelli avatar alexzaganelli commented on August 23, 2024

Yes, since yesterday morning.
Please, let me known if you still have this issue.

from strapi-plugin-email-designer.

Moreno-dev avatar Moreno-dev commented on August 23, 2024

Yes, since yesterday morning. Please, let me known if you still have this issue.
Same issue, when the /new endpoint gets called it doesn't get the bodyHtml in the body of the http request.
I've been looking a bit at the react component yesterday and it looks like the two variables that should receive their value in this chunk (Designer/index.js)

let design, html;

try {
  emailEditorRef.current.editor.exportHtml((data) => ({ design, html } = data));
} catch (error) {
  console.log(error);
  return;
}

I've tried some console.log here and there and it always returns undefined for html and design

from strapi-plugin-email-designer.

Moreno-dev avatar Moreno-dev commented on August 23, 2024

emailEditorRef.current.editor.exportHtml(async data => {
const {design, html} = data
try {
let response;
if (templateId) {
response = await request(/${pluginId}/templates/${templateId}, {
method: 'POST',
body: {
name: templateData?.name || getMessage('noName'),
templateReferenceId: templateData?.templateReferenceId,
subject: templateData?.subject || '',
design,
bodyText,
bodyHtml: html,
},
});
} else if (coreEmailType) {
response = await request(/${pluginId}/core/${coreEmailType}, {
method: 'POST',
body: {
subject: templateData?.subject || '',
design,
message: html,
bodyText,
},
});
}

    toggleNotification({
      type: 'success',
      message: `${pluginId}.notification.success.submit`,
    });
    togglePrompt(false);

    if (templateId === 'new' && templateId !== response.id)
      history.replace(`/plugins/${pluginId}/design/${response.id}`);
  } catch (err) {
    console.error(err?.response?.payload);

    const errorMessage = err?.response?.payload?.message;
    if (errorMessage) {
      toggleNotification({
        type: 'warning',
        title: 'Error',
        message: errorMessage,
      });
    } else {
      toggleNotification({
        type: 'warning',
        title: 'Error',
        message: `${pluginId}.notification.error`,
      });
    }
  }
})

might be a solution to move all strapi saving logic inside the exportHtml func. At least the htm gets saved now...Still I'm not getting the auto-text function

from strapi-plugin-email-designer.

Moreno-dev avatar Moreno-dev commented on August 23, 2024

Also, in the /server/services/email.js file I had to change the strapi.query() function to the new strapi way of calling a plugin i.e. plugin::users-permissions.user, or in this case plugin::email-designer.email-template otherwise it would give an error because it couldn't find the appropriate model in the DB.

if (templateReferenceId) {
const response = await strapi.query("plugin::email-designer.email-template").findOne({ templateReferenceId });
({ bodyHtml, bodyText, subject } = response);
} else {
const response = await strapi.query("plugin::email-designer.email-template").findOne({ id: emailTemplate.templateId });
({ bodyHtml, bodyText, subject } = response);
}

from strapi-plugin-email-designer.

alexzaganelli avatar alexzaganelli commented on August 23, 2024

Thank you very much for your contribution @Moreno-dev
Please try the v2.0.3 and if you still can't use the plugin I'd ask you to make a PR.

Ps. remember to re-build the admin with yarn build

from strapi-plugin-email-designer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.