-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add buttons #148
Comments
I as well need to add a button that will open a modal and allow me to insert HTML. |
I would love to have left center and right alignments buttons 👍 |
Yea, this is missing a lot of functionality of wysihtml5. It seems to hide it or cut it off in some manner. I'm going to have to rip through this but would rather not. I'm hoping there's a way to extend things... I'd love to add a speech button for starters (tried appending it to the toolbar with the load event but I imagine it's too late at that point). Then I'd love to start building plugins. Which I see how to change up the template for things, but will need greater control. Also tried with custom templates key, but it didn't seem to work either. I could change existing ones but couldn't add new buttons. A code button would be a big +1 from me. |
Yay, figured it out.
I imagine custom commands will need to be built using the functionality of https://github.com/xing/wysihtml5 and then referenced here... |
As far as your code concerns, you can keep the code tag by doing:
In the options you pass to wysihtml5() but you're going to still need a button that runs a command to wrap the code in a |
You can add
|
Ok, it's a little hacky, but I pasted it all out for everyone. If you want a really bad ass editor, use this:
Basically... You're using the "insertHTML" command that exists in wysihtml5. The first anchor doesn't really do what "insertHTML" normally does, it just brings up the modal. The link within the modal then sets the data attribute. Alternatively, you can insert any text with "insertHTML" in a static manner like so:
Note: You can not do both because you can only have one of each command. |
You can also look at this guy's solution: http://itsnot.freehostia.com/wysihtml5/wysihtml5-new.htm ... But you have to have focus and I think have something typed in order for the insert to work. You may be able to fix it up so it works a little nicer though. |
As it turns out, after all this hard work...The thing submits an empty string for me. So wysihtml5 is dead to me. Moved to CKEditor. So glad to have wasted an entire day. Hopefully this helps someone though. |
@tmaiaroto, your code was a total timesaver... i'm sorry it didn't work out for you but it worked out great for me. I just got the value from the textarea using jQuery val(), and it worked perfectly. |
@tmaiaroto thanks for your nice work! It helped me really to figure out some cool internals. Despite all that, I think what you've tried should not be impossible. Maybe it is not the right way to trust on the internal commands of this plugin. Why didn't you just apply a click-handler on your a-tag in the modal and then do this stuff bypassed? This should work in theory. Even if this plugin has some misterious behaviour when you'll dig in a bit, it's really worth to customize it further. |
Well, now that my frustrations have gone away =) I may give it another shot haha. |
how can I use a template for the font-style drop-down button?? thanks in advance! |
No word on allowing custom buttons? |
Hi!
How to add some buttons to http://jhollingworth.github.com/bootstrap-wysihtml5/
I need add button like a «code» with tags
<code></code>
The text was updated successfully, but these errors were encountered: