-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Make markdown toolbar extensible #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
respectable
Is this easily extendible? I thought using override/extend on exported functions was hard (cause don't you have to go through Just occurred to me. |
This should work: old = markdownToolbarItems;
markdownToolbarItems = function (){
const items = old();
items.add(/* ... */);
return items;
} |
@davwheat Um, don't think so? Assigning variables from |
Ah yeah David is right. Until we have an export registry and can actually replace functions in the registry, this won't work. For some reason I thought this was being added a a method, must have missed this, sorry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
1f1b78b
to
4c2ee9a
Compare
Hoping that #34 will be merged first, since this PR will need some changes once that is done. |
Ready for review now. |
if (TextEditor.prototype.markdownToolbarItems) { | ||
override(TextEditor.prototype, 'markdownToolbarItems', markdownToolbarItems); | ||
} else { | ||
TextEditor.prototype.markdownToolbarItems = markdownToolbarItems; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be able to override
in either case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried that, it seemed to error at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we might want to change that in core. But makes sense for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
Replaces #31 because I broke GitHub.