pen
pen copied to clipboard
export content
- easy to export content
- easy to bind to an hidden input/textarea
I would love this feature to exist. It is the only thing stopping me from using it on my projects.
Hi,
just started implementing pen into a project of mine and I would really like to help with this. How would you implement this feature?
If anything changes an event would be triggered and the content will get synced with the bound textarea.
ok, i have something working now. It creates a digest of the pen editor every 50ms and if the hash changed, it will fire a 'valueChanged' event, which will then sync the innerHTML with a bound target. To create the hash I use this library's sha1 method: http://caligatio.github.com/jsSHA/
Yes, this would be great!
I thought this was a built-in feature, I spent 30 mins implementing it in one of my CMS and now I'm stuck with no way of exporting back to a textarea.
+1
Don't know if this helps anyone, here's what I did:
- Listen for the form submit event ala jQuery
$('form').on('submit', function(...) {...}); - Get the content from pen and put it in a hidden input field
$('#id').val(pen.getContent()); - Let the form submit as it usually would
Maybe I'm under-thinking things but this works reliably and with very little voodoo.
@hugobast thanks for taking the time!