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

Handle two editors with different toolbars on the same page #604

Merged
merged 1 commit into from
May 9, 2019

Conversation

defr
Copy link
Contributor

@defr defr commented Jul 26, 2018

Right now, if you try to include two editors on the same page with different toolbars, there's a race condition, and most of the time the two editors end up with the same toolbar. This is due to both trying to extend editormd.defaults instead of getting their own independent settings ; can be fixed easily.

Test code would be something like

function bindFirst() {
  editormd('area1-field', {
    path: 'libraries/editor.md/lib/',
    toolbarIcons: function() {
      return ['bold', 'italic', 'underline'];
    },
    width: '75%'
  });
}
function bindSecond() {
  editormd('area2-field', {
    path: 'libraries/editor.md/lib/',
    toolbarIcons: function() {
      return ['undo', 'redo'];
    },
    width: '75%'
  });
}
jQuery(function() {
  bindFirst();
  bindSecond();
});

@pandao pandao merged commit d69e3ed into pandao:master May 9, 2019
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

Successfully merging this pull request may close these issues.

2 participants