pen icon indicating copy to clipboard operation
pen copied to clipboard

export content

Open sofish opened this issue 12 years ago • 7 comments

  1. easy to export content
  2. easy to bind to an hidden input/textarea

sofish avatar Sep 11 '13 16:09 sofish

I would love this feature to exist. It is the only thing stopping me from using it on my projects.

marxistpokemon avatar Sep 12 '13 18:09 marxistpokemon

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.

the-architect avatar Sep 30 '13 13:09 the-architect

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/

the-architect avatar Sep 30 '13 14:09 the-architect

Yes, this would be great!

pusewicz avatar Jan 15 '14 13:01 pusewicz

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

tbergeron avatar Aug 05 '14 14:08 tbergeron

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 avatar Mar 11 '15 04:03 hugobast

@hugobast thanks for taking the time!

krazyjakee avatar Feb 24 '16 11:02 krazyjakee