w00t. I successfully hacked jquery.markitup (1.1.9) to display it's preview (routed through previewParserPath) in a div rather than in an iframe (i.e., this is on the same page as the markitup textarea - so with previewInWindow not set.)
My problem was that my markitup'd textarea is on the same page where the content will be displayed (a textarea at the bottom of a column of comments.) With an iframe the previewed post does not get the styling of the parent page where it will be displayed when posted, so the preview doesn't necessarily match how the comment will look when posted. By displaying the preview in a div on the page I automatically get the correct styling (I just make the preview div have the same class as the divs holding the real comments.)
Sure, I could alter the script outputting the preview (the script at previewParserPath) to have the same styling as the comment page itself. But this is for a CMS where I don't know ahead of time what the styling of a page will be (since the styles are user changeable.) And I don't want the preview script to have to connect to the database and figure it out since this script gets hit *a lot* (on every enter key press in every comment textarea.)
I don't think anyone reads this blog, but if someone finds this through google I'd be happy to share my modifications.
Can you post your changes? I'm trying to modify markitup so "previewPosition" can accept an element ID (div) so the iframe can be inserted inside it.
I apreciate if you post this change. Yes, we read your blog. Tks.
|
My problem was that my markitup'd textarea is on the same page where the content will be displayed (a textarea at the bottom of a column of comments.) With an iframe the previewed post does not get the styling of the parent page where it will be displayed when posted, so the preview doesn't necessarily match how the comment will look when posted. By displaying the preview in a div on the page I automatically get the correct styling (I just make the preview div have the same class as the divs holding the real comments.)
Sure, I could alter the script outputting the preview (the script at previewParserPath) to have the same styling as the comment page itself. But this is for a CMS where I don't know ahead of time what the styling of a page will be (since the styles are user changeable.) And I don't want the preview script to have to connect to the database and figure it out since this script gets hit *a lot* (on every enter key press in every comment textarea.)
I don't think anyone reads this blog, but if someone finds this through google I'd be happy to share my modifications.
- jim 1-20-2011 11:13 am
Can you post your changes? I'm trying to modify markitup so "previewPosition" can accept an element ID (div) so the iframe can be inserted inside it.
- anonymous (guest) 3-14-2011 9:04 pm
I apreciate if you post this change. Yes, we read your blog. Tks.
- jucca (guest) 4-21-2011 1:01 pm