asp.net - CKEditor (.net) disappears on postback where HttpResponse hijacked to deliver download stream -


i have page 2 tabs on (using bootstrap's .tab-nav). in 1 tab, inside update panel, have ckeditor 4.x instance. in other tab, have button pushes csv file via httpresponse (initiates download). download button triggers full postback since partial postbacks can't push streams download.

the problem after initiate download, when switch tab ckeditor instance, it's vanished.

any ideas how fix? suspect directly related fact i'm hacking httpresponse server deliver download, why cke instance disappear?

here's how fixed it: every time opens tab ckeditor on it, use cke's js api restore it.

html

    <ul class="nav nav-tabs" role="tablist">         <li class="active"><a href="#tab1" role="tab" data-toggle="tab">tab 1</a></li>         <li><a href="#tab2" role="tab" data-toggle="tab">tab 2</a></li>     </ul>      <div class="tab-content">         <div class="tab-pane active" id="tab1">             ...         </div>         <div class="tab-pane" id="tab2">             <textarea class="ckeditor" id="ckeditor1" />             ...         </div>     </div> 

js

    // every time opens ckeditor-containing tab, replace ckeditor if missing     $("a[href='#tab2']").on("shown.bs.tab", function (e) {         if (ckeditor.instances.ckeditor1 == null) {              // decode textarea content             var t = $("#ckeditor1");             t.val(ckeditor.tools.htmldecode(t.val()));              // show ckeditor instance             ckeditor.replace("ckeditor1", { toolbar: 'customtoolbar' });         }     }); 

just using ckeditor.replace didn't work because content encoded when stored cache. had upgrade cke 4.0.2 decode content using ckeditor.tools.htmldecode when restoring instance.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -