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

Summernote editor does not works on edit page. #21

Open
thesmooth opened this issue Jun 24, 2016 · 0 comments
Open

Summernote editor does not works on edit page. #21

thesmooth opened this issue Jun 24, 2016 · 0 comments

Comments

@thesmooth
Copy link

Hi! I tried to use summernote rich editor with yours admin panel.

I used this code to add summernote-textarea class to special fields.

autoform: {
  class: "summernote-textarea",
  afFieldInput: {
    type: 'textarea'
  }
}

And used this code to run summernote on that fields.

Template.AdminDashboardNew.rendered = function() {
  console.log($("input").length); //returns number > 0
  initEditor();
};

Template.AdminDashboardEdit.rendered = function() {
  console.log($("input").length); //returns 0
  initEditor();
};

function initEditor() {
  $('.summernote-textarea').summernote({
    height: "160px",
    toolbar: [
          ['style', ['style']],
          ['font', ['bold', 'italic', 'underline', 'strikethrough', 'clear']],
          ['fontParams', ['fontname', 'fontsize','color']],
          ['paragraps', ['ul', 'ol', 'paragraph']],
          ['table', ['hr', 'table']],
          ['insert', ['link', 'picture', 'video']],
          ['view', ['codeview', 'fullscreen']],
          ['misc', ['undo','redo']]
        ]
  });
};

This code works with AdminDashboardNew template, but when I tried to do the same with AdminDashboardEdit template, I received the next problem:
console.log($("input").length); //returns 0
It means that Template.AdminDashboardEdit.rendered does not executed when it actually rendered.
setTimeout(() => {},0) does not helps too.

Do you have any idea what is wrong with this template and how i could solve my issue ?

Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant